@banou/stub 0.0.61 → 0.0.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./worker-KoBi1osA.js","./worker-rQdZfdAR.js","./country-Bcvbkb-P.js","./dist-sBTuRPnX.js","./build-CHRBRLpA.js","./theme-player-BsVznGeU.js","./player-volume-DTOJyhLh.js","./dist-B_MSi_-2.js"])))=>i.map(i=>d[i]);
2
- import{o as e,r as t,s as n}from"./dist-sBTuRPnX.js";import{C as r,D as i,E as a,O as o,S as s,T as c,_ as l,a as u,b as d,c as f,d as p,f as m,g as h,h as g,k as _,l as v,m as y,n as b,p as x,r as S,v as C,w,x as T}from"./embed-title-BDqOXK5e.js";import{B as E,D,G as O,H as k,I as A,J as j,K as M,M as N,N as P,O as ee,R as te,T as ne,V as F,W as I,Y as re,a as ie,c as ae,d as oe,f as se,g as ce,h as le,i as ue,k as de,l as fe,m as pe,n as me,o as he,p as ge,q as _e,r as ve,s as ye,t as be,u as xe,v as Se,w as Ce,z as we}from"./country-Bcvbkb-P.js";import{$ as Te,A as Ee,B as L,C as De,D as R,E as Oe,F as ke,H as Ae,I as je,J as Me,K as Ne,L as Pe,M as Fe,N as Ie,O as Le,P as Re,Q as ze,R as Be,S as Ve,T as He,U as Ue,V as We,W as Ge,X as Ke,Y as qe,Z as Je,_ as Ye,a as z,at as B,c as Xe,ct as Ze,d as Qe,dt as $e,et,f as tt,ft as nt,g as rt,gt as it,h as at,ht as ot,i as st,it as V,j as ct,k as lt,l as ut,lt as H,m as dt,mt as ft,nt as pt,o as U,ot as W,p as mt,pt as ht,q as gt,rt as _t,s as G,st as K,t as vt,tt as q,u as yt,v as bt,w as xt,x as St,y as Ct,z as wt}from"./player-volume-DTOJyhLh.js";import{A as Tt,C as Et,D as Dt,E as Ot,M as kt,O as At,S as jt,T as Mt,_ as Nt,a as Pt,b as Ft,c as It,g as Lt,h as Rt,i as zt,j as Bt,k as Vt,l as Ht,m as Ut,n as Wt,o as Gt,p as Kt,r as qt,s as Jt,t as Yt,u as Xt,v as Zt,w as Qt,x as $t,y as en}from"./worker-rQdZfdAR.js";import{t as tn}from"./remote-D8UjjUy7.js";var nn=()=>`https://fkn.app/connect-button`,rn=[`ready`,`loading`,`away`],an=[`play`,`seek`,`go`,`rate`,`subs`,`audio`],on={subtitles:`subs`,audio:`audio`},sn={all:[],by:{}},cn=(e,t,n)=>e.by[t]?.[n]??e.all.includes(n),ln=new Set([`nav`,`scroll`,`cursor`,`playback`,`state`,`pong`]),un=e=>ln.has(e.t),dn=e=>e.trim().slice(0,500)||void 0,fn=e=>e.trim().replace(/\s+/g,` `).slice(0,32)||void 0,pn=e=>JSON.stringify({v:1,...e}),mn=e=>{let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!=`object`)return;let n=t;if(n.v===1)switch(n.t){case`nav`:return Sn(n.path)?{t:`nav`,path:n.path}:void 0;case`scroll`:return En(n.y)?{t:`scroll`,y:n.y}:void 0;case`cursor`:return En(n.x)&&En(n.y)?{t:`cursor`,x:n.x,y:n.y}:void 0;case`chat`:{let e=typeof n.text==`string`?dn(n.text):void 0;return e?{t:`chat`,text:e}:void 0}case`name`:{let e=typeof n.name==`string`?fn(n.name):void 0;return e?{t:`name`,name:e}:void 0}case`ping`:return wn(n.n)&&wn(n.at)?{t:`ping`,n:n.n,at:n.at}:void 0;case`pong`:return wn(n.n)&&wn(n.at)&&wn(n.host)?{t:`pong`,n:n.n,at:n.at,host:n.host}:void 0;case`playback`:return Dn(n.s)?{t:`playback`,s:n.s}:void 0;case`state`:{if(!Sn(n.path)||!En(n.y)||n.s!==void 0&&!Dn(n.s))return;let e=gn(n.grants),t=vn(n.sub),r=vn(n.audio);return{t:`state`,path:n.path,y:n.y,...n.s?{s:n.s}:{},...e?{grants:e}:{},...t===void 0?{}:{sub:t},...r===void 0?{}:{audio:r}}}case`status`:{if(!rn.includes(n.s)||n.path!==void 0&&!Cn(n.path))return;let e=Tn(n.time)&&typeof n.rate==`number`&&n.rate>=0&&n.rate<=16;return!e&&(n.time!==void 0||n.rate!==void 0)?void 0:{t:`status`,s:n.s,...n.path===void 0?{}:{path:n.path},...e?{time:n.time,rate:n.rate}:{}}}case`ask`:if(n.c===`go`)return Cn(n.path)?{t:`ask`,c:`go`,path:n.path}:void 0;if(n.c===`subs`){let e=vn(n.sub);return e===void 0?void 0:{t:`ask`,c:`subs`,sub:e}}if(n.c===`audio`){let e=vn(n.audio);return e===void 0?void 0:{t:`ask`,c:`audio`,audio:e}}return hn(n.c)&&Sn(n.path)&&Dn(n.s)?{t:`ask`,c:n.c,path:n.path,s:n.s}:void 0;default:return}},hn=e=>an.includes(e),gn=e=>{if(!e||typeof e!=`object`)return;let{all:t,by:n}=e;if(!Array.isArray(t)||!n||typeof n!=`object`||Array.isArray(n))return;let r=Object.entries(n);if(r.length>_n)return;let i={all:t.filter(hn),by:{}};for(let[e,t]of r){if(!e||e.length>128||!t||typeof t!=`object`)return;i.by[e]=Object.fromEntries(Object.entries(t).filter(([e,t])=>hn(e)&&typeof t==`boolean`))}return i},_n=100,vn=e=>{if(e===null)return null;if(typeof e!=`string`)return;let t=e.replace(/\s+/g,` `).trim();return t&&t.length<=64?t:void 0},yn=e=>e.c===`go`?`changed the episode`:e.c===`subs`?bn(`subtitles`,e.sub):e.c===`audio`?bn(`audio`,e.audio):e.c===`seek`?`skipped to ${xn(e.s.time)}`:e.c===`rate`?`set speed to ${Number(e.s.rate.toFixed(2))}x`:e.s.paused?`paused`:`resumed`,bn=(e,t)=>t===null?`turned ${e} off`:`set ${e} to ${t}`,xn=e=>{let t=Math.floor(e),n=e=>String(e).padStart(2,`0`),r=Math.floor(t/60)%60;return t>=3600?`${Math.floor(t/3600)}:${n(r)}:${n(t%60)}`:`${r}:${n(t%60)}`},Sn=e=>typeof e==`string`&&e.length>0&&e.length<=2048&&e.startsWith(`/`)&&!e.startsWith(`//`)&&!e.startsWith(`/\\`)&&!/[\r\n\t]/.test(e),Cn=e=>Sn(e)&&new URL(e,`https://stub.invalid`).pathname.startsWith(`/watch/`),wn=e=>typeof e==`number`&&Number.isFinite(e),Tn=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0,En=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=1,Dn=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.paused==`boolean`&&Tn(t.time)&&typeof t.rate==`number`&&Number.isFinite(t.rate)&&t.rate>0&&t.rate<=16&&typeof t.at==`number`&&Number.isFinite(t.at)},On=1.05,kn=5e3,An=(e,t,n=!1)=>{if(e.paused)return e.time;let r=Math.max(t-e.at,0),i=(n?r:Math.min(r,jn))/1e3;return e.time+i*e.rate},jn=2e3,Mn=(e,t,n,r=!1)=>{let i={},a=An(t,n,r),o=a-e.time;Math.abs(o)>.5&&(i.seek=a),t.paused&&!e.paused&&(i.pause=!0),!t.paused&&e.paused&&(i.play=!0);let s=!t.paused&&i.seek===void 0&&Math.abs(o)>=.05&&Pn(e.rate,t.rate)?t.rate*(o>0?On:1/On):t.rate;return Nn(e.rate,s)||(i.rate=s),i},Nn=(e,t)=>Math.abs(e-t)<=.001,Pn=(e,t)=>e<=t*1.05+.001&&e>=t/1.05-.001,Fn=(e,t,n)=>({...e,time:e.paused?e.time:e.time+Math.max(0,n-t)/1e3*e.rate,at:n}),In=2e3,Ln=3e3,Rn=(e,t,n)=>{let r=[];return t.paused!==e.paused&&t.paused!==n.paused&&r.push(`play`),(t.time<e.time-.05||t.time>An(e,t.at,!0)+.5)&&Math.abs(t.time-n.time)>.5&&r.push(`seek`),!Pn(t.rate,e.rate)&&!Pn(t.rate,n.rate)&&r.push(`rate`),r},zn=(e,t,n)=>{let r=Fn(e,e.at,n);if(t.c===`play`)return e.paused===t.s.paused?void 0:{...r,paused:t.s.paused};if(t.c===`rate`)return Nn(e.rate,t.s.rate)?void 0:{...r,rate:t.s.rate};let i=An(t.s,n);return Math.abs(i-r.time)<=.5?void 0:{...r,time:i}},Bn=1e3,Vn=1,Hn=(e,t)=>{let n=e.find(([e,n])=>e-.5<=t&&t<n);return n?n[1]-t:0},Un=(e,t,n,r=0)=>{if(!t||t.readyState<3)return`loading`;let i=e===`ready`?2:10,a=r>0&&Number.isFinite(r)?r-n:1/0;return Hn(t.ranges,n)>=Math.min(i,a)?`ready`:`loading`},Wn=(e,t)=>e.time===void 0?void 0:e.time+Math.max(0,t)/1e3*(e.rate??0),Gn=(e,t,n)=>{if(e.s!==t.s||e.path!==t.path||!e.rate!=!t.rate)return!0;let r=Wn(e,n);return r===void 0||t.time===void 0?r!==t.time:Math.abs(r-t.time)>Vn},Kn=(e,t,n)=>{if(e.path!==n)return{s:e.s===`away`?`away`:`loading`};let r=Wn(e,t);return r===void 0?{s:e.s}:{s:e.s,time:r}},qn=(e,t,n)=>({rtt:n-e,offset:t-(e+n)/2}),Jn=e=>e.length?e.reduce((e,t)=>t.rtt<e.rtt?t:e):void 0,Yn=(e,t)=>e-t,Xn=(e,t)=>e+t,Zn=4e3,Qn=`stub-party-invite`,$n=`stub-party-name`,er=1e4,tr=3e4,nr=2e3,rr=1e4,ir=6e4,ar={subtitles:`party`,audio:`party`},or=()=>{try{return globalThis.sessionStorage}catch{return}},sr=e=>e instanceof Error&&typeof e.code==`string`,cr=(e,t=or())=>{let n={status:`idle`},r,i,a={path:`/`,y:0},o=new Set,s=new Set,c,l,u=new Map,d=new Map,f=[],p,m=sn,h=!0,g={},_={},v=ar,y,b,x,S,C=new Map,w=1,T,E,D,O,k=new Map,A=(()=>{try{return t?.getItem(`stub-party-name`)??void 0}catch{return}})(),j=e=>{n=e;for(let e of o)e(n)},M=e=>{try{t?.setItem(Qn,e)}catch{}},N=()=>{try{t?.removeItem(Qn)}catch{}},P=()=>{try{return t?.getItem(`stub-party-invite`)??void 0}catch{return}},ee=e=>e.owner===e.self.id?`host`:`guest`,te=(e,t)=>{for(let n of s)n(e,t)},ne=async e=>{let t=await e.members().catch(()=>void 0);r===e&&n.status===`active`&&t&&j({...n,members:t.length})},F=e=>{r&&n.status===`active`&&(un(e)&&n.role!==`host`||r.send(pn(e)).catch(()=>{}))},I=()=>{if(!r||n.status!==`active`||n.role!==`guest`)return;let e=r,t=[];x=t;for(let n=0;n<5;n++)setTimeout(()=>{if(x!==t||r!==e)return;let n=Date.now(),i=w++;C.set(i,n),setTimeout(()=>C.delete(i),Zn),F({t:`ping`,n:i,at:n})},n*400);setTimeout(()=>{if(x!==t||r!==e)return;x=void 0;let n=Jn(t);n&&(b=n)},2e3+Zn)},re=()=>({t:`state`,path:a.path,y:a.y,...a.playback?{s:Fn(a.playback,a.playbackAt??Date.now(),Date.now())}:{},...p?{grants:p}:{},...g.subtitles===void 0?{}:{sub:g.subtitles},...g.audio===void 0?{}:{audio:g.audio}}),ie=({grants:e=sn,sub:t,audio:r})=>{let i={subtitles:t,audio:r};JSON.stringify([e,i])!==JSON.stringify([m,_])&&(m=e,_=i,n.status===`active`&&j({...n}))},ae=(e,t)=>{g={...g,[e]:t},F(re())},oe=()=>{if(D=void 0,!T)return;let e=Date.now(),t=Wn(T.status,e-T.at);E={status:t===void 0?T.status:{...T.status,time:t},at:e},F({t:`status`,...E.status})},se=e=>{if(!T||D||!e&&E&&!Gn(E.status,T.status,T.at-E.at))return;let t=(E?.at??-1/0)+nr-Date.now();t<=0?oe():D=setTimeout(oe,t)},ce=()=>[...u.values()].filter(e=>`path`in e).at(-1)?.path,le=()=>{let e=u.get(`state`),t=u.get(`scroll`);if(e?.t!==`state`||t?.t!==`scroll`)return e;let n=[...u.keys()];return n.indexOf(`scroll`)>n.indexOf(`state`)?{...e,y:t.y}:e},ue=()=>{i?.(),i=void 0,r=void 0,c&&clearInterval(c),c=void 0,l&&clearInterval(l),l=void 0,S&&clearInterval(S),S=void 0,clearTimeout(D),D=void 0,clearInterval(O),O=void 0,T=void 0,E=void 0,k.clear(),x=void 0,b=void 0,C.clear(),v=ar},de=async e=>{r=e;let t=ee(e);d.clear(),f.length=0,p=void 0,m=sn,h=!0,g={},_={},j({status:`active`,role:t,invite:e.invite,members:1,self:e.self.id,owner:e.owner}),M(e.invite),i=await e.on(i=>{if(r===e)switch(i.type){case`message`:{let n=mn(i.message.text);if(!n)return;let r=i.message.from,a=r===e.self.id;if(n.t===`ping`){t===`host`&&!a&&F({t:`pong`,n:n.n,at:n.at,host:Date.now()});return}if(n.t===`pong`){if(t!==`guest`||r!==e.owner)return;let i=C.get(n.n);if(i===void 0||i!==n.at)return;C.delete(n.n);let a=qn(i,n.host,Date.now());if(a.rtt>4e3)return;x?.push(a),b||=a;return}if(un(n)){if(r!==e.owner||(n.t===`state`&&ie(n),t===`host`))return;u.delete(n.t),u.set(n.t,n),te(n,{replayed:!1,from:r,self:a});return}if(n.t===`ask`){if(!cn(m,r,n.c))return;let e=f.at(-1);e?.from===r&&e.action===n.c&&f.pop(),t===`host`&&n.c===`subs`&&ae(`subtitles`,n.sub),t===`host`&&n.c===`audio`&&ae(`audio`,n.audio)}if(n.t===`name`&&d.set(r,n.name),n.t===`status`&&t===`host`&&!a){let{t:e,...t}=n;k.set(r,{status:t,at:Date.now()})}if(n.t===`chat`||n.t===`ask`){let e=n.t===`chat`?{text:n.text}:{text:yn(n),action:n.c};f.push({seq:i.message.seq,from:r,name:d.get(r),at:i.message.at,self:a,...e}),f.length>200&&f.splice(0,f.length-200)}te(n,{replayed:!1,from:r,self:a});return}case`joined`:t===`host`&&F(re()),A&&F({t:`name`,name:A}),ne(e);return;case`left`:{if(t===`guest`&&i.id===e.owner){pe(`host-left`);return}k.delete(i.id);let r=p?.by[i.id];t===`host`&&p&&r&&!Object.values(r).includes(!1)&&(p={...p,by:Object.fromEntries(Object.entries(p.by).filter(([e])=>e!==i.id))},F(re()),j({...n})),ne(e);return}}}),r===e?(t===`host`&&(c=setInterval(()=>F(re()),er)),t===`guest`&&(I(),S=setInterval(I,ir),T={status:{s:`away`},at:Date.now()},O=setInterval(()=>{Cn(ce())&&se(!0)},rr)),l=setInterval(()=>{A&&F({t:`name`,name:A})},tr),A&&F({t:`name`,name:A}),ne(e),e.closed.then(({reason:t})=>{r===e&&(ue(),N(),j({status:`ended`,reason:t}))})):(i(),i=void 0)},fe=e=>n.status===`active`&&(n.role===`host`||cn(m,n.self,e)),pe=async e=>{let t=r;ue(),N(),j({status:`ended`,reason:e}),await t?.leave().catch(()=>{})},me=(e,t)=>{N(),j(t?{status:`idle`}:{status:`failed`,code:sr(e)?e.code:`unknown`})},he=async(e,t,n=!1)=>{r&&await pe(`left`),u.clear(),j({status:`joining`,invite:e??``});try{let e=await t();await de(e)}catch(e){me(e,n)}};return{getState:()=>n,subscribe:e=>(o.add(e),()=>{o.delete(e)}),onMessage:e=>(s.add(e),()=>{s.delete(e)}),create:()=>he(void 0,()=>e.create()),join:t=>he(t,()=>e.join(t)),resume:async()=>{let t=P();t&&!r&&await he(t,()=>e.join(t),!0)},leave:async()=>{r&&await pe(`left`)},send:F,setLocation:(e,t)=>{a.path=e,a.y=t},setPlayback:e=>{a.playback=e,a.playbackAt=Date.now()},issued:()=>p??sn,setGrants:e=>{n.status===`active`&&n.role===`host`&&(p=e,F(re()),j({...n}))},may:fe,partyTrack:e=>_[e],setPartyTrack:(e,t)=>{n.status===`active`&&(n.role===`host`?ae(e,t):fe(on[e])&&F(e===`subtitles`?{t:`ask`,c:`subs`,sub:t}:{t:`ask`,c:`audio`,audio:t}))},mine:e=>v[e],setMine:(e,t)=>{v={...v,[e]:t},j({...n})},playerTracks:()=>y,setPlayerTracks:e=>{y=e,j({...n})},invite:()=>n.status===`active`?n.invite:void 0,hostClock:()=>b,hostPath:ce,following:()=>h,setFollowing:e=>{h=e,j({...n})},replay:()=>{for(let e of[`state`,`nav`,`scroll`,`playback`]){let t=e===`state`?le():u.get(e);t&&r&&te(t,{replayed:!0,from:r.owner,self:!1})}h||(h=!0,j({...n}))},nameOf:e=>d.get(e),roster:async()=>{if(!r)return[];let e=r;return(await e.members().catch(()=>[])).map(t=>({id:t.id,name:d.get(t.id),host:t.id===e.owner,self:t.id===e.self.id}))},chat:()=>f.slice(),setName:e=>{A=e;try{e?t?.setItem($n,e):t?.removeItem($n)}catch{}e&&F({t:`name`,name:e})},name:()=>A,kick:async e=>{r&&n.status===`active`&&n.role===`host`&&await r.remove(e)},ban:async e=>{r&&n.status===`active`&&n.role===`host`&&await r.block(e)},playing:()=>!(!a.playback||a.playback.paused),setStatus:e=>{n.status===`active`&&n.role===`guest`&&(T={status:e,at:Date.now()},se(!1))},statuses:()=>k,dismiss:()=>{(n.status===`ended`||n.status===`failed`)&&j({status:`idle`})}}},lr=`/party`,ur=(e,t)=>`${e}${lr}#${fr(e,t)}`,dr=(e,t)=>{let n=e.startsWith(`#`)?e.slice(1):e,r;try{r=decodeURIComponent(n).trim()}catch{return}if(hr.test(r))return r;if(!gr.test(r))return;let i=r.indexOf(`.`),a=`${r.slice(0,i)}.${t}/${r.slice(i+1)}`;return hr.test(a)?a:void 0},fr=(e,t)=>{let n=t.indexOf(`.`),r=t.slice(n+1),i=r.lastIndexOf(`/`);return i>0&&r.slice(0,i)===e?`${t.slice(0,n)}.${r.slice(i+1)}`:t},pr=`[A-Za-z0-9_-]{43}`,mr=`[a-z0-9][a-z0-9._-]{0,63}`,hr=RegExp(`^${pr}\\.[\\x21-\\x7e]{1,256}\\/${mr}$`),gr=RegExp(`^${pr}\\.${mr}$`),J=cr(we),_r=/^(anime|movies|series|stub)\.(fkn\.app|localhost)$/,vr=e=>{let t=e.match(_r)?.[1];return t===`movies`?`movie`:t??`stub`},yr=e=>_r.test(e),br=vr(globalThis.location?.hostname??``),xr=[{site:`movie`,host:`movies`,label:`Movies`},{site:`series`,host:`series`,label:`Series`},{site:`anime`,host:`anime`,label:`Anime`},{site:`stub`,host:`stub`,label:`All`}],Sr=globalThis.location?(({protocol:e,hostname:t,port:n})=>{let r=t.match(_r)?.[2];return r?xr.map(({site:t,host:i,label:a})=>({site:t,label:a,href:`${e}//${i}.${r}${n?`:${n}`:``}/`})):[]})(globalThis.location):[],Cr=[`anilist`,`mal`,`kitsu`,`livechart`,`anizip`,`offline`,`cr`],wr=(e,t=br)=>t!==`movie`&&t!==`series`||!Cr.includes(e),Tr=/^\/assets\//,Er=e=>[...new Set([...e.querySelectorAll(`script[src], link[href]`)].map(e=>e.getAttribute(`src`)??e.getAttribute(`href`)??``).filter(e=>Tr.test(e)))].sort(),Dr=e=>e.ok&&/javascript|css/.test(e.headers.get(`content-type`)??``),Or=async e=>{let t=await fetch(`/`,{cache:`no-store`}),n=Er(new DOMParser().parseFromString(await t.text(),`text/html`)).filter(t=>!e.includes(t));return n.length!==0&&(await Promise.all(n.map(async e=>{let t=await fetch(e);return await t.arrayBuffer(),Dr(t)}))).every(Boolean)},kr=9e5,Ar=e=>{let t=!1,n=!1,r=async()=>{if(!(t||n)){t=!0;try{n=await Or(Er(document))}catch{}t=!1,n&&(clearInterval(i),e())}},i=setInterval(r,kr);document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&r()}),window.addEventListener(`vite:preloadError`,()=>{r()})},jr={categoryBar:1,hoverCard:150,sourcePopup:300,filterMenu:500,mediaModal:1e3,header:1100,headerPopup:1150,franchiseDialog:1200,pluginPrompt:2e3,updating:2500,partyCursor:3e3},Mr=`stub-update-reloads`,Nr=2,Pr=3e5,Fr=1e3,Ir=`textarea:not([readonly]), input:not([type=checkbox]):not([type=radio]):not([readonly]), [contenteditable]:not([contenteditable=false])`,Lr=()=>{try{let e=Date.now(),t=JSON.parse(sessionStorage.getItem(`stub-update-reloads`)??`[]`).filter(t=>e-t<Pr);return t.length>=Nr?!1:(sessionStorage.setItem(Mr,JSON.stringify([...t,e])),!0)}catch{return!1}},Rr=new Set,zr=e=>{Rr.add(e)},Br=e=>{let{status:t}=e.getState();return![...Rr].some(e=>e())&&navigator.onLine&&!location.pathname.startsWith(`/watch/`)&&t!==`joining`&&t!==`active`&&!document.activeElement?.matches(Ir)&&![...document.querySelectorAll(`video`)].some(e=>!e.paused&&!e.ended)},Vr=()=>{let e=document.createElement(`div`);e.textContent=`Updating Stub`,e.style.cssText=`position: fixed; inset: 0; z-index: ${jr.updating}; display: flex; align-items: center; justify-content: center; background: #0f0f0f; color: #fff; font-size: 2rem`,document.body.append(e)},Hr=(({party:e})=>{let t,n=!1,r=()=>{!n&&Br(e)&&Lr()&&(n=!0,Vr(),location.reload())};return{due:()=>{t??=setInterval(r,Fr),r()}}})({party:J});te.onUpdateTaken(Hr.due),yr(location.hostname)&&Ar(Hr.due),ft();var Ur={NAME:`Name`,DOCUMENT:`Document`,OPERATION_DEFINITION:`OperationDefinition`,VARIABLE_DEFINITION:`VariableDefinition`,SELECTION_SET:`SelectionSet`,FIELD:`Field`,ARGUMENT:`Argument`,FRAGMENT_SPREAD:`FragmentSpread`,INLINE_FRAGMENT:`InlineFragment`,FRAGMENT_DEFINITION:`FragmentDefinition`,VARIABLE:`Variable`,INT:`IntValue`,FLOAT:`FloatValue`,STRING:`StringValue`,BOOLEAN:`BooleanValue`,NULL:`NullValue`,ENUM:`EnumValue`,LIST:`ListValue`,OBJECT:`ObjectValue`,OBJECT_FIELD:`ObjectField`,DIRECTIVE:`Directive`,NAMED_TYPE:`NamedType`,LIST_TYPE:`ListType`,NON_NULL_TYPE:`NonNullType`},Wr=class extends Error{constructor(e,t,n,r,i,a,o){super(e),this.name=`GraphQLError`,this.message=e,i&&(this.path=i),t&&(this.nodes=Array.isArray(t)?t:[t]),n&&(this.source=n),r&&(this.positions=r),a&&(this.originalError=a);var s=o;if(!s&&a){var c=a.extensions;c&&typeof c==`object`&&(s=c)}this.extensions=s||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return`GraphQLError`}},Y,X;function Gr(e){return new Wr(`Syntax Error: Unexpected token at ${X} in ${e}`)}function Kr(e){if(e.lastIndex=X,e.test(Y))return Y.slice(X,X=e.lastIndex)}var qr=/ +(?=[^\s])/y;function Jr(e){for(var t=e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./worker-Bqm03xpO.js","./worker-SLqI-fGd.js","./country-DssWUNbC.js","./dist-sBTuRPnX.js","./build-CHRBRLpA.js","./theme-player-BsVznGeU.js","./player-volume-DTOJyhLh.js","./dist-B_MSi_-2.js"])))=>i.map(i=>d[i]);
2
+ import{o as e,r as t,s as n}from"./dist-sBTuRPnX.js";import{C as r,D as i,E as a,O as o,S as s,T as c,_ as l,a as u,b as d,c as f,d as p,f as m,g as h,h as g,k as _,l as v,m as y,n as b,p as x,r as S,v as C,w,x as T}from"./embed-title-BKQDbQFL.js";import{B as E,D,G as O,H as k,I as A,J as j,K as M,M as N,N as P,O as ee,R as te,T as ne,V as F,W as I,Y as re,a as ie,c as ae,d as oe,f as se,g as ce,h as le,i as ue,k as de,l as fe,m as pe,n as me,o as he,p as ge,q as _e,r as ve,s as ye,t as be,u as xe,v as Se,w as Ce,z as we}from"./country-DssWUNbC.js";import{$ as Te,A as Ee,B as L,C as De,D as R,E as Oe,F as ke,H as Ae,I as je,J as Me,K as Ne,L as Pe,M as Fe,N as Ie,O as Le,P as Re,Q as ze,R as Be,S as Ve,T as He,U as Ue,V as We,W as Ge,X as Ke,Y as qe,Z as Je,_ as Ye,a as z,at as B,c as Xe,ct as Ze,d as Qe,dt as $e,et,f as tt,ft as nt,g as rt,gt as it,h as at,ht as ot,i as st,it as V,j as ct,k as lt,l as ut,lt as H,m as dt,mt as ft,nt as pt,o as U,ot as W,p as mt,pt as ht,q as gt,rt as _t,s as G,st as K,t as vt,tt as q,u as yt,v as bt,w as xt,x as St,y as Ct,z as wt}from"./player-volume-DTOJyhLh.js";import{A as Tt,C as Et,D as Dt,E as Ot,M as kt,O as At,S as jt,T as Mt,_ as Nt,a as Pt,b as Ft,c as It,g as Lt,h as Rt,i as zt,j as Bt,k as Vt,l as Ht,m as Ut,n as Wt,o as Gt,p as Kt,r as qt,s as Jt,t as Yt,u as Xt,v as Zt,w as Qt,x as $t,y as en}from"./worker-SLqI-fGd.js";import{t as tn}from"./remote-D8UjjUy7.js";var nn=()=>`https://fkn.app/connect-button`,rn=[`ready`,`loading`,`away`],an=[`play`,`seek`,`go`,`rate`,`subs`,`audio`],on={subtitles:`subs`,audio:`audio`},sn={all:[],by:{}},cn=(e,t,n)=>e.by[t]?.[n]??e.all.includes(n),ln=new Set([`nav`,`scroll`,`cursor`,`playback`,`state`,`pong`]),un=e=>ln.has(e.t),dn=e=>e.trim().slice(0,500)||void 0,fn=e=>e.trim().replace(/\s+/g,` `).slice(0,32)||void 0,pn=e=>JSON.stringify({v:1,...e}),mn=e=>{let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!=`object`)return;let n=t;if(n.v===1)switch(n.t){case`nav`:return Sn(n.path)?{t:`nav`,path:n.path}:void 0;case`scroll`:return En(n.y)?{t:`scroll`,y:n.y}:void 0;case`cursor`:return En(n.x)&&En(n.y)?{t:`cursor`,x:n.x,y:n.y}:void 0;case`chat`:{let e=typeof n.text==`string`?dn(n.text):void 0;return e?{t:`chat`,text:e}:void 0}case`name`:{let e=typeof n.name==`string`?fn(n.name):void 0;return e?{t:`name`,name:e}:void 0}case`ping`:return wn(n.n)&&wn(n.at)?{t:`ping`,n:n.n,at:n.at}:void 0;case`pong`:return wn(n.n)&&wn(n.at)&&wn(n.host)?{t:`pong`,n:n.n,at:n.at,host:n.host}:void 0;case`playback`:return Dn(n.s)?{t:`playback`,s:n.s}:void 0;case`state`:{if(!Sn(n.path)||!En(n.y)||n.s!==void 0&&!Dn(n.s))return;let e=gn(n.grants),t=vn(n.sub),r=vn(n.audio);return{t:`state`,path:n.path,y:n.y,...n.s?{s:n.s}:{},...e?{grants:e}:{},...t===void 0?{}:{sub:t},...r===void 0?{}:{audio:r}}}case`status`:{if(!rn.includes(n.s)||n.path!==void 0&&!Cn(n.path))return;let e=Tn(n.time)&&typeof n.rate==`number`&&n.rate>=0&&n.rate<=16;return!e&&(n.time!==void 0||n.rate!==void 0)?void 0:{t:`status`,s:n.s,...n.path===void 0?{}:{path:n.path},...e?{time:n.time,rate:n.rate}:{}}}case`ask`:if(n.c===`go`)return Cn(n.path)?{t:`ask`,c:`go`,path:n.path}:void 0;if(n.c===`subs`){let e=vn(n.sub);return e===void 0?void 0:{t:`ask`,c:`subs`,sub:e}}if(n.c===`audio`){let e=vn(n.audio);return e===void 0?void 0:{t:`ask`,c:`audio`,audio:e}}return hn(n.c)&&Sn(n.path)&&Dn(n.s)?{t:`ask`,c:n.c,path:n.path,s:n.s}:void 0;default:return}},hn=e=>an.includes(e),gn=e=>{if(!e||typeof e!=`object`)return;let{all:t,by:n}=e;if(!Array.isArray(t)||!n||typeof n!=`object`||Array.isArray(n))return;let r=Object.entries(n);if(r.length>_n)return;let i={all:t.filter(hn),by:{}};for(let[e,t]of r){if(!e||e.length>128||!t||typeof t!=`object`)return;i.by[e]=Object.fromEntries(Object.entries(t).filter(([e,t])=>hn(e)&&typeof t==`boolean`))}return i},_n=100,vn=e=>{if(e===null)return null;if(typeof e!=`string`)return;let t=e.replace(/\s+/g,` `).trim();return t&&t.length<=64?t:void 0},yn=e=>e.c===`go`?`changed the episode`:e.c===`subs`?bn(`subtitles`,e.sub):e.c===`audio`?bn(`audio`,e.audio):e.c===`seek`?`skipped to ${xn(e.s.time)}`:e.c===`rate`?`set speed to ${Number(e.s.rate.toFixed(2))}x`:e.s.paused?`paused`:`resumed`,bn=(e,t)=>t===null?`turned ${e} off`:`set ${e} to ${t}`,xn=e=>{let t=Math.floor(e),n=e=>String(e).padStart(2,`0`),r=Math.floor(t/60)%60;return t>=3600?`${Math.floor(t/3600)}:${n(r)}:${n(t%60)}`:`${r}:${n(t%60)}`},Sn=e=>typeof e==`string`&&e.length>0&&e.length<=2048&&e.startsWith(`/`)&&!e.startsWith(`//`)&&!e.startsWith(`/\\`)&&!/[\r\n\t]/.test(e),Cn=e=>Sn(e)&&new URL(e,`https://stub.invalid`).pathname.startsWith(`/watch/`),wn=e=>typeof e==`number`&&Number.isFinite(e),Tn=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0,En=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=1,Dn=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.paused==`boolean`&&Tn(t.time)&&typeof t.rate==`number`&&Number.isFinite(t.rate)&&t.rate>0&&t.rate<=16&&typeof t.at==`number`&&Number.isFinite(t.at)},On=1.05,kn=5e3,An=(e,t,n=!1)=>{if(e.paused)return e.time;let r=Math.max(t-e.at,0),i=(n?r:Math.min(r,jn))/1e3;return e.time+i*e.rate},jn=2e3,Mn=(e,t,n,r=!1)=>{let i={},a=An(t,n,r),o=a-e.time;Math.abs(o)>.5&&(i.seek=a),t.paused&&!e.paused&&(i.pause=!0),!t.paused&&e.paused&&(i.play=!0);let s=!t.paused&&i.seek===void 0&&Math.abs(o)>=.05&&Pn(e.rate,t.rate)?t.rate*(o>0?On:1/On):t.rate;return Nn(e.rate,s)||(i.rate=s),i},Nn=(e,t)=>Math.abs(e-t)<=.001,Pn=(e,t)=>e<=t*1.05+.001&&e>=t/1.05-.001,Fn=(e,t,n)=>({...e,time:e.paused?e.time:e.time+Math.max(0,n-t)/1e3*e.rate,at:n}),In=2e3,Ln=3e3,Rn=(e,t,n)=>{let r=[];return t.paused!==e.paused&&t.paused!==n.paused&&r.push(`play`),(t.time<e.time-.05||t.time>An(e,t.at,!0)+.5)&&Math.abs(t.time-n.time)>.5&&r.push(`seek`),!Pn(t.rate,e.rate)&&!Pn(t.rate,n.rate)&&r.push(`rate`),r},zn=(e,t,n)=>{let r=Fn(e,e.at,n);if(t.c===`play`)return e.paused===t.s.paused?void 0:{...r,paused:t.s.paused};if(t.c===`rate`)return Nn(e.rate,t.s.rate)?void 0:{...r,rate:t.s.rate};let i=An(t.s,n);return Math.abs(i-r.time)<=.5?void 0:{...r,time:i}},Bn=1e3,Vn=1,Hn=(e,t)=>{let n=e.find(([e,n])=>e-.5<=t&&t<n);return n?n[1]-t:0},Un=(e,t,n,r=0)=>{if(!t||t.readyState<3)return`loading`;let i=e===`ready`?2:10,a=r>0&&Number.isFinite(r)?r-n:1/0;return Hn(t.ranges,n)>=Math.min(i,a)?`ready`:`loading`},Wn=(e,t)=>e.time===void 0?void 0:e.time+Math.max(0,t)/1e3*(e.rate??0),Gn=(e,t,n)=>{if(e.s!==t.s||e.path!==t.path||!e.rate!=!t.rate)return!0;let r=Wn(e,n);return r===void 0||t.time===void 0?r!==t.time:Math.abs(r-t.time)>Vn},Kn=(e,t,n)=>{if(e.path!==n)return{s:e.s===`away`?`away`:`loading`};let r=Wn(e,t);return r===void 0?{s:e.s}:{s:e.s,time:r}},qn=(e,t,n)=>({rtt:n-e,offset:t-(e+n)/2}),Jn=e=>e.length?e.reduce((e,t)=>t.rtt<e.rtt?t:e):void 0,Yn=(e,t)=>e-t,Xn=(e,t)=>e+t,Zn=4e3,Qn=`stub-party-invite`,$n=`stub-party-name`,er=1e4,tr=3e4,nr=2e3,rr=1e4,ir=6e4,ar={subtitles:`party`,audio:`party`},or=()=>{try{return globalThis.sessionStorage}catch{return}},sr=e=>e instanceof Error&&typeof e.code==`string`,cr=(e,t=or())=>{let n={status:`idle`},r,i,a={path:`/`,y:0},o=new Set,s=new Set,c,l,u=new Map,d=new Map,f=[],p,m=sn,h=!0,g={},_={},v=ar,y,b,x,S,C=new Map,w=1,T,E,D,O,k=new Map,A=(()=>{try{return t?.getItem(`stub-party-name`)??void 0}catch{return}})(),j=e=>{n=e;for(let e of o)e(n)},M=e=>{try{t?.setItem(Qn,e)}catch{}},N=()=>{try{t?.removeItem(Qn)}catch{}},P=()=>{try{return t?.getItem(`stub-party-invite`)??void 0}catch{return}},ee=e=>e.owner===e.self.id?`host`:`guest`,te=(e,t)=>{for(let n of s)n(e,t)},ne=async e=>{let t=await e.members().catch(()=>void 0);r===e&&n.status===`active`&&t&&j({...n,members:t.length})},F=e=>{r&&n.status===`active`&&(un(e)&&n.role!==`host`||r.send(pn(e)).catch(()=>{}))},I=()=>{if(!r||n.status!==`active`||n.role!==`guest`)return;let e=r,t=[];x=t;for(let n=0;n<5;n++)setTimeout(()=>{if(x!==t||r!==e)return;let n=Date.now(),i=w++;C.set(i,n),setTimeout(()=>C.delete(i),Zn),F({t:`ping`,n:i,at:n})},n*400);setTimeout(()=>{if(x!==t||r!==e)return;x=void 0;let n=Jn(t);n&&(b=n)},2e3+Zn)},re=()=>({t:`state`,path:a.path,y:a.y,...a.playback?{s:Fn(a.playback,a.playbackAt??Date.now(),Date.now())}:{},...p?{grants:p}:{},...g.subtitles===void 0?{}:{sub:g.subtitles},...g.audio===void 0?{}:{audio:g.audio}}),ie=({grants:e=sn,sub:t,audio:r})=>{let i={subtitles:t,audio:r};JSON.stringify([e,i])!==JSON.stringify([m,_])&&(m=e,_=i,n.status===`active`&&j({...n}))},ae=(e,t)=>{g={...g,[e]:t},F(re())},oe=()=>{if(D=void 0,!T)return;let e=Date.now(),t=Wn(T.status,e-T.at);E={status:t===void 0?T.status:{...T.status,time:t},at:e},F({t:`status`,...E.status})},se=e=>{if(!T||D||!e&&E&&!Gn(E.status,T.status,T.at-E.at))return;let t=(E?.at??-1/0)+nr-Date.now();t<=0?oe():D=setTimeout(oe,t)},ce=()=>[...u.values()].filter(e=>`path`in e).at(-1)?.path,le=()=>{let e=u.get(`state`),t=u.get(`scroll`);if(e?.t!==`state`||t?.t!==`scroll`)return e;let n=[...u.keys()];return n.indexOf(`scroll`)>n.indexOf(`state`)?{...e,y:t.y}:e},ue=()=>{i?.(),i=void 0,r=void 0,c&&clearInterval(c),c=void 0,l&&clearInterval(l),l=void 0,S&&clearInterval(S),S=void 0,clearTimeout(D),D=void 0,clearInterval(O),O=void 0,T=void 0,E=void 0,k.clear(),x=void 0,b=void 0,C.clear(),v=ar},de=async e=>{r=e;let t=ee(e);d.clear(),f.length=0,p=void 0,m=sn,h=!0,g={},_={},j({status:`active`,role:t,invite:e.invite,members:1,self:e.self.id,owner:e.owner}),M(e.invite),i=await e.on(i=>{if(r===e)switch(i.type){case`message`:{let n=mn(i.message.text);if(!n)return;let r=i.message.from,a=r===e.self.id;if(n.t===`ping`){t===`host`&&!a&&F({t:`pong`,n:n.n,at:n.at,host:Date.now()});return}if(n.t===`pong`){if(t!==`guest`||r!==e.owner)return;let i=C.get(n.n);if(i===void 0||i!==n.at)return;C.delete(n.n);let a=qn(i,n.host,Date.now());if(a.rtt>4e3)return;x?.push(a),b||=a;return}if(un(n)){if(r!==e.owner||(n.t===`state`&&ie(n),t===`host`))return;u.delete(n.t),u.set(n.t,n),te(n,{replayed:!1,from:r,self:a});return}if(n.t===`ask`){if(!cn(m,r,n.c))return;let e=f.at(-1);e?.from===r&&e.action===n.c&&f.pop(),t===`host`&&n.c===`subs`&&ae(`subtitles`,n.sub),t===`host`&&n.c===`audio`&&ae(`audio`,n.audio)}if(n.t===`name`&&d.set(r,n.name),n.t===`status`&&t===`host`&&!a){let{t:e,...t}=n;k.set(r,{status:t,at:Date.now()})}if(n.t===`chat`||n.t===`ask`){let e=n.t===`chat`?{text:n.text}:{text:yn(n),action:n.c};f.push({seq:i.message.seq,from:r,name:d.get(r),at:i.message.at,self:a,...e}),f.length>200&&f.splice(0,f.length-200)}te(n,{replayed:!1,from:r,self:a});return}case`joined`:t===`host`&&F(re()),A&&F({t:`name`,name:A}),ne(e);return;case`left`:{if(t===`guest`&&i.id===e.owner){pe(`host-left`);return}k.delete(i.id);let r=p?.by[i.id];t===`host`&&p&&r&&!Object.values(r).includes(!1)&&(p={...p,by:Object.fromEntries(Object.entries(p.by).filter(([e])=>e!==i.id))},F(re()),j({...n})),ne(e);return}}}),r===e?(t===`host`&&(c=setInterval(()=>F(re()),er)),t===`guest`&&(I(),S=setInterval(I,ir),T={status:{s:`away`},at:Date.now()},O=setInterval(()=>{Cn(ce())&&se(!0)},rr)),l=setInterval(()=>{A&&F({t:`name`,name:A})},tr),A&&F({t:`name`,name:A}),ne(e),e.closed.then(({reason:t})=>{r===e&&(ue(),N(),j({status:`ended`,reason:t}))})):(i(),i=void 0)},fe=e=>n.status===`active`&&(n.role===`host`||cn(m,n.self,e)),pe=async e=>{let t=r;ue(),N(),j({status:`ended`,reason:e}),await t?.leave().catch(()=>{})},me=(e,t)=>{N(),j(t?{status:`idle`}:{status:`failed`,code:sr(e)?e.code:`unknown`})},he=async(e,t,n=!1)=>{r&&await pe(`left`),u.clear(),j({status:`joining`,invite:e??``});try{let e=await t();await de(e)}catch(e){me(e,n)}};return{getState:()=>n,subscribe:e=>(o.add(e),()=>{o.delete(e)}),onMessage:e=>(s.add(e),()=>{s.delete(e)}),create:()=>he(void 0,()=>e.create()),join:t=>he(t,()=>e.join(t)),resume:async()=>{let t=P();t&&!r&&await he(t,()=>e.join(t),!0)},leave:async()=>{r&&await pe(`left`)},send:F,setLocation:(e,t)=>{a.path=e,a.y=t},setPlayback:e=>{a.playback=e,a.playbackAt=Date.now()},issued:()=>p??sn,setGrants:e=>{n.status===`active`&&n.role===`host`&&(p=e,F(re()),j({...n}))},may:fe,partyTrack:e=>_[e],setPartyTrack:(e,t)=>{n.status===`active`&&(n.role===`host`?ae(e,t):fe(on[e])&&F(e===`subtitles`?{t:`ask`,c:`subs`,sub:t}:{t:`ask`,c:`audio`,audio:t}))},mine:e=>v[e],setMine:(e,t)=>{v={...v,[e]:t},j({...n})},playerTracks:()=>y,setPlayerTracks:e=>{y=e,j({...n})},invite:()=>n.status===`active`?n.invite:void 0,hostClock:()=>b,hostPath:ce,following:()=>h,setFollowing:e=>{h=e,j({...n})},replay:()=>{for(let e of[`state`,`nav`,`scroll`,`playback`]){let t=e===`state`?le():u.get(e);t&&r&&te(t,{replayed:!0,from:r.owner,self:!1})}h||(h=!0,j({...n}))},nameOf:e=>d.get(e),roster:async()=>{if(!r)return[];let e=r;return(await e.members().catch(()=>[])).map(t=>({id:t.id,name:d.get(t.id),host:t.id===e.owner,self:t.id===e.self.id}))},chat:()=>f.slice(),setName:e=>{A=e;try{e?t?.setItem($n,e):t?.removeItem($n)}catch{}e&&F({t:`name`,name:e})},name:()=>A,kick:async e=>{r&&n.status===`active`&&n.role===`host`&&await r.remove(e)},ban:async e=>{r&&n.status===`active`&&n.role===`host`&&await r.block(e)},playing:()=>!(!a.playback||a.playback.paused),setStatus:e=>{n.status===`active`&&n.role===`guest`&&(T={status:e,at:Date.now()},se(!1))},statuses:()=>k,dismiss:()=>{(n.status===`ended`||n.status===`failed`)&&j({status:`idle`})}}},lr=`/party`,ur=(e,t)=>`${e}${lr}#${fr(e,t)}`,dr=(e,t)=>{let n=e.startsWith(`#`)?e.slice(1):e,r;try{r=decodeURIComponent(n).trim()}catch{return}if(hr.test(r))return r;if(!gr.test(r))return;let i=r.indexOf(`.`),a=`${r.slice(0,i)}.${t}/${r.slice(i+1)}`;return hr.test(a)?a:void 0},fr=(e,t)=>{let n=t.indexOf(`.`),r=t.slice(n+1),i=r.lastIndexOf(`/`);return i>0&&r.slice(0,i)===e?`${t.slice(0,n)}.${r.slice(i+1)}`:t},pr=`[A-Za-z0-9_-]{43}`,mr=`[a-z0-9][a-z0-9._-]{0,63}`,hr=RegExp(`^${pr}\\.[\\x21-\\x7e]{1,256}\\/${mr}$`),gr=RegExp(`^${pr}\\.${mr}$`),J=cr(we),_r=/^(anime|movies|series|stub)\.(fkn\.app|localhost)$/,vr=e=>{let t=e.match(_r)?.[1];return t===`movies`?`movie`:t??`stub`},yr=e=>_r.test(e),br=vr(globalThis.location?.hostname??``),xr=[{site:`movie`,host:`movies`,label:`Movies`},{site:`series`,host:`series`,label:`Series`},{site:`anime`,host:`anime`,label:`Anime`},{site:`stub`,host:`stub`,label:`All`}],Sr=globalThis.location?(({protocol:e,hostname:t,port:n})=>{let r=t.match(_r)?.[2];return r?xr.map(({site:t,host:i,label:a})=>({site:t,label:a,href:`${e}//${i}.${r}${n?`:${n}`:``}/`})):[]})(globalThis.location):[],Cr=[`anilist`,`mal`,`kitsu`,`livechart`,`anizip`,`offline`,`cr`],wr=(e,t=br)=>t!==`movie`&&t!==`series`||!Cr.includes(e),Tr=/^\/assets\//,Er=e=>[...new Set([...e.querySelectorAll(`script[src], link[href]`)].map(e=>e.getAttribute(`src`)??e.getAttribute(`href`)??``).filter(e=>Tr.test(e)))].sort(),Dr=e=>e.ok&&/javascript|css/.test(e.headers.get(`content-type`)??``),Or=async e=>{let t=await fetch(`/`,{cache:`no-store`}),n=Er(new DOMParser().parseFromString(await t.text(),`text/html`)).filter(t=>!e.includes(t));return n.length!==0&&(await Promise.all(n.map(async e=>{let t=await fetch(e);return await t.arrayBuffer(),Dr(t)}))).every(Boolean)},kr=9e5,Ar=e=>{let t=!1,n=!1,r=async()=>{if(!(t||n)){t=!0;try{n=await Or(Er(document))}catch{}t=!1,n&&(clearInterval(i),e())}},i=setInterval(r,kr);document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&r()}),window.addEventListener(`vite:preloadError`,()=>{r()})},jr={categoryBar:1,hoverCard:150,sourcePopup:300,filterMenu:500,mediaModal:1e3,header:1100,headerPopup:1150,franchiseDialog:1200,pluginPrompt:2e3,updating:2500,partyCursor:3e3},Mr=`stub-update-reloads`,Nr=2,Pr=3e5,Fr=1e3,Ir=`textarea:not([readonly]), input:not([type=checkbox]):not([type=radio]):not([readonly]), [contenteditable]:not([contenteditable=false])`,Lr=()=>{try{let e=Date.now(),t=JSON.parse(sessionStorage.getItem(`stub-update-reloads`)??`[]`).filter(t=>e-t<Pr);return t.length>=Nr?!1:(sessionStorage.setItem(Mr,JSON.stringify([...t,e])),!0)}catch{return!1}},Rr=new Set,zr=e=>{Rr.add(e)},Br=e=>{let{status:t}=e.getState();return![...Rr].some(e=>e())&&navigator.onLine&&!location.pathname.startsWith(`/watch/`)&&t!==`joining`&&t!==`active`&&!document.activeElement?.matches(Ir)&&![...document.querySelectorAll(`video`)].some(e=>!e.paused&&!e.ended)},Vr=()=>{let e=document.createElement(`div`);e.textContent=`Updating Stub`,e.style.cssText=`position: fixed; inset: 0; z-index: ${jr.updating}; display: flex; align-items: center; justify-content: center; background: #0f0f0f; color: #fff; font-size: 2rem`,document.body.append(e)},Hr=(({party:e})=>{let t,n=!1,r=()=>{!n&&Br(e)&&Lr()&&(n=!0,Vr(),location.reload())};return{due:()=>{t??=setInterval(r,Fr),r()}}})({party:J});te.onUpdateTaken(Hr.due),yr(location.hostname)&&Ar(Hr.due),ft();var Ur={NAME:`Name`,DOCUMENT:`Document`,OPERATION_DEFINITION:`OperationDefinition`,VARIABLE_DEFINITION:`VariableDefinition`,SELECTION_SET:`SelectionSet`,FIELD:`Field`,ARGUMENT:`Argument`,FRAGMENT_SPREAD:`FragmentSpread`,INLINE_FRAGMENT:`InlineFragment`,FRAGMENT_DEFINITION:`FragmentDefinition`,VARIABLE:`Variable`,INT:`IntValue`,FLOAT:`FloatValue`,STRING:`StringValue`,BOOLEAN:`BooleanValue`,NULL:`NullValue`,ENUM:`EnumValue`,LIST:`ListValue`,OBJECT:`ObjectValue`,OBJECT_FIELD:`ObjectField`,DIRECTIVE:`Directive`,NAMED_TYPE:`NamedType`,LIST_TYPE:`ListType`,NON_NULL_TYPE:`NonNullType`},Wr=class extends Error{constructor(e,t,n,r,i,a,o){super(e),this.name=`GraphQLError`,this.message=e,i&&(this.path=i),t&&(this.nodes=Array.isArray(t)?t:[t]),n&&(this.source=n),r&&(this.positions=r),a&&(this.originalError=a);var s=o;if(!s&&a){var c=a.extensions;c&&typeof c==`object`&&(s=c)}this.extensions=s||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return`GraphQLError`}},Y,X;function Gr(e){return new Wr(`Syntax Error: Unexpected token at ${X} in ${e}`)}function Kr(e){if(e.lastIndex=X,e.test(Y))return Y.slice(X,X=e.lastIndex)}var qr=/ +(?=[^\s])/y;function Jr(e){for(var t=e.split(`
3
3
  `),n=``,r=0,i=0,a=t.length-1,o=0;o<t.length;o++)qr.lastIndex=0,qr.test(t[o])&&(o&&(!r||qr.lastIndex<r)&&(r=qr.lastIndex),i||=o,a=o);for(var s=i;s<=a;s++)s!==i&&(n+=`
4
4
  `),n+=t[s].slice(r).replace(/\\"""/g,`"""`);return n}function Yr(){for(var e=0|Y.charCodeAt(X++);e===9||e===10||e===13||e===32||e===35||e===44||e===65279;e=0|Y.charCodeAt(X++))if(e===35)for(;(e=0|Y.charCodeAt(X++))&&e!==10&&e!==13;);X--}function Xr(){for(var e=X,t=0|Y.charCodeAt(X++);t>=48&&t<=57||t>=65&&t<=90||t===95||t>=97&&t<=122;t=0|Y.charCodeAt(X++));if(e===X-1)throw Gr(`Name`);var n=Y.slice(e,--X);return Yr(),n}function Zr(){return{kind:`Name`,value:Xr()}}var Qr=/(?:"""|(?:[\s\S]*?[^\\])""")/y,$r=/(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;function ei(e){var t;switch(Y.charCodeAt(X)){case 91:X++,Yr();for(var n=[];Y.charCodeAt(X)!==93;)n.push(ei(e));return X++,Yr(),{kind:`ListValue`,values:n};case 123:X++,Yr();for(var r=[];Y.charCodeAt(X)!==125;){var i=Zr();if(Y.charCodeAt(X++)!==58)throw Gr(`ObjectField`);Yr(),r.push({kind:`ObjectField`,name:i,value:ei(e)})}return X++,Yr(),{kind:`ObjectValue`,fields:r};case 36:if(e)throw Gr(`Variable`);return X++,{kind:`Variable`,name:Zr()};case 34:if(Y.charCodeAt(X+1)===34&&Y.charCodeAt(X+2)===34){if(X+=3,(t=Kr(Qr))==null)throw Gr(`StringValue`);return Yr(),{kind:`StringValue`,value:Jr(t.slice(0,-3)),block:!0}}var a=X,o;X++;var s=!1;for(o=0|Y.charCodeAt(X++);o===92&&(X++,s=!0)||o!==10&&o!==13&&o!==34&&o;o=0|Y.charCodeAt(X++));if(o!==34)throw Gr(`StringValue`);return t=Y.slice(a,X),Yr(),{kind:`StringValue`,value:s?JSON.parse(t):t.slice(1,-1),block:!1};case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:for(var c=X++,l;(l=0|Y.charCodeAt(X++))>=48&&l<=57;);var u=Y.slice(c,--X);if((l=Y.charCodeAt(X))===46||l===69||l===101){if((t=Kr($r))==null)throw Gr(`FloatValue`);return Yr(),{kind:`FloatValue`,value:u+t}}return Yr(),{kind:`IntValue`,value:u};case 110:if(Y.charCodeAt(X+1)===117&&Y.charCodeAt(X+2)===108&&Y.charCodeAt(X+3)===108)return X+=4,Yr(),{kind:`NullValue`};break;case 116:if(Y.charCodeAt(X+1)===114&&Y.charCodeAt(X+2)===117&&Y.charCodeAt(X+3)===101)return X+=4,Yr(),{kind:`BooleanValue`,value:!0};break;case 102:if(Y.charCodeAt(X+1)===97&&Y.charCodeAt(X+2)===108&&Y.charCodeAt(X+3)===115&&Y.charCodeAt(X+4)===101)return X+=5,Yr(),{kind:`BooleanValue`,value:!1}}return{kind:`EnumValue`,value:Xr()}}function ti(e){if(Y.charCodeAt(X)===40){var t=[];X++,Yr();do{var n=Zr();if(Y.charCodeAt(X++)!==58)throw Gr(`Argument`);Yr(),t.push({kind:`Argument`,name:n,value:ei(e)})}while(Y.charCodeAt(X)!==41);return X++,Yr(),t}}function ni(e){if(Y.charCodeAt(X)===64){var t=[];do X++,t.push({kind:`Directive`,name:Zr(),arguments:ti(e)});while(Y.charCodeAt(X)===64);return t}}function ri(){for(var e=0;Y.charCodeAt(X)===91;)e++,X++,Yr();var t={kind:`NamedType`,name:Zr()};do if(Y.charCodeAt(X)===33&&(X++,Yr(),t={kind:`NonNullType`,type:t}),e){if(Y.charCodeAt(X++)!==93)throw Gr(`NamedType`);Yr(),t={kind:`ListType`,type:t}}while(e--);return t}function ii(){if(Y.charCodeAt(X++)!==123)throw Gr(`SelectionSet`);return Yr(),ai()}function ai(){var e=[];do if(Y.charCodeAt(X)===46){if(Y.charCodeAt(++X)!==46||Y.charCodeAt(++X)!==46)throw Gr(`SelectionSet`);switch(X++,Yr(),Y.charCodeAt(X)){case 64:e.push({kind:`InlineFragment`,typeCondition:void 0,directives:ni(!1),selectionSet:ii()});break;case 111:Y.charCodeAt(X+1)===110?(X+=2,Yr(),e.push({kind:`InlineFragment`,typeCondition:{kind:`NamedType`,name:Zr()},directives:ni(!1),selectionSet:ii()})):e.push({kind:`FragmentSpread`,name:Zr(),directives:ni(!1)});break;case 123:X++,Yr(),e.push({kind:`InlineFragment`,typeCondition:void 0,directives:void 0,selectionSet:ai()});break;default:e.push({kind:`FragmentSpread`,name:Zr(),directives:ni(!1)})}}else{var t=Zr(),n=void 0;Y.charCodeAt(X)===58&&(X++,Yr(),n=t,t=Zr());var r=ti(!1),i=ni(!1),a=void 0;Y.charCodeAt(X)===123&&(X++,Yr(),a=ai()),e.push({kind:`Field`,alias:n,name:t,arguments:r,directives:i,selectionSet:a})}while(Y.charCodeAt(X)!==125);return X++,Yr(),{kind:`SelectionSet`,selections:e}}function oi(){if(Yr(),Y.charCodeAt(X)===40){var e=[];X++,Yr();do{var t=void 0;if(Y.charCodeAt(X)===34&&(t=ei(!0)),Y.charCodeAt(X++)!==36)throw Gr(`Variable`);var n=Zr();if(Y.charCodeAt(X++)!==58)throw Gr(`VariableDefinition`);Yr();var r=ri(),i=void 0;Y.charCodeAt(X)===61&&(X++,Yr(),i=ei(!0)),Yr();var a={kind:`VariableDefinition`,variable:{kind:`Variable`,name:n},type:r,defaultValue:i,directives:ni(!0)};t&&(a.description=t),e.push(a)}while(Y.charCodeAt(X)!==41);return X++,Yr(),e}}function si(e){var t=Zr();if(Y.charCodeAt(X++)!==111||Y.charCodeAt(X++)!==110)throw Gr(`FragmentDefinition`);Yr();var n={kind:`FragmentDefinition`,name:t,typeCondition:{kind:`NamedType`,name:Zr()},directives:ni(!1),selectionSet:ii()};return e&&(n.description=e),n}function ci(){var e=[];do{var t=void 0;if(Y.charCodeAt(X)===34&&(t=ei(!0)),Y.charCodeAt(X)===123){if(t)throw Gr(`Document`);X++,Yr(),e.push({kind:`OperationDefinition`,operation:`query`,name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:ai()})}else{var n=Xr();switch(n){case`fragment`:e.push(si(t));break;case`query`:case`mutation`:case`subscription`:var r,i=void 0;(r=Y.charCodeAt(X))!==40&&r!==64&&r!==123&&(i=Zr());var a={kind:`OperationDefinition`,operation:n,name:i,variableDefinitions:oi(),directives:ni(!1),selectionSet:ii()};t&&(a.description=t),e.push(a);break;default:throw Gr(`Document`)}}}while(X<Y.length);return e}function li(e,t){return Y=e.body?e.body:e,X=0,Yr(),t&&t.noLocation?{kind:`Document`,definitions:ci()}:{kind:`Document`,definitions:ci(),loc:{start:0,end:Y.length,startToken:void 0,endToken:void 0,source:{body:Y,name:`graphql.web`,locationOffset:{line:1,column:1}}}}}function ui(e,t,n){for(var r=``,i=0;i<e.length;i++)i&&(r+=t),r+=n(e[i]);return r}function di(e){return JSON.stringify(e)}function fi(e){return`"""
5
5
  `+e.replace(/"""/g,`\\"""`)+`
@@ -16,7 +16,7 @@ import{o as e,r as t,s as n}from"./dist-sBTuRPnX.js";import{C as r,D as i,E as a
16
16
  \r
17
17
  `)+4))}catch(e){if(!a)throw e}if(a&&!1===a.hasNext)break}a&&!1!==a.hasNext&&(yield{hasNext:!1})}(o,a):/text\/event-stream/i.test(o)?async function*(e){var t;for await(var n of Aa(ka(e),`
18
18
 
19
- `)){var r=n.match(Oa);if(r){var i=r[1];try{yield t=JSON.parse(i)}catch(e){if(!t)throw e}if(t&&!1===t.hasNext)break}}t&&!1!==t.hasNext&&(yield{hasNext:!1})}(a):/text\//i.test(o)?async function*(e){var t=await e.text();try{yield JSON.parse(t)}catch{throw Error(t)}}(a):async function*(e){yield JSON.parse(await e.text())}(a),c;for await(var l of s)l.pending&&!i?c=l.pending:l.pending&&(c=[...c,...l.pending]),i=i?ba(i,l,a,c):va(e,l,a),r=!1,yield i,r=!0;i||(yield i=va(e,{},a))}catch(t){if(!r)throw t;yield xa(e,a&&(a.status<200||a.status>=300)&&a.statusText?Error(a.statusText):t,a)}}function Ma(e,t,n){var r;return typeof AbortController<`u`&&(n.signal=(r=new AbortController).signal),ki((()=>{r&&r.abort()}))(wi((e=>!!e))(Ri(ja(e,t,n))))}function Na(e){var t=t=>e(t);return t.toPromise=()=>Ji(Pi(1)(wi((e=>!e.stale&&!e.hasNext))(t))),t.then=(e,n)=>t.toPromise().then(e,n),t.subscribe=e=>Ki(e)(t),t}function Pa(e,t,n){return{...t,kind:e,context:t.context?{...t.context,...n}:n||t.context}}var Fa=()=>{},Ia=({forward:e,dispatchDebug:t})=>t=>Oi([Ei((e=>{var n=Sa(e),r=Ca(e,n),i=Ea(e,n);return Fi(wi((t=>t.kind===`teardown`&&t.key===e.key))(t))(Ma(e,r,i))}))(wi((e=>e.kind!==`teardown`&&(e.kind!==`subscription`||!!e.context.fetchSubscriptions)))(t)),e(wi((e=>e.kind===`teardown`||e.kind===`subscription`&&!e.context.fetchSubscriptions))(t))]),La=e=>({client:t,forward:n,dispatchDebug:r})=>e.reduceRight(((e,n)=>n({client:t,forward(t){return Mi(e(Mi(t)))},dispatchDebug(e){}})),n),Ra=({onOperation:e,onResult:t,onError:n})=>({forward:r})=>i=>Ei((e=>{n&&e.error&&n(e.error,e.operation);var r=t&&t(e)||e;return`then`in r?Gi(r):Vi(r)}))(r(Ei((t=>{var n=e&&e(t)||t;return`then`in n?Gi(n):Vi(n)}))(i))),za=({dispatchDebug:e})=>e=>wi((e=>!1))(e),Ba=function e(t){var n=0,r=new Map,i=new Map,a=new Set,o=[],s={url:t.url,fetchSubscriptions:t.fetchSubscriptions,fetchOptions:t.fetchOptions,fetch:t.fetch,preferGetMethod:t.preferGetMethod,requestPolicy:t.requestPolicy||`cache-first`},c=Ui();function l(e){e.kind!==`mutation`&&e.kind!==`teardown`&&a.has(e.key)||(e.kind===`teardown`?a.delete(e.key):e.kind!==`mutation`&&a.add(e.key),c.next(e))}var u=!1;function d(e){if(e&&l(e),!u){for(u=!0;u&&(e=o.shift());)l(e);u=!1}}var f=e=>{var t=Fi(wi((t=>t.kind===`teardown`&&t.key===e.key))(c.source))(wi((t=>t.operation.kind===e.kind&&t.operation.key===e.key&&(!t.operation.context._instance||t.operation.context._instance===e.context._instance)))(g));return t=e.kind===`query`?Ni((t=>{var n=Vi(t);return t.stale||t.hasNext?n:Oi([n,Ti((()=>(t.stale=!0,t)))(Pi(1)(wi((t=>t.key===e.key))(c.source)))])}))(t):Ii((e=>!!e.hasNext),!0)(t),t=e.kind===`mutation`?ji((()=>{l(e)}))(t):ki((()=>{a.delete(e.key),r.delete(e.key),i.delete(e.key),u=!1;for(var t=o.length-1;t>=0;t--)o[t].key===e.key&&o.splice(t,1);l(Pa(`teardown`,e,e.context))}))(Ai((t=>{if(t.stale){if(!t.hasNext)a.delete(e.key);else for(var n=0;n<o.length;n++){var i=o[n];if(i.key===t.operation.key){a.delete(i.key);break}}}else t.hasNext||a.delete(e.key);r.set(e.key,t)}))(t)),Mi(t)},p=this instanceof e?this:Object.create(e.prototype),m=Object.assign(p,{suspense:!!t.suspense,operations$:c.source,reexecuteOperation(e){if(e.kind===`teardown`)d(e);else if(e.kind===`mutation`)o.push(e),Promise.resolve().then(d);else if(i.has(e.key)){for(var t=!1,n=0;n<o.length;n++)o[n].key===e.key&&(o[n]=e,t=!0);t||a.has(e.key)&&e.context.requestPolicy!==`network-only`?(a.delete(e.key),Promise.resolve().then(d)):(o.push(e),Promise.resolve().then(d))}},createRequestOperation(e,t,r){return r||={},Pa(e,t,{_instance:e===`mutation`?n=n+1|0:void 0,...s,...r,requestPolicy:r.requestPolicy||s.requestPolicy,suspense:r.suspense||!1!==r.suspense&&m.suspense})},executeRequestOperation(e){return e.kind===`mutation`?Na(f(e)):Na(Li((()=>{var t=i.get(e.key);t||i.set(e.key,t=f(e)),t=ji((()=>{d(e)}))(t);var n=r.get(e.key);return e.kind===`query`&&n&&(n.stale||n.hasNext)?Ni(Vi)(Oi([t,wi((t=>t===r.get(e.key)))(Vi(n))])):t})))},executeQuery(e,t){var n=m.createRequestOperation(`query`,e,t);return m.executeRequestOperation(n)},executeSubscription(e,t){var n=m.createRequestOperation(`subscription`,e,t);return m.executeRequestOperation(n)},executeMutation(e,t){var n=m.createRequestOperation(`mutation`,e,t);return m.executeRequestOperation(n)},readQuery(e,t,n){var r=null;return Ki((e=>{r=e}))(m.query(e,t,n)).unsubscribe(),r},query:(e,t,n)=>m.executeQuery(ga(e,t),n),subscription:(e,t,n)=>m.executeSubscription(ga(e,t),n),mutation:(e,t,n)=>m.executeMutation(ga(e,t),n)}),h=Fa,g=Mi(La(t.exchanges)({client:m,dispatchDebug:h,forward:za({dispatchDebug:h})})(c.source));return qi(g),m};Je();var Va=nt({}),Ha=Va.Provider;Va.Consumer,Va.displayName=`UrqlContext`;var Ua=()=>Ze(Va),Wa={fetching:!1,stale:!1,hasNext:!1,error:void 0,data:void 0,extensions:void 0,operation:void 0},Ga=(e,t)=>e===t||!(!e||!t||e.key!==t.key),Ka=(e,t)=>{var n={...e,...t,data:t.data!==void 0||t.error?t.data:e.data,fetching:!!t.fetching,stale:!!t.stale};return((e,t)=>{for(var n in e)if(!(n in t))return!0;for(var r in t)if(r===`operation`?!Ga(e[r],t[r]):e[r]!==t[r])return!0;return!1})(e,n)?n:e},qa=(e,t)=>{for(var n=0,r=t.length;n<r;n++)if(e[n]!==t[n])return!0;return!1};function Ja(e,t){e(t)}function Ya(e){var t=q(!0),n=Ua(),[r,i]=W(Wa),a=B(((r,a)=>(Ja(i,{...Wa,fetching:!0}),Ji(Pi(1)(wi((e=>!e.hasNext))(Ai((e=>{t.current&&Ja(i,{fetching:!1,stale:e.stale,data:e.data,error:e.error,extensions:e.extensions,operation:e.operation,hasNext:e.hasNext})}))(n.executeMutation(ga(e,r),a||{}))))))),[n,e,i]);return V((()=>(t.current=!0,()=>{t.current=!1})),[]),[r,a]}function Xa(e,t){var n=q(void 0);return H((()=>{var r=ga(e,t);return n.current!==void 0&&n.current.key===r.key?n.current:(n.current=r,r)}),[e,t])}function Za(e,t){var n=Ua(),r=Xa(e.query,e.variables),i=q(t);i.current=t;var a=H((()=>e.pause?null:n.executeSubscription(r,e.context)),[n,r,e.pause,e.context]),o=[n,r,e.context,e.pause],[s,c]=W((()=>[a,{...Wa,fetching:!!a},o])),l=s[1];a!==s[0]&&qa(s[2],o)&&c([a,l=Ka(s[1],{fetching:!!a}),o]),V((()=>{var e=e=>{Ja(c,(t=>{var n=Ka(t[1],e);return t[1]===n?t:(i.current&&n.data!=null&&t[1].data!==n.data&&(n.data=i.current(t[1].data,n.data)),[t[0],n,t[2]])}))};if(s[0])return Ki(e)(ki((()=>{e({fetching:!!a})}))(s[0])).unsubscribe;e({fetching:!1})}),[s[0]]);var u=B((t=>{var i=n.executeSubscription(r,{...e.context,...t});Ja(c,(e=>[i,e[1],o]))}),[n,r,e.context,e.pause]);return[l,u]}K();var Qa=`stub-source@1`,$a=`stub-enabled-plugins`,eo=`stub-account-plugins`,to=()=>{try{return globalThis.localStorage}catch{return}},no=e=>{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]},ro=(e,t)=>{try{let n=t?.getItem(e);return n==null?void 0:no(n)}catch{return[]}},io=(e=to())=>[...new Set([...so(e)??[],...ao(e)])],ao=(e=to())=>ro(`stub-enabled-plugins`,e)??[],oo=(e,t=to())=>{try{t?.setItem($a,JSON.stringify(e))}catch{}},so=(e=to())=>ro(eo,e),co=(e,t=to())=>{try{e?t?.setItem(eo,JSON.stringify(e)):t?.removeItem(eo)}catch{}},lo=[`mal`,`anilist`,`kitsu`,`anidb`],uo=function(e){return e.Anime=`ANIME`,e.Movie=`MOVIE`,e.Series=`SERIES`,e}({}),fo=function(e){return e.Html=`HTML`,e.Text=`TEXT`,e}({}),po=function(e){return e.Fall=`FALL`,e.Spring=`SPRING`,e.Summer=`SUMMER`,e.Winter=`WINTER`,e}({}),mo=function(e){return e.Popularity=`POPULARITY`,e.PopularityDesc=`POPULARITY_DESC`,e}({}),ho=function(e){return e.Cancelled=`CANCELLED`,e.Finished=`FINISHED`,e.Hiatus=`HIATUS`,e.NotYetReleased=`NOT_YET_RELEASED`,e.Releasing=`RELEASING`,e}({}),go=function(e){return e.Anime=`ANIME`,e.LiveAction=`LIVE_ACTION`,e.Movie=`MOVIE`,e.Ona=`ONA`,e.Ova=`OVA`,e.Special=`SPECIAL`,e.Tv=`TV`,e.TvShort=`TV_SHORT`,e}({}),_o=function(e){return e.IsApiOnly=`IS_API_ONLY`,e.IsNotApiOnly=`IS_NOT_API_ONLY`,e}({}),vo=function(e){return e.Ambiguous=`AMBIGUOUS`,e.Error=`ERROR`,e.Listed=`LISTED`,e.Loading=`LOADING`,e.NotListed=`NOT_LISTED`,e.NoId=`NO_ID`,e.Paused=`PAUSED`,e.SignedOut=`SIGNED_OUT`,e}({}),yo={kind:`Document`,definitions:[{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}}]},bo={kind:`Document`,definitions:[{kind:`FragmentDefinition`,name:{kind:`Name`,value:`SearchCard`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`score`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`color`}}]}},{kind:`Field`,name:{kind:`Name`,value:`banners`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`trailers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`thumbnail`}}]}},{kind:`Field`,name:{kind:`Name`,value:`popularity`}},{kind:`Field`,name:{kind:`Name`,value:`genres`}},{kind:`Field`,name:{kind:`Name`,value:`tags`}},{kind:`Field`,name:{kind:`Name`,value:`averageScore`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`type`}},{kind:`Field`,name:{kind:`Name`,value:`season`}},{kind:`Field`,name:{kind:`Name`,value:`seasonYear`}},{kind:`Field`,name:{kind:`Name`,value:`nextAiringEpisode`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}}]},xo={kind:`Document`,definitions:[{kind:`FragmentDefinition`,name:{kind:`Name`,value:`EpisodeFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Episode`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}}]}}]}}]}}]},So={kind:`Document`,definitions:[{kind:`FragmentDefinition`,name:{kind:`Name`,value:`OriginFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Origin`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`icon`}},{kind:`Field`,name:{kind:`Name`,value:`color`}},{kind:`Field`,name:{kind:`Name`,value:`isApiOnly`}}]}}]},Co={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`MediaTracking`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`TrackingInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`tracking`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`disagreements`}},{kind:`Field`,name:{kind:`Name`,value:`summary`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`progress`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}}]}},{kind:`Field`,name:{kind:`Name`,value:`answers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`state`}},{kind:`Field`,name:{kind:`Name`,value:`candidates`}},{kind:`Field`,name:{kind:`Name`,value:`error`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`tracker`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`icon`}},{kind:`Field`,name:{kind:`Name`,value:`color`}},{kind:`Field`,name:{kind:`Name`,value:`canWrite`}},{kind:`Field`,name:{kind:`Name`,value:`statuses`}},{kind:`Field`,name:{kind:`Name`,value:`account`}},{kind:`Field`,name:{kind:`Name`,value:`scoreScale`}},{kind:`Field`,name:{kind:`Name`,value:`canClearScore`}}]}},{kind:`Field`,name:{kind:`Name`,value:`entry`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`progress`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}}]}}]}}]}}]}}]},wo={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`mutation`,name:{kind:`Name`,value:`SaveListEntry`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`SaveListEntryInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`saveListEntry`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`tracker`}},{kind:`Field`,name:{kind:`Name`,value:`outcome`}},{kind:`Field`,name:{kind:`Name`,value:`error`}},{kind:`Field`,name:{kind:`Name`,value:`entry`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`progress`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}}]}}]}}]}}]},To={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`mutation`,name:{kind:`Name`,value:`DeleteListEntry`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`DeleteListEntryInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`deleteListEntry`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`tracker`}},{kind:`Field`,name:{kind:`Name`,value:`outcome`}},{kind:`Field`,name:{kind:`Name`,value:`error`}}]}}]}}]},Eo={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`StubTrackerStorage`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`stubTrackerStorage`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`location`}},{kind:`Field`,name:{kind:`Name`,value:`signedIn`}},{kind:`Field`,name:{kind:`Name`,value:`locked`}},{kind:`Field`,name:{kind:`Name`,value:`waiting`}},{kind:`Field`,name:{kind:`Name`,value:`held`}},{kind:`Field`,name:{kind:`Name`,value:`error`}}]}}]}}]},Do={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`mutation`,name:{kind:`Name`,value:`AddHeldStubEntries`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`addHeldStubEntries`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`location`}},{kind:`Field`,name:{kind:`Name`,value:`signedIn`}},{kind:`Field`,name:{kind:`Name`,value:`locked`}},{kind:`Field`,name:{kind:`Name`,value:`waiting`}},{kind:`Field`,name:{kind:`Name`,value:`held`}},{kind:`Field`,name:{kind:`Name`,value:`error`}}]}}]}}]},Oo={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetReleasingMediaPage`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaPageInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaShortDescriptionInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`mediaPage`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`nodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`score`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`banners`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`trailers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`thumbnail`}}]}},{kind:`Field`,name:{kind:`Name`,value:`popularity`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}}]},ko={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetMediaDetails`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`descriptionInput`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaDescriptionInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`details`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`Boolean`}}},defaultValue:{kind:`BooleanValue`,value:!1}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`media`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`score`}}]}},{kind:`Field`,name:{kind:`Name`,value:`descriptions`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`descriptionInput`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`description`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`banners`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`trailers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`thumbnail`}}]}},{kind:`Field`,name:{kind:`Name`,value:`popularity`}},{kind:`Field`,name:{kind:`Name`,value:`categories`}},{kind:`Field`,name:{kind:`Name`,value:`type`}},{kind:`Field`,name:{kind:`Name`,value:`startDate`}},{kind:`Field`,name:{kind:`Name`,value:`endDate`}},{kind:`Field`,name:{kind:`Name`,value:`season`}},{kind:`Field`,name:{kind:`Name`,value:`seasonYear`}},{kind:`Field`,name:{kind:`Name`,value:`averageScore`}},{kind:`Field`,name:{kind:`Name`,value:`genres`}},{kind:`Field`,name:{kind:`Name`,value:`tags`}},{kind:`Field`,name:{kind:`Name`,value:`franchise`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`nodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`format`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`startDate`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`edges`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`from`}},{kind:`Field`,name:{kind:`Name`,value:`to`}},{kind:`Field`,name:{kind:`Name`,value:`relation`}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`relations`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`format`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`startDate`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`color`}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`releaseDate`}},{kind:`Field`,name:{kind:`Name`,value:`runtime`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`thumbnails`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`releaseDate`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`thumbnails`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`settled`}},{kind:`Field`,name:{kind:`Name`,value:`seasons`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`number`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}}]}},{kind:`Field`,name:{kind:`Name`,value:`nextAiringEpisode`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}},{kind:`Field`,name:{kind:`Name`,value:`airingSchedule`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}},{kind:`Field`,name:{kind:`Name`,value:`duration`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}]},{kind:`Field`,name:{kind:`Name`,value:`sourceMaterial`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}]},{kind:`Field`,name:{kind:`Name`,value:`studios`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}]},{kind:`Field`,name:{kind:`Name`,value:`characters`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`image`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`role`}},{kind:`Field`,name:{kind:`Name`,value:`voiceActors`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`image`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`language`}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`staff`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`image`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`roles`}}]}},{kind:`Field`,name:{kind:`Name`,value:`themes`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`kind`}},{kind:`Field`,name:{kind:`Name`,value:`sequence`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`artists`}},{kind:`Field`,name:{kind:`Name`,value:`video`}}]}},{kind:`Field`,name:{kind:`Name`,value:`ratings`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`source`}},{kind:`Field`,name:{kind:`Name`,value:`value`}},{kind:`Field`,name:{kind:`Name`,value:`scale`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`EpisodeFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Episode`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}}]}}]}}]}}]},Ao={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetMediaOrigins`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`OriginPageInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`originPage`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`nodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`OriginFragment`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`OriginFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Origin`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`icon`}},{kind:`Field`,name:{kind:`Name`,value:`color`}},{kind:`Field`,name:{kind:`Name`,value:`isApiOnly`}}]}}]},jo={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`SearchMediaPage`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaPageInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaShortDescriptionInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`mediaPage`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`nodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`SearchCard`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`SearchCard`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`score`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`color`}}]}},{kind:`Field`,name:{kind:`Name`,value:`banners`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`trailers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`thumbnail`}}]}},{kind:`Field`,name:{kind:`Name`,value:`popularity`}},{kind:`Field`,name:{kind:`Name`,value:`genres`}},{kind:`Field`,name:{kind:`Name`,value:`tags`}},{kind:`Field`,name:{kind:`Name`,value:`averageScore`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`type`}},{kind:`Field`,name:{kind:`Name`,value:`season`}},{kind:`Field`,name:{kind:`Name`,value:`seasonYear`}},{kind:`Field`,name:{kind:`Name`,value:`nextAiringEpisode`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}}]}}]},Mo={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`SceneMedia`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaShortDescriptionInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`media`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`SearchCard`}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`SearchCard`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`score`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`color`}}]}},{kind:`Field`,name:{kind:`Name`,value:`banners`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`trailers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`thumbnail`}}]}},{kind:`Field`,name:{kind:`Name`,value:`popularity`}},{kind:`Field`,name:{kind:`Name`,value:`genres`}},{kind:`Field`,name:{kind:`Name`,value:`tags`}},{kind:`Field`,name:{kind:`Name`,value:`averageScore`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`type`}},{kind:`Field`,name:{kind:`Name`,value:`season`}},{kind:`Field`,name:{kind:`Name`,value:`seasonYear`}},{kind:`Field`,name:{kind:`Name`,value:`nextAiringEpisode`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}}]}}]},No={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetWatchMedia`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`media`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`type`}},{kind:`Field`,name:{kind:`Name`,value:`categories`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`settled`}},{kind:`Field`,name:{kind:`Name`,value:`nextAiringEpisode`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}},{kind:`Field`,name:{kind:`Name`,value:`seasons`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`number`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}}]}},{kind:`Field`,name:{kind:`Name`,value:`relations`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`format`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`releaseDate`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`thumbnails`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`embedUrl`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`releaseDate`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}}]}}]}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`EpisodeFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Episode`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}}]},Po={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetWatchOrigins`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`OriginPageInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`originPage`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`nodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`icon`}},{kind:`Field`,name:{kind:`Name`,value:`color`}},{kind:`Field`,name:{kind:`Name`,value:`isApiOnly`}}]}}]}}]}}]},Fo=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Lo.unregister(this),e}free(){let e=this.__destroy_into_raw();Zo.__wbg_haystacks_free(e,0)}bytesView(){return Zo.haystacks_bytesView(this.__wbg_ptr)}clear(){Zo.haystacks_clear(this.__wbg_ptr)}commit(e,t){let n=Zo.haystacks_commit(this.__wbg_ptr,e,t);if(n[1])throw Jo(n[0])}get length(){return Zo.haystacks_length(this.__wbg_ptr)>>>0}constructor(e){var t=Go(e)?0:Ko(e,Zo.__wbindgen_malloc),n=Xo;let r=Zo.haystacks_new(t,n);return this.__wbg_ptr=r,Lo.register(this,this.__wbg_ptr,this),this}offsetsView(){return Zo.haystacks_offsetsView(this.__wbg_ptr)}push(e){let t=Ko(e,Zo.__wbindgen_malloc),n=Xo;Zo.haystacks_push(this.__wbg_ptr,t,n)}reserve(e,t){Zo.haystacks_reserve(this.__wbg_ptr,e,t)}};Symbol.dispose&&(Fo.prototype[Symbol.dispose]=Fo.prototype.free);var Io=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ro.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ro.unregister(this),e}free(){let e=this.__destroy_into_raw();Zo.__wbg_matcher_free(e,0)}static fromPatterns(t,n){let r=Zo.matcher_fromPatterns(t,Go(n)?0:zo(n));if(r[2])throw Jo(r[1]);return e.__wrap(r[0])}static fromQuery(t,n){let r=qo(t,Zo.__wbindgen_malloc,Zo.__wbindgen_realloc),i=Xo,a=Zo.matcher_fromQuery(r,i,Go(n)?0:zo(n));if(a[2])throw Jo(a[1]);return e.__wrap(a[0])}matchHaystacks(e){return Bo(e,Fo),Zo.matcher_matchHaystacks(this.__wbg_ptr,e.__wbg_ptr)}matchHaystacksIndices(e){return Bo(e,Fo),Zo.matcher_matchHaystacksIndices(this.__wbg_ptr,e.__wbg_ptr)}matchList(e){let t=Ko(e,Zo.__wbindgen_malloc),n=Xo;return Zo.matcher_matchList(this.__wbg_ptr,t,n)}matchListIndices(e){let t=Ko(e,Zo.__wbindgen_malloc),n=Xo;return Zo.matcher_matchListIndices(this.__wbg_ptr,t,n)}matchOne(e,t){let n=qo(e,Zo.__wbindgen_malloc,Zo.__wbindgen_realloc),r=Xo;return Zo.matcher_matchOne(this.__wbg_ptr,n,r,t)}matchOneIndices(e,t){let n=qo(e,Zo.__wbindgen_malloc,Zo.__wbindgen_realloc),r=Xo;return Zo.matcher_matchOneIndices(this.__wbg_ptr,n,r,t)}constructor(e,t){let n=qo(e,Zo.__wbindgen_malloc,Zo.__wbindgen_realloc),r=Xo,i=Zo.matcher_new(n,r,Go(t)?0:zo(t));if(i[2])throw Jo(i[1]);return this.__wbg_ptr=i[0],Ro.register(this,this.__wbg_ptr,this),this}setConfig(e){let t=Zo.matcher_setConfig(this.__wbg_ptr,e);if(t[1])throw Jo(t[0])}setPattern(e){let t=Zo.matcher_setPattern(this.__wbg_ptr,e);if(t[1])throw Jo(t[0])}setPatterns(e){let t=Zo.matcher_setPatterns(this.__wbg_ptr,e);if(t[1])throw Jo(t[0])}};Symbol.dispose&&(Io.prototype[Symbol.dispose]=Io.prototype.free);var Lo=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Zo.__wbg_haystacks_free(e,1)),Ro=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Zo.__wbg_matcher_free(e,1));function zo(e){let t=Zo.__externref_table_alloc();return Zo.__wbindgen_externrefs.set(t,e),t}function Bo(e,t){if(!(e instanceof t))throw Error(`expected instance of ${t.name}`)}var Vo=null;function Ho(){return(Vo===null||Vo.buffer.detached===!0||Vo.buffer.detached===void 0&&Vo.buffer!==Zo.memory.buffer)&&(Vo=new DataView(Zo.memory.buffer)),Vo}var Uo=null;function Wo(){return(Uo===null||Uo.byteLength===0)&&(Uo=new Uint8Array(Zo.memory.buffer)),Uo}function Go(e){return e==null}function Ko(e,t){let n=t(e.length*4,4)>>>0;for(let t=0;t<e.length;t++){let r=zo(e[t]);Ho().setUint32(n+4*t,r,!0)}return Xo=e.length,n}function qo(e,t,n){if(n===void 0){let n=Yo.encode(e),r=t(n.length,1)>>>0;return Wo().subarray(r,r+n.length).set(n),Xo=n.length,r}let r=e.length,i=t(r,1)>>>0,a=Wo(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=Wo().subarray(i+o,i+r),a=Yo.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return Xo=o,i}function Jo(e){let t=Zo.__wbindgen_externrefs.get(e);return Zo.__externref_table_dealloc(e),t}new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode();var Yo=new TextEncoder;`encodeInto`in Yo||(Yo.encodeInto=function(e,t){let n=Yo.encode(e);return t.set(n),{read:e.length,written:n.length}});var Xo=0,Zo,Qo=new TextEncoder;function $o(e,t){let n=0;for(let e of t)n+=e.length*3;e.reserve(n,t.length);let r=e.bytesView(),i=e.offsetsView(),a=0;for(let e=0;e<t.length;e++)a+=Qo.encodeInto(t[e],r.subarray(a)).written,i[e]=a;return e.commit(a,t.length),e}var es=class extends Fo{constructor(e){super(),e?.length&&$o(this,e)}push(e){$o(this,e)}},ts;function ns(e){return ts??=new es,ts.clear(),$o(ts,e)}Io.prototype.matchList=function(e){return this.matchHaystacks(e instanceof Fo?e:ns(e))},Io.prototype.matchListIndices=function(e){return this.matchHaystacksIndices(e instanceof Fo?e:ns(e))};var rs=[`winter`,`spring`,`summer`,`fall`],is=(e=new Date)=>({season:rs[Math.floor(e.getMonth()/3)],year:e.getFullYear()}),as=e=>e.toUpperCase(),os=(e=new Date)=>{let{season:t,year:n}=is(e);return{season:as(t),year:n}},ss=String.raw`(?:\s|<\/?br\s*\/?>)*`,cs=String.raw`(?:\(Source:[^()]*\)|\[Written by MAL Rewrite\]|(?<=[\n>])Source:[^\n<]*)`;RegExp(`${ss}${cs}(?:${ss}$|(?=${ss}<(?:i|em)>))`,`i`);var ls=`\\u002d\\u2013\\u2014\\u007e\\uff5e\\u301c`;RegExp(`(?:^|\\s)([${ls}])\\s*[^${ls}]{2,}\\s*\\1\\s*$`),go.Tv,go.TvShort,go.Movie,go.Ova,go.Ona,go.Special,new Set(lo);var us=`tracking/v1/`,ds=18e4,fs={changed:!0},ps=()=>{let e=0;return{moved:()=>{e+=1},begin:()=>{let t=e,n=()=>e===t;return{call:e=>n()?e():Promise.resolve(fs),current:n}}}},ms=`sources/v1/list.json`,hs=(e,t)=>JSON.stringify(e)===JSON.stringify(t),gs=({cloud:e,onAccountChange:t,lock:n,storage:r,onList:i})=>{let a=ps(),o=io(r),s=new Set,c=async()=>{let{call:t,current:n}=a.begin(),c=io(r),l=await e.availability();if(l===`unknown`)return;let u;if(l===`connected`){if(!await e.unlocked())return;let n=await t(()=>e.read(ms));if(!(`ok`in n)&&!(`missing`in n))return;let i=`ok`in n?no(n.ok):[],a=[...s],o=[...new Set([...i,...ao(r)])].filter(e=>!a.includes(e));if(!hs(o,i)&&!(`ok`in await t(()=>e.write(`sources/v1/list.json`,JSON.stringify(o)))))return;for(let e of a)s.delete(e);u=o}if(!hs(io(r),c)||(u&&oo(ao(r).filter(e=>!u.includes(e)),r),!n()))return;co(u,r);let d=io(r);if(hs(d,o))return;let f=o;o=d,i(f,d)},l=e=>n(e).catch(e=>console.warn(`sources: account list`,e));return t(()=>{a.moved(),l(c)}),{check:()=>l(c),add:e=>(s.delete(e),oo([...new Set([...ao(r),e])],r),o=[...new Set([...o,e])],l(c)),remove:e=>{oo(ao(r).filter(t=>t!==e),r);let t=so(r);return t&&(co(t.filter(t=>t!==e),r),s.add(e)),o=o.filter(t=>t!==e),l(c)}}},_s=`FKN_E2E_LOCKED`,vs=`FKN_STORAGE_NOT_FOUND`,ys=`FKN_ACCOUNT_CHANGED`,bs=`fkn:account-changed`,xs=`FKN_ACCOUNT_PIN_UNSUPPORTED`,Ss=`FKN has to update before this list can reach your FKN account`,Cs=e=>{let t=e?.code,n=e instanceof Error?e.message:String(e);return t===_s?{locked:!0}:t===vs?{missing:!0}:t===ys||n.startsWith(bs)?{changed:!0}:t===xs?{error:Ss}:{error:n}},ws=((e,{timeoutMs:t=8e3}={})=>{let n=(e,n)=>new Promise(r=>{let i=setTimeout(()=>r(n),t);new Promise(t=>t(e())).then(e=>{clearTimeout(i),r(e)},()=>{clearTimeout(i),r(n)})}),r=e=>new Promise(n=>{let r=setTimeout(()=>n({error:`FKN storage did not answer`}),t);new Promise(t=>t(e())).then(e=>{clearTimeout(r),n({ok:e})},e=>{clearTimeout(r),n(Cs(e))})});return{availability:()=>n(()=>e.availability(),`unknown`),unlocked:()=>n(async()=>(await e.encryption()).unlocked===!0,!1),list:()=>r(async()=>(await e.list()).filter(e=>e.path.startsWith(us)).map(({path:e,updatedAt:t})=>({path:e,updatedAt:t}))),read:t=>r(async()=>{let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)}),write:(t,n)=>r(async()=>(await e.writeFile(t,n),!0))}})({availability:_e,list:O,encryption:j,readFile:e=>I.readFile(e,{encoding:`utf8`}),writeFile:(e,t)=>I.writeFile(e,t)}),Ts=F,Es=()=>M().catch(()=>!1),Ds=3e3,Os=new Map,ks=new Set,As=()=>ks.forEach(e=>{try{e()}catch{}}),js=e=>(ks.add(e),()=>{ks.delete(e)}),Ms=()=>io().map(e=>Os.get(e)??{uri:e,state:`connecting`}),Ns=()=>io(),Ps=(e,t)=>{Os.set(e,{uri:e,...t}),As()},Fs=45e3,Is=(e,t)=>Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(Error(t)),Fs))]),Ls=new Set,Rs=new Map,zs=3e4,Bs=(e,t)=>{if(!io().includes(e)||Ls.has(e)||Rs.has(e))return;Os.get(e)?.state!==`error`&&Ps(e,{state:`connecting`});let n=Math.min(Ds*t,zs),r=setTimeout(()=>{Rs.delete(e),Vs(e,t+1).catch(()=>{})},n);Rs.set(e,r)},Vs=async(e,t=1)=>{if(!Ls.has(e)){Ls.add(e),Ps(e,{state:`connecting`});try{let{port:t,closed:n}=await Is(E.connect(e,{protocol:Qa,raw:!0}),`connecting to '${e}' timed out`);n.then(()=>{Ls.delete(e),Rt(e),Bs(e,1)});let r=await Is(Promise.race([Gt(t,e),n.then(()=>({error:`the plugin closed while connecting`}))]),`'${e}' did not finish connecting`);if(`error`in r)throw Error(r.error);Ps(e,{state:`connected`,sources:r.ok.sources,rejected:r.ok.rejected})}catch(n){throw Ls.delete(e),console.warn(`Plugin '${e}' failed to connect:`,n),Ps(e,{state:`error`}),Bs(e,t+1),n}}},Hs=e=>{let t=Rs.get(e);t!==void 0&&(clearTimeout(t),Rs.delete(e))},Us=e=>{Hs(e),Ls.delete(e),Os.delete(e),Rt(e)},Ws=gs({cloud:ws,onAccountChange:Ts,lock:e=>typeof navigator<`u`&&navigator.locks?navigator.locks.request(`stub:source-list`,e):e(),onList:(e,t)=>{for(let n of e)t.includes(n)||(Us(n),E.uninstall(n).catch(()=>{}));As();for(let n of t)e.includes(n)||E.install(n,{noConfirm:!0}).then(e=>{if(!e)throw Error(`FKN did not install '${n}'`);Vs(n).catch(()=>{})}).catch(e=>{console.warn(`Plugin '${n}' could not be installed:`,e),Ps(n,{state:`error`})})}}),Gs=()=>Ws.check(),Ks=async(e,t)=>{let n=await E.install(e,t);return n?(Ws.add(n.uri),n.uri):null},qs=async e=>{let t=await Ks(e);return t&&Vs(t).catch(()=>{}),t},Js=async(e,t)=>{let n=await Ks(e,t);return n&&await Vs(n),n},Ys=async e=>{Ws.remove(e),Us(e),As(),await E.uninstall(e).catch(()=>{})},Xs=async()=>{let e=await E.pick({type:`plugin`,id:`stub`},{multiple:!0,title:`Add stub sources`});for(let t of e)await Js(t.uri).catch(()=>{})};for(let e of io())Vs(e).catch(()=>{});var Zs=`stub.sources.hidden-icons`,Qs=()=>{try{let e=JSON.parse(oe.getItem(`stub.sources.hidden-icons`)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}},$s=(e,t)=>{let n=new Set(Qs());t?n.delete(e):n.add(e);try{n.size?oe.setItem(Zs,JSON.stringify([...n])):oe.removeItem(Zs)}catch{}},ec=e=>oe.watch(Zs,e),tc=()=>{let[e,t]=W(()=>new Set(Qs()));return V(()=>ec(()=>t(new Set(Qs()))),[]),e},nc=`stub.sources.play-order`,rc=[`cr`,`amazon`,`nf`],ic=()=>{try{let e=JSON.parse(oe.getItem(`stub.sources.play-order`)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}},ac=e=>{try{oe.setItem(nc,JSON.stringify(e))}catch{}},oc=e=>oe.watch(nc,e),sc=(e,t)=>[...new Set([...e,...rc,...t])],cc=(e,t,n,r=e)=>{let i=r[r.indexOf(t)+n];if(!i||!r.includes(t))return[...e];let a=e.filter(e=>e!==t);return a.splice(a.indexOf(i)+ +(n>0),0,t),a},lc=`stub.tracking.compact`,uc={targets:{}},dc=e=>{try{let t=JSON.parse(e??`null`);return{targets:Object.fromEntries(Object.entries(t?.targets??{}).filter(([,e])=>typeof e==`boolean`))}}catch{return uc}},fc=((e=oe)=>{let t;return{read:()=>{if(t)return t;try{return dc(e?.getItem(lc))}catch{return uc}},write:n=>{try{if(!e)throw Error(`No storage`);e.setItem(lc,JSON.stringify(n)),t=void 0}catch{t=n}}}})(),pc=e=>oe.watch(lc,e),mc=`stub.player.autoplay`,hc=()=>oe.getItem(mc)!==`off`,gc=e=>{try{e?oe.removeItem(mc):oe.setItem(mc,`off`)}catch{}},_c=e=>oe.watch(mc,e),vc=e=>Math.max(1,e),yc={POINT_100:{step:1,native:e=>Math.round(e),raw:e=>e},POINT_10_DECIMAL:{step:1,native:e=>Math.round(e)/10,raw:e=>Math.round(e*10)},POINT_10:{step:10,native:e=>vc(Math.floor(e/10)),raw:e=>e*10},POINT_5:{step:20,native:e=>vc(Math.round(e/20)),raw:e=>e*20},POINT_3:{step:33,native:e=>e<36?1:e<61?2:3,raw:e=>[30,50,85][e-1]??85}},bc=e=>yc[e??``]??yc.POINT_100,xc=e=>e!=null&&e>0,Sc=(e,t)=>bc(t).native(e),Cc=(e,t)=>{let{native:n,raw:r}=bc(t);return r(n(e))},wc=(e,t)=>bc(t).step>bc(e).step?t:e,Tc={WATCHING:`Watching`,REWATCHING:`Rewatching`,PLANNING:`Plan to watch`,COMPLETED:`Completed`,PAUSED:`Paused`,DROPPED:`Dropped`},Ec=new Set([`LISTED`,`NOT_LISTED`]),Dc=e=>e.tracker.canWrite&&Ec.has(e.state),Oc=e=>e.error||(e.state===`PAUSED`?`Paused for a while`:`Could not answer`),kc=(e,t)=>{let n=e?.summary;return{status:n?.status??null,progress:n?.progress??0,score:xc(n?.score)?n.score:null,total:n?.episodeCount??t??null,differs:[...e?.disagreements??[]]}},Ac=e=>e.entry?.episodeCount??e.episodeCount,jc=(e,t)=>({status:e.entry?.status??null,progress:e.entry?.progress??0,score:xc(e.entry?.score)?e.entry.score:null,total:Ac(e)??t,differs:[]}),Mc=(e,t={})=>({...e,...t.status===void 0?{}:{status:t.status},...t.progress===void 0?{}:{progress:t.progress},...t.score===void 0?{}:{score:t.score}}),Nc=(e,t)=>{let n={...e};return n.status===t.status&&delete n.status,n.progress===t.progress&&delete n.progress,n.score!==void 0&&(n.score??null)===t.score&&delete n.score,n},Pc=(e,t)=>{switch(e.state){case`LOADING`:return{kind:`loading`};case`SIGNED_OUT`:return{kind:`login`};case`AMBIGUOUS`:return{kind:`cannot`,reason:`Names ${e.candidates.join(` and `)}, cannot tell which`}}let n=t??!0;return{kind:`check`,checked:n,sendable:n&&Dc(e)}},Fc=(e,t)=>{let n=Ac(e);return n!=null&&t!=null&&n!==t},Ic=e=>e.state===`LISTED`&&(!e.tracker.statuses||!!e.entry?.status),Lc=(e,t,n)=>{if(t.remove)return Ic(e)?{remove:!0}:void 0;let{statuses:r}=e.tracker,i=`score`in t?t.score:n.score,a=e.state===`LISTED`||r?{...t}:{status:t.status??n.status??`WATCHING`,progress:t.progress??n.progress,...xc(i)?{score:i}:{}};return a.status!==void 0&&r&&!r.includes(a.status)&&delete a.status,a.progress!==void 0&&(Fc(e,n.total)?delete a.progress:a.progress=Math.max(0,Math.min(n.total??1/0,a.progress))),Object.keys(a).length?a:void 0},Rc=(e,t)=>!!e?.answers.find(e=>e.tracker.id===t)?.tracker.statuses,zc={POINT_3:[30,50,85],POINT_5:[20,40,60,80,100],POINT_10:[10,20,30,40,50,60,70,80,90,100],POINT_10_DECIMAL:[10,20,30,40,50,60,70,80,90,100],POINT_100:[10,20,30,40,50,60,70,80,90,100]},Bc=e=>{if(!e.length)return;let t=e.map(e=>e&&zc[e]?e:`POINT_100`);return{scale:t.reduce((e,t)=>wc(e,t)??`POINT_100`,`POINT_100`),mixed:new Set(t).size>1}},Vc=(e,t)=>Cc(e,t),Hc=(e,t)=>t?e?.remove||t.remove?t:{...e,...t}:e??{},Uc=({send:e,onChange:t=()=>{},shape:n=(e,t)=>t,steps:r=()=>!1,delay:i=1e3,timers:a={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)}})=>{let o=new Map,s=new Map,c=new Set,l=new Map,u=new Map,d=new Map,f,p=(e,...t)=>t.reduce((t,n)=>{let i=t.at(-1);return n?r(e)&&i?.progress!==void 0&&n.progress!==void 0&&n.progress>i.progress?[...t,n]:[...t.slice(0,-1),Hc(i,n)]:t},[]),m=e=>{let t=u.get(e);return t?.unsent?t.saves.map(t=>n(e,t)):t?.saves??[]},h=n=>{let[i,...a]=o.get(n)??[];if(!i||!c.has(n)||l.has(n))return;a.length?o.set(n,a):(o.delete(n),s.delete(n),c.delete(n)),l.set(n,i);let f=(e,a)=>{if(l.delete(n),e===`SAVED`||e===`QUEUED`)u.delete(n);else if(e===`REFUSED`)d.set(n,a??`Refused`);else{let e=r(n)?o.get(n)??[]:[];e.length&&o.delete(n),u.set(n,{saves:[i,...e],error:a??`Did not save`});let t=o.get(n);t&&o.set(n,p(n,i,...t))}t({tracker:n,outcome:e,fields:i,error:a}),h(n)};e(n,i).then(({outcome:e,error:t})=>f(e,t),e=>f(`FAILED`,e instanceof Error?e.message:String(e))),t()},g=()=>{f!==void 0&&a.clear(f),f=void 0;for(let e of o.keys())c.add(e);for(let e of[...c])h(e)};return{stage:(e,n,r=!1)=>{for(let[t,n]of Object.entries(e)){let e=m(t);u.delete(t),d.delete(t),o.set(t,p(t,...e,...o.get(t)??[],n)),r&&s.set(t,p(t,...s.get(t)??[],n))}n?g():(f!==void 0&&a.clear(f),f=a.set(g,i),t())},flush:g,fail:(e,n,r)=>{u.set(e,{saves:p(e,...u.get(e)?.saves??[],n),error:r,unsent:!0}),t({tracker:e,outcome:`FAILED`,fields:n,error:r})},retry:e=>{if(!u.has(e))return;let n=p(e,...m(e),...o.get(e)??[]);u.delete(e),n.length&&(o.set(e,n),c.add(e),h(e)),t()},drop:e=>{let n=s.get(e);n?o.set(e,n):(o.delete(e),c.delete(e)),u.delete(e),d.delete(e),t()},dismiss:e=>{d.delete(e),t()},state:e=>{let t=u.get(e);return{busy:l.has(e)||o.has(e),failed:t&&{fields:t.saves[0],error:t.error},refused:d.get(e)}},idle:()=>!l.size&&!o.size}},Wc=({played:e,episode:t,movie:n},r)=>{if(!(e<.85||r.status===`COMPLETED`)){if(n)return{status:`COMPLETED`,progress:1};if(!(t==null||!Number.isInteger(t)||t<=r.progress||r.total!=null&&t>r.total))return t===r.total?{progress:t,status:`COMPLETED`}:{progress:t,...r.status===`WATCHING`||r.status===`REWATCHING`?{}:{status:`WATCHING`}}}},Gc=(e,t,n,r)=>{let i=kc(t,r);if(i.status===`COMPLETED`)return{};let a={};for(let r of t.answers){if(r.state===`NO_ID`)continue;let t=Pc(r,n[r.tracker.id]);if(t.kind!==`check`||!t.checked||Fc(r,i.total))continue;let o=Wc(e,jc(r,i.total));o&&(a[r.tracker.id]=o)}return a};K();var Kc=`stub.player.positions`,qc=`stub.player.positions.account`,Jc=e=>e.length===2?e[1]:e[3],Yc=e=>{if(!Array.isArray(e)||typeof e[0]!=`string`||!e.slice(1).every(e=>typeof e==`number`))return[];let[t,...n]=e;return n.length===1?[[t,n[0]]]:n.length===2||n.length===3?[[t,n[0],n[1],n[2]??0]]:[]},Xc=e=>{try{let t=JSON.parse(e??`[]`);return Array.isArray(t)?t.flatMap(Yc):[]}catch{return[]}},Zc=(e,t)=>{let n=new Map;for(let r of[...Xc(e),...Xc(t)]){let e=n.get(r[0]);e&&Jc(e)>Jc(r)||(n.delete(r[0]),n.set(r[0],r))}let r=[...n.values()].sort((e,t)=>Jc(e)-Jc(t)),i=new Set([...r.filter(e=>e.length===4).slice(-200),...r.filter(e=>e.length===2).slice(-200)]);return JSON.stringify(r.filter(e=>i.has(e)))},Qc=(e=>fe(e,{accountKey:qc,merge:Zc}))(),$c=()=>Xc(Qc.getItem(Kc)),el=(e,t=$c())=>{let n=t.findLast(([t])=>e.includes(t));return n?.length===4?n:void 0},tl=()=>{let[e,t]=W($c);return V(()=>Qc.watch(Kc,()=>t($c())),[]),e},nl=(e,{time:t,duration:n,ended:r=!1})=>{let i=r||n!==void 0&&n>0&&t/n>=.85;if(!i&&(t<30||n===0)||i&&$c().find(([t])=>t===e)?.length===2)return;let a=i?[e,Date.now()]:[e,t,n??0,Date.now()];try{Qc.setItem(Kc,JSON.stringify([a]))}catch{}},rl=[{value:`grid`,label:`Covers`},{value:`card`,label:`Cards`},{value:`list`,label:`List`}],il=`grid`,al=`stub-search-display-mode`,ol=rl.map(e=>e.value),sl=e=>ol.includes(e)?e:il,cl=(e=oe)=>{try{return sl(e?.getItem(al))}catch{return il}},ll=(e,t=oe)=>{try{t?.setItem(al,e)}catch{}},ul=`settings/v1/settings.json`,dl=`positions/v1/positions.json`,fl=3e4,pl=[Lt,Zs],ml=[...pl,me,mc,al,lc,nc],hl=(e,t)=>JSON.stringify(e)===JSON.stringify(t),gl=e=>{try{return no(e??`[]`)}catch{return[]}},_l=(e,t)=>JSON.stringify([...new Set([...gl(e),...gl(t)])]),vl=({settings:e,cloud:t,onAccountChange:n,lock:r,path:i=ul,keys:a=ml,paceMs:o})=>{let{raw:s,write:c,edits:l,tell:u,onEdit:d,accountKey:f,merge:p}=e.internal,m=ps(),h=(e,t)=>{let n={...e};for(let[e,r]of t)n[e]=p?p(n[e]??null,r):r;return n},g=async()=>{let{call:n,current:r}=m.begin(),o=new Map(a.map(t=>[t,e.getItem(t)])),d=s(f),g=await t.availability();if(g===`unknown`)return;let _;if(g===`connected`){if(!await t.unlocked())return;let e=await n(()=>t.read(i));if(!(`ok`in e)&&!(`missing`in e))return;let r=`ok`in e?xe(e.ok):{};if(p)for(let[e,t]of l)p(r[e]??null,t)===r[e]&&l.delete(e);let o=new Map(a.map(e=>[e,s(e)])),u=new Map(l);_={...r};for(let[e,t]of o)t!==null&&(_[e]=p?p(r[e]??null,t):pl.includes(e)?_l(r[e],t):e in r?r[e]??null:t);if(_=h(_,[...u].filter(([e])=>a.includes(e))),!hl(_,r)&&!(`ok`in await n(()=>t.write(i,JSON.stringify(_)))))return;if(!p)for(let[e,t]of u)l.get(e)===t&&l.delete(e);try{for(let[e,t]of o)s(e)===t&&c(e,null)}catch{}}else l.clear();if(r()&&s(f)===d){try{c(f,_?JSON.stringify(h(_,l)):null)}catch{}for(let t of a)e.getItem(t)!==o.get(t)&&u(t)}},_=0,v=0,y=!1,b=Promise.resolve(),x=()=>y?b:(y=!0,b=r(()=>{y=!1;let e=_;return g().finally(()=>{v=Math.max(v,e)})}).catch(e=>console.warn(`settings: account file`,e))),S,C=-1/0,w=()=>(clearTimeout(S),S=void 0,C=Date.now(),x());return d(e=>{e||(_+=1),e?l.size&&w():o===void 0?x():S??=setTimeout(w,Math.max(0,C+o-Date.now()))}),n(e=>{m.moved(),e?.switched!==!1&&l.clear(),x()}),{check:x,unsaved:()=>v<_}},yl=e=>vl({...e,path:dl,keys:[Kc],paceMs:fl}),bl=({check:e,focused:t,page:n=globalThis,document:r=globalThis.document,intervalMs:i=6e4})=>{let a=e=>()=>{e().catch(e=>console.warn(`tracking: account link`,e))},o=()=>r?.visibilityState!==`hidden`,s=a(e),c=a(t);s(),n.addEventListener(`online`,s),n.addEventListener(`focus`,c),r?.addEventListener(`visibilitychange`,()=>{o()&&c()});let l=setInterval(()=>{o()&&c()},i);return()=>clearInterval(l)},xl=e=>t=>typeof navigator<`u`&&navigator.locks?navigator.locks.request(e,t):t(),Sl=vl({settings:oe,cloud:ws,onAccountChange:Ts,lock:xl(`stub:settings`)}),Cl=yl({settings:Qc,cloud:ws,onAccountChange:Ts,lock:xl(`stub:positions`)});zr(()=>Sl.unsaved()||Cl.unsaved());var wl=Sl.check,Tl=Cl.check,El=(e,t={})=>{let n=()=>Promise.all([e(),wl(),Tl()]);return bl({check:n,focused:n,intervalMs:ds,...t})};function Dl(e){var t=e.forward;return function(e){return Yi(e,t)}}var Ol=function(){return typeof navigator>`u`||navigator==null||navigator.product,Dl}(),kl=(e,t)=>{for(var n=0|(t||5381),r=0,i=0|e.length;r<i;r++)n=(n<<5)+n+e.charCodeAt(r);return n},Al=new Set,jl=new WeakMap,Ml=(e,t)=>{if(e===null||Al.has(e))return`null`;if(typeof e!=`object`)return JSON.stringify(e)||``;if(e.toJSON)return Ml(e.toJSON(),t);if(Array.isArray(e)){for(var n=`[`,r=0,i=e.length;r<i;r++)n.length>1&&(n+=`,`),n+=Ml(e[r],t)||`null`;return n+=`]`}if(!t&&(Fl!==Pl&&e instanceof Fl||Il!==Pl&&e instanceof Il))return`null`;var a=Object.keys(e).sort();if(!a.length&&e.constructor&&Object.getPrototypeOf(e).constructor!==Object.prototype.constructor){var o=jl.get(e)||Math.random().toString(36).slice(2);return jl.set(e,o),Ml({__key:o},t)}Al.add(e);for(var s=`{`,c=0,l=a.length;c<l;c++){var u=Ml(e[a[c]],t);u&&(s.length>1&&(s+=`,`),s+=Ml(a[c],t)+`:`+u)}return Al.delete(e),s+=`}`},Nl=(e,t)=>(Al.clear(),Ml(e,t||!1)),Pl=class{},Fl=typeof File<`u`?File:Pl,Il=typeof Blob<`u`?Blob:Pl,Ll=/("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g,Rl=/(?:#[^\n\r]+)?(?:[\r\n]+|$)/g,zl=(e,t)=>t%2==0?e.replace(Rl,`
19
+ `)){var r=n.match(Oa);if(r){var i=r[1];try{yield t=JSON.parse(i)}catch(e){if(!t)throw e}if(t&&!1===t.hasNext)break}}t&&!1!==t.hasNext&&(yield{hasNext:!1})}(a):/text\//i.test(o)?async function*(e){var t=await e.text();try{yield JSON.parse(t)}catch{throw Error(t)}}(a):async function*(e){yield JSON.parse(await e.text())}(a),c;for await(var l of s)l.pending&&!i?c=l.pending:l.pending&&(c=[...c,...l.pending]),i=i?ba(i,l,a,c):va(e,l,a),r=!1,yield i,r=!0;i||(yield i=va(e,{},a))}catch(t){if(!r)throw t;yield xa(e,a&&(a.status<200||a.status>=300)&&a.statusText?Error(a.statusText):t,a)}}function Ma(e,t,n){var r;return typeof AbortController<`u`&&(n.signal=(r=new AbortController).signal),ki((()=>{r&&r.abort()}))(wi((e=>!!e))(Ri(ja(e,t,n))))}function Na(e){var t=t=>e(t);return t.toPromise=()=>Ji(Pi(1)(wi((e=>!e.stale&&!e.hasNext))(t))),t.then=(e,n)=>t.toPromise().then(e,n),t.subscribe=e=>Ki(e)(t),t}function Pa(e,t,n){return{...t,kind:e,context:t.context?{...t.context,...n}:n||t.context}}var Fa=()=>{},Ia=({forward:e,dispatchDebug:t})=>t=>Oi([Ei((e=>{var n=Sa(e),r=Ca(e,n),i=Ea(e,n);return Fi(wi((t=>t.kind===`teardown`&&t.key===e.key))(t))(Ma(e,r,i))}))(wi((e=>e.kind!==`teardown`&&(e.kind!==`subscription`||!!e.context.fetchSubscriptions)))(t)),e(wi((e=>e.kind===`teardown`||e.kind===`subscription`&&!e.context.fetchSubscriptions))(t))]),La=e=>({client:t,forward:n,dispatchDebug:r})=>e.reduceRight(((e,n)=>n({client:t,forward(t){return Mi(e(Mi(t)))},dispatchDebug(e){}})),n),Ra=({onOperation:e,onResult:t,onError:n})=>({forward:r})=>i=>Ei((e=>{n&&e.error&&n(e.error,e.operation);var r=t&&t(e)||e;return`then`in r?Gi(r):Vi(r)}))(r(Ei((t=>{var n=e&&e(t)||t;return`then`in n?Gi(n):Vi(n)}))(i))),za=({dispatchDebug:e})=>e=>wi((e=>!1))(e),Ba=function e(t){var n=0,r=new Map,i=new Map,a=new Set,o=[],s={url:t.url,fetchSubscriptions:t.fetchSubscriptions,fetchOptions:t.fetchOptions,fetch:t.fetch,preferGetMethod:t.preferGetMethod,requestPolicy:t.requestPolicy||`cache-first`},c=Ui();function l(e){e.kind!==`mutation`&&e.kind!==`teardown`&&a.has(e.key)||(e.kind===`teardown`?a.delete(e.key):e.kind!==`mutation`&&a.add(e.key),c.next(e))}var u=!1;function d(e){if(e&&l(e),!u){for(u=!0;u&&(e=o.shift());)l(e);u=!1}}var f=e=>{var t=Fi(wi((t=>t.kind===`teardown`&&t.key===e.key))(c.source))(wi((t=>t.operation.kind===e.kind&&t.operation.key===e.key&&(!t.operation.context._instance||t.operation.context._instance===e.context._instance)))(g));return t=e.kind===`query`?Ni((t=>{var n=Vi(t);return t.stale||t.hasNext?n:Oi([n,Ti((()=>(t.stale=!0,t)))(Pi(1)(wi((t=>t.key===e.key))(c.source)))])}))(t):Ii((e=>!!e.hasNext),!0)(t),t=e.kind===`mutation`?ji((()=>{l(e)}))(t):ki((()=>{a.delete(e.key),r.delete(e.key),i.delete(e.key),u=!1;for(var t=o.length-1;t>=0;t--)o[t].key===e.key&&o.splice(t,1);l(Pa(`teardown`,e,e.context))}))(Ai((t=>{if(t.stale){if(!t.hasNext)a.delete(e.key);else for(var n=0;n<o.length;n++){var i=o[n];if(i.key===t.operation.key){a.delete(i.key);break}}}else t.hasNext||a.delete(e.key);r.set(e.key,t)}))(t)),Mi(t)},p=this instanceof e?this:Object.create(e.prototype),m=Object.assign(p,{suspense:!!t.suspense,operations$:c.source,reexecuteOperation(e){if(e.kind===`teardown`)d(e);else if(e.kind===`mutation`)o.push(e),Promise.resolve().then(d);else if(i.has(e.key)){for(var t=!1,n=0;n<o.length;n++)o[n].key===e.key&&(o[n]=e,t=!0);t||a.has(e.key)&&e.context.requestPolicy!==`network-only`?(a.delete(e.key),Promise.resolve().then(d)):(o.push(e),Promise.resolve().then(d))}},createRequestOperation(e,t,r){return r||={},Pa(e,t,{_instance:e===`mutation`?n=n+1|0:void 0,...s,...r,requestPolicy:r.requestPolicy||s.requestPolicy,suspense:r.suspense||!1!==r.suspense&&m.suspense})},executeRequestOperation(e){return e.kind===`mutation`?Na(f(e)):Na(Li((()=>{var t=i.get(e.key);t||i.set(e.key,t=f(e)),t=ji((()=>{d(e)}))(t);var n=r.get(e.key);return e.kind===`query`&&n&&(n.stale||n.hasNext)?Ni(Vi)(Oi([t,wi((t=>t===r.get(e.key)))(Vi(n))])):t})))},executeQuery(e,t){var n=m.createRequestOperation(`query`,e,t);return m.executeRequestOperation(n)},executeSubscription(e,t){var n=m.createRequestOperation(`subscription`,e,t);return m.executeRequestOperation(n)},executeMutation(e,t){var n=m.createRequestOperation(`mutation`,e,t);return m.executeRequestOperation(n)},readQuery(e,t,n){var r=null;return Ki((e=>{r=e}))(m.query(e,t,n)).unsubscribe(),r},query:(e,t,n)=>m.executeQuery(ga(e,t),n),subscription:(e,t,n)=>m.executeSubscription(ga(e,t),n),mutation:(e,t,n)=>m.executeMutation(ga(e,t),n)}),h=Fa,g=Mi(La(t.exchanges)({client:m,dispatchDebug:h,forward:za({dispatchDebug:h})})(c.source));return qi(g),m};Je();var Va=nt({}),Ha=Va.Provider;Va.Consumer,Va.displayName=`UrqlContext`;var Ua=()=>Ze(Va),Wa={fetching:!1,stale:!1,hasNext:!1,error:void 0,data:void 0,extensions:void 0,operation:void 0},Ga=(e,t)=>e===t||!(!e||!t||e.key!==t.key),Ka=(e,t)=>{var n={...e,...t,data:t.data!==void 0||t.error?t.data:e.data,fetching:!!t.fetching,stale:!!t.stale};return((e,t)=>{for(var n in e)if(!(n in t))return!0;for(var r in t)if(r===`operation`?!Ga(e[r],t[r]):e[r]!==t[r])return!0;return!1})(e,n)?n:e},qa=(e,t)=>{for(var n=0,r=t.length;n<r;n++)if(e[n]!==t[n])return!0;return!1};function Ja(e,t){e(t)}function Ya(e){var t=q(!0),n=Ua(),[r,i]=W(Wa),a=B(((r,a)=>(Ja(i,{...Wa,fetching:!0}),Ji(Pi(1)(wi((e=>!e.hasNext))(Ai((e=>{t.current&&Ja(i,{fetching:!1,stale:e.stale,data:e.data,error:e.error,extensions:e.extensions,operation:e.operation,hasNext:e.hasNext})}))(n.executeMutation(ga(e,r),a||{}))))))),[n,e,i]);return V((()=>(t.current=!0,()=>{t.current=!1})),[]),[r,a]}function Xa(e,t){var n=q(void 0);return H((()=>{var r=ga(e,t);return n.current!==void 0&&n.current.key===r.key?n.current:(n.current=r,r)}),[e,t])}function Za(e,t){var n=Ua(),r=Xa(e.query,e.variables),i=q(t);i.current=t;var a=H((()=>e.pause?null:n.executeSubscription(r,e.context)),[n,r,e.pause,e.context]),o=[n,r,e.context,e.pause],[s,c]=W((()=>[a,{...Wa,fetching:!!a},o])),l=s[1];a!==s[0]&&qa(s[2],o)&&c([a,l=Ka(s[1],{fetching:!!a}),o]),V((()=>{var e=e=>{Ja(c,(t=>{var n=Ka(t[1],e);return t[1]===n?t:(i.current&&n.data!=null&&t[1].data!==n.data&&(n.data=i.current(t[1].data,n.data)),[t[0],n,t[2]])}))};if(s[0])return Ki(e)(ki((()=>{e({fetching:!!a})}))(s[0])).unsubscribe;e({fetching:!1})}),[s[0]]);var u=B((t=>{var i=n.executeSubscription(r,{...e.context,...t});Ja(c,(e=>[i,e[1],o]))}),[n,r,e.context,e.pause]);return[l,u]}K();var Qa=`stub-source@1`,$a=`stub-enabled-plugins`,eo=`stub-account-plugins`,to=()=>{try{return globalThis.localStorage}catch{return}},no=e=>{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]},ro=(e,t)=>{try{let n=t?.getItem(e);return n==null?void 0:no(n)}catch{return[]}},io=(e=to())=>[...new Set([...so(e)??[],...ao(e)])],ao=(e=to())=>ro(`stub-enabled-plugins`,e)??[],oo=(e,t=to())=>{try{t?.setItem($a,JSON.stringify(e))}catch{}},so=(e=to())=>ro(eo,e),co=(e,t=to())=>{try{e?t?.setItem(eo,JSON.stringify(e)):t?.removeItem(eo)}catch{}},lo=[`mal`,`anilist`,`kitsu`,`anidb`],uo=function(e){return e.Anime=`ANIME`,e.Movie=`MOVIE`,e.Series=`SERIES`,e}({}),fo=function(e){return e.Html=`HTML`,e.Text=`TEXT`,e}({}),po=function(e){return e.Fall=`FALL`,e.Spring=`SPRING`,e.Summer=`SUMMER`,e.Winter=`WINTER`,e}({}),mo=function(e){return e.Popularity=`POPULARITY`,e.PopularityDesc=`POPULARITY_DESC`,e}({}),ho=function(e){return e.Cancelled=`CANCELLED`,e.Finished=`FINISHED`,e.Hiatus=`HIATUS`,e.NotYetReleased=`NOT_YET_RELEASED`,e.Releasing=`RELEASING`,e}({}),go=function(e){return e.Anime=`ANIME`,e.LiveAction=`LIVE_ACTION`,e.Movie=`MOVIE`,e.Ona=`ONA`,e.Ova=`OVA`,e.Special=`SPECIAL`,e.Tv=`TV`,e.TvShort=`TV_SHORT`,e}({}),_o=function(e){return e.IsApiOnly=`IS_API_ONLY`,e.IsNotApiOnly=`IS_NOT_API_ONLY`,e}({}),vo=function(e){return e.Ambiguous=`AMBIGUOUS`,e.Error=`ERROR`,e.Listed=`LISTED`,e.Loading=`LOADING`,e.NotListed=`NOT_LISTED`,e.NoId=`NO_ID`,e.Paused=`PAUSED`,e.SignedOut=`SIGNED_OUT`,e}({}),yo={kind:`Document`,definitions:[{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}}]},bo={kind:`Document`,definitions:[{kind:`FragmentDefinition`,name:{kind:`Name`,value:`SearchCard`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`score`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`color`}}]}},{kind:`Field`,name:{kind:`Name`,value:`banners`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`trailers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`thumbnail`}}]}},{kind:`Field`,name:{kind:`Name`,value:`popularity`}},{kind:`Field`,name:{kind:`Name`,value:`genres`}},{kind:`Field`,name:{kind:`Name`,value:`tags`}},{kind:`Field`,name:{kind:`Name`,value:`averageScore`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`type`}},{kind:`Field`,name:{kind:`Name`,value:`season`}},{kind:`Field`,name:{kind:`Name`,value:`seasonYear`}},{kind:`Field`,name:{kind:`Name`,value:`nextAiringEpisode`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}}]},xo={kind:`Document`,definitions:[{kind:`FragmentDefinition`,name:{kind:`Name`,value:`EpisodeFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Episode`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}}]}}]}}]}}]},So={kind:`Document`,definitions:[{kind:`FragmentDefinition`,name:{kind:`Name`,value:`OriginFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Origin`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`icon`}},{kind:`Field`,name:{kind:`Name`,value:`color`}},{kind:`Field`,name:{kind:`Name`,value:`isApiOnly`}}]}}]},Co={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`MediaTracking`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`TrackingInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`tracking`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`disagreements`}},{kind:`Field`,name:{kind:`Name`,value:`summary`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`progress`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}}]}},{kind:`Field`,name:{kind:`Name`,value:`answers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`state`}},{kind:`Field`,name:{kind:`Name`,value:`candidates`}},{kind:`Field`,name:{kind:`Name`,value:`error`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`tracker`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`icon`}},{kind:`Field`,name:{kind:`Name`,value:`color`}},{kind:`Field`,name:{kind:`Name`,value:`canWrite`}},{kind:`Field`,name:{kind:`Name`,value:`statuses`}},{kind:`Field`,name:{kind:`Name`,value:`account`}},{kind:`Field`,name:{kind:`Name`,value:`scoreScale`}},{kind:`Field`,name:{kind:`Name`,value:`canClearScore`}}]}},{kind:`Field`,name:{kind:`Name`,value:`entry`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`progress`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}}]}}]}}]}}]}}]},wo={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`mutation`,name:{kind:`Name`,value:`SaveListEntry`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`SaveListEntryInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`saveListEntry`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`tracker`}},{kind:`Field`,name:{kind:`Name`,value:`outcome`}},{kind:`Field`,name:{kind:`Name`,value:`error`}},{kind:`Field`,name:{kind:`Name`,value:`entry`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`progress`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}}]}}]}}]}}]},To={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`mutation`,name:{kind:`Name`,value:`DeleteListEntry`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`DeleteListEntryInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`deleteListEntry`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`tracker`}},{kind:`Field`,name:{kind:`Name`,value:`outcome`}},{kind:`Field`,name:{kind:`Name`,value:`error`}}]}}]}}]},Eo={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`StubTrackerStorage`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`stubTrackerStorage`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`location`}},{kind:`Field`,name:{kind:`Name`,value:`signedIn`}},{kind:`Field`,name:{kind:`Name`,value:`locked`}},{kind:`Field`,name:{kind:`Name`,value:`waiting`}},{kind:`Field`,name:{kind:`Name`,value:`held`}},{kind:`Field`,name:{kind:`Name`,value:`error`}}]}}]}}]},Do={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`mutation`,name:{kind:`Name`,value:`AddHeldStubEntries`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`addHeldStubEntries`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`location`}},{kind:`Field`,name:{kind:`Name`,value:`signedIn`}},{kind:`Field`,name:{kind:`Name`,value:`locked`}},{kind:`Field`,name:{kind:`Name`,value:`waiting`}},{kind:`Field`,name:{kind:`Name`,value:`held`}},{kind:`Field`,name:{kind:`Name`,value:`error`}}]}}]}}]},Oo={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetReleasingMediaPage`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaPageInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaShortDescriptionInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`mediaPage`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`nodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`score`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`banners`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`trailers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`thumbnail`}}]}},{kind:`Field`,name:{kind:`Name`,value:`popularity`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}}]},ko={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetMediaDetails`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`descriptionInput`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaDescriptionInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`details`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`Boolean`}}},defaultValue:{kind:`BooleanValue`,value:!1}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`media`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`score`}}]}},{kind:`Field`,name:{kind:`Name`,value:`descriptions`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`descriptionInput`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`description`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`banners`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`trailers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`thumbnail`}}]}},{kind:`Field`,name:{kind:`Name`,value:`popularity`}},{kind:`Field`,name:{kind:`Name`,value:`categories`}},{kind:`Field`,name:{kind:`Name`,value:`type`}},{kind:`Field`,name:{kind:`Name`,value:`startDate`}},{kind:`Field`,name:{kind:`Name`,value:`endDate`}},{kind:`Field`,name:{kind:`Name`,value:`season`}},{kind:`Field`,name:{kind:`Name`,value:`seasonYear`}},{kind:`Field`,name:{kind:`Name`,value:`averageScore`}},{kind:`Field`,name:{kind:`Name`,value:`genres`}},{kind:`Field`,name:{kind:`Name`,value:`tags`}},{kind:`Field`,name:{kind:`Name`,value:`franchise`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`nodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`format`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`startDate`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`edges`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`from`}},{kind:`Field`,name:{kind:`Name`,value:`to`}},{kind:`Field`,name:{kind:`Name`,value:`relation`}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`relations`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`format`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`startDate`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`color`}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`releaseDate`}},{kind:`Field`,name:{kind:`Name`,value:`runtime`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`thumbnails`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`releaseDate`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`thumbnails`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`settled`}},{kind:`Field`,name:{kind:`Name`,value:`seasons`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`number`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}}]}},{kind:`Field`,name:{kind:`Name`,value:`nextAiringEpisode`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}},{kind:`Field`,name:{kind:`Name`,value:`airingSchedule`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}},{kind:`Field`,name:{kind:`Name`,value:`duration`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}]},{kind:`Field`,name:{kind:`Name`,value:`sourceMaterial`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}]},{kind:`Field`,name:{kind:`Name`,value:`studios`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}]},{kind:`Field`,name:{kind:`Name`,value:`characters`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`image`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`role`}},{kind:`Field`,name:{kind:`Name`,value:`voiceActors`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`image`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`language`}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`staff`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`image`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`roles`}}]}},{kind:`Field`,name:{kind:`Name`,value:`themes`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`kind`}},{kind:`Field`,name:{kind:`Name`,value:`sequence`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`artists`}},{kind:`Field`,name:{kind:`Name`,value:`video`}}]}},{kind:`Field`,name:{kind:`Name`,value:`ratings`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`details`}}}]}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`source`}},{kind:`Field`,name:{kind:`Name`,value:`value`}},{kind:`Field`,name:{kind:`Name`,value:`scale`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`EpisodeFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Episode`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}}]}}]}}]}}]},Ao={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetMediaOrigins`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`OriginPageInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`originPage`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`nodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`OriginFragment`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`OriginFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Origin`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`icon`}},{kind:`Field`,name:{kind:`Name`,value:`color`}},{kind:`Field`,name:{kind:`Name`,value:`isApiOnly`}}]}}]},jo={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`SearchMediaPage`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaPageInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaShortDescriptionInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`mediaPage`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`nodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`SearchCard`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`SearchCard`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`score`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`color`}}]}},{kind:`Field`,name:{kind:`Name`,value:`banners`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`trailers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`thumbnail`}}]}},{kind:`Field`,name:{kind:`Name`,value:`popularity`}},{kind:`Field`,name:{kind:`Name`,value:`genres`}},{kind:`Field`,name:{kind:`Name`,value:`tags`}},{kind:`Field`,name:{kind:`Name`,value:`averageScore`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`type`}},{kind:`Field`,name:{kind:`Name`,value:`season`}},{kind:`Field`,name:{kind:`Name`,value:`seasonYear`}},{kind:`Field`,name:{kind:`Name`,value:`nextAiringEpisode`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}}]}}]},Mo={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`SceneMedia`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaShortDescriptionInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`media`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`SearchCard`}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`SearchCard`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`score`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`score`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`shortDescriptionInput`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`color`}}]}},{kind:`Field`,name:{kind:`Name`,value:`banners`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`trailers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`thumbnail`}}]}},{kind:`Field`,name:{kind:`Name`,value:`popularity`}},{kind:`Field`,name:{kind:`Name`,value:`genres`}},{kind:`Field`,name:{kind:`Name`,value:`tags`}},{kind:`Field`,name:{kind:`Name`,value:`averageScore`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`type`}},{kind:`Field`,name:{kind:`Name`,value:`season`}},{kind:`Field`,name:{kind:`Name`,value:`seasonYear`}},{kind:`Field`,name:{kind:`Name`,value:`nextAiringEpisode`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}}]}}]},No={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetWatchMedia`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`MediaInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`media`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`covers`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`type`}},{kind:`Field`,name:{kind:`Name`,value:`categories`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`settled`}},{kind:`Field`,name:{kind:`Name`,value:`nextAiringEpisode`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`airingAt`}}]}},{kind:`Field`,name:{kind:`Name`,value:`seasons`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`number`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}}]}},{kind:`Field`,name:{kind:`Name`,value:`relations`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`format`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`releaseDate`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`thumbnails`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`url`}}]}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`embedUrl`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}},{kind:`Field`,name:{kind:`Name`,value:`releaseDate`}},{kind:`Field`,name:{kind:`Name`,value:`titles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`title`}}]}},{kind:`Field`,name:{kind:`Name`,value:`shortDescriptions`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`language`}},{kind:`Field`,name:{kind:`Name`,value:`shortDescription`}}]}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`MediaFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}}]}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`episodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`FragmentSpread`,name:{kind:`Name`,value:`EpisodeFragment`}},{kind:`Field`,name:{kind:`Name`,value:`episodeNumber`}}]}}]}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`EpisodeFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Episode`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`mediaUri`}}]}}]}}]}},{kind:`FragmentDefinition`,name:{kind:`Name`,value:`MediaFragment`},typeCondition:{kind:`NamedType`,name:{kind:`Name`,value:`Media`}},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`handles`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`relation`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`_id`}},{kind:`Field`,name:{kind:`Name`,value:`uri`}},{kind:`Field`,name:{kind:`Name`,value:`origin`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}}]}}]}}]}}]},Po={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetWatchOrigins`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`input`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`OriginPageInput`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`originPage`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`input`},value:{kind:`Variable`,name:{kind:`Name`,value:`input`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`nodes`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`icon`}},{kind:`Field`,name:{kind:`Name`,value:`color`}},{kind:`Field`,name:{kind:`Name`,value:`isApiOnly`}}]}}]}}]}}]},Fo=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Lo.unregister(this),e}free(){let e=this.__destroy_into_raw();Zo.__wbg_haystacks_free(e,0)}bytesView(){return Zo.haystacks_bytesView(this.__wbg_ptr)}clear(){Zo.haystacks_clear(this.__wbg_ptr)}commit(e,t){let n=Zo.haystacks_commit(this.__wbg_ptr,e,t);if(n[1])throw Jo(n[0])}get length(){return Zo.haystacks_length(this.__wbg_ptr)>>>0}constructor(e){var t=Go(e)?0:Ko(e,Zo.__wbindgen_malloc),n=Xo;let r=Zo.haystacks_new(t,n);return this.__wbg_ptr=r,Lo.register(this,this.__wbg_ptr,this),this}offsetsView(){return Zo.haystacks_offsetsView(this.__wbg_ptr)}push(e){let t=Ko(e,Zo.__wbindgen_malloc),n=Xo;Zo.haystacks_push(this.__wbg_ptr,t,n)}reserve(e,t){Zo.haystacks_reserve(this.__wbg_ptr,e,t)}};Symbol.dispose&&(Fo.prototype[Symbol.dispose]=Fo.prototype.free);var Io=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ro.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ro.unregister(this),e}free(){let e=this.__destroy_into_raw();Zo.__wbg_matcher_free(e,0)}static fromPatterns(t,n){let r=Zo.matcher_fromPatterns(t,Go(n)?0:zo(n));if(r[2])throw Jo(r[1]);return e.__wrap(r[0])}static fromQuery(t,n){let r=qo(t,Zo.__wbindgen_malloc,Zo.__wbindgen_realloc),i=Xo,a=Zo.matcher_fromQuery(r,i,Go(n)?0:zo(n));if(a[2])throw Jo(a[1]);return e.__wrap(a[0])}matchHaystacks(e){return Bo(e,Fo),Zo.matcher_matchHaystacks(this.__wbg_ptr,e.__wbg_ptr)}matchHaystacksIndices(e){return Bo(e,Fo),Zo.matcher_matchHaystacksIndices(this.__wbg_ptr,e.__wbg_ptr)}matchList(e){let t=Ko(e,Zo.__wbindgen_malloc),n=Xo;return Zo.matcher_matchList(this.__wbg_ptr,t,n)}matchListIndices(e){let t=Ko(e,Zo.__wbindgen_malloc),n=Xo;return Zo.matcher_matchListIndices(this.__wbg_ptr,t,n)}matchOne(e,t){let n=qo(e,Zo.__wbindgen_malloc,Zo.__wbindgen_realloc),r=Xo;return Zo.matcher_matchOne(this.__wbg_ptr,n,r,t)}matchOneIndices(e,t){let n=qo(e,Zo.__wbindgen_malloc,Zo.__wbindgen_realloc),r=Xo;return Zo.matcher_matchOneIndices(this.__wbg_ptr,n,r,t)}constructor(e,t){let n=qo(e,Zo.__wbindgen_malloc,Zo.__wbindgen_realloc),r=Xo,i=Zo.matcher_new(n,r,Go(t)?0:zo(t));if(i[2])throw Jo(i[1]);return this.__wbg_ptr=i[0],Ro.register(this,this.__wbg_ptr,this),this}setConfig(e){let t=Zo.matcher_setConfig(this.__wbg_ptr,e);if(t[1])throw Jo(t[0])}setPattern(e){let t=Zo.matcher_setPattern(this.__wbg_ptr,e);if(t[1])throw Jo(t[0])}setPatterns(e){let t=Zo.matcher_setPatterns(this.__wbg_ptr,e);if(t[1])throw Jo(t[0])}};Symbol.dispose&&(Io.prototype[Symbol.dispose]=Io.prototype.free);var Lo=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Zo.__wbg_haystacks_free(e,1)),Ro=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Zo.__wbg_matcher_free(e,1));function zo(e){let t=Zo.__externref_table_alloc();return Zo.__wbindgen_externrefs.set(t,e),t}function Bo(e,t){if(!(e instanceof t))throw Error(`expected instance of ${t.name}`)}var Vo=null;function Ho(){return(Vo===null||Vo.buffer.detached===!0||Vo.buffer.detached===void 0&&Vo.buffer!==Zo.memory.buffer)&&(Vo=new DataView(Zo.memory.buffer)),Vo}var Uo=null;function Wo(){return(Uo===null||Uo.byteLength===0)&&(Uo=new Uint8Array(Zo.memory.buffer)),Uo}function Go(e){return e==null}function Ko(e,t){let n=t(e.length*4,4)>>>0;for(let t=0;t<e.length;t++){let r=zo(e[t]);Ho().setUint32(n+4*t,r,!0)}return Xo=e.length,n}function qo(e,t,n){if(n===void 0){let n=Yo.encode(e),r=t(n.length,1)>>>0;return Wo().subarray(r,r+n.length).set(n),Xo=n.length,r}let r=e.length,i=t(r,1)>>>0,a=Wo(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=Wo().subarray(i+o,i+r),a=Yo.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return Xo=o,i}function Jo(e){let t=Zo.__wbindgen_externrefs.get(e);return Zo.__externref_table_dealloc(e),t}new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode();var Yo=new TextEncoder;`encodeInto`in Yo||(Yo.encodeInto=function(e,t){let n=Yo.encode(e);return t.set(n),{read:e.length,written:n.length}});var Xo=0,Zo,Qo=new TextEncoder;function $o(e,t){let n=0;for(let e of t)n+=e.length*3;e.reserve(n,t.length);let r=e.bytesView(),i=e.offsetsView(),a=0;for(let e=0;e<t.length;e++)a+=Qo.encodeInto(t[e],r.subarray(a)).written,i[e]=a;return e.commit(a,t.length),e}var es=class extends Fo{constructor(e){super(),e?.length&&$o(this,e)}push(e){$o(this,e)}},ts;function ns(e){return ts??=new es,ts.clear(),$o(ts,e)}Io.prototype.matchList=function(e){return this.matchHaystacks(e instanceof Fo?e:ns(e))},Io.prototype.matchListIndices=function(e){return this.matchHaystacksIndices(e instanceof Fo?e:ns(e))};var rs=[`winter`,`spring`,`summer`,`fall`],is=(e=new Date)=>({season:rs[Math.floor(e.getMonth()/3)],year:e.getFullYear()}),as=e=>e.toUpperCase(),os=(e=new Date)=>{let{season:t,year:n}=is(e);return{season:as(t),year:n}},ss=String.raw`(?:\s|<\/?br\s*\/?>)*`,cs=String.raw`(?:\(Source:[^()]*\)|\[Written by MAL Rewrite\]|(?<=[\n>])Source:[^\n<]*)`;RegExp(`${ss}${cs}(?:${ss}$|(?=${ss}<(?:i|em)>))`,`i`);var ls=`\\u002d\\u2013\\u2014\\u007e\\uff5e\\u301c`;RegExp(`(?:^|\\s)([${ls}])\\s*[^${ls}]{2,}\\s*\\1\\s*$`),go.Tv,go.TvShort,go.Movie,go.Ova,go.Ona,go.Special,new Set(lo);var us=`tracking/v1/`,ds=18e4,fs={changed:!0},ps=()=>{let e=0;return{moved:()=>{e+=1},begin:()=>{let t=e,n=()=>e===t;return{call:e=>n()?e():Promise.resolve(fs),current:n}}}},ms=`sources/v1/list.json`,hs=(e,t)=>JSON.stringify(e)===JSON.stringify(t),gs=({cloud:e,onAccountChange:t,lock:n,storage:r,onList:i})=>{let a=ps(),o=io(r),s=new Set,c=async()=>{let{call:t,current:n}=a.begin(),c=io(r),l=await e.availability();if(l===`unknown`)return;let u;if(l===`connected`){if(!await e.unlocked())return;let n=await t(()=>e.read(ms));if(!(`ok`in n)&&!(`missing`in n))return;let i=`ok`in n?no(n.ok):[],a=[...s],o=[...new Set([...i,...ao(r)])].filter(e=>!a.includes(e));if(!hs(o,i)&&!(`ok`in await t(()=>e.write(`sources/v1/list.json`,JSON.stringify(o)))))return;for(let e of a)s.delete(e);u=o}if(!hs(io(r),c)||(u&&oo(ao(r).filter(e=>!u.includes(e)),r),!n()))return;co(u,r);let d=io(r);if(hs(d,o))return;let f=o;o=d,i(f,d)},l=e=>n(e).catch(e=>console.warn(`sources: account list`,e));return t(()=>{a.moved(),l(c)}),{check:()=>l(c),add:e=>(s.delete(e),oo([...new Set([...ao(r),e])],r),o=[...new Set([...o,e])],l(c)),remove:e=>{oo(ao(r).filter(t=>t!==e),r);let t=so(r);return t&&(co(t.filter(t=>t!==e),r),s.add(e)),o=o.filter(t=>t!==e),l(c)}}},_s=`FKN_E2E_LOCKED`,vs=`FKN_STORAGE_NOT_FOUND`,ys=`FKN_ACCOUNT_CHANGED`,bs=`fkn:account-changed`,xs=`FKN_ACCOUNT_PIN_UNSUPPORTED`,Ss=`FKN has to update before this list can reach your FKN account`,Cs=e=>{let t=e?.code,n=e instanceof Error?e.message:String(e);return t===_s?{locked:!0}:t===vs?{missing:!0}:t===ys||n.startsWith(bs)?{changed:!0}:t===xs?{error:Ss}:{error:n}},ws=((e,{timeoutMs:t=8e3}={})=>{let n=(e,n)=>new Promise(r=>{let i=setTimeout(()=>r(n),t);new Promise(t=>t(e())).then(e=>{clearTimeout(i),r(e)},()=>{clearTimeout(i),r(n)})}),r=e=>new Promise(n=>{let r=setTimeout(()=>n({error:`FKN storage did not answer`}),t);new Promise(t=>t(e())).then(e=>{clearTimeout(r),n({ok:e})},e=>{clearTimeout(r),n(Cs(e))})});return{availability:()=>n(()=>e.availability(),`unknown`),unlocked:()=>n(async()=>(await e.encryption()).unlocked===!0,!1),list:()=>r(async()=>(await e.list()).filter(e=>e.path.startsWith(us)).map(({path:e,updatedAt:t})=>({path:e,updatedAt:t}))),read:t=>r(async()=>{let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)}),write:(t,n)=>r(async()=>(await e.writeFile(t,n),!0))}})({availability:_e,list:O,encryption:j,readFile:e=>I.readFile(e,{encoding:`utf8`}),writeFile:(e,t)=>I.writeFile(e,t)}),Ts=F,Es=()=>M().catch(()=>!1),Ds=3e3,Os=new Map,ks=new Set,As=()=>ks.forEach(e=>{try{e()}catch{}}),js=e=>(ks.add(e),()=>{ks.delete(e)}),Ms=()=>io().map(e=>Os.get(e)??{uri:e,state:`connecting`}),Ns=()=>io(),Ps=(e,t)=>{Os.set(e,{uri:e,...t}),As()},Fs=45e3,Is=(e,t)=>Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(Error(t)),Fs))]),Ls=new Set,Rs=new Map,zs=3e4,Bs=(e,t)=>{if(!io().includes(e)||Ls.has(e)||Rs.has(e))return;Os.get(e)?.state!==`error`&&Ps(e,{state:`connecting`,retry:!0});let n=Math.min(Ds*t,zs),r=setTimeout(()=>{Rs.delete(e),Vs(e,t+1).catch(()=>{})},n);Rs.set(e,r)},Vs=async(e,t=1)=>{if(!Ls.has(e)){Ls.add(e),Ps(e,t>1?{state:`connecting`,retry:!0}:{state:`connecting`});try{let{port:t,closed:n}=await Is(E.connect(e,{protocol:Qa,raw:!0}),`connecting to '${e}' timed out`);n.then(()=>{Ls.delete(e),Rt(e),Bs(e,1)});let r=await Is(Promise.race([Gt(t,e),n.then(()=>({error:`the plugin closed while connecting`}))]),`'${e}' did not finish connecting`);if(`error`in r)throw Error(r.error);Ps(e,{state:`connected`,sources:r.ok.sources,rejected:r.ok.rejected})}catch(n){throw Ls.delete(e),console.warn(`Plugin '${e}' failed to connect:`,n),Ps(e,{state:`error`}),Bs(e,t+1),n}}},Hs=e=>{let t=Rs.get(e);t!==void 0&&(clearTimeout(t),Rs.delete(e))},Us=e=>{Hs(e),Ls.delete(e),Os.delete(e),Rt(e)},Ws=gs({cloud:ws,onAccountChange:Ts,lock:e=>typeof navigator<`u`&&navigator.locks?navigator.locks.request(`stub:source-list`,e):e(),onList:(e,t)=>{for(let n of e)t.includes(n)||(Us(n),E.uninstall(n).catch(()=>{}));As();for(let n of t)e.includes(n)||E.install(n,{noConfirm:!0}).then(e=>{if(!e)throw Error(`FKN did not install '${n}'`);Vs(n).catch(()=>{})}).catch(e=>{console.warn(`Plugin '${n}' could not be installed:`,e),Ps(n,{state:`error`})})}}),Gs=()=>Ws.check(),Ks=async(e,t)=>{let n=await E.install(e,t);return n?(Ws.add(n.uri),n.uri):null},qs=async e=>{let t=await Ks(e);return t&&Vs(t).catch(()=>{}),t},Js=async(e,t)=>{let n=await Ks(e,t);return n&&await Vs(n),n},Ys=async e=>{Ws.remove(e),Us(e),As(),await E.uninstall(e).catch(()=>{})},Xs=async()=>{let e=await E.pick({type:`plugin`,id:`stub`},{multiple:!0,title:`Add stub sources`});for(let t of e)await Js(t.uri).catch(()=>{})};for(let e of io())Vs(e).catch(()=>{});var Zs=`stub.sources.hidden-icons`,Qs=()=>{try{let e=JSON.parse(oe.getItem(`stub.sources.hidden-icons`)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}},$s=(e,t)=>{let n=new Set(Qs());t?n.delete(e):n.add(e);try{n.size?oe.setItem(Zs,JSON.stringify([...n])):oe.removeItem(Zs)}catch{}},ec=e=>oe.watch(Zs,e),tc=()=>{let[e,t]=W(()=>new Set(Qs()));return V(()=>ec(()=>t(new Set(Qs()))),[]),e},nc=`stub.sources.play-order`,rc=[`cr`,`amazon`,`nf`],ic=()=>{try{let e=JSON.parse(oe.getItem(`stub.sources.play-order`)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}},ac=e=>{try{oe.setItem(nc,JSON.stringify(e))}catch{}},oc=e=>oe.watch(nc,e),sc=(e,t)=>[...new Set([...e,...rc,...t])],cc=(e,t,n,r=e)=>{let i=r[r.indexOf(t)+n];if(!i||!r.includes(t))return[...e];let a=e.filter(e=>e!==t);return a.splice(a.indexOf(i)+ +(n>0),0,t),a},lc=`stub.tracking.compact`,uc={targets:{}},dc=e=>{try{let t=JSON.parse(e??`null`);return{targets:Object.fromEntries(Object.entries(t?.targets??{}).filter(([,e])=>typeof e==`boolean`))}}catch{return uc}},fc=((e=oe)=>{let t;return{read:()=>{if(t)return t;try{return dc(e?.getItem(lc))}catch{return uc}},write:n=>{try{if(!e)throw Error(`No storage`);e.setItem(lc,JSON.stringify(n)),t=void 0}catch{t=n}}}})(),pc=e=>oe.watch(lc,e),mc=`stub.player.autoplay`,hc=()=>oe.getItem(mc)!==`off`,gc=e=>{try{e?oe.removeItem(mc):oe.setItem(mc,`off`)}catch{}},_c=e=>oe.watch(mc,e),vc=e=>Math.max(1,e),yc={POINT_100:{step:1,native:e=>Math.round(e),raw:e=>e},POINT_10_DECIMAL:{step:1,native:e=>Math.round(e)/10,raw:e=>Math.round(e*10)},POINT_10:{step:10,native:e=>vc(Math.floor(e/10)),raw:e=>e*10},POINT_5:{step:20,native:e=>vc(Math.round(e/20)),raw:e=>e*20},POINT_3:{step:33,native:e=>e<36?1:e<61?2:3,raw:e=>[30,50,85][e-1]??85}},bc=e=>yc[e??``]??yc.POINT_100,xc=e=>e!=null&&e>0,Sc=(e,t)=>bc(t).native(e),Cc=(e,t)=>{let{native:n,raw:r}=bc(t);return r(n(e))},wc=(e,t)=>bc(t).step>bc(e).step?t:e,Tc={WATCHING:`Watching`,REWATCHING:`Rewatching`,PLANNING:`Plan to watch`,COMPLETED:`Completed`,PAUSED:`Paused`,DROPPED:`Dropped`},Ec=new Set([`LISTED`,`NOT_LISTED`]),Dc=e=>e.tracker.canWrite&&Ec.has(e.state),Oc=e=>e.error||(e.state===`PAUSED`?`Paused for a while`:`Could not answer`),kc=(e,t)=>{let n=e?.summary;return{status:n?.status??null,progress:n?.progress??0,score:xc(n?.score)?n.score:null,total:n?.episodeCount??t??null,differs:[...e?.disagreements??[]]}},Ac=e=>e.entry?.episodeCount??e.episodeCount,jc=(e,t)=>({status:e.entry?.status??null,progress:e.entry?.progress??0,score:xc(e.entry?.score)?e.entry.score:null,total:Ac(e)??t,differs:[]}),Mc=(e,t={})=>({...e,...t.status===void 0?{}:{status:t.status},...t.progress===void 0?{}:{progress:t.progress},...t.score===void 0?{}:{score:t.score}}),Nc=(e,t)=>{let n={...e};return n.status===t.status&&delete n.status,n.progress===t.progress&&delete n.progress,n.score!==void 0&&(n.score??null)===t.score&&delete n.score,n},Pc=(e,t)=>{switch(e.state){case`LOADING`:return{kind:`loading`};case`SIGNED_OUT`:return{kind:`login`};case`AMBIGUOUS`:return{kind:`cannot`,reason:`Names ${e.candidates.join(` and `)}, cannot tell which`}}let n=t??!0;return{kind:`check`,checked:n,sendable:n&&Dc(e)}},Fc=(e,t)=>{let n=Ac(e);return n!=null&&t!=null&&n!==t},Ic=e=>e.state===`LISTED`&&(!e.tracker.statuses||!!e.entry?.status),Lc=(e,t,n)=>{if(t.remove)return Ic(e)?{remove:!0}:void 0;let{statuses:r}=e.tracker,i=`score`in t?t.score:n.score,a=e.state===`LISTED`||r?{...t}:{status:t.status??n.status??`WATCHING`,progress:t.progress??n.progress,...xc(i)?{score:i}:{}};return a.status!==void 0&&r&&!r.includes(a.status)&&delete a.status,a.progress!==void 0&&(Fc(e,n.total)?delete a.progress:a.progress=Math.max(0,Math.min(n.total??1/0,a.progress))),Object.keys(a).length?a:void 0},Rc=(e,t)=>!!e?.answers.find(e=>e.tracker.id===t)?.tracker.statuses,zc={POINT_3:[30,50,85],POINT_5:[20,40,60,80,100],POINT_10:[10,20,30,40,50,60,70,80,90,100],POINT_10_DECIMAL:[10,20,30,40,50,60,70,80,90,100],POINT_100:[10,20,30,40,50,60,70,80,90,100]},Bc=e=>{if(!e.length)return;let t=e.map(e=>e&&zc[e]?e:`POINT_100`);return{scale:t.reduce((e,t)=>wc(e,t)??`POINT_100`,`POINT_100`),mixed:new Set(t).size>1}},Vc=(e,t)=>Cc(e,t),Hc=(e,t)=>t?e?.remove||t.remove?t:{...e,...t}:e??{},Uc=({send:e,onChange:t=()=>{},shape:n=(e,t)=>t,steps:r=()=>!1,delay:i=1e3,timers:a={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)}})=>{let o=new Map,s=new Map,c=new Set,l=new Map,u=new Map,d=new Map,f,p=(e,...t)=>t.reduce((t,n)=>{let i=t.at(-1);return n?r(e)&&i?.progress!==void 0&&n.progress!==void 0&&n.progress>i.progress?[...t,n]:[...t.slice(0,-1),Hc(i,n)]:t},[]),m=e=>{let t=u.get(e);return t?.unsent?t.saves.map(t=>n(e,t)):t?.saves??[]},h=n=>{let[i,...a]=o.get(n)??[];if(!i||!c.has(n)||l.has(n))return;a.length?o.set(n,a):(o.delete(n),s.delete(n),c.delete(n)),l.set(n,i);let f=(e,a)=>{if(l.delete(n),e===`SAVED`||e===`QUEUED`)u.delete(n);else if(e===`REFUSED`)d.set(n,a??`Refused`);else{let e=r(n)?o.get(n)??[]:[];e.length&&o.delete(n),u.set(n,{saves:[i,...e],error:a??`Did not save`});let t=o.get(n);t&&o.set(n,p(n,i,...t))}t({tracker:n,outcome:e,fields:i,error:a}),h(n)};e(n,i).then(({outcome:e,error:t})=>f(e,t),e=>f(`FAILED`,e instanceof Error?e.message:String(e))),t()},g=()=>{f!==void 0&&a.clear(f),f=void 0;for(let e of o.keys())c.add(e);for(let e of[...c])h(e)};return{stage:(e,n,r=!1)=>{for(let[t,n]of Object.entries(e)){let e=m(t);u.delete(t),d.delete(t),o.set(t,p(t,...e,...o.get(t)??[],n)),r&&s.set(t,p(t,...s.get(t)??[],n))}n?g():(f!==void 0&&a.clear(f),f=a.set(g,i),t())},flush:g,fail:(e,n,r)=>{u.set(e,{saves:p(e,...u.get(e)?.saves??[],n),error:r,unsent:!0}),t({tracker:e,outcome:`FAILED`,fields:n,error:r})},retry:e=>{if(!u.has(e))return;let n=p(e,...m(e),...o.get(e)??[]);u.delete(e),n.length&&(o.set(e,n),c.add(e),h(e)),t()},drop:e=>{let n=s.get(e);n?o.set(e,n):(o.delete(e),c.delete(e)),u.delete(e),d.delete(e),t()},dismiss:e=>{d.delete(e),t()},state:e=>{let t=u.get(e);return{busy:l.has(e)||o.has(e),failed:t&&{fields:t.saves[0],error:t.error},refused:d.get(e)}},idle:()=>!l.size&&!o.size}},Wc=({played:e,episode:t,movie:n},r)=>{if(!(e<.85||r.status===`COMPLETED`)){if(n)return{status:`COMPLETED`,progress:1};if(!(t==null||!Number.isInteger(t)||t<=r.progress||r.total!=null&&t>r.total))return t===r.total?{progress:t,status:`COMPLETED`}:{progress:t,...r.status===`WATCHING`||r.status===`REWATCHING`?{}:{status:`WATCHING`}}}},Gc=(e,t,n,r)=>{let i=kc(t,r);if(i.status===`COMPLETED`)return{};let a={};for(let r of t.answers){if(r.state===`NO_ID`)continue;let t=Pc(r,n[r.tracker.id]);if(t.kind!==`check`||!t.checked||Fc(r,i.total))continue;let o=Wc(e,jc(r,i.total));o&&(a[r.tracker.id]=o)}return a};K();var Kc=`stub.player.positions`,qc=`stub.player.positions.account`,Jc=e=>e.length===2?e[1]:e[3],Yc=e=>{if(!Array.isArray(e)||typeof e[0]!=`string`||!e.slice(1).every(e=>typeof e==`number`))return[];let[t,...n]=e;return n.length===1?[[t,n[0]]]:n.length===2||n.length===3?[[t,n[0],n[1],n[2]??0]]:[]},Xc=e=>{try{let t=JSON.parse(e??`[]`);return Array.isArray(t)?t.flatMap(Yc):[]}catch{return[]}},Zc=(e,t)=>{let n=new Map;for(let r of[...Xc(e),...Xc(t)]){let e=n.get(r[0]);e&&Jc(e)>Jc(r)||(n.delete(r[0]),n.set(r[0],r))}let r=[...n.values()].sort((e,t)=>Jc(e)-Jc(t)),i=new Set([...r.filter(e=>e.length===4).slice(-200),...r.filter(e=>e.length===2).slice(-200)]);return JSON.stringify(r.filter(e=>i.has(e)))},Qc=(e=>fe(e,{accountKey:qc,merge:Zc}))(),$c=()=>Xc(Qc.getItem(Kc)),el=(e,t=$c())=>{let n=t.findLast(([t])=>e.includes(t));return n?.length===4?n:void 0},tl=()=>{let[e,t]=W($c);return V(()=>Qc.watch(Kc,()=>t($c())),[]),e},nl=(e,{time:t,duration:n,ended:r=!1})=>{let i=r||n!==void 0&&n>0&&t/n>=.85;if(!i&&(t<30||n===0)||i&&$c().find(([t])=>t===e)?.length===2)return;let a=i?[e,Date.now()]:[e,t,n??0,Date.now()];try{Qc.setItem(Kc,JSON.stringify([a]))}catch{}},rl=[{value:`grid`,label:`Covers`},{value:`card`,label:`Cards`},{value:`list`,label:`List`}],il=`grid`,al=`stub-search-display-mode`,ol=rl.map(e=>e.value),sl=e=>ol.includes(e)?e:il,cl=(e=oe)=>{try{return sl(e?.getItem(al))}catch{return il}},ll=(e,t=oe)=>{try{t?.setItem(al,e)}catch{}},ul=`settings/v1/settings.json`,dl=`positions/v1/positions.json`,fl=3e4,pl=[Lt,Zs],ml=[...pl,me,mc,al,lc,nc],hl=(e,t)=>JSON.stringify(e)===JSON.stringify(t),gl=e=>{try{return no(e??`[]`)}catch{return[]}},_l=(e,t)=>JSON.stringify([...new Set([...gl(e),...gl(t)])]),vl=({settings:e,cloud:t,onAccountChange:n,lock:r,path:i=ul,keys:a=ml,paceMs:o})=>{let{raw:s,write:c,edits:l,tell:u,onEdit:d,accountKey:f,merge:p}=e.internal,m=ps(),h=(e,t)=>{let n={...e};for(let[e,r]of t)n[e]=p?p(n[e]??null,r):r;return n},g=async()=>{let{call:n,current:r}=m.begin(),o=new Map(a.map(t=>[t,e.getItem(t)])),d=s(f),g=await t.availability();if(g===`unknown`)return;let _;if(g===`connected`){if(!await t.unlocked())return;let e=await n(()=>t.read(i));if(!(`ok`in e)&&!(`missing`in e))return;let r=`ok`in e?xe(e.ok):{};if(p)for(let[e,t]of l)p(r[e]??null,t)===r[e]&&l.delete(e);let o=new Map(a.map(e=>[e,s(e)])),u=new Map(l);_={...r};for(let[e,t]of o)t!==null&&(_[e]=p?p(r[e]??null,t):pl.includes(e)?_l(r[e],t):e in r?r[e]??null:t);if(_=h(_,[...u].filter(([e])=>a.includes(e))),!hl(_,r)&&!(`ok`in await n(()=>t.write(i,JSON.stringify(_)))))return;if(!p)for(let[e,t]of u)l.get(e)===t&&l.delete(e);try{for(let[e,t]of o)s(e)===t&&c(e,null)}catch{}}else l.clear();if(r()&&s(f)===d){try{c(f,_?JSON.stringify(h(_,l)):null)}catch{}for(let t of a)e.getItem(t)!==o.get(t)&&u(t)}},_=0,v=0,y=!1,b=Promise.resolve(),x=()=>y?b:(y=!0,b=r(()=>{y=!1;let e=_;return g().finally(()=>{v=Math.max(v,e)})}).catch(e=>console.warn(`settings: account file`,e))),S,C=-1/0,w=()=>(clearTimeout(S),S=void 0,C=Date.now(),x());return d(e=>{e||(_+=1),e?l.size&&w():o===void 0?x():S??=setTimeout(w,Math.max(0,C+o-Date.now()))}),n(e=>{m.moved(),e?.switched!==!1&&l.clear(),x()}),{check:x,unsaved:()=>v<_}},yl=e=>vl({...e,path:dl,keys:[Kc],paceMs:fl}),bl=({check:e,focused:t,page:n=globalThis,document:r=globalThis.document,intervalMs:i=6e4})=>{let a=e=>()=>{e().catch(e=>console.warn(`tracking: account link`,e))},o=()=>r?.visibilityState!==`hidden`,s=a(e),c=a(t);s(),n.addEventListener(`online`,s),n.addEventListener(`focus`,c),r?.addEventListener(`visibilitychange`,()=>{o()&&c()});let l=setInterval(()=>{o()&&c()},i);return()=>clearInterval(l)},xl=e=>t=>typeof navigator<`u`&&navigator.locks?navigator.locks.request(e,t):t(),Sl=vl({settings:oe,cloud:ws,onAccountChange:Ts,lock:xl(`stub:settings`)}),Cl=yl({settings:Qc,cloud:ws,onAccountChange:Ts,lock:xl(`stub:positions`)});zr(()=>Sl.unsaved()||Cl.unsaved());var wl=Sl.check,Tl=Cl.check,El=(e,t={})=>{let n=()=>Promise.all([e(),wl(),Tl()]);return bl({check:n,focused:n,intervalMs:ds,...t})};function Dl(e){var t=e.forward;return function(e){return Yi(e,t)}}var Ol=function(){return typeof navigator>`u`||navigator==null||navigator.product,Dl}(),kl=(e,t)=>{for(var n=0|(t||5381),r=0,i=0|e.length;r<i;r++)n=(n<<5)+n+e.charCodeAt(r);return n},Al=new Set,jl=new WeakMap,Ml=(e,t)=>{if(e===null||Al.has(e))return`null`;if(typeof e!=`object`)return JSON.stringify(e)||``;if(e.toJSON)return Ml(e.toJSON(),t);if(Array.isArray(e)){for(var n=`[`,r=0,i=e.length;r<i;r++)n.length>1&&(n+=`,`),n+=Ml(e[r],t)||`null`;return n+=`]`}if(!t&&(Fl!==Pl&&e instanceof Fl||Il!==Pl&&e instanceof Il))return`null`;var a=Object.keys(e).sort();if(!a.length&&e.constructor&&Object.getPrototypeOf(e).constructor!==Object.prototype.constructor){var o=jl.get(e)||Math.random().toString(36).slice(2);return jl.set(e,o),Ml({__key:o},t)}Al.add(e);for(var s=`{`,c=0,l=a.length;c<l;c++){var u=Ml(e[a[c]],t);u&&(s.length>1&&(s+=`,`),s+=Ml(a[c],t)+`:`+u)}return Al.delete(e),s+=`}`},Nl=(e,t)=>(Al.clear(),Ml(e,t||!1)),Pl=class{},Fl=typeof File<`u`?File:Pl,Il=typeof Blob<`u`?Blob:Pl,Ll=/("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g,Rl=/(?:#[^\n\r]+)?(?:[\r\n]+|$)/g,zl=(e,t)=>t%2==0?e.replace(Rl,`
20
20
  `):e,Bl=e=>e.split(Ll).map(zl).join(``).trim(),Vl=new Map,Hl=new Map,Ul=e=>{var t;return typeof e==`string`?t=Bl(e):e.loc&&Hl.get(e.__key)===e?t=e.loc.source.body:(t=Vl.get(e)||Bl(gi(e)),Vl.set(e,t)),typeof e!=`string`&&!e.loc&&(e.loc={start:0,end:t.length,source:{body:t,name:`gql`,locationOffset:{line:1,column:1}}}),t},Wl=e=>{var t;if(e.documentId)t=kl(e.documentId);else if(t=kl(Ul(e)),e.definitions){var n=ql(e);n&&(t=kl(`\n# ${n}`,t))}return t},Gl=e=>{var t,n;return typeof e==`string`?(t=Wl(e),n=Hl.get(t)||li(e,{noLocation:!0})):(t=e.__key||Wl(e),n=Hl.get(t)||e),n.loc||Ul(n),n.__key=t,Hl.set(t,n),n},Kl=(e,t,n)=>{var r=t||{},i=Gl(e),a=Nl(r,!0),o=i.__key;return a!==`{}`&&(o=kl(a,o)),{key:o,query:i,variables:r,extensions:n}},ql=e=>{for(var t=0,n=e.definitions.length;t<n;t++){var r=e.definitions[t];if(r.kind===Ur.OPERATION_DEFINITION)return r.name?r.name.value:void 0}},Jl=e=>{if(`definitions`in e){for(var t=[],n=0,r=e.definitions.length;n<r;n++){var i=Jl(e.definitions[n]);t.push(i)}return{...e,definitions:t}}if(`directives`in e&&e.directives&&e.directives.length){for(var a=[],o={},s=0,c=e.directives.length;s<c;s++){var l=e.directives[s],u=l.name.value;u[0]===`_`?u=u.slice(1):a.push(l),o[u]=l}e={...e,directives:a,_directives:o}}if(`selectionSet`in e){var d=[],f=e.kind===Ur.OPERATION_DEFINITION;if(e.selectionSet){for(var p=0,m=e.selectionSet.selections.length;p<m;p++){var h=e.selectionSet.selections[p];f||=h.kind===Ur.FIELD&&h.name.value===`__typename`&&!h.alias;var g=Jl(h);d.push(g)}return f||d.push({kind:Ur.FIELD,name:{kind:Ur.NAME,value:`__typename`},_generated:!0}),{...e,selectionSet:{...e.selectionSet,selections:d}}}}return e},Yl=new Map,Xl=e=>{var t=Gl(e),n=Yl.get(t.__key);return n||(Yl.set(t.__key,n=Jl(t)),Object.defineProperty(n,"__key",{value:t.__key,enumerable:!1})),n};function Zl(e,t,n){return{...t,kind:e,context:t.context?{...t.context,...n}:n||t.context}}var Ql=`
21
21
  https://bit.ly/2XbVrpR#`;function $l(e,t,n){if(!e){var r=t||`Minfied Error #`+n+`
22
22
  `,i=Error(r+Ql+n);throw i.name=`Graphcache Error`,i}}var eu={},tu=e=>e._directives||eu,nu=e=>e.name.value,ru=e=>e.typeCondition.name.value,iu=e=>e.alias?e.alias.value:e.name.value,au=[],ou=e=>e.selectionSet?e.selectionSet.selections:au,su=e=>e.typeCondition?e.typeCondition.name.value:null,cu=(e,t)=>{var n=null;if(e.arguments)for(var r=0,i=e.arguments.length;r<i;r++){var a=e.arguments[r],o=_i(a.value,t);o!=null&&(n||={},n[nu(a)]=o)}return n},lu=(e,t)=>{if(t&&e.variableDefinitions){for(var n={},r=0,i=e.variableDefinitions.length;r<i;r++){var a=nu(e.variableDefinitions[r].variable);n[a]=t[a]}return n}},uu=(e,t)=>{var n={};if(!t)return n;if(e.variableDefinitions)for(var r=0,i=e.variableDefinitions.length;r<i;r++){var a=e.variableDefinitions[r],o=nu(a.variable);n[o]=t[o]===void 0&&a.defaultValue?_i(a.defaultValue,t):t[o]}for(var s in t)s in n||(n[s]=t[s]);return n};function du(e){for(var t=0;t<e.definitions.length;t++)if(e.definitions[t].kind===Ur.OPERATION_DEFINITION)return e.definitions[t];$l(!1,``,1)}var fu=e=>{for(var t={},n=0;n<e.definitions.length;n++){var r=e.definitions[n];r.kind===Ur.FRAGMENT_DEFINITION&&(t[nu(r)]=r)}return t},pu=(e,t)=>{var n=tu(e);if(n.include||n.skip)for(var r in n){var i=n[r];if(i&&(r===`include`||r===`skip`)&&i.arguments&&i.arguments[0]&&nu(i.arguments[0])===`if`){var a=_i(i.arguments[0].value,t);return r===`include`?!!a:!a}}return!0},mu=(e,t)=>{var{defer:n}=tu(e);if(n){for(var r of n.arguments||[])if(nu(r)===`if`)return!!_i(r.value,t);return!0}return!1},hu=e=>{var{optional:t,required:n}=tu(e);if(n)return!1;if(t)return!0},gu=`__`,_u=(e,t,n,r)=>{var i=bu(e,t,n,r);return!!i&&i.type.kind!==`NON_NULL`},vu=(e,t,n,r)=>{var i=bu(e,t,n,r);if(!i)return!1;var a=i.type.kind===`NON_NULL`?i.type.ofType:i.type;return a.kind===`LIST`&&a.ofType.kind!==`NON_NULL`},yu=(e,t,n)=>{if(!n)return!1;var r=su(t);return!r||n===r?!0:e.types.has(r)&&e.types.get(r).kind===`OBJECT`?r===n:((function(e,t){$l(e.types.has(t)&&(e.types.get(t).kind===`INTERFACE`||e.types.get(t).kind===`UNION`),``,5)})(e,r),xu(e,n),e.isSubType(r,n))},bu=(e,t,n,r)=>{if(n.indexOf(gu)!==0&&t.indexOf(gu)!==0)return xu(e,t),e.types.get(t).fields()[n]};function xu(e,t){$l(e.types.has(t)&&e.types.get(t).kind===`OBJECT`,``,3)}var Su=(e,t)=>t?`${e}(${Nl(t)})`:e,Cu=(e,t)=>`${e}.${t}`,wu=e=>{var t=e.indexOf(`(`);return t>-1?{fieldKey:e,fieldName:e.slice(0,t),arguments:JSON.parse(e.slice(t+1,-1))}:{fieldKey:e,fieldName:e,arguments:null}},Tu=e=>{var t=e.indexOf(`.`);return{entityKey:e.slice(0,t).replace(/%2e/g,`.`),fieldKey:e.slice(t+1)}},Eu=null,Du=null,Z=null,Ou=null,ku=null,Au=null,ju=!1,Mu=!1;function Nu(e,t){var n;if(e){if(Eu.has(e))return e;n=Du.get(e)}return n??=t?[]:{},e&&Du.set(e,n),Eu.add(n),n}var Pu=e=>!!e&&Eu.has(e),Fu=(e,t,n,r,i)=>{Eu=new WeakSet,Du=new WeakMap,ku=e,Z=t,Au=new Set,Mu=!!r,ju=!!i,n?ku===`read`?Ou=n:r||t.hydrating||t.optimisticOrder.length>1?(!r&&!t.commutativeKeys.has(n)?ed(t,n):r&&(t.optimisticOrder.indexOf(n)!==-1&&!t.commutativeKeys.has(n)&&t.optimisticOrder.splice(t.optimisticOrder.indexOf(n),1),t.commutativeKeys.delete(n)),Ou=n,td(t,n)):(Ou=null,rd(t,n)):Ou=null},Iu=()=>{var e=Z,t=Ou;if(Mu=!1,Ou=null,!e.hydrating&&t&&e.optimisticOrder.indexOf(t)>-1)for(var n=e.optimisticOrder.length;--n>=0&&e.dirtyKeys.has(e.optimisticOrder[n])&&e.commutativeKeys.has(e.optimisticOrder[n]);)id(e.optimisticOrder[n]);Eu=null,Du=null,ku=null,Z=null,Au=null,e.defer||!e.storage&&e.optimisticOrder.length||(e.defer=!0,setTimeout((()=>{Fu(`read`,e,null),Gu(),od(),Iu(),e.defer=!1})))},Lu=(e,t,n)=>{t&&!n&&e.deferredKeys.delete(t),Fu(`write`,e,t,n),Iu()},Ru=new Set,zu=(e,t,n,r)=>{var i=Ou?e.optimistic.get(Ou):e.base,a=i.get(t);a===void 0&&i.set(t,a=Object.create(null)),r===void 0&&!Ou?delete a[n]:a[n]=r},Bu=(e,t,n)=>{for(var r,i=!Mu&&ku===`read`&&Ou&&Z.commutativeKeys.has(Ou),a=0,o=Z.optimisticOrder.length;a<o;a++){var s=Z.optimisticOrder[a],c=e.optimistic.get(s);if(i&&=s!==Ou,c&&(!i||!Z.commutativeKeys.has(s))&&(!Mu||ku===`write`||Z.commutativeKeys.has(s))&&(r=c.get(t))!==void 0&&n in r)return r[n]}return(r=e.base.get(t))===void 0?void 0:r[n]};function Vu(e){return Z.refCount.get(e)||0}var Hu=(e,t)=>{if(Array.isArray(e))for(var n=0,r=e.length;n<r;n++)Hu(e[n],t);else typeof e==`string`&&((e,t)=>{var n=Vu(e),r=n+t>0?n+t:0;Z.refCount.set(e,r),r?!n&&r&&Z.gc.delete(e):Z.gc.add(e)})(e,t)},Uu=(e,t,n)=>{if(n!==void 0)for(var r in n)t.has(r)||(e.push(wu(r)),t.add(r))},Wu=(e,t,n,r)=>{Uu(e,t,r.base.get(n));for(var i=0,a=Z.optimisticOrder.length;i<a;i++){var o=r.optimistic.get(Z.optimisticOrder[i]);o!==void 0&&Uu(e,t,o.get(n))}},Gu=()=>{if(!Z.optimisticOrder.length){for(var e of Z.gc.keys())if(Z.gc.delete(e),!(Vu(e)>0)){var t=Z.records.base.get(e);Z.refCount.delete(e),Z.records.base.delete(e);var n=t&&t.__typename;if(n){var r=Z.types.get(n);r&&r.delete(e)}var i=Z.links.base.get(e);if(i)for(var a in Z.links.base.delete(e),i)Hu(i[a],-1)}}},Ku=(e,t)=>{e===Z.queryRootKey?t!==void 0&&t!==`__typename`&&Au.add(Cu(e,t)):Au.add(e)},qu=(e,t)=>{!Mu&&Z.storage&&Z.persist.add(((e,t)=>`${e.replace(/\./g,`%2e`)}.${t}`)(e,t))},Ju=(e,t)=>(ku===`read`&&Ku(e,t),Bu(Z.records,e,t)),Yu=(e,t)=>(ku===`read`&&Ku(e,t),Bu(Z.links,e,t)),Xu=(e,t)=>{var n=Z.abstractToConcreteMap.get(e);if(n)n.add(t);else{var r=new Set;r.add(t),Z.abstractToConcreteMap.set(e,r)}},Zu=(e,t,n)=>{sd(Bu(Z.records,e,t),n)||(Ku(e,t),qu(e,t)),zu(Z.records,e,t,n)},Qu=(e,t)=>Ju(e,t)!==void 0||Yu(e,t)!==void 0,$u=(e,t,n)=>{var r=Ou?Z.links.optimistic.get(Ou):Z.links.base;if(!Ou){var i=r&&r.get(e);Hu(i&&i[t],-1),Hu(n,1)}sd(Bu(Z.links,e,t),n)||(Ku(e,t),qu(e,t)),zu(Z.links,e,t,n)},ed=(e,t,n)=>{var r=e.optimisticOrder.indexOf(t);if(r>-1&&e.optimisticOrder.splice(r,1),n)for(e.deferredKeys.add(t),r=r>-1?r:0;r<e.optimisticOrder.length&&!e.deferredKeys.has(e.optimisticOrder[r])&&(!e.dirtyKeys.has(e.optimisticOrder[r])||!e.commutativeKeys.has(e.optimisticOrder[r]));r++);else e.deferredKeys.delete(t),r>-1&&!e.commutativeKeys.has(t)&&nd(e,t),r=0;e.optimisticOrder.splice(r,0,t),e.commutativeKeys.add(t)},td=(e,t)=>{e.optimisticOrder.indexOf(t)===-1&&e.optimisticOrder.unshift(t),e.dirtyKeys.has(t)||(e.dirtyKeys.add(t),e.links.optimistic.set(t,new Map),e.records.optimistic.set(t,new Map))},nd=(e,t)=>{e.dirtyKeys.has(t)&&(e.dirtyKeys.delete(t),e.records.optimistic.delete(t),e.links.optimistic.delete(t),e.deferredKeys.delete(t))},rd=(e,t)=>{var n=e.optimisticOrder.indexOf(t);n>-1&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),nd(e,t)},id=e=>{var t=Au;Au=new Set,ku=`write`;var n=Z.links.optimistic.get(e);if(n)for(var r of n.entries()){var i=r[0],a=r[1];for(var o in a)$u(i,o,a[o])}var s=Z.records.optimistic.get(e);if(s)for(var c of s.entries()){var l=c[0],u=c[1];for(var d in u)Zu(l,d,u[d])}Au=t,rd(Z,e)},ad=e=>{var{links:t,records:n}=Z,r=[],i=new Set;return Ku(e),Wu(r,i,e,t),Wu(r,i,e,n),r},od=()=>{if(Z.storage){Mu=!0,ku=`read`;var e={};for(var t of Z.persist.keys()){var{entityKey:n,fieldKey:r}=Tu(t),i=void 0;e[t]=(i=Yu(n,r))===void 0?(i=Ju(n,r))===void 0?void 0:Nl(i):`:${Nl(i)}`}Mu=!1,Z.storage.writeData(e),Z.persist.clear()}};function sd(e,t){return typeof e!=typeof t||e!==t?!1:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&!e.some(((e,n)=>e!==t[n])):!0}var cd=null,ld=!1,ud=void 0,dd=e=>e.__internal.path.length>0&&e.__internal.errorMap?e.__internal.errorMap[e.__internal.path.join(`.`)]:void 0,fd=(e,t,n,r,i,a)=>{var o={store:e,variables:t,fragments:n,parent:{__typename:r},parentTypeName:r,parentKey:i,parentFieldKey:``,fieldName:``,error:void 0,partial:!1,hasNext:!1,optimistic:Mu,__internal:{path:[],errorMap:void 0}};if(a&&a.graphQLErrors)for(var s=0;s<a.graphQLErrors.length;s++){var c=a.graphQLErrors[s];c.path&&c.path.length&&(o.__internal.errorMap||(o.__internal.errorMap=Object.create(null)),o.__internal.errorMap[c.path.join(`.`)]=c)}return o},pd=(e,t,n,r,i,a)=>{cd=e,e.parent=t,e.parentTypeName=n,e.parentKey=r,e.parentFieldKey=i,e.fieldName=a,e.error=dd(e)},md=(e,t,n,r,i)=>{if(!t)return!1;var a=su(e);return!a||t===a||!ou(e).some((e=>e.kind===Ur.FIELD&&!Qu(n,Su(nu(e),cu(e,r)))))},hd=class{constructor(e,t,n,r,i,a){this.typename=e,this.entityKey=t,this.ctx=a,this.stack=[{selectionSet:i,index:0,defer:n,optional:r}]}next(){for(;this.stack.length>0;){for(var e=this.stack[this.stack.length-1];e.index<e.selectionSet.length;){var t=e.selectionSet[e.index++];if(pu(t,this.ctx.variables)){if(t.kind!==Ur.FIELD){var n=t.kind===Ur.INLINE_FRAGMENT?t:this.ctx.fragments[nu(t)];if(n){var r=!n.typeCondition||(this.ctx.store.schema?yu(this.ctx.store.schema,n,this.typename):this.ctx.store.possibleTypeMap?gd(this.ctx.store.possibleTypeMap,n.typeCondition.name.value,this.typename):ku===`read`&&_d(n.typeCondition.name.value,this.typename)||md(n,this.typename,this.entityKey,this.ctx.variables,this.ctx.store.logger));if(r||ku===`write`&&!this.ctx.store.schema){var i=hu(t);r&&n.typeCondition&&this.typename!==n.typeCondition.name.value&&Xu(n.typeCondition.name.value,this.typename),this.stack.push(e={selectionSet:ou(n),index:0,defer:e.defer||mu(t,this.ctx.variables),optional:i===void 0?e.optional:i})}}}else if(ku===`write`||!t._generated)return ld=e.defer,ud=e.optional,t}}this.stack.pop()}}},gd=(e,t,n)=>{if(!n)return!1;if(t===n)return!0;var r=e.get(t);return r&&r.has(n)},_d=(e,t)=>{if(!t)return!1;if(e===t)return!0;if((e=>Z.types.has(e))(e))return!1;var n=(e=>Z.abstractToConcreteMap.get(e)||Ru)(e);return n.size&&n.has(t)},vd=e=>e??null,yd=(e,t)=>{if(!t)return t||null;if(Array.isArray(t)){for(var n=Array(t.length),r=0,i=n.length;r<i;r++)n[r]=yd(e,t[r]);return n}return e.keyOfEntity(t)},bd=(e,t,n,r)=>{var i=Xl(t.query),a=du(i),o=e.rootFields[a.operation],s=ou(a),c=fd(e,uu(a,t.variables),fu(i),o,o,r),l=o===c.store.rootFields.query?wd(c,o,s,n||Nu()):xd(c,o,s,n||Nu());return{dependencies:Au,partial:c.partial||!l,hasNext:c.hasNext,data:l||null}},xd=(e,t,n,r)=>{if(typeof(e.store.rootNames[t]?t:r.__typename)!=`string`)return r;for(var i=new hd(t,t,!1,void 0,n,e),a,o=ju,s=Nu(r);a=i.next();){var c=iu(a),l=r[c];e.__internal.path.push(c);var u=void 0;u=a.selectionSet&&l!==null?Sd(e,ou(a),vd(l)):l,o||=u!==l,u!==void 0&&(s[c]=u),e.__internal.path.pop()}return o?s:r},Sd=(e,t,n)=>{if(Array.isArray(n)){for(var r=Array(n.length),i=ju,a=0,o=n.length;a<o;a++)e.__internal.path.push(a),r[a]=Sd(e,t,n[a]),i||=r[a]!==n[a],e.__internal.path.pop();return i?r:n}if(n===null)return null;var s=e.store.keyOfEntity(n);return s===null?xd(e,n.__typename,t,n):wd(e,s,t,n)||null};function Cd(e,t,n,r){var i=r.store.resolvers[t],a=i&&i[n],o;for(var s in e){var c=e[s];if(c&&s!==`include`&&s!==`skip`&&r.store.directives[s])return o=r.store.directives[s](cu(c,r.variables)),o}return o||a}var wd=(e,t,n,r,i)=>{var{store:a}=e,o=t===a.rootFields.query,s=i&&a.keyOfEntity(i)||t,c=o?t:Ju(s,`__typename`)||i&&i.__typename;if(typeof c==`string`&&!(i&&c!==i.__typename)){for(var l=new hd(c,s,!1,void 0,n,e),u=!1,d=!1,f=ju,p,m=e.partial,h=Nu(r);(p=l.next())!==void 0;){var g=nu(p),_=cu(p,e.variables),v=iu(p),y=tu(p),b=Cd(y,c,g,e),x=Su(g,_),S=Cu(s,x),C=Ju(s,x),w=i?i[g]:void 0;e.__internal.path.push(v);var T=void 0;if(g===`__typename`)T=c;else if(w!==void 0&&p.selectionSet===void 0)T=w;else if(ku===`read`&&b){var E=h;if(p.selectionSet===void 0&&C!==void 0&&(E={...h,[v]:C,[g]:C}),pd(e,E,c,s,x,g),T=b(E,_||{},a,e),p.selectionSet&&(T=Td(e,c,g,S,ou(p),h[v]===void 0?r[v]:h[v],T,Pu(r))),a.schema&&T===null&&!_u(a.schema,c,g,e.store.logger))return}else if(!p.selectionSet)T=C;else if(w!==void 0)T=Td(e,c,g,S,ou(p),h[v]===void 0?r[v]:h[v],w,Pu(r));else{var D=Yu(s,x);D===void 0?typeof C==`object`&&C&&(T=C):T=Ed(e,D,c,g,ou(p),h[v]===void 0?r[v]:h[v],Pu(r))}if(!ld&&T===void 0&&(y.optional||ud&&!y.required||dd(e)||!y.required&&a.schema&&_u(a.schema,c,g,e.store.logger))?(e.partial=!0,T=null):T===null&&(y.required||!1===ud)?(e.store.logger,T=void 0):u||=g!==`__typename`,e.__internal.path.pop(),f||=T!==r[v],T!==void 0)h[v]=T;else if(ld)d=!0;else{e.store.logger,e.partial=m;return}}return e.partial=e.partial||m,e.hasNext=e.hasNext||d,o&&e.partial&&!u?void 0:f?h:r}},Td=(e,t,n,r,i,a,o,s)=>{if(Array.isArray(o)){for(var{store:c}=e,l=c.schema?vu(c.schema,t,n,e.store.logger):!1,u=e.partial,d=Nu(a,!0),f=ju||!Array.isArray(a)||o.length!==a.length,p=0,m=o.length;p<m;p++){e.__internal.path.push(p);var h=Td(e,t,n,Cu(r,`${p}`),i,a?.[p],o[p],s);if(e.__internal.path.pop(),h===void 0&&!l){e.partial=u;return}e.partial=e.partial||h===void 0&&l,d[p]=h??null,f||=d[p]!==a[p]}return f?d:a}if(o==null)return o;if(s&&a===null)return null;if(Dd(o)){var g=a||Nu(a);return typeof o==`string`?wd(e,o,i,g):wd(e,r,i,g,o)}},Ed=(e,t,n,r,i,a,o)=>{if(Array.isArray(t)){for(var{store:s}=e,c=s.schema?vu(s.schema,n,r,e.store.logger):!1,l=Nu(a,!0),u=e.partial,d=ju||!Array.isArray(a)||t.length!==a.length,f=0,p=t.length;f<p;f++){e.__internal.path.push(f);var m=Ed(e,t[f],n,r,i,a?.[f],o);if(e.__internal.path.pop(),m===void 0&&!c){e.partial=u;return}e.partial=e.partial||m===void 0&&c,l[f]=m||null,d||=l[f]!==a[f]}return d?l:a}return t===null||a===null&&o?null:wd(e,t,i,a||Nu(a))},Dd=e=>typeof e==`string`||typeof e==`object`&&typeof e.__typename==`string`,Od=(e,t,n)=>{for(var r=t?[{fieldKey:Su(t,n)}]:ad(e),i=0,a=r.length;i<a;i++){var{fieldKey:o}=r[i];Yu(e,o)===void 0?Zu(e,o,void 0):$u(e,o,void 0)}},kd=(e,t)=>{for(var n of(e=>Z.types.get(e)||Ru)(e))t.includes(n)||Od(n)},Ad=(e,t,n,r)=>{var i=Xl(t.query),a=du(i),o={data:n||Nu(),dependencies:Au},s=e.rootFields[a.operation];return jd(fd(e,uu(a,t.variables),fu(i),s,s,r),s,ou(a),o.data),o},jd=(e,t,n,r)=>{var i=e.store.rootNames[t]||`query`,a=!!e.store.rootNames[t],o=a?t:r.__typename;if(!o&&t&&e.optimistic&&(o=Ju(t,`__typename`)),o)!a&&t&&(Zu(t,`__typename`,o),((e,t)=>{var n=Z.types.get(e);if(n)n.add(t);else{var r=new Set;r.add(t),Z.types.set(e,r)}})(o,t));else return;for(var s=e.store.updates[o],c=new hd(o,t||o,!1,void 0,n,e),l;l=c.next();){var u=nu(l),d=cu(l,e.variables),f=Su(u,d),p=iu(l),m=r[e.optimistic?u:p];if(!(u===`__typename`||m===void 0&&(ld||e.optimistic&&i===`query`))){e.__internal.path.push(p);var h=void 0;if(e.optimistic&&i===`mutation`){if(!(h=e.store.optimisticMutations[u]))continue}else e.optimistic&&typeof m==`function`&&(h=m);if(h&&(pd(e,r,o,t||o,f,u),m=vd(h(d||{},e.store,e))),m!==void 0){if(l.selectionSet){if(t&&i===`query`){var g=Cu(t,f),_=Md(e,ou(l),vd(m),g,e.optimistic?Yu(t||o,f):void 0);$u(t||o,f,_)}else Md(e,ou(l),vd(m))}else t&&i===`query`&&Zu(t||o,f,m!==null||!dd(e)?m:void 0);var v=s&&s[u];if(v)pd(e,r,o,t||o,f,u),r[u]=m,v(r,d||{},e.store,e);else if(o===e.store.rootFields.mutation&&!e.optimistic){if(m&&Array.isArray(m))for(var y=m.map((t=>e.store.keyOfEntity(t)||``)),b=0,x=m.length;b<x;b++){var S=y[b];if(S&&m[b].__typename){var C=Ju(S,`__typename`),w=Vu(S);C&&!w&&kd(m[b].__typename,y)}}else if(m&&typeof m==`object`){var T=e.store.keyOfEntity(m);if(T){var E=Ju(T,`__typename`),D=Vu(T);E&&D||!m.__typename||kd(m.__typename,[T])}}}e.__internal.path.pop()}}}},Md=(e,t,n,r,i)=>{if(Array.isArray(n)){for(var a=Array(n.length),o=0,s=n.length;o<s;o++){e.__internal.path.push(o);var c=r?Cu(r,`${o}`):void 0,l=Md(e,t,n[o],c,i?.[o]);a[o]=l,e.__internal.path.pop()}return a}if(n===null)return dd(e)?void 0:null;var u=e.store.keyOfEntity(n)||(typeof i==`string`?i:null);n.__typename;var d=u||r;return jd(e,d,t,n),d||null},Nd=class{constructor(e){e||={},this.logger=e.logger,this.resolvers=e.resolvers||{},this.directives=e.directives||{},this.optimisticMutations=e.optimistic||{},this.keys=e.keys||{},this.globalIDs=Array.isArray(e.globalIDs)?new Set(e.globalIDs):!!e.globalIDs;var t=`Query`,n=`Mutation`,r=`Subscription`;if(e.schema){var i=(({__schema:e})=>{var t=new Map,n=e=>{var t;return()=>{if(!t){t={};for(var n=0;n<e.length;n++)t[e[n].name]=e[n]}return t}},r=e=>{switch(e.kind){case`OBJECT`:case`INTERFACE`:return{name:e.name,kind:e.kind,interfaces:n(e.interfaces||[]),fields:n(e.fields.map((e=>({name:e.name,type:e.type,args:n(e.args)}))))};case`UNION`:return{name:e.name,kind:e.kind,types:n(e.possibleTypes||[])}}},i={query:e.queryType?e.queryType.name:null,mutation:e.mutationType?e.mutationType.name:null,subscription:e.subscriptionType?e.subscriptionType.name:null,types:void 0,isSubType(e,n){var r=t.get(e),i=t.get(n);return!r||!i?!1:r.kind===`UNION`?!!r.types()[n]:r.kind!==`OBJECT`&&i.kind===`OBJECT`?!!i.interfaces()[e]:e===n}};if(e.types){i.types=t;for(var a=0;a<e.types.length;a++){var o=e.types[a];if(o&&o.name){var s=r(o);s&&t.set(o.name,s)}}}return i})(e.schema);t=i.query||t,n=i.mutation||n,r=i.subscription||r,i.types&&(this.schema=i)}if(!this.schema&&e.possibleTypes){this.possibleTypeMap=new Map;for(var a of Object.entries(e.possibleTypes)){var[o,s]=a;this.possibleTypeMap.set(o,new Set(s))}}this.updates=e.updates||{},this.rootFields={query:t,mutation:n,subscription:r},this.rootNames={[t]:`query`,[n]:`mutation`,[r]:`subscription`},this.data=(c=t,{hydrating:!1,defer:!1,gc:new Set,types:new Map,persist:new Set,queryRootKey:c,refCount:new Map,links:{optimistic:new Map,base:new Map},abstractToConcreteMap:new Map,records:{optimistic:new Map,base:new Map},deferredKeys:new Set,commutativeKeys:new Set,dirtyKeys:new Set,optimisticOrder:[],storage:null});var c;this.schema}keyOfField(e,t){return Su(e,t)}keyOfEntity(e){if(cd&&e===cd.parent)return cd.parentKey;if(e==null||typeof e==`string`)return e||null;if(!e.__typename)return null;if(this.rootNames[e.__typename])return e.__typename;var t=null;this.keys[e.__typename]?t=this.keys[e.__typename](e)||null:e.id==null?e._id!=null&&(t=`${e._id}`):t=`${e.id}`;var n=e.__typename;return!0===this.globalIDs||this.globalIDs&&this.globalIDs.has(n)||!t?t:`${n}:${t}`}resolve(e,t,n){var r=this.keyOfEntity(e);if(r){var i=Su(t,n),a=Ju(r,i);if(a!==void 0)return a;var o=Yu(r,i);return o!==void 0&&(o=yd(this,o)),o}}invalidate(e,t,n){var r=this.keyOfEntity(e);e&&typeof e==`string`&&!t&&!n&&!this.resolve(e,`__typename`)?kd(e,[]):($l(r,``,19),Od(r,t,n))}inspectFields(e){var t=this.keyOfEntity(e);return t?ad(t):[]}updateQuery(e,t){var n=Kl(e.query,e.variables),r=t(this.readQuery(n));r!==null&&Ad(this,n,r,void 0)}readQuery(e){var t=Kl(e.query,e.variables);return bd(this,t,void 0,void 0).data}readFragment(e,t,n,r){return((e,t,n,r,i)=>{var a=fu(t),o;if(i){if(!(o=a[i]))return null}else if(!(o=a[Object.keys(a)[0]]))return null;var s=ru(o);typeof n!=`string`&&!n.__typename&&(n.__typename=s);var c=e.keyOfEntity(n);return c&&wd(fd(e,r||{},a,s,c,void 0),c,ou(o),Nu())||null})(this,Xl(e),t,n,r)}writeFragment(e,t,n,r){((e,t,n,r,i)=>{var a=fu(t),o;if(i){if(!(o=a[i]))return null}else if(!(o=a[Object.keys(a)[0]]))return null;var s=ru(o),c={__typename:s,...n},l=e.keyOfEntity(c);l&&jd(fd(e,r||{},a,s,l,void 0),l,ou(o),c)})(this,Xl(e),t,n,r)}link(e,t,...n){var r=n.length===2?n[0]:null,i=n.length===2?n[1]:n[0],a=this.keyOfEntity(e);a&&$u(a,Su(t,r),yd(this,i))}},Pd=(e,t)=>Zl(e.kind,e,{...e.context,meta:{...e.context.meta,...t}}),Fd=(e,t)=>Zl(e.kind,e,{...e.context,requestPolicy:t}),Id=e=>({forward:t,client:n,dispatchDebug:r})=>{var i=new Nd(e);e&&e.storage&&(i.data.hydrating=!0,e.storage.readData().then((t=>{((e,t,n)=>{for(var r in Fu(`write`,e,null),n){var i=n[r];if(i!==void 0){var{entityKey:a,fieldKey:o}=Tu(r);i[0]===`:`?Yu(a,o)===void 0&&$u(a,o,JSON.parse(i.slice(1))):Ju(a,o)===void 0&&Zu(a,o,JSON.parse(i))}}e.storage=t,e.hydrating=!1,Iu()})(i.data,e.storage,t),e.storage.onCacheHydrated&&e.storage.onCacheHydrated()})));var a=new Map,o=[],s=new Map,c=new Map,l=new Set,u=new Set,d=new Map,f=new Set,p=new Set,m=e=>{for(var t of e.values())if(l.has(t))return!0;return!1},h=(e,t)=>{if(t)for(var n of t.values()){var r=d.get(n);if(r)for(var i of r.values())e.add(i)}},g=(e,t,r)=>{for(var i of t.values())if(i!==e.key){var a=s.get(i);if(a){e.kind===`query`&&p.add(i);var o=`cache-first`;u.has(i)&&(u.delete(i),o=`cache-and-network`),n.reexecuteOperation(Fd(a,o))}}if(!r){var c=f;f=p,e.kind===`query`&&f.add(e.key),(p=c).clear()}},_=e=>{var t=!1;if(e.kind===`query`)ed(i.data,e.key),s.set(e.key,e);else if(e.kind===`teardown`)return s.delete(e.key),c.delete(e.key),f.delete(e.key),Lu(i.data,e.key),e;else if(e.kind===`mutation`&&e.context.requestPolicy!==`network-only`){s.set(e.key,e),Fu(`write`,i.data,e.key,!0,!1);var{dependencies:n}=Ad(i,e,void 0,void 0);if(Iu(),n.size){for(var r of n.values())l.add(r);a.set(e.key,n);var o=new Set;h(o,n),g(e,o,!0),t=!0}}return Zl(e.kind,{key:e.key,query:Xl(e.query),variables:e.variables?lu(du(e.query),e.variables):e.variables},{...e.context,optimistic:t})},v=(e,t)=>{for(var n of t.values()){var r=d.get(n);r||d.set(n,r=new Set),r.add(e.key)}},y=e=>{Fu(`read`,i.data,void 0,!1,!1);var t=bd(i,e,c.get(e.key),void 0);Iu();var n=t.data?!t.partial&&!t.hasNext?`hit`:`partial`:`miss`;return c.set(e.key,t.data),s.set(e.key,e),v(e,t.dependencies),{outcome:n,operation:e,data:t.data,dependencies:t.dependencies,hasNext:t.hasNext}},b=(e,t)=>{var n=s.get(e.operation.key)||e.operation;n.kind===`mutation`&&(h(t,a.get(n.key)),a.delete(n.key)),(n.kind===`subscription`||e.hasNext)&&ed(i.data,n.key,!0);var r,o=e.data;if(o){Fu(`write`,i.data,n.key,!1,!1);var l=Ad(i,n,o,e.error).dependencies;Iu(),h(t,l);var u=n.kind===`query`?c.get(n.key):null;Fu(`read`,i.data,n.key,!1,u!==o);var d=bd(i,n,u||o,e.error);Iu(),o=d.data,n.kind===`query`&&(h(t,r=d.dependencies),c.set(n.key,o))}else Lu(i.data,n.key);return r&&v(e.operation,r),{operation:n,data:o,error:e.error,extensions:e.extensions,hasNext:e.hasNext,stale:e.stale}};return e=>{var r=Mi(Ti(y)(wi((e=>e.kind===`query`&&e.context.requestPolicy!==`network-only`))(e))),c=wi((e=>e.kind!==`query`||e.context.requestPolicy===`network-only`))(e),d=Ti((e=>Pd(e.operation,{cacheOutcome:`miss`})))(wi((e=>e.outcome===`miss`&&e.operation.context.requestPolicy!==`cache-only`&&!m(e.dependencies)&&!f.has(e.operation.key)))(r)),p=Ti((e=>{var{requestPolicy:t}=e.operation.context,r=t!==`cache-only`&&(e.hasNext||t===`cache-and-network`||t===`cache-first`&&e.outcome===`partial`&&!f.has(e.operation.key)),a=t!==`cache-only`&&(r||e.outcome===`partial`&&f.has(e.operation.key)&&((o=i.data).commutativeKeys.has(c=e.operation.key)||o.optimisticOrder.indexOf(c)>-1)),o,c,l={operation:Pd(e.operation,{cacheOutcome:e.outcome}),data:e.data,error:e.error,extensions:e.extensions,stale:a&&!e.hasNext,hasNext:r&&e.hasNext};return r&&(m(e.dependencies)?t===`cache-and-network`&&u.add(e.operation.key):n.reexecuteOperation(Fd(s.get(e.operation.key)||e.operation,`network-only`))),l}))(wi((e=>e.outcome!==`miss`||e.operation.context.requestPolicy===`cache-only`))(r)),h=t(Ti(_)(Oi([c,d])));return Oi([Ti((e=>{var t=new Set,n=b(e,t);return g(e.operation,t,!1),n}))(wi((e=>!a.has(e.operation.key)))(h)),Ei((e=>{if(o.push(e)<a.size)return Wi;for(var t=0;t<o.length;t++)ed(i.data,o[t].operation.key);l.clear();for(var n=[],r=new Set,s;s=o.shift();)n.push(b(s,r));return g(e.operation,r,!1),Bi(n)}))(wi((e=>a.has(e.operation.key)))(h)),p])}},Ld={Media:e=>e._id,MediaHandle:()=>null,MediaRelationEdge:()=>null,MediaFranchise:()=>null,MediaFranchiseNode:()=>null,MediaFranchiseEdge:()=>null,EpisodeHandle:()=>null,MediaTitle:()=>null,MediaDescription:()=>null,MediaShortDescription:()=>null,MediaCover:()=>null,MediaBanner:()=>null,MediaAiringEpisode:()=>null,MediaFieldProvenance:()=>null,MediaAnomaly:()=>null,MediaPerson:()=>null,MediaCharacter:()=>null,MediaTheme:()=>null,MediaRating:()=>null,MediaSeasonLink:()=>null,MediaTrailer:e=>e.uri,Episode:e=>e._id,EpisodeTitle:()=>null,EpisodeDescription:()=>null,EpisodeShortDescription:()=>null,EpisodeThumbnail:()=>null,PlaybackSource:e=>e.uri,Tracking:e=>String(e._id),TrackerAnswer:e=>String(e._id),Tracker:e=>e.id,ListEntry:e=>String(e._id),FuzzyDate:()=>null,WriteOutcome:()=>null,StubTrackerStorage:()=>null},Rd=()=>{let e=new Map;return{exchange:({forward:t})=>n=>Yi(t(Yi(n,Ai(t=>{t.kind===`teardown`&&e.delete(t.key)}))),Ai(t=>{t.operation.kind===`subscription`&&e.set(t.operation.key,t)})),replay:t=>{let n=t.executeRequestOperation.bind(t);return t.executeRequestOperation=(t=>{let r=n(t);if(t.kind!==`subscription`)return r;let i=Li(()=>{let n=e.get(t.key);return n?Oi([Vi(n),r]):r}),a=()=>Ji(Yi(i,wi(e=>!e.stale&&!e.hasNext),Pi(1)));return Object.assign(i,{toPromise:a,then:((e,t)=>a().then(e,t)),subscribe:e=>Yi(i,Ki(e))})}),t}}},zd=Id({schema:{__schema:JSON.parse(`{"queryType":{"name":"Query","kind":"OBJECT"},"mutationType":{"name":"Mutation","kind":"OBJECT"},"subscriptionType":{"name":"Subscription","kind":"OBJECT"},"types":[{"kind":"OBJECT","name":"Episode","fields":[{"name":"_id","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"absoluteEpisodeNumber","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"absoluteNumber","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"descriptions","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"EpisodeDescription","ofType":null}}}},"args":[{"name":"input","type":{"kind":"SCALAR","name":"Any"}}]},{"name":"embedUrl","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"episodeNumber","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"handles","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"EpisodeHandle","ofType":null}}}},"args":[]},{"name":"id","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"mediaUri","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"origin","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"relativeNumber","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"releaseDate","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"runtime","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"seasonNumber","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"shortDescriptions","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"EpisodeShortDescription","ofType":null}}}},"args":[{"name":"input","type":{"kind":"SCALAR","name":"Any"}}]},{"name":"thumbnails","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"EpisodeThumbnail","ofType":null}}}},"args":[]},{"name":"titles","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"EpisodeTitle","ofType":null}}}},"args":[]},{"name":"uri","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"url","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"EpisodeDescription","fields":[{"name":"description","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"language","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"EpisodeHandle","fields":[{"name":"node","type":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"Episode","ofType":null}},"args":[]},{"name":"relation","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"EpisodeShortDescription","fields":[{"name":"language","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"shortDescription","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"EpisodeThumbnail","fields":[{"name":"color","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"height","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"language","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"url","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"width","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"EpisodeTitle","fields":[{"name":"language","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"title","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"FuzzyDate","fields":[{"name":"day","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"month","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"year","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"ListEntry","fields":[{"name":"_id","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"completedAt","type":{"kind":"OBJECT","name":"FuzzyDate","ofType":null},"args":[]},{"name":"cover","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"episodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"mediaUri","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"progress","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"rewatchCount","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"startedAt","type":{"kind":"OBJECT","name":"FuzzyDate","ofType":null},"args":[]},{"name":"status","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"title","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"tracker","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"updatedAt","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"url","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"Media","fields":[{"name":"_id","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"airingSchedule","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaAiringEpisode","ofType":null}}},"args":[]},{"name":"anomalies","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaAnomaly","ofType":null}}},"args":[]},{"name":"averageScore","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"banners","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaBanner","ofType":null}}}},"args":[]},{"name":"categories","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}},"args":[]},{"name":"characters","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaCharacter","ofType":null}}},"args":[]},{"name":"covers","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaCover","ofType":null}}}},"args":[]},{"name":"descriptions","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaDescription","ofType":null}}}},"args":[{"name":"input","type":{"kind":"SCALAR","name":"Any"}}]},{"name":"duration","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"endDate","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"episodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"episodes","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"Episode","ofType":null}}}},"args":[]},{"name":"franchise","type":{"kind":"OBJECT","name":"MediaFranchise","ofType":null},"args":[]},{"name":"genres","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}},"args":[]},{"name":"handles","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaHandle","ofType":null}}}},"args":[]},{"name":"id","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"isAdult","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"kind","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"nextAiringEpisode","type":{"kind":"OBJECT","name":"MediaAiringEpisode","ofType":null},"args":[]},{"name":"origin","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"popularity","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"provenance","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaFieldProvenance","ofType":null}}},"args":[]},{"name":"ratings","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaRating","ofType":null}}},"args":[]},{"name":"relations","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaRelationEdge","ofType":null}}}},"args":[]},{"name":"scope","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"season","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"seasonYear","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"seasons","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaSeasonLink","ofType":null}}},"args":[]},{"name":"settled","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"shortDescriptions","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaShortDescription","ofType":null}}}},"args":[{"name":"input","type":{"kind":"SCALAR","name":"Any"}}]},{"name":"sourceMaterial","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"staff","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaPerson","ofType":null}}},"args":[]},{"name":"startDate","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"status","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"studios","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}},"args":[]},{"name":"tags","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}},"args":[]},{"name":"themes","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaTheme","ofType":null}}},"args":[]},{"name":"titles","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaTitle","ofType":null}}}},"args":[]},{"name":"trailers","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaTrailer","ofType":null}}}},"args":[]},{"name":"type","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"uri","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"url","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaAiringEpisode","fields":[{"name":"airingAt","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"episodeNumber","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaAnomaly","fields":[{"name":"detail","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"rule","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaBanner","fields":[{"name":"color","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"height","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"language","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"url","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"width","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaCharacter","fields":[{"name":"image","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"name","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"role","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"url","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"voiceActors","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaPerson","ofType":null}}}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaCover","fields":[{"name":"color","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"height","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"language","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"url","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"width","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaDescription","fields":[{"name":"description","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"language","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaFieldProvenance","fields":[{"name":"answerSeq","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"field","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"rule","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"tier","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"uri","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"uris","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}},"args":[]},{"name":"witnesses","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaFranchise","fields":[{"name":"edges","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaFranchiseEdge","ofType":null}}}},"args":[]},{"name":"nodes","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaFranchiseNode","ofType":null}}}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaFranchiseEdge","fields":[{"name":"from","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"relation","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"to","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaFranchiseNode","fields":[{"name":"covers","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaCover","ofType":null}}}},"args":[]},{"name":"episodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"format","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"startDate","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"status","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"titles","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaTitle","ofType":null}}}},"args":[]},{"name":"uri","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaHandle","fields":[{"name":"by","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"node","type":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"Media","ofType":null}},"args":[]},{"name":"provenance","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"relation","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"via","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaPage","fields":[{"name":"afterCurrentPageNodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"beforeCurrentPageNodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"currentPageCursor","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"currentPageNodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"firstPageCursor","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"lastPageCursor","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"nextPageCursor","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"nodes","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"Media","ofType":null}}}},"args":[]},{"name":"previousPageCursor","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"totalNodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaPerson","fields":[{"name":"image","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"language","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"name","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"roles","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}},"args":[]},{"name":"url","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaRating","fields":[{"name":"scale","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"source","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"value","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaRelationEdge","fields":[{"name":"format","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"node","type":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"Media","ofType":null}},"args":[]},{"name":"relation","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaSeasonLink","fields":[{"name":"number","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"uri","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaShortDescription","fields":[{"name":"language","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"shortDescription","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaTheme","fields":[{"name":"artists","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}},"args":[]},{"name":"kind","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"sequence","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"title","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"video","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaTitle","fields":[{"name":"language","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"score","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"title","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"MediaTrailer","fields":[{"name":"id","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"language","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"origin","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"thumbnail","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"uri","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"url","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"Mutation","fields":[{"name":"_empty","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"addHeldStubEntries","type":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"StubTrackerStorage","ofType":null}},"args":[]},{"name":"deleteListEntry","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"WriteOutcome","ofType":null}}}},"args":[{"name":"input","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}]},{"name":"saveListEntry","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"WriteOutcome","ofType":null}}}},"args":[{"name":"input","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}]}],"interfaces":[]},{"kind":"OBJECT","name":"Origin","fields":[{"name":"color","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"icon","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"id","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"isApiOnly","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"name","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"url","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"OriginPage","fields":[{"name":"afterCurrentPageNodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"beforeCurrentPageNodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"currentPageCursor","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"currentPageNodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"firstPageCursor","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"lastPageCursor","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"nextPageCursor","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"nodes","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"Origin","ofType":null}}}},"args":[]},{"name":"previousPageCursor","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"totalNodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"PlaybackSource","fields":[{"name":"Episode","type":{"kind":"OBJECT","name":"Episode","ofType":null},"args":[]},{"name":"data","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"id","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"origin","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"type","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"uri","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"url","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"Query","fields":[{"name":"_empty","type":{"kind":"SCALAR","name":"Any"},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"StubTrackerStorage","fields":[{"name":"error","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"held","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"location","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"locked","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"signedIn","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"waiting","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"Subscription","fields":[{"name":"_empty","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"containingMedia","type":{"kind":"OBJECT","name":"Media","ofType":null},"args":[{"name":"input","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}]},{"name":"media","type":{"kind":"OBJECT","name":"Media","ofType":null},"args":[{"name":"input","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}]},{"name":"mediaPage","type":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"MediaPage","ofType":null}},"args":[{"name":"input","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}]},{"name":"origin","type":{"kind":"OBJECT","name":"Origin","ofType":null},"args":[{"name":"input","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}]},{"name":"originPage","type":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"OriginPage","ofType":null}},"args":[{"name":"input","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}]},{"name":"similarMedia","type":{"kind":"OBJECT","name":"Media","ofType":null},"args":[{"name":"input","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}]},{"name":"stubTrackerStorage","type":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"StubTrackerStorage","ofType":null}},"args":[]},{"name":"tracking","type":{"kind":"OBJECT","name":"Tracking","ofType":null},"args":[{"name":"input","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}]}],"interfaces":[]},{"kind":"OBJECT","name":"Tracker","fields":[{"name":"account","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"canClearScore","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"canWrite","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"color","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"icon","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"id","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"name","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"scoreScale","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"signedIn","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"statuses","type":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"TrackerAnswer","fields":[{"name":"_id","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"candidates","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}},"args":[]},{"name":"entry","type":{"kind":"OBJECT","name":"ListEntry","ofType":null},"args":[]},{"name":"episodeCount","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"error","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"state","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"tracker","type":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"Tracker","ofType":null}},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"Tracking","fields":[{"name":"_id","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"answers","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"OBJECT","name":"TrackerAnswer","ofType":null}}}},"args":[]},{"name":"disagreements","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}},"args":[]},{"name":"summary","type":{"kind":"OBJECT","name":"ListEntry","ofType":null},"args":[]}],"interfaces":[]},{"kind":"OBJECT","name":"WriteOutcome","fields":[{"name":"entry","type":{"kind":"OBJECT","name":"ListEntry","ofType":null},"args":[]},{"name":"error","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"outcome","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"tracker","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]}],"interfaces":[]},{"kind":"SCALAR","name":"Any"}],"directives":[]}`)},keys:Ld,resolvers:{}}),Bd=Rd(),Vd=Bd.replay(new Ba({url:`http://d/graphql`,exchanges:[Bd.exchange,Ra({onError(e,t){for(let n of e.graphQLErrors)console.error(Error(n.message,{cause:`GQL Error originated from ${t.query.definitions.find(e=>e.kind===`OperationDefinition`)?.name?.value}`}))}}),Ol,zd,Ia],fetchSubscriptions:!0,fetch:async(e,t)=>Pt(e,t)}));function Hd(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,i,a,o=[],s=``,c=e.split(`/`);for(c[0]||c.shift();i=c.shift();)n=i[0],n===`*`?(o.push(n),s+=i[1]===`?`?`(?:/(.*))?`:`/(.*)`):n===`:`?(r=i.indexOf(`?`,1),a=i.indexOf(`.`,1),o.push(i.substring(1,~r?r:~a?a:i.length)),s+=~r&&!~a?`(?:/([^/]+?))?`:`/([^/]+?)`,~a&&(s+=(~r?`?`:``)+`\\`+i.substring(a))):s+=`/`+i;return{keys:o,pattern:RegExp(`^`+s+(t?`(?=$|/)`:`/?$`),`i`)}}var Ud=t((t=>{var n=(Je(),e(qe));function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useState,o=n.useEffect,s=n.useLayoutEffect,c=n.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;t.useSyncExternalStore=n.useSyncExternalStore===void 0?f:n.useSyncExternalStore})),Wd=t(((e,t)=>{t.exports=Ud()}));Je();var Gd=Wd(),Kd=Te,qd=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?et:V,Jd=Kd||qd,Yd=e=>{let t=q([e,(...e)=>t[0](...e)]).current;return Jd(()=>{t[0]=e}),t[1]},Xd=`popstate`,Zd=`pushState`,Qd=`replaceState`,$d=[Xd,Zd,Qd,`hashchange`],ef=e=>{for(let t of $d)addEventListener(t,e);return()=>{for(let t of $d)removeEventListener(t,e)}},tf=(e,t)=>(0,Gd.useSyncExternalStore)(ef,e,t),nf=()=>location.search,rf=({ssrSearch:e=``}={})=>tf(nf,()=>e),af=()=>location.pathname,of=({ssrPath:e}={})=>tf(af,e?()=>e:af),sf=(e,{replace:t=!1,state:n=null}={})=>history[t?Qd:Zd](n,``,e),cf=(e={})=>[of(e),sf],lf=Symbol.for(`wouter_v3`);if(typeof history<`u`&&window[lf]===void 0){for(let e of[Zd,Qd]){let t=history[e];history[e]=function(){let n=t.apply(this,arguments),r=new Event(e);return r.arguments=arguments,dispatchEvent(r),n}}Object.defineProperty(window,lf,{value:!0})}var uf=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?`~`+t:t.slice(e.length)||`/`,df=(e=``)=>e===`/`?``:e,ff=(e,t)=>e[0]===`~`?e.slice(1):df(t)+e,pf=(e=``,t)=>uf(hf(df(e)),hf(t)),mf=e=>e[0]===`?`?e.slice(1):e,hf=e=>{try{return decodeURI(e)}catch{return e}},gf=e=>hf(mf(e)),_f={hook:cf,searchHook:rf,parser:Hd,base:``,ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},vf=nt(_f),yf=()=>Ze(vf),bf={},xf=nt(bf),Sf=()=>Ze(xf),Cf=e=>{let[t,n]=e.hook(e);return[pf(e.base,t),Yd((t,r)=>n(ff(t,e.base),r))]},wf=()=>Cf(yf()),Tf=()=>{let e=yf();return gf(e.searchHook(e))},Ef=(e,t,n,r)=>{let{pattern:i,keys:a}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||`*`,r),o=i.exec(n)||[],[s,...c]=o;return s===void 0?[!1,null]:[!0,(()=>{let e=a===!1?o.groups:Object.fromEntries(a.map((e,t)=>[e,c[t]])),t={...c};return e&&Object.assign(t,e),t})(),...r?[s]:[]]},Df=e=>Ef(yf().parser,e,wf()[0]),Of=({children:e,...t})=>{let n=yf(),r=t.hook?_f:n,i=r,[a,o]=t.ssrPath?.split(`?`)??[];o&&(t.ssrSearch=o,t.ssrPath=a),t.hrefs=t.hrefs??t.hook?.hrefs;let s=q({}),c=s.current,l=c;for(let e in r){let n=e===`base`?r[e]+(t[e]||``):t[e]||r[e];c===l&&n!==l[e]&&(s.current=l={...l}),l[e]=n,(n!==r[e]||n!==i[e])&&(i=l)}return ht(vf.Provider,{value:i,children:e})},kf=({children:e,component:t},n)=>t?ht(t,{params:n}):typeof e==`function`?e(n):e,Af=e=>{let t=q(bf),n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([e,t])=>t!==n[e])?e:n},jf=({path:e,nest:t,match:n,...r})=>{let i=yf(),[a]=Cf(i),[o,s,c]=n??Ef(i.parser,e,a,t),l=Af({...Sf(),...s});if(!o)return null;let u=c?ht(Of,{base:c},kf(r,l)):kf(r,l);return ht(xf.Provider,{value:l,children:u})},Mf=gt((e,t)=>{let n=yf(),[r,i]=Cf(n),{to:a=``,href:o=a,onClick:s,asChild:c,children:l,className:u,replace:d,state:f,...p}=e,m=Yd(t=>{t.ctrlKey||t.metaKey||t.altKey||t.shiftKey||t.button!==0||(s?.(t),t.defaultPrevented||(t.preventDefault(),i(o,e)))}),h=n.hrefs(o[0]===`~`?o.slice(1):n.base+o,n);return c&&ze(l)?Ke(l,{onClick:m,href:h}):ht(`a`,{...p,onClick:m,href:h,className:u?.call?u(r===o):u,children:l,ref:t})}),Nf=e=>Array.isArray(e)?e.flatMap(e=>Nf(e&&e.type===ot?e.props.children:e)):[e],Pf=({children:e,location:t})=>{let n=yf(),[r]=Cf(n);for(let i of Nf(e)){let e=0;if(ze(i)&&(e=Ef(n.parser,i.props.path,t||r,i.props.nest))[0])return Ke(i,{match:e})}return null},Ff=e=>{let{to:t,href:n=t}=e,r=yf(),[,i]=Cf(r),a=Yd(()=>i(t||n,e)),{ssrContext:o}=r;return qd(()=>{a()},[]),o&&(o.redirectTo=t),null},Q=function(e){return e.HOME=`HOME`,e.MEDIA=`MEDIA`,e.MEDIA_EPISODE=`MEDIA_EPISODE`,e.TITLE=`TITLE`,e.SEARCH=`SEARCH`,e.SEARCH_LEGACY=`SEARCH_LEGACY`,e.LEGAL=`LEGAL`,e.PRIVACY=`PRIVACY`,e.SETTINGS=`SETTINGS`,e.WATCH=`WATCH`,e.PARTY=`PARTY`,e.DEBUG_TRACE=`DEBUG_TRACE`,e.LOGIN_CALLBACK=`LOGIN_CALLBACK`,e}({}),If={HOME:()=>`/`,MEDIA:({uri:e})=>`/media/${e}`,MEDIA_EPISODE:({uri:e,mediaUri:t})=>`/media/${e}/${t}`,TITLE:({uri:e})=>`/title/${e}`,SEARCH:()=>`/search`,SEARCH_LEGACY:({query:e})=>`/search/${encodeURIComponent(e)}`,LEGAL:()=>`/legal`,PRIVACY:()=>`/privacy`,SETTINGS:()=>`/settings`,WATCH:({mediaUri:e,episodeUri:t,sourceUri:n})=>`/watch/${e}/${t}${n?`/${n}`:``}`,PARTY:()=>`/party`,DEBUG_TRACE:()=>`/debug/trace`,LOGIN_CALLBACK:()=>`/login/callback`},Lf={HOME:`/`,MEDIA:`/media/:uri`,MEDIA_EPISODE:`/media/:uri/:mediaUri`,TITLE:`/title/:uri`,SEARCH:`/search`,SEARCH_LEGACY:`/search/:query`,LEGAL:`/legal`,PRIVACY:`/privacy`,SETTINGS:`/settings`,WATCH:`/watch/:mediaUri/:episodeUri/:sourceUri?`,PARTY:`/party`,DEBUG_TRACE:`/debug/trace`,LOGIN_CALLBACK:`/login/callback`},Rf=e=>Lf[e],zf=(e,t)=>If[e](t),Bf={"Action & Adventure":`act`,Animation:`ani`,Comedy:`cmy`,Crime:`crm`,Documentary:`doc`,Drama:`drm`,Fantasy:`fnt`,History:`hst`,Horror:`hrr`,"Kids & Family":`fml`,"Music & Musical":`msc`,"Mystery & Thriller":`trl`,"Reality TV":`rly`,Romance:`rma`,"Science-Fiction":`scf`,Sport:`spt`,"War & Military":`war`,Western:`wsn`},Vf=e=>/^[\w-]{28}$/.test(e??``),Hf={limit:`trace.moe's daily limit is reached. Try again tomorrow.`,busy:`trace.moe is busy. Try again in a moment.`,failed:`trace.moe could not search this picture.`};Promise.resolve();var Uf=({episode:e,from:t})=>{let n=Math.floor(t),r=e=>String(e).padStart(2,`0`),i=Math.floor(n/60),a=i>=60?`${Math.floor(i/60)}:${r(i%60)}:${r(n%60)}`:`${i}:${r(n%60)}`;return e==null?a:`Episode ${e}, ${a}`},Wf={query:`q`,category:`category`,status:`status`,season:`season`,year:`year`,format:`format`,genre:`genre`,tag:`tag`},Gf=[{value:go.Tv,label:`TV Show`},{value:go.Movie,label:`Movie`},{value:go.TvShort,label:`TV Short`},{value:go.Special,label:`Special`},{value:go.Ova,label:`OVA`},{value:go.Ona,label:`ONA`}],Kf=[{value:ho.Releasing,label:`Airing`},{value:ho.Finished,label:`Finished`},{value:ho.NotYetReleased,label:`Not yet aired`},{value:ho.Cancelled,label:`Cancelled`},{value:ho.Hiatus,label:`Hiatus`}],qf=[{value:po.Winter,label:`Winter`},{value:po.Spring,label:`Spring`},{value:po.Summer,label:`Summer`},{value:po.Fall,label:`Fall`}],Jf=[{value:uo.Anime,label:`Anime`},{value:uo.Series,label:`Series`},{value:uo.Movie,label:`Movies`}],Yf=[`Action`,`Adventure`,`Comedy`,`Drama`,`Ecchi`,`Fantasy`,`Horror`,`Mahou Shoujo`,`Mecha`,`Music`,`Mystery`,`Psychological`,`Romance`,`Sci-Fi`,`Slice of Life`,`Sports`,`Supernatural`,`Thriller`],Xf={anime:Yf,movie:Object.keys(Bf),series:Object.keys(Bf),stub:[...new Set([...Yf,...Object.keys(Bf)])]},Zf=(e,t)=>e.find(e=>e===t)??null,Qf=(e,t)=>t.map(t=>Zf(e,t)).filter(e=>e!==null),$f=e=>qf.map(e=>e.value).find(t=>t===e)??null,ep=Gf.map(e=>e.value),tp=Kf.map(e=>e.value),np=qf.map(e=>e.value),rp=Jf.map(e=>e.value),ip=1917,ap=(e=new Date)=>e.getFullYear()+5,op=(e,t=new Date)=>{if(!e||!/^\d{4}$/.test(e))return null;let n=Number(e);return n>=1917&&n<=ap(t)?n:null},sp=(e,t=new Date)=>{let n=new URLSearchParams(e);return{query:(n.get(Wf.query)??``).trim(),category:Zf(rp,n.get(Wf.category)),status:Zf(tp,n.get(Wf.status)),season:Zf(np,n.get(Wf.season)),year:op(n.get(Wf.year),t),formats:Qf(ep,n.getAll(Wf.format)),genres:cp(n.getAll(Wf.genre)),tags:cp(n.getAll(Wf.tag))}},cp=e=>{let t=new Set,n=[];for(let r of e){let e=r.trim(),i=e.toLowerCase();e&&!t.has(i)&&(t.add(i),n.push(e))}return n},lp=e=>{let t=new URLSearchParams,n=e.query?.trim();n&&t.set(Wf.query,n),e.category&&t.set(Wf.category,e.category),e.status&&t.set(Wf.status,e.status),e.season&&t.set(Wf.season,e.season),e.year&&t.set(Wf.year,String(e.year));for(let n of e.formats??[])t.append(Wf.format,n);for(let n of e.genres??[])t.append(Wf.genre,n);for(let n of e.tags??[])t.append(Wf.tag,n);return t.toString()},up=e=>{if(!e)return``;try{return decodeURIComponent(e)}catch{return e}},dp=(e={})=>{let t=lp(e);return t?`/search?${t}`:`/search`},fp=`scene`,pp=e=>`/search?${fp}=${e}`,mp=e=>{let t=new URLSearchParams(e).get(fp);return Vf(t)?t:void 0},hp=e=>{if(e.query)return`Results for \u201C${e.query}\u201D`;let t=qf.find(t=>t.value===e.season)?.label;return t&&e.year?`${t} ${e.year}`:t?`${t} seasons`:e.year?String(e.year):yp(e)?`Browsing`:`Search`},gp=e=>Gf.find(t=>t.value===e)?.label,_p=e=>Kf.find(t=>t.value===e)?.label,vp=(e,t)=>{let n=qf.find(t=>t.value===e)?.label;return n&&t?`${n} ${t}`:t?String(t):void 0},yp=e=>!!(e.query||e.category||e.status||e.season||e.year||e.formats.length||e.genres.length||e.tags.length),bp=e=>!!(e.query||e.status||e.season||e.year||e.formats.length||e.genres.length||e.tags.length),xp=`plugins`,Sp=`plugin`,Cp=(e,t)=>{try{return new URL(e,t)}catch{return}},wp=e=>{let t=new Set;return e.filter(e=>{let n=Tp(e);return!n||t.has(n)?!1:(t.add(n),!0)})},Tp=e=>e.trim().replace(/\/+$/,``).replace(/@\d[^@/]*$/,``),Ep=(e,t)=>{let n=Cp(e,t);return n?wp([...n.searchParams].filter(([e])=>e===`plugins`||e===Sp).map(([,e])=>e.trim())):[]},Dp=e=>encodeURIComponent(e).replace(/%3A/g,`:`).replace(/%2F/g,`/`).replace(/%40/g,`@`),Op=(e,t,n)=>{let r=Cp(e,n),i=Cp(n);return!r||!i||r.origin!==i.origin?e:(r.searchParams.delete(xp),r.searchParams.delete(Sp),r.search=[r.searchParams.toString(),wp(t.map(e=>e.trim())).sort().map(e=>`${xp}=${Dp(e)}`).join(`&`)].filter(Boolean).join(`&`),r.href)},kp=new Map,Ap=new Set,jp=new Set,Mp=()=>jp.forEach(e=>{try{e()}catch{}}),Np=e=>(jp.add(e),()=>{jp.delete(e)}),Pp=()=>[...kp.values()],Fp=()=>[...kp.keys()],Ip=()=>new Set(Ns().map(Tp)),Lp=e=>{let t=Ip(),n=!1;for(let r of e){let e=Tp(r);!e||t.has(e)||Ap.has(e)||kp.has(r)||(kp.set(r,{uri:r,state:`offered`}),n=!0)}n&&Mp()};js(()=>{let e=Ip(),t=!1;for(let[n,r]of kp)r.state===`offered`&&e.has(Tp(n))&&(kp.delete(n),t=!0);t&&Mp()});var Rp=()=>{if(kp.size){for(let e of kp.keys())Ap.add(Tp(e));kp.clear(),Mp()}},zp=async()=>{let e=[...kp.keys()];if(e.length){for(let t of e)kp.set(t,{uri:t,state:`installing`});Mp();for(let t of e){try{await Js(t,{noConfirm:!0})||Ap.add(Tp(t)),kp.delete(t)}catch(e){console.warn(`Source '${t}' could not be added:`,e),kp.set(t,{uri:t,state:`error`})}Mp()}}},Bp=e=>{kp.delete(e)&&(Ap.add(Tp(e)),Mp())},Vp=()=>[...Ns(),...Fp()],Hp=()=>{let e=Op(location.href,Vp(),location.href);e!==location.href&&history.replaceState(history.state,``,e)},Up=()=>Lp(Ep(location.href)),Wp=e=>{let t=Op(e,Vp(),location.href);return t.startsWith(location.origin)?t.slice(location.origin.length):t},Gp=e=>{let t=history[e];history[e]=function(e,n,r){let i=r==null?location.href:String(r);return t.call(this,e,n,Op(i,Vp(),location.href))}},Kp=Symbol.for(`stub_plugin_url`);Kp in globalThis||(Object.defineProperty(globalThis,Kp,{value:!0}),Gp(`pushState`),Gp(`replaceState`),addEventListener(`popstate`,()=>{Up(),Hp()}),js(Hp),Np(Hp),Up(),Hp());var qp=`input:not([inert]),select:not([inert]),textarea:not([inert]),a[href]:not([inert]),button:not([inert]),[tabindex]:not(slot):not([inert]),audio[controls]:not([inert]),video[controls]:not([inert]),[contenteditable]:not([contenteditable="false"]):not([inert]),details>summary:first-of-type:not([inert]),details:not([inert])`,Jp=typeof Element>`u`,Yp=Jp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Xp=!Jp&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},Zp=function e(t,n){n===void 0&&(n=!0);var r=t?.getAttribute?.call(t,`inert`);return r===``||r===`true`||n&&t&&e(t.parentNode)},Qp=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},$p=function(e,t,n){if(Zp(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(qp));return t&&Yp.call(e,qp)&&r.unshift(e),r=r.filter(n),r},em=function e(t,n,r){for(var i=[],a=Array.from(t);a.length;){var o=a.shift();if(!Zp(o,!1)){if(o.tagName===`SLOT`){var s=o.assignedElements(),c=e(s.length?s:o.children,!0,r);r.flatten?i.push.apply(i,c):i.push({scopeParent:o,candidates:c})}else{Yp.call(o,qp)&&r.filter(o)&&(n||!t.includes(o))&&i.push(o);var l=o.shadowRoot||typeof r.getShadowRoot==`function`&&r.getShadowRoot(o),u=!Zp(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(l&&u){var d=e(l===!0?o.children:l.children,!0,r);r.flatten?i.push.apply(i,d):i.push({scopeParent:o,candidates:d})}else a.unshift.apply(a,o.children)}}}return i},tm=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},nm=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Qp(e))&&!tm(e)?0:e.tabIndex},rm=function(e,t){var n=nm(e);return n<0&&t&&!tm(e)?0:n},im=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},am=function(e){return e.tagName===`INPUT`},om=function(e){return am(e)&&e.type===`hidden`},sm=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},cm=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},lm=function(e){if(!e.name)return!0;var t=e.form||Xp(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){return console.error(`Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s`,e.message),!1}var i=cm(r,e.form);return!i||i===e},um=function(e){return am(e)&&e.type===`radio`},dm=function(e){return um(e)&&!lm(e)},fm=function(e){var t=e&&Xp(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=Xp(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},pm=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},mm=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(getComputedStyle(e).visibility===`hidden`)return!0;var i=Yp.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(Yp.call(i,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`legacy-full`){if(typeof r==`function`){for(var a=e;e;){var o=e.parentElement,s=Xp(e);if(o&&!o.shadowRoot&&r(o)===!0)return pm(e);e=e.assignedSlot?e.assignedSlot:!o&&s!==e.ownerDocument?s.host:o}e=a}if(fm(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return pm(e);return!1},hm=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return Yp.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},gm=function(e,t){return!(t.disabled||Zp(t)||om(t)||mm(t,e)||sm(t)||hm(t))},_m=function(e,t){return!(dm(t)||nm(t)<0||!gm(e,t))},vm=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},ym=function e(t){var n=[],r=[];return t.forEach(function(t,i){var a=!!t.scopeParent,o=a?t.scopeParent:t,s=rm(o,a),c=a?e(t.candidates):o;s===0?a?n.push.apply(n,c):n.push(o):r.push({documentOrder:i,tabIndex:s,item:t,isScope:a,content:c})}),r.sort(im).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(n)},bm=function(e,t){return t||={},ym(t.getShadowRoot?em([e],t.includeContainer,{filter:_m.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:vm}):$p(e,t.includeContainer,_m.bind(null,t)))},xm=function(e,t){return t||={},t.getShadowRoot?em([e],t.includeContainer,{filter:gm.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):$p(e,t.includeContainer,gm.bind(null,t))},Sm=function(e,t){if(t||={},!e)throw Error(`No node provided`);return Yp.call(e,qp)!==!1&&_m(t,e)};Je();function Cm(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function wm(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+`/`+n}).join(` `):navigator.userAgent}function Tm(){return/apple/i.test(navigator.vendor)}function Em(){let e=/android/i;return e.test(Cm())||e.test(wm())}function Dm(){return Cm().toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints}function Om(){return wm().includes(`jsdom/`)}var km=`data-floating-ui-focusable`,Am=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`;function jm(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Mm(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Pe(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Nm(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Pm(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Fm(e){return e.matches(`html,body`)}function Im(e){return e?.ownerDocument||document}function Lm(e){return Re(e)&&e.matches(Am)}function Rm(e){return e?e.getAttribute(`role`)===`combobox`&&Lm(e):!1}function zm(e){if(!e||Om())return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Bm(e){return e?e.hasAttribute(km)?e:e.querySelector(`[`+km+`]`)||e:null}function Vm(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Vm(e,t.id,n)])}function Hm(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function Um(e){e.preventDefault(),e.stopPropagation()}function Wm(e){return`nativeEvent`in e}function Gm(e){return e.mozInputSource===0&&e.isTrusted?!0:Em()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Km(e){return Om()?!1:!Em()&&e.width===0&&e.height===0||Em()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function qm(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var Jm=typeof document<`u`?et:function(){},Ym={...qe};function Xm(e){let t=q(e);return Jm(()=>{t.current=e}),t}var Zm=Ym.useInsertionEffect||(e=>e());function Qm(e){let t=q(()=>{});return Zm(()=>{t.current=e}),B(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}var $m=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function eh(e,t){let n=bm(e,$m()),r=n.length;if(r===0)return;let i=jm(Im(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function th(e){return eh(Im(e).body,1)||e}function nh(e){return eh(Im(e).body,-1)||e}function rh(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Mm(n,r)}function ih(e){bm(e,$m()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function ah(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}Je();var oh=typeof document<`u`?et:function(){};function sh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!sh(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!sh(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ch(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function lh(e,t){let n=ch(e);return Math.round(t*n)/n}function uh(e){let t=q(e);return oh(()=>{t.current=e}),t}function dh(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=W({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=W(r);sh(f,r)||p(r);let[m,h]=W(null),[g,_]=W(null),v=B(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=B(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=q(null),C=q(null),w=q(u),T=c!=null,E=uh(c),D=uh(i),O=uh(l),k=B(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Ve(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!sh(w.current,t)&&(w.current=t,Me(()=>{d(t)}))})},[f,t,n,D,O]);oh(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=q(!1);oh(()=>(A.current=!0,()=>{A.current=!1}),[]),oh(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=H(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=H(()=>({reference:b,floating:x}),[b,x]),N=H(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=lh(M.floating,u.x),r=lh(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ch(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return H(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var fh=(e,t)=>({...xt(e),options:[e,t]}),ph=(e,t)=>({...He(e),options:[e,t]}),mh=(e,t)=>({...De(e),options:[e,t]}),hh=(e,t)=>({...Oe(e),options:[e,t]});Je(),ft();function gh(e){let t=q(void 0),n=B(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return H(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}var _h=`data-floating-ui-focusable`,vh=`active`,yh=`selected`,bh=`ArrowLeft`,xh=`ArrowRight`,Sh=`ArrowUp`,Ch=`ArrowDown`,wh=[bh,xh],Th=[Sh,Ch];[...wh,...Th];var Eh={...qe},Dh=!1,Oh=0,kh=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+Oh++;function Ah(){let[e,t]=W(()=>Dh?kh():void 0);return Jm(()=>{e??t(kh())},[]),V(()=>{Dh=!0},[]),e}var jh=Eh.useId||Ah;function Mh(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}var Nh=nt(null),Ph=nt(null),Fh=()=>Ze(Nh)?.id||null,Ih=()=>Ze(Ph);function Lh(e){return`data-floating-ui-`+e}function Rh(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}var zh=Lh(`safe-polygon`);function Bh(e,t,n){if(n&&!qm(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function Vh(e){return typeof e==`function`?e():e}function Hh(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,events:a,elements:o}=e,{enabled:s=!0,delay:c=0,handleClose:l=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=t,p=Ih(),m=Fh(),h=Xm(l),g=Xm(c),_=Xm(n),v=Xm(d),y=q(),b=q(-1),x=q(),S=q(-1),C=q(!0),w=q(!1),T=q(()=>{}),E=q(!1),D=Qm(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});V(()=>{if(!s)return;function e(e){let{open:t}=e;t||(Rh(b),Rh(S),C.current=!0,E.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[s,a]),V(()=>{if(!s||!h.current||!n)return;function e(e){D()&&r(!1,e,`hover`)}let t=Im(o.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[o.floating,n,r,s,h,D]);let O=B(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=Bh(g.current,`close`,y.current);i&&!x.current?(Rh(b),b.current=window.setTimeout(()=>r(!1,e,n),i)):t&&(Rh(b),r(!1,e,n))},[g,r]),k=Qm(()=>{T.current(),x.current=void 0}),A=Qm(()=>{if(w.current){let e=Im(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(zh),w.current=!1}}),j=Qm(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);V(()=>{if(!s)return;function e(e){if(Rh(b),C.current=!1,u&&!qm(y.current)||Vh(v.current)>0&&!Bh(g.current,`open`))return;let t=Bh(g.current,`open`,y.current);t?b.current=window.setTimeout(()=>{_.current||r(!0,e,`hover`)},t):n||r(!0,e,`hover`)}function t(e){if(j()){A();return}T.current();let t=Im(o.floating);if(Rh(S),E.current=!1,h.current&&i.current.floatingContext){n||Rh(b),x.current=h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){A(),k(),j()||O(e,!0,`safe-polygon`)}});let r=x.current;t.addEventListener(`mousemove`,r),T.current=()=>{t.removeEventListener(`mousemove`,r)}}else y.current===`touch`&&Mm(o.floating,e.relatedTarget)||O(e)}function a(e){j()||i.current.floatingContext&&(h.current==null||h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){A(),k(),j()||O(e)}})(e))}function c(){Rh(b)}function l(e){j()||O(e,!1)}if(Ie(o.domReference)){let r=o.domReference,i=o.floating;return n&&r.addEventListener(`mouseleave`,a),f&&r.addEventListener(`mousemove`,e,{once:!0}),r.addEventListener(`mouseenter`,e),r.addEventListener(`mouseleave`,t),i&&(i.addEventListener(`mouseleave`,a),i.addEventListener(`mouseenter`,c),i.addEventListener(`mouseleave`,l)),()=>{n&&r.removeEventListener(`mouseleave`,a),f&&r.removeEventListener(`mousemove`,e),r.removeEventListener(`mouseenter`,e),r.removeEventListener(`mouseleave`,t),i&&(i.removeEventListener(`mouseleave`,a),i.removeEventListener(`mouseenter`,c),i.removeEventListener(`mouseleave`,l))}}},[o,s,e,u,f,O,k,A,r,n,_,p,g,h,i,j,v]),Jm(()=>{var e;if(s&&n&&(e=h.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&D()){w.current=!0;let e=o.floating;if(Ie(o.domReference)&&e){var t;let n=Im(o.floating).body;n.setAttribute(zh,``);let r=o.domReference,i=p==null||(t=p.nodesRef.current.find(e=>e.id===m))==null||(t=t.context)==null?void 0:t.elements.floating;return i&&(i.style.pointerEvents=``),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{n.style.pointerEvents=``,r.style.pointerEvents=``,e.style.pointerEvents=``}}}},[s,n,m,o,p,h,D]),Jm(()=>{n||(y.current=void 0,E.current=!1,k(),A())},[n,k,A]),V(()=>()=>{k(),Rh(b),Rh(S),A()},[s,o.domReference,k,A]);let M=H(()=>{function e(e){y.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function i(){!C.current&&!_.current&&r(!0,t,`hover`)}u&&!qm(y.current)||n||Vh(v.current)===0||E.current&&e.movementX**2+e.movementY**2<2||(Rh(S),y.current===`touch`?i():(E.current=!0,S.current=window.setTimeout(i,Vh(v.current))))}}},[u,r,n,_,v]);return H(()=>s?{reference:M}:{},[s,M])}var Uh=0;function Wh(e,t){t===void 0&&(t={});let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Uh);let a=()=>e?.focus({preventScroll:n});i?a():Uh=requestAnimationFrame(a)}function Gh(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Pe(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Kh(e){return`composedPath`in e?e.composedPath()[0]:e.target}function qh(e){return e?.ownerDocument||document}var Jh={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Yh(e){return e===`inert`?Jh.inert:e===`aria-hidden`?Jh[`aria-hidden`]:Jh.none}var Xh=new WeakSet,Zh={},Qh=0,$h=()=>typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype,eg=e=>e&&(e.host||eg(e.parentNode)),tg=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=eg(t);return e.contains(n)?n:null}).filter(e=>e!=null);function ng(e,t,n,r){let i=`data-floating-ui-inert`,a=r?`inert`:n?`aria-hidden`:null,o=tg(t,e),s=new Set,c=new Set(o),l=[];Zh[i]||(Zh[i]=new WeakMap);let u=Zh[i];o.forEach(d),f(t),s.clear();function d(e){e&&!s.has(e)&&(s.add(e),e.parentNode&&d(e.parentNode))}function f(e){e&&!c.has(e)&&[].forEach.call(e.children,e=>{if(lt(e)!==`script`){if(s.has(e))f(e);else{let t=a?e.getAttribute(a):null,n=t!==null&&t!==`false`,r=Yh(a),o=(r.get(e)||0)+1,s=(u.get(e)||0)+1;r.set(e,o),u.set(e,s),l.push(e),o===1&&n&&Xh.add(e),s===1&&e.setAttribute(i,``),!n&&a&&e.setAttribute(a,a===`inert`?``:`true`)}}})}return Qh++,()=>{l.forEach(e=>{let t=Yh(a),n=(t.get(e)||0)-1,r=(u.get(e)||0)-1;t.set(e,n),u.set(e,r),n||(!Xh.has(e)&&a&&e.removeAttribute(a),Xh.delete(e)),r||e.removeAttribute(i)}),Qh--,Qh||(Jh.inert=new WeakMap,Jh[`aria-hidden`]=new WeakMap,Jh.none=new WeakMap,Xh=new WeakSet,Zh={})}}function rg(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);let r=qh(e[0]).body;return ng(e.concat(Array.from(r.querySelectorAll(`[aria-live],[role="status"],output`))),r,t,n)}var ig={border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`fixed`,whiteSpace:`nowrap`,width:`1px`,top:0,left:0},ag=gt(function(e,t){let[n,r]=W();Jm(()=>{Tm()&&r(`button`)},[]);let i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Lh(`focus-guard`)]:``,style:ig};return R(`span`,{...e,...i})}),og=nt(null),sg=Lh(`portal`);function cg(e){e===void 0&&(e={});let{id:t,root:n}=e,r=jh(),i=ug(),[a,o]=W(null),s=q(null);return Jm(()=>()=>{a?.remove(),queueMicrotask(()=>{s.current=null})},[a]),Jm(()=>{if(!r||s.current)return;let e=t?document.getElementById(t):null;if(!e)return;let n=document.createElement(`div`);n.id=r,n.setAttribute(sg,``),e.appendChild(n),s.current=n,o(n)},[t,r]),Jm(()=>{if(n===null||!r||s.current)return;let e=n||i?.portalNode;e&&!je(e)&&(e=e.current),e||=document.body;let a=null;t&&(a=document.createElement(`div`),a.id=t,e.appendChild(a));let c=document.createElement(`div`);c.id=r,c.setAttribute(sg,``),e=a||e,e.appendChild(c),s.current=c,o(c)},[t,n,r,i]),a}function lg(e){let{children:t,id:n,root:r,preserveTabOrder:i=!0}=e,a=cg({id:n,root:r}),[o,s]=W(null),c=q(null),l=q(null),u=q(null),d=q(null),f=o?.modal,p=o?.open,m=!!o&&!o.modal&&o.open&&i&&!!(r||a);return V(()=>{if(!a||!i||f)return;function e(e){a&&rh(e)&&(e.type===`focusin`?ah:ih)(a)}return a.addEventListener(`focusin`,e,!0),a.addEventListener(`focusout`,e,!0),()=>{a.removeEventListener(`focusin`,e,!0),a.removeEventListener(`focusout`,e,!0)}},[a,i,f]),V(()=>{a&&(p||ah(a))},[p,a]),R(og.Provider,{value:H(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:d,portalNode:a,setFocusManagerState:s}),[i,a]),children:[m&&a&&R(ag,{"data-type":`outside`,ref:c,onFocus:e=>{if(rh(e,a)){var t;(t=u.current)==null||t.focus()}else nh(o?o.domReference:null)?.focus()}}),m&&a&&R(`span`,{"aria-owns":a.id,style:ig}),a&&Ne(t,a),m&&a&&R(ag,{"data-type":`outside`,ref:l,onFocus:e=>{if(rh(e,a)){var t;(t=d.current)==null||t.focus()}else th(o?o.domReference:null)?.focus(),o!=null&&o.closeOnFocusOut&&o?.onOpenChange(!1,e.nativeEvent,`focus-out`)}})]})}var ug=()=>Ze(og);function dg(e){return H(()=>t=>{e.forEach(e=>{e&&(e.current=t)})},e)}var fg=20,pg=[];function mg(){pg=pg.filter(e=>e.isConnected)}function hg(e){mg(),e&&lt(e)!==`body`&&(pg.push(e),pg.length>fg&&(pg=pg.slice(-20)))}function gg(){return mg(),pg[pg.length-1]}function _g(e){let t=$m();return Sm(e,t)?e:bm(e,t)[0]||e}function vg(e,t){var n;if(!t.current.includes(`floating`)&&!((n=e.getAttribute(`role`))!=null&&n.includes(`dialog`)))return;let r=$m(),i=xm(e,r).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Sm(e,r)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),a=e.getAttribute(`tabindex`);t.current.includes(`floating`)||i.length===0?a!==`0`&&e.setAttribute(`tabindex`,`0`):(a!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}var yg=gt(function(e,t){return R(`button`,{...e,type:`button`,ref:t,tabIndex:-1,style:ig})});function bg(e){let{context:t,children:n,disabled:r=!1,order:i=[`content`],guards:a=!0,initialFocus:o=0,returnFocus:s=!0,restoreFocus:c=!1,modal:l=!0,visuallyHiddenDismiss:u=!1,closeOnFocusOut:d=!0,outsideElementsInert:f=!1,getInsideElements:p=()=>[]}=e,{open:m,onOpenChange:h,events:g,dataRef:_,elements:{domReference:v,floating:y}}=t,b=Qm(()=>_.current.floatingContext?.nodeId),x=Qm(p),S=typeof o==`number`&&o<0,C=Rm(v)&&S,w=$h(),T=!w||a,E=!T||w&&f,D=Xm(i),O=Xm(o),k=Xm(s),A=Ih(),j=ug(),M=q(null),N=q(null),P=q(!1),ee=q(!1),te=q(-1),ne=q(-1),F=j!=null,I=Bm(y),re=Qm(function(e){return e===void 0&&(e=I),e?bm(e,$m()):[]}),ie=Qm(e=>{let t=re(e);return D.current.map(e=>v&&e===`reference`?v:I&&e===`floating`?I:t).filter(Boolean).flat()});V(()=>{if(r||!l)return;function e(e){if(e.key===`Tab`){Mm(I,jm(Im(I)))&&re().length===0&&!C&&Um(e);let t=ie(),n=Nm(e);D.current[0]===`reference`&&n===v&&(Um(e),e.shiftKey?Wh(t[t.length-1]):Wh(t[1])),D.current[1]===`floating`&&n===I&&e.shiftKey&&(Um(e),Wh(t[0]))}}let t=Im(I);return t.addEventListener(`keydown`,e),()=>{t.removeEventListener(`keydown`,e)}},[r,v,I,l,D,C,re,ie]),V(()=>{if(r||!y)return;function e(e){let t=Nm(e),n=re().indexOf(t);n!==-1&&(te.current=n)}return y.addEventListener(`focusin`,e),()=>{y.removeEventListener(`focusin`,e)}},[r,y,re]),V(()=>{if(r||!d)return;function e(){ee.current=!0,setTimeout(()=>{ee.current=!1})}function t(e){let t=e.relatedTarget,n=e.currentTarget,r=Nm(e);queueMicrotask(()=>{let i=b(),a=!(Mm(v,t)||Mm(y,t)||Mm(t,y)||Mm(j?.portalNode,t)||t!=null&&t.hasAttribute(Lh(`focus-guard`))||A&&(Vm(A.nodesRef.current,i).find(e=>Mm(e.context?.elements.floating,t)||Mm(e.context?.elements.domReference,t))||Hm(A.nodesRef.current,i).find(e=>[e.context?.elements.floating,Bm(e.context?.elements.floating)].includes(t)||e.context?.elements.domReference===t)));if(n===v&&I&&vg(I,D),c&&n!==v&&!(r!=null&&r.isConnected)&&jm(Im(I))===Im(I).body){Re(I)&&I.focus();let e=te.current,t=re(),n=t[e]||t[t.length-1]||I;Re(n)&&n.focus()}_.current.insideReactTree?_.current.insideReactTree=!1:(C||!l)&&t&&a&&!ee.current&&t!==gg()&&(P.current=!0,h(!1,e,`focus-out`))})}let n=!(A||!j);function i(){Rh(ne),_.current.insideReactTree=!0,ne.current=window.setTimeout(()=>{_.current.insideReactTree=!1})}if(y&&Re(v))return v.addEventListener(`focusout`,t),v.addEventListener(`pointerdown`,e),y.addEventListener(`focusout`,t),n&&y.addEventListener(`focusout`,i,!0),()=>{v.removeEventListener(`focusout`,t),v.removeEventListener(`pointerdown`,e),y.removeEventListener(`focusout`,t),n&&y.removeEventListener(`focusout`,i,!0)}},[r,v,y,I,l,A,j,h,d,c,re,C,b,D,_]);let ae=q(null),oe=q(null),se=dg([ae,j?.beforeInsideRef]),ce=dg([oe,j?.afterInsideRef]);V(()=>{var e,t;if(r||!y)return;let n=Array.from((j==null||(e=j.portalNode)==null?void 0:e.querySelectorAll(`[`+Lh(`portal`)+`]`))||[]),i=(t=(A?Hm(A.nodesRef.current,b()):[]).find(e=>Rm(e.context?.elements.domReference||null)))==null||(t=t.context)==null?void 0:t.elements.domReference,a=[y,i,...n,...x(),M.current,N.current,ae.current,oe.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,D.current.includes(`reference`)||C?v:null].filter(e=>e!=null),o=l||C?rg(a,!E,E):rg(a);return()=>{o()}},[r,v,y,l,D,j,C,T,E,A,b,x]),Jm(()=>{if(r||!Re(I))return;let e=jm(Im(I));queueMicrotask(()=>{let t=ie(I),n=O.current,r=(typeof n==`number`?t[n]:n.current)||I,i=Mm(I,e);!S&&!i&&m&&Wh(r,{preventScroll:r===I})})},[r,m,I,S,ie,O]),Jm(()=>{if(r||!I)return;let e=Im(I);hg(jm(e));function t(e){let{reason:t,event:n,nested:r}=e;if([`hover`,`safe-polygon`].includes(t)&&n.type===`mouseleave`&&(P.current=!0),t===`outside-press`){if(r)P.current=!1;else if(Gm(n)||Km(n))P.current=!1;else{let e=!1;document.createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?P.current=!1:P.current=!0}}}g.on(`openchange`,t);let n=e.createElement(`span`);n.setAttribute(`tabindex`,`-1`),n.setAttribute(`aria-hidden`,`true`),Object.assign(n.style,ig),F&&v&&v.insertAdjacentElement(`afterend`,n);function i(){if(typeof k.current==`boolean`){let e=v||gg();return e&&e.isConnected?e:n}return k.current.current||n}return()=>{g.off(`openchange`,t);let r=jm(e),a=Mm(y,r)||A&&Vm(A.nodesRef.current,b(),!1).some(e=>Mm(e.context?.elements.floating,r)),o=i();queueMicrotask(()=>{let t=_g(o);k.current&&!P.current&&Re(t)&&(t===r||r===e.body||a)&&t.focus({preventScroll:!0}),n.remove()})}},[r,y,I,k,_,g,A,F,v,b]),V(()=>(queueMicrotask(()=>{P.current=!1}),()=>{queueMicrotask(mg)}),[r]),Jm(()=>{if(!r&&j)return j.setFocusManagerState({modal:l,closeOnFocusOut:d,open:m,onOpenChange:h,domReference:v}),()=>{j.setFocusManagerState(null)}},[r,j,l,m,h,d,v]),Jm(()=>{r||I&&vg(I,D)},[r,I,D]);function le(e){return r||!u||!l?null:R(yg,{ref:e===`start`?M:N,onClick:e=>h(!1,e.nativeEvent),children:typeof u==`string`?u:`Dismiss`})}let ue=!r&&T&&(!l||!C)&&(F||l);return R(ot,{children:[ue&&R(ag,{"data-type":`inside`,ref:se,onFocus:e=>{if(l){let e=ie();Wh(i[0]===`reference`?e[0]:e[e.length-1])}else if(j!=null&&j.preserveTabOrder&&j.portalNode){if(P.current=!1,rh(e,j.portalNode))th(v)?.focus();else{var t;(t=j.beforeOutsideRef.current)==null||t.focus()}}}}),!C&&le(`start`),n,le(`end`),ue&&R(ag,{"data-type":`inside`,ref:ce,onFocus:e=>{if(l)Wh(ie()[0]);else if(j!=null&&j.preserveTabOrder&&j.portalNode){if(d&&(P.current=!0),rh(e,j.portalNode))nh(v)?.focus();else{var t;(t=j.afterOutsideRef.current)==null||t.focus()}}}})]})}var xg=0,Sg=`--floating-ui-scrollbar-width`;function Cg(){let e=Cm(),t=/iP(hone|ad|od)|iOS/.test(e)||e===`MacIntel`&&navigator.maxTouchPoints>1,n=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?`paddingLeft`:`paddingRight`,i=window.innerWidth-document.documentElement.clientWidth,a=n.left?parseFloat(n.left):window.scrollX,o=n.top?parseFloat(n.top):window.scrollY;if(n.overflow=`hidden`,n.setProperty(Sg,i+`px`),i&&(n[r]=i+`px`),t){let e=window.visualViewport?.offsetLeft||0,t=window.visualViewport?.offsetTop||0;Object.assign(n,{position:`fixed`,top:-(o-Math.floor(t))+`px`,left:-(a-Math.floor(e))+`px`,right:`0`})}return()=>{Object.assign(n,{overflow:``,[r]:``}),n.removeProperty(Sg),t&&(Object.assign(n,{position:``,top:``,left:``,right:``}),window.scrollTo(a,o))}}var wg=()=>{},Tg=gt(function(e,t){let{lockScroll:n=!1,...r}=e;return Jm(()=>{if(n)return xg++,xg===1&&(wg=Cg()),()=>{xg--,xg===0&&wg()}},[n]),R(`div`,{ref:t,...r,style:{position:`fixed`,overflow:`auto`,top:0,right:0,bottom:0,left:0,...r.style}})});function Eg(e){return Re(e.target)&&e.target.tagName===`BUTTON`}function Dg(e){return Re(e.target)&&e.target.tagName===`A`}function Og(e){return Lm(e)}function kg(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,elements:{domReference:a}}=e,{enabled:o=!0,event:s=`click`,toggle:c=!0,ignoreMouse:l=!1,keyboardHandlers:u=!0,stickIfOpen:d=!0}=t,f=q(),p=q(!1),m=H(()=>({onPointerDown(e){f.current=e.pointerType},onMouseDown(e){let t=f.current;e.button===0&&s!==`click`&&(qm(t,!0)&&l||(n&&c&&(!(i.current.openEvent&&d)||i.current.openEvent.type===`mousedown`)?r(!1,e.nativeEvent,`click`):(e.preventDefault(),r(!0,e.nativeEvent,`click`))))},onClick(e){let t=f.current;s===`mousedown`&&f.current?f.current=void 0:qm(t,!0)&&l||(n&&c&&(!(i.current.openEvent&&d)||i.current.openEvent.type===`click`)?r(!1,e.nativeEvent,`click`):r(!0,e.nativeEvent,`click`))},onKeyDown(e){f.current=void 0,!(e.defaultPrevented||!u||Eg(e))&&(e.key===` `&&!Og(a)&&(e.preventDefault(),p.current=!0),!Dg(e)&&e.key===`Enter`&&r(!(n&&c),e.nativeEvent,`click`))},onKeyUp(e){e.defaultPrevented||!u||Eg(e)||Og(a)||e.key===` `&&p.current&&(p.current=!1,r(!(n&&c),e.nativeEvent,`click`))}}),[i,a,s,l,u,r,n,d,c]);return H(()=>o?{reference:m}:{},[o,m])}var Ag={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},jg={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},Mg=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function Ng(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,elements:i,dataRef:a}=e,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`pointerdown`,referencePress:u=!1,referencePressEvent:d=`pointerdown`,ancestorScroll:f=!1,bubbles:p,capture:m}=t,h=Ih(),g=Qm(typeof c==`function`?c:()=>!1),_=typeof c==`function`?g:c,v=q(!1),{escapeKey:y,outsidePress:b}=Mg(p),{escapeKey:x,outsidePress:S}=Mg(m),C=q(!1),w=Qm(e=>{if(!n||!o||!s||e.key!==`Escape`||C.current)return;let t=a.current.floatingContext?.nodeId,i=h?Vm(h.nodesRef.current,t):[];if(!y&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;(n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}r(!1,Wm(e)?e.nativeEvent:e,`escape-key`)}),T=Qm(e=>{var t;let n=()=>{var t;w(e),(t=Nm(e))==null||t.removeEventListener(`keydown`,n)};(t=Nm(e))==null||t.addEventListener(`keydown`,n)}),E=Qm(e=>{let t=a.current.insideReactTree;a.current.insideReactTree=!1;let n=v.current;if(v.current=!1,l===`click`&&n||t||typeof _==`function`&&!_(e))return;let o=Nm(e),s=`[`+Lh(`inert`)+`]`,c=Im(i.floating).querySelectorAll(s),u=Ie(o)?o:null;for(;u&&!ke(u);){let e=ct(u);if(ke(e)||!Ie(e))break;u=e}if(c.length&&Ie(o)&&!Fm(o)&&!Mm(o,i.floating)&&Array.from(c).every(e=>!Mm(u,e)))return;if(Re(o)&&k){let t=ke(o),n=Le(o),r=/auto|scroll/,i=t||r.test(n.overflowX),a=t||r.test(n.overflowY),s=i&&o.clientWidth>0&&o.scrollWidth>o.clientWidth,c=a&&o.clientHeight>0&&o.scrollHeight>o.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=o.offsetWidth-o.clientWidth:e.offsetX>o.clientWidth),d=s&&e.offsetY>o.clientHeight;if(u||d)return}let d=a.current.floatingContext?.nodeId,f=h&&Vm(h.nodesRef.current,d).some(t=>Pm(e,t.context?.elements.floating));if(Pm(e,i.floating)||Pm(e,i.domReference)||f)return;let p=h?Vm(h.nodesRef.current,d):[];if(p.length>0){let e=!0;if(p.forEach(t=>{var n;(n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}r(!1,e,`outside-press`)}),D=Qm(e=>{var t;let n=()=>{var t;E(e),(t=Nm(e))==null||t.removeEventListener(l,n)};(t=Nm(e))==null||t.addEventListener(l,n)});V(()=>{if(!n||!o)return;a.current.__escapeKeyBubbles=y,a.current.__outsidePressBubbles=b;let e=-1;function t(e){r(!1,e,`ancestor-scroll`)}function c(){window.clearTimeout(e),C.current=!0}function u(){e=window.setTimeout(()=>{C.current=!1},Be()?5:0)}let d=Im(i.floating);s&&(d.addEventListener(`keydown`,x?T:w,x),d.addEventListener(`compositionstart`,c),d.addEventListener(`compositionend`,u)),_&&d.addEventListener(l,S?D:E,S);let p=[];return f&&(Ie(i.domReference)&&(p=Ee(i.domReference)),Ie(i.floating)&&(p=p.concat(Ee(i.floating))),!Ie(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(Ee(i.reference.contextElement)))),p=p.filter(e=>e!==d.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{s&&(d.removeEventListener(`keydown`,x?T:w,x),d.removeEventListener(`compositionstart`,c),d.removeEventListener(`compositionend`,u)),_&&d.removeEventListener(l,S?D:E,S),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[a,i,s,_,l,n,r,f,o,y,b,w,x,T,E,S,D]),V(()=>{a.current.insideReactTree=!1},[a,_,l]);let O=H(()=>({onKeyDown:w,...u&&{[Ag[d]]:e=>{r(!1,e.nativeEvent,`reference-press`)},...d!==`click`&&{onClick(e){r(!1,e.nativeEvent,`reference-press`)}}}}),[w,r,u,d]),k=H(()=>({onKeyDown:w,onMouseDown(){v.current=!0},onMouseUp(){v.current=!0},[jg[l]]:()=>{a.current.insideReactTree=!0}}),[w,l,a]);return H(()=>o?{reference:O,floating:k}:{},[o,O,k])}function Pg(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=jh(),a=q({}),[o]=W(()=>Mh()),s=Fh()!=null,[c,l]=W(r.reference),u=Qm((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=H(()=>({setPositionReference:l}),[]),f=H(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return H(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function Fg(e){e===void 0&&(e={});let{nodeId:t}=e,n=Pg({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[a,o]=W(null),[s,c]=W(null),l=i?.domReference||a,u=q(null),d=Ih();Jm(()=>{l&&(u.current=l)},[l]);let f=dh({...e,elements:{...i,...s&&{reference:s}}}),p=B(e=>{let t=Ie(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;c(t),f.refs.setReference(t)},[f.refs]),m=B(e=>{(Ie(e)||e===null)&&(u.current=e,o(e)),(Ie(f.refs.reference.current)||f.refs.reference.current===null||e!==null&&!Ie(e))&&f.refs.setReference(e)},[f.refs]),h=H(()=>({...f.refs,setReference:m,setPositionReference:p,domReference:u}),[f.refs,m,p]),g=H(()=>({...f.elements,domReference:l}),[f.elements,l]),_=H(()=>({...f,...r,refs:h,elements:g,nodeId:t}),[f,h,g,t,r]);return Jm(()=>{r.dataRef.current.floatingContext=_;let e=d?.nodesRef.current.find(e=>e.id===t);e&&(e.context=_)}),H(()=>({...f,context:_,refs:h,elements:g}),[f,h,g,_])}function Ig(){return Dm()&&Tm()}function Lg(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,events:i,dataRef:a,elements:o}=e,{enabled:s=!0,visibleOnly:c=!0}=t,l=q(!1),u=q(-1),d=q(!0);V(()=>{if(!s)return;let e=Fe(o.domReference);function t(){!n&&Re(o.domReference)&&o.domReference===jm(Im(o.domReference))&&(l.current=!0)}function r(){d.current=!0}function i(){d.current=!1}return e.addEventListener(`blur`,t),Ig()&&(e.addEventListener(`keydown`,r,!0),e.addEventListener(`pointerdown`,i,!0)),()=>{e.removeEventListener(`blur`,t),Ig()&&(e.removeEventListener(`keydown`,r,!0),e.removeEventListener(`pointerdown`,i,!0))}},[o.domReference,n,s]),V(()=>{if(!s)return;function e(e){let{reason:t}=e;(t===`reference-press`||t===`escape-key`)&&(l.current=!0)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[i,s]),V(()=>()=>{Rh(u)},[]);let f=H(()=>({onMouseLeave(){l.current=!1},onFocus(e){if(l.current)return;let t=Nm(e.nativeEvent);if(c&&Ie(t)){if(Ig()&&!e.relatedTarget){if(!d.current&&!Lm(t))return}else if(!zm(t))return}r(!0,e.nativeEvent,`focus`)},onBlur(e){l.current=!1;let t=e.relatedTarget,n=e.nativeEvent,i=Ie(t)&&t.hasAttribute(Lh(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;u.current=window.setTimeout(()=>{let e=jm(o.domReference?o.domReference.ownerDocument:document);!t&&e===o.domReference||Mm(a.current.floatingContext?.refs.floating.current,e)||Mm(o.domReference,e)||i||r(!1,n,`focus`)})}}),[a,o.domReference,r,c]);return H(()=>s?{reference:f}:{},[s,f])}function Rg(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[vh]:t,[yh]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[_h]:``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[vh,yh].includes(n))){if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}}),e),{})}}function zg(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=B(t=>Rg(t,e,`reference`),t),a=B(t=>Rg(t,e,`floating`),n),o=B(t=>Rg(t,e,`item`),r);return H(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}var Bg=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Vg(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=jh(),c=r.domReference?.id||s,l=H(()=>Bm(r.floating)?.id||i,[r.floating,i]),u=Bg.get(o)??o,d=Fh()!=null,f=H(()=>u===`tooltip`||o===`label`?{[`aria-`+(o===`label`?`labelledby`:`describedby`)]:n?l:void 0}:{"aria-expanded":n?`true`:`false`,"aria-haspopup":u===`alertdialog`?`dialog`:u,"aria-controls":n?l:void 0,...u===`listbox`&&{role:`combobox`},...u===`menu`&&{id:c},...u===`menu`&&d&&{role:`menuitem`},...o===`select`&&{"aria-autocomplete":`none`},...o===`combobox`&&{"aria-autocomplete":`list`}},[u,l,d,n,c,o]),p=H(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=B(e=>{let{active:t,selected:n}=e,r={role:`option`,...t&&{id:l+`-fui-option`}};switch(o){case`select`:case`combobox`:return{...r,"aria-selected":n}}return{}},[l,o]);return H(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}var Hg=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?`-`:``)+e.toLowerCase());function Ug(e,t){return typeof e==`function`?e(t):e}function Wg(e,t){let[n,r]=W(e);return e&&!n&&r(!0),V(()=>{if(!e&&n){let e=setTimeout(()=>r(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}function Gg(e,t){t===void 0&&(t={});let{open:n,elements:{floating:r}}=e,{duration:i=250}=t,a=(typeof i==`number`?i:i.close)||0,[o,s]=W(`unmounted`),c=Wg(n,a);return!c&&o===`close`&&s(`unmounted`),Jm(()=>{if(r){if(n){s(`initial`);let e=requestAnimationFrame(()=>{Me(()=>{s(`open`)})});return()=>{cancelAnimationFrame(e)}}s(`close`)}},[n,r]),{isMounted:c,status:o}}function Kg(e,t){t===void 0&&(t={});let{initial:n={opacity:0},open:r,close:i,common:a,duration:o=250}=t,s=e.placement,c=s.split(`-`)[0],l=H(()=>({side:c,placement:s}),[c,s]),u=typeof o==`number`,d=(u?o:o.open)||0,f=(u?o:o.close)||0,[p,m]=W(()=>({...Ug(a,l),...Ug(n,l)})),{isMounted:h,status:g}=Gg(e,{duration:o}),_=Xm(n),v=Xm(r),y=Xm(i),b=Xm(a);return Jm(()=>{let e=Ug(_.current,l),t=Ug(y.current,l),n=Ug(b.current,l),r=Ug(v.current,l)||Object.keys(e).reduce((e,t)=>(e[t]=``,e),{});if(g===`initial`&&m(t=>({transitionProperty:t.transitionProperty,...n,...e})),g===`open`&&m({transitionProperty:Object.keys(r).map(Hg).join(`,`),transitionDuration:d+`ms`,...n,...r}),g===`close`){let r=t||e;m({transitionProperty:Object.keys(r).map(Hg).join(`,`),transitionDuration:f+`ms`,...n,...r})}},[f,y,_,v,b,d,g,l]),{isMounted:h,styles:p}}function qg(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...qg(e,t.id,n)])}function Jg(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e<a;o=e++){let[a,s]=t[e]||[0,0],[c,l]=t[o]||[0,0];s>=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function Yg(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Xg(e){e===void 0&&(e={});let{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,i={current:-1},a=!1,o=null,s=null,c=typeof performance<`u`?performance.now():0;function l(e,t){let n=performance.now(),r=n-c;if(o===null||s===null||r===0)return o=e,s=t,c=n,null;let i=e-o,a=t-s,l=Math.sqrt(i*i+a*a)/r;return o=e,s=t,c=n,l}let u=e=>{let{x:n,y:o,placement:s,elements:c,onClose:u,nodeId:d,tree:f}=e;return function(e){function p(){Rh(i),u()}if(Rh(i),!c.domReference||!c.floating||s==null||n==null||o==null)return;let{clientX:m,clientY:h}=e,g=[m,h],_=Kh(e),v=e.type===`mouseleave`,y=Gh(c.floating,_),b=Gh(c.domReference,_),x=c.domReference.getBoundingClientRect(),S=c.floating.getBoundingClientRect(),C=s.split(`-`)[0],w=n>S.right-S.width/2,T=o>S.bottom-S.height/2,E=Yg(g,x),D=S.width>x.width,O=S.height>x.height,k=(D?x:S).left,A=(D?x:S).right,j=(O?x:S).top,M=(O?x:S).bottom;if(y&&(a=!0,!v))return;if(b&&(a=!1),b&&!v){a=!0;return}if(v&&Ie(e.relatedTarget)&&Gh(c.floating,e.relatedTarget)||f&&qg(f.nodesRef.current,d).length)return;if(C===`top`&&o>=x.bottom-1||C===`bottom`&&o<=x.top+1||C===`left`&&n>=x.right-1||C===`right`&&n<=x.left+1)return p();let N=[];switch(C){case`top`:N=[[k,x.top+1],[k,S.bottom-1],[A,S.bottom-1],[A,x.top+1]];break;case`bottom`:N=[[k,S.top+1],[k,x.bottom-1],[A,x.bottom-1],[A,S.top+1]];break;case`left`:N=[[S.right-1,M],[S.right-1,j],[x.left+1,j],[x.left+1,M]];break;case`right`:N=[[x.right-1,M],[x.right-1,j],[S.left+1,j],[S.left+1,M]]}function P(e){let[n,r]=e;switch(C){case`top`:return[[D?n+t/2:w?n+t*4:n-t*4,r+t+1],[D?n-t/2:w?n+t*4:n-t*4,r+t+1],[S.left,w||D?S.bottom-t:S.top],[S.right,w?D?S.bottom-t:S.top:S.bottom-t]];case`bottom`:return[[D?n+t/2:w?n+t*4:n-t*4,r-t],[D?n-t/2:w?n+t*4:n-t*4,r-t],[S.left,w||D?S.top+t:S.bottom],[S.right,w?D?S.top+t:S.bottom:S.top+t]];case`left`:{let e=[n+t+1,O?r+t/2:T?r+t*4:r-t*4],i=[n+t+1,O?r-t/2:T?r+t*4:r-t*4];return[[T||O?S.right-t:S.left,S.top],[T?O?S.right-t:S.left:S.right-t,S.bottom],e,i]}case`right`:return[[n-t,O?r+t/2:T?r+t*4:r-t*4],[n-t,O?r-t/2:T?r+t*4:r-t*4],[T||O?S.left+t:S.right,S.top],[T?O?S.left+t:S.right:S.left+t,S.bottom]]}}if(!Jg([m,h],N)){if(a&&!E)return p();if(!v&&r){let t=l(e.clientX,e.clientY);if(t!==null&&t<.1)return p()}Jg([m,h],P([n,o]))?!a&&r&&(i.current=window.setTimeout(p,40)):p()}}};return u.__options={blockPointerEvents:n},u}var Zg=Ct(`audio-lines`,[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]),Qg=Ct(`ban`,[[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),$g=Ct(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),e_=Ct(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),t_=Ct(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),n_=Ct(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),r_=Ct(`clapperboard`,[[`path`,{d:`M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z`,key:`1tn4o7`}],[`path`,{d:`m6.2 5.3 3.1 3.9`,key:`iuk76l`}],[`path`,{d:`m12.4 3.4 3.1 4`,key:`6hsd6n`}],[`path`,{d:`M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z`,key:`ltgou9`}]]),i_=Ct(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),a_=Ct(`fast-forward`,[[`path`,{d:`M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z`,key:`b19h5q`}],[`path`,{d:`M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z`,key:`h7h5ge`}]]),o_=Ct(`frown`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2`,key:`epbg0q`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),s_=Ct(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),c_=Ct(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),l_=Ct(`grid-3x2`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),u_=Ct(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),d_=Ct(`layout-list`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}],[`path`,{d:`M14 4h7`,key:`3xa0d5`}],[`path`,{d:`M14 9h7`,key:`1icrd9`}],[`path`,{d:`M14 15h7`,key:`1mj8o2`}],[`path`,{d:`M14 20h7`,key:`11slyb`}]]),f_=Ct(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),p_=Ct(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),m_=Ct(`meh`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`8`,x2:`16`,y1:`15`,y2:`15`,key:`1xb1d9`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),h_=Ct(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),g_=Ct(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),__=Ct(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),v_=Ct(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),y_=Ct(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),b_=Ct(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),x_=Ct(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),S_=Ct(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),C_=Ct(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),w_=Ct(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),T_=Ct(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),E_=Ct(`user-x`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`17`,x2:`22`,y1:`8`,y2:`13`,key:`3nzzx3`}],[`line`,{x1:`22`,x2:`17`,y1:`8`,y2:`13`,key:`1swrse`}]]),D_=Ct(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),O_=Ct(`volume`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}]]),k_=Ct(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),A_=e=>e===`/`||e===`/media`||e.startsWith(`/media/`),j_=e=>e.startsWith(`/title/`),M_=({from:e,to:t,kind:n,asked:r=!1})=>r?!0:n===`pop`||A_(e.pathname)&&A_(t.pathname)?!1:n!==`replace`||e.pathname!==t.pathname&&!(j_(e.pathname)&&j_(t.pathname)),N_=()=>{window.scrollTo({top:0,left:0,behavior:`instant`})},P_=0,F_=()=>{I_(),P_=requestAnimationFrame(()=>{P_=0,N_()})},I_=()=>{cancelAnimationFrame(P_),P_=0},L_=!1,R_=()=>{L_=!0},z_=()=>{let e=L_;return L_=!1,e};Je();var B_=({className:e,style:t}={})=>ht(`iframe`,{src:nn(),title:`Sign in to FKN`,className:e,style:{border:`none`,width:150,height:40,background:`transparent`,colorScheme:`normal`,...t}}),V_=8e3,H_=async(e,t=V_)=>{let n,r=new Promise(e=>{n=setTimeout(()=>e(`timeout`),t)});try{return await Promise.race([Promise.resolve().then(e).then(()=>`settled`,()=>`settled`),r])}finally{clearTimeout(n)}};K();var U_=()=>Promise.race([k.info(),new Promise(e=>setTimeout(()=>e(null),4e3))]),W_=()=>{let[e,t]=W(null),[n,r]=W(!1),i=B(()=>U_().then(e=>{t(e),r(!0)}).catch(()=>r(!0)),[]);return V(()=>{let e=!1,t=k.onChange(()=>{e||i()});i();let n=window.setInterval(()=>{e||i()},3e4);return()=>{e=!0,window.clearInterval(n),t.then(e=>e()).catch(()=>{})}},[i]),{info:e,ready:n,logout:B(async()=>{let e=await H_(()=>k.logout());return await i(),e},[i])}};K();var G_=`https://fkn.app/account`,K_=150,q_=40,J_=L`
@@ -809,7 +809,7 @@ https://bit.ly/2XbVrpR#`;function $l(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
809
809
  gap: 1.2rem;
810
810
  padding: 2rem 1.5rem;
811
811
  }
812
- `,Mv=()=>{let[e]=Df(Rf(Q.WATCH)),[t]=Df(Rf(Q.LOGIN_CALLBACK));return e||t?null:G(`footer`,{css:jv,children:[U(Mf,{to:zf(Q.HOME),className:`wordmark`,onClick:R_,children:`stub`}),U(Mf,{to:zf(Q.LEGAL),className:`nav-link`,children:`Legal`}),U(Mf,{to:zf(Q.PRIVACY),className:`nav-link`,children:`Privacy`}),G(`span`,{className:`version`,title:`stub v0.0.61, commit ${document.querySelector(`meta[name="stub-commit"]`)?.content}`,children:[`v`,`0.0.61`,` `,U(`span`,{className:`commit`,children:document.querySelector(`meta[name="stub-commit"]`)?.content})]})]})};K();var Nv=L`
812
+ `,Mv=()=>{let[e]=Df(Rf(Q.WATCH)),[t]=Df(Rf(Q.LOGIN_CALLBACK));return e||t?null:G(`footer`,{css:jv,children:[U(Mf,{to:zf(Q.HOME),className:`wordmark`,onClick:R_,children:`stub`}),U(Mf,{to:zf(Q.LEGAL),className:`nav-link`,children:`Legal`}),U(Mf,{to:zf(Q.PRIVACY),className:`nav-link`,children:`Privacy`}),G(`span`,{className:`version`,title:`stub v0.0.62, commit ${document.querySelector(`meta[name="stub-commit"]`)?.content}`,children:[`v`,`0.0.62`,` `,U(`span`,{className:`commit`,children:document.querySelector(`meta[name="stub-commit"]`)?.content})]})]})};K();var Nv=L`
813
813
  position: fixed;
814
814
  inset: 0;
815
815
  /* a sibling of the modal's portal rather than a child of it, so it competes at the root and 200
@@ -1066,7 +1066,7 @@ height: 100%;
1066
1066
 
1067
1067
  & > * { height: 1em; }
1068
1068
  & > :last-child { width: 60%; }
1069
- `,ty=({className:e})=>U(`span`,{css:$v,className:e,"aria-hidden":`true`}),ny=({count:e,className:t})=>U(`span`,{css:ey,className:t,"aria-hidden":`true`,children:Array.from({length:e},(e,t)=>U(ty,{},t))}),ry=e=>e._id??e.uri??``,iy=(e,t,n)=>{let r=t.handles?.filter(e=>e.relation===`SAME_AS`).map(e=>e.node.uri)??[];return!!e.handles?.some(e=>e.relation===n&&r.includes(e.node.uri))},ay=(e,t)=>ry(e)===ry(t)||iy(e,t,`SAME_AS`),oy=(e,t)=>iy(e,t,`PART_OF`),sy=e=>{let t=e.filter(e=>e.titles?.length&&e.shortDescriptions?.length),n=t.filter(e=>e.trailers?.length);return n.length?n:t},cy=e=>!!e?.saveData||[`slow-2g`,`2g`].includes(e?.effectiveType??``),ly=12e4,uy=.3,dy=e=>(e.titles?.[0]?.score??0)>uy,fy=5e3,py=(e,t,n=e=>Math.floor(Math.random()*e))=>{if(t){let n=e.find(e=>ay(e,t));if(n)return dy(t)?t:n;if(e.some(e=>oy(e,t)))return t}let r=e.slice(0,10);return r.length?r[Math.min(r.length-1,Math.max(0,n(r.length)))]:t};K();var my=new Map,hy=new Map,gy=3e4,_y=e=>{let t=my.get(e);if(t)return t;let n=new Promise(t=>{let n=new Image;n.onload=()=>{hy.set(e,{width:n.naturalWidth,height:n.naturalHeight}),t(!0)},n.onerror=()=>{setTimeout(()=>my.delete(e),gy),t(!1)},n.src=e});return my.set(e,n),n},vy=(e,t)=>{let n=hy.get(e);return n?Math.min(n.width/t.width,n.height/t.height):0},yy=(e,t,n)=>vy(e,n)>=(globalThis.devicePixelRatio||1)||vy(t,n)<1.25*vy(e,n),by=e=>[...e?.banners??[],...e?.covers??[]],xy=(e,t,{standIn:n=!1,box:r}={})=>{let i=(e??[]).map(e=>e?.url).filter(e=>!!e),a=i.join(`|`),[o,s]=W({owner:t}),c=e=>!!t&&!!e&&ay(t,e),l=e=>c(e)||n&&!!t&&!!e&&oy(t,e),u=(l(o.owner)?o.url:void 0)??i.find(e=>hy.has(e))??i[0];return V(()=>{let e=!1;return s(e=>l(e.owner)?{...e,url:e.url??u}:{owner:t,url:u}),(async()=>{for(let n of i){let i=await _y(n);if(e)return;if(i){s(e=>({owner:t,url:r&&e.url&&c(e.owner)&&yy(e.url,n,r)?e.url:n}));return}}})(),()=>{e=!0}},[a,t&&ry(t)]),u};K();var Sy=L`
1069
+ `,ty=({className:e})=>U(`span`,{css:$v,className:e,"aria-hidden":`true`}),ny=({count:e,className:t})=>U(`span`,{css:ey,className:t,"aria-hidden":`true`,children:Array.from({length:e},(e,t)=>U(ty,{},t))}),ry=e=>e._id??e.uri??``,iy=(e,t,n)=>{let r=t.handles?.filter(e=>e.relation===`SAME_AS`).map(e=>e.node.uri)??[];return!!e.handles?.some(e=>e.relation===n&&r.includes(e.node.uri))},ay=(e,t)=>ry(e)===ry(t)||iy(e,t,`SAME_AS`),oy=(e,t)=>iy(e,t,`PART_OF`),sy=e=>{let t=e.filter(e=>e.titles?.length&&e.shortDescriptions?.length),n=t.filter(e=>e.trailers?.length);return n.length?n:t},cy=.07,ly=e=>!!e?.saveData||[`slow-2g`,`2g`].includes(e?.effectiveType??``)||!!e?.downlink&&e.downlink<=cy,uy=1e4,dy=.3,fy=e=>(e.titles?.[0]?.score??0)>dy,py=5e3,my=(e,t,n=e=>Math.floor(Math.random()*e))=>{if(t){let n=e.find(e=>ay(e,t));if(n)return fy(t)?t:n;if(e.some(e=>oy(e,t)))return t}let r=e.slice(0,10);return r.length?r[Math.min(r.length-1,Math.max(0,n(r.length)))]:t};K();var hy=new Map,gy=new Map,_y=3e4,vy=e=>{let t=hy.get(e);if(t)return t;let n=new Promise(t=>{let n=new Image;n.onload=()=>{gy.set(e,{width:n.naturalWidth,height:n.naturalHeight}),t(!0)},n.onerror=()=>{setTimeout(()=>hy.delete(e),_y),t(!1)},n.src=e});return hy.set(e,n),n},yy=(e,t)=>{let n=gy.get(e);return n?Math.min(n.width/t.width,n.height/t.height):0},by=(e,t,n)=>yy(e,n)>=(globalThis.devicePixelRatio||1)||yy(t,n)<1.25*yy(e,n),xy=e=>[...e?.banners??[],...e?.covers??[]],Sy=(e,t,{standIn:n=!1,box:r}={})=>{let i=(e??[]).map(e=>e?.url).filter(e=>!!e),a=i.join(`|`),[o,s]=W({owner:t}),c=e=>!!t&&!!e&&ay(t,e),l=e=>c(e)||n&&!!t&&!!e&&oy(t,e),u=(l(o.owner)?o.url:void 0)??i.find(e=>gy.has(e))??i[0];return V(()=>{let e=!1;return s(e=>l(e.owner)?{...e,url:e.url??u}:{owner:t,url:u}),(async()=>{for(let n of i){let i=await vy(n);if(e)return;if(i){s(e=>({owner:t,url:r&&e.url&&c(e.owner)&&by(e.url,n,r)?e.url:n}));return}}})(),()=>{e=!0}},[a,t&&ry(t)]),u};K();var Cy=L`
1070
1070
  /* below the fixed header when a page change scrolls the list back into view */
1071
1071
  & > .page {
1072
1072
  scroll-margin-top: calc(var(--stub-header-height, 0px) + var(--fkn-inset-top, 0px) + 1.6rem);
@@ -1130,7 +1130,7 @@ height: 100%;
1130
1130
  clip-path: inset(50%);
1131
1131
  white-space: nowrap;
1132
1132
  }
1133
- `,Cy=(e,t)=>{let n=t<=7?Array.from({length:t},(e,t)=>t):e<4?[0,1,2,3,4,void 0,t-1]:e>t-5?[0,void 0,t-5,t-4,t-3,t-2,t-1]:[0,void 0,e-1,e,e+1,void 0,t-1];return n.map((e,t)=>e===void 0?{page:Math.floor((n[t-1]+n[t+1])/2),gap:!0}:{page:e,gap:!1})},wy=({items:e,size:t,label:n,start:r=0,children:i})=>{let[a,o]=W(),[s,c]=W(0),l=q(null),u=Math.max(1,Math.ceil(e.length/t)),d=Math.min(Math.max(a??Math.floor(r/t),0),u-1),f=e=>{if(e<0||e>=u||e===d)return;let t=l.current,{top:n,height:r}=t.getBoundingClientRect();o(e),n<0?(c(0),t.scrollIntoView({block:`start`,behavior:`instant`})):c(Math.max(s,r))};return G(`div`,{css:Sy,children:[U(`div`,{className:`page`,ref:l,style:s?{minHeight:`${s}px`}:void 0,children:i(e.slice(d*t,(d+1)*t),d*t)}),u>1?G(`nav`,{"aria-label":`${n} pages`,children:[U(`button`,{type:`button`,"aria-label":`Previous page`,"aria-disabled":d===0,onClick:()=>f(d-1),children:U(rt,{size:18,"aria-hidden":`true`})}),Cy(d,u).map(({page:e,gap:t})=>U(`button`,{type:`button`,className:t?`gap`:void 0,"aria-label":`Page ${e+1}`,"aria-current":e===d?`page`:void 0,onClick:()=>f(e),children:t?`…`:e+1},e)),U(`button`,{type:`button`,"aria-label":`Next page`,"aria-disabled":d===u-1,onClick:()=>f(d+1),children:U(at,{size:18,"aria-hidden":`true`})}),U(`span`,{role:`status`,children:a===void 0?``:`Page ${d+1} of ${u}`})]}):void 0]})};K();var Ty=({icon:e,name:t})=>{let[n,r]=W(!1);return n?U(`span`,{className:`letter`,"aria-hidden":`true`,children:t.charAt(0)}):U(`img`,{src:e,alt:``,onError:()=>r(!0)})};K();var Ey=L`
1133
+ `,wy=(e,t)=>{let n=t<=7?Array.from({length:t},(e,t)=>t):e<4?[0,1,2,3,4,void 0,t-1]:e>t-5?[0,void 0,t-5,t-4,t-3,t-2,t-1]:[0,void 0,e-1,e,e+1,void 0,t-1];return n.map((e,t)=>e===void 0?{page:Math.floor((n[t-1]+n[t+1])/2),gap:!0}:{page:e,gap:!1})},Ty=({items:e,size:t,label:n,start:r=0,children:i})=>{let[a,o]=W(),[s,c]=W(0),l=q(null),u=Math.max(1,Math.ceil(e.length/t)),d=Math.min(Math.max(a??Math.floor(r/t),0),u-1),f=e=>{if(e<0||e>=u||e===d)return;let t=l.current,{top:n,height:r}=t.getBoundingClientRect();o(e),n<0?(c(0),t.scrollIntoView({block:`start`,behavior:`instant`})):c(Math.max(s,r))};return G(`div`,{css:Cy,children:[U(`div`,{className:`page`,ref:l,style:s?{minHeight:`${s}px`}:void 0,children:i(e.slice(d*t,(d+1)*t),d*t)}),u>1?G(`nav`,{"aria-label":`${n} pages`,children:[U(`button`,{type:`button`,"aria-label":`Previous page`,"aria-disabled":d===0,onClick:()=>f(d-1),children:U(rt,{size:18,"aria-hidden":`true`})}),wy(d,u).map(({page:e,gap:t})=>U(`button`,{type:`button`,className:t?`gap`:void 0,"aria-label":`Page ${e+1}`,"aria-current":e===d?`page`:void 0,onClick:()=>f(e),children:t?`…`:e+1},e)),U(`button`,{type:`button`,"aria-label":`Next page`,"aria-disabled":d===u-1,onClick:()=>f(d+1),children:U(at,{size:18,"aria-hidden":`true`})}),U(`span`,{role:`status`,children:a===void 0?``:`Page ${d+1} of ${u}`})]}):void 0]})};K();var Ey=({icon:e,name:t})=>{let[n,r]=W(!1);return n?U(`span`,{className:`letter`,"aria-hidden":`true`,children:t.charAt(0)}):U(`img`,{src:e,alt:``,onError:()=>r(!0)})};K();var Dy=L`
1134
1134
  position: fixed;
1135
1135
  inset: 0;
1136
1136
  z-index: ${jr.sourcePopup};
@@ -1198,7 +1198,7 @@ height: 100%;
1198
1198
  color: rgba(255, 255, 255, 0.55);
1199
1199
  font-size: 1.4rem;
1200
1200
  }
1201
- `,Dy=({pluginUri:e,origin:t,name:n,uris:r,onPick:i,onClose:a})=>{let o=q(null),[s,c]=W(!1);return V(()=>{let n=o.current;if(!n)return;let s=!1,l;return(async()=>{try{l=await E.show(e,{element:n})}catch(t){console.warn(`Source '${e}' could not open its picker:`,t),c(!0);return}let o=await Xt(t,r);s||(o?i(o):a())})(),()=>{s=!0,l?.hide(),E.hide(e,{element:n}).catch(()=>{})}},[e,t,r.join(`,`)]),V(()=>{let e=e=>{e.key===`Escape`&&a()};return addEventListener(`keydown`,e),()=>removeEventListener(`keydown`,e)},[a]),U(`div`,{css:Ey,role:`dialog`,"aria-modal":`true`,"aria-label":`Choose a source from ${n}`,onClick:a,children:G(`div`,{className:`wrap`,onClick:e=>e.stopPropagation(),children:[G(`div`,{className:`bar`,children:[U(`span`,{children:n}),U(`span`,{className:`spacer`}),U(`button`,{type:`button`,className:`close`,onClick:a,children:`Close`})]}),s?U(`div`,{className:`fallback`,children:`This source could not open its picker.`}):U(`div`,{className:`slot`,ref:o})]})})};K();var Oy={cr:`#f47521`,nf:`#e50914`,jw:`#fcd53f`,disney:`#0063e5`,amazon:`#00a8e1`,appletv:`#e8e8ed`,hulu:`#1ce783`,hbo:`#7b5cff`,peacock:`#069de0`,paramount:`#0064ff`,fubo:`#fa4616`},ky=`#9aa0a6`,Ay=e=>e.color||Oy[e.id]||ky,jy=L`
1201
+ `,Oy=({pluginUri:e,origin:t,name:n,uris:r,onPick:i,onClose:a})=>{let o=q(null),[s,c]=W(!1);return V(()=>{let n=o.current;if(!n)return;let s=!1,l;return(async()=>{try{l=await E.show(e,{element:n})}catch(t){console.warn(`Source '${e}' could not open its picker:`,t),c(!0);return}let o=await Xt(t,r);s||(o?i(o):a())})(),()=>{s=!0,l?.hide(),E.hide(e,{element:n}).catch(()=>{})}},[e,t,r.join(`,`)]),V(()=>{let e=e=>{e.key===`Escape`&&a()};return addEventListener(`keydown`,e),()=>removeEventListener(`keydown`,e)},[a]),U(`div`,{css:Dy,role:`dialog`,"aria-modal":`true`,"aria-label":`Choose a source from ${n}`,onClick:a,children:G(`div`,{className:`wrap`,onClick:e=>e.stopPropagation(),children:[G(`div`,{className:`bar`,children:[U(`span`,{children:n}),U(`span`,{className:`spacer`}),U(`button`,{type:`button`,className:`close`,onClick:a,children:`Close`})]}),s?U(`div`,{className:`fallback`,children:`This source could not open its picker.`}):U(`div`,{className:`slot`,ref:o})]})})};K();var ky={cr:`#f47521`,nf:`#e50914`,jw:`#fcd53f`,disney:`#0063e5`,amazon:`#00a8e1`,appletv:`#e8e8ed`,hulu:`#1ce783`,hbo:`#7b5cff`,peacock:`#069de0`,paramount:`#0064ff`,fubo:`#fa4616`},Ay=`#9aa0a6`,jy=e=>e.color||ky[e.id]||Ay,My=L`
1202
1202
  display: flex;
1203
1203
  flex-direction: column;
1204
1204
  gap: 1.1rem;
@@ -1218,7 +1218,7 @@ height: 100%;
1218
1218
  }
1219
1219
 
1220
1220
  .source {
1221
- --brand: ${ky};
1221
+ --brand: ${Ay};
1222
1222
  position: relative;
1223
1223
  display: flex;
1224
1224
  align-items: center;
@@ -1445,13 +1445,13 @@ height: 100%;
1445
1445
  0%, 100% { transform: scaleY(0.35); }
1446
1446
  50% { transform: scaleY(1); }
1447
1447
  }
1448
- `,My=L`
1448
+ `,Ny=L`
1449
1449
  display: flex;
1450
1450
  align-items: center;
1451
1451
  gap: 0.7rem;
1452
1452
 
1453
1453
  .src {
1454
- --brand: ${ky};
1454
+ --brand: ${Ay};
1455
1455
  display: flex;
1456
1456
  text-decoration: none;
1457
1457
  border-radius: 0.6rem;
@@ -1491,7 +1491,7 @@ height: 100%;
1491
1491
  background: color-mix(in srgb, var(--brand) 30%, rgba(255, 255, 255, 0.05));
1492
1492
  }
1493
1493
  }
1494
- `,Ny=({source:e})=>{let[t,n]=W(!1);return U(`span`,{className:`icon`,children:e.icon&&!t?U(`img`,{src:e.icon,alt:``,onError:()=>n(!0)}):e.name.charAt(0)})},Py=({external:e,href:t,...n})=>e||!t?U(`a`,{...n,href:t,target:`_blank`,rel:`noreferrer`}):U(Mf,{...n,href:t}),Fy=({sources:e,compact:t=!1,film:n=!1,pending:r=!1,onPickRelease:i})=>{let[a,o]=W(null),s=tc(),c=n?e.filter(e=>!s.has(e.id)):e;return!c.length&&!(n&&r)?null:t?U(`div`,{css:My,children:e.filter(e=>!s.has(e.id)).slice(0,5).map(e=>U(Py,{className:`src`,style:{"--brand":Ay(e)},href:e.href,external:e.external,title:`Watch on ${e.name}`,children:U(Ny,{source:e})},e.id))}):G(`div`,{css:jy,className:n?`watch film`:`watch`,children:[n?void 0:U(`div`,{className:`label`,children:`Watch on`}),G(`div`,{className:`list`,children:[c.length?void 0:U(ty,{className:`pending`}),c.map(e=>e.releases&&e.releases.length>1&&!n?U(Iy,{source:e,onOpenPicker:()=>o(e)},e.id):G(Py,{className:`source${e.active?` active`:``}`,style:{"--brand":Ay(e)},href:e.href,external:e.external,title:e.name,children:[U(Ny,{source:e}),U(`span`,{className:`name`,children:e.name}),e.releases&&e.releases.length>1?U(`span`,{className:`count`,children:e.releases.length}):void 0,e.active?G(`span`,{className:`playing`,children:[U(`i`,{}),U(`i`,{}),U(`i`,{})]}):e.external?U(`span`,{className:`ext`,children:`↗`}):U(`span`,{className:`play`,children:`▶`})]},e.id))]}),a?.picker?U(Dy,{pluginUri:a.picker.pluginUri,origin:a.id,name:a.name,uris:(a.releases??[]).map(e=>e.uri),onPick:e=>{o(null),i?.(e)},onClose:()=>o(null)}):void 0]})},Iy=({source:e,onOpenPicker:t})=>{let n=e.releases??[],[r,i]=W(n.some(e=>e.active)),a=!!e.picker;return G(`div`,{className:`source-group`,style:{"--brand":Ay(e)},children:[G(`button`,{type:`button`,className:`source${e.active?` active`:``}`,style:{"--brand":Ay(e)},onClick:()=>a?t():i(e=>!e),title:`${n.length} releases on ${e.name}`,"aria-expanded":a?void 0:r,"aria-haspopup":a?`dialog`:void 0,children:[U(Ny,{source:e}),U(`span`,{className:`name`,children:e.name}),U(`span`,{className:`count`,children:n.length}),U(`span`,{className:`chevron`,children:a?`›`:r?`▾`:`▸`})]}),!a&&r?U(`div`,{className:`releases`,children:n.map(e=>G(Py,{className:`release${e.active?` active`:``}`,href:e.href,external:e.external,title:e.label,children:[U(`span`,{className:`release-label`,children:e.label}),e.active?G(`span`,{className:`playing`,children:[U(`i`,{}),U(`i`,{}),U(`i`,{})]}):e.external?U(`span`,{className:`ext`,children:`↗`}):U(`span`,{className:`play`,children:`▶`})]},e.uri))}):void 0]})},Ly=e=>e?w(e)?s(e)?.handleUris??[]:c(e)?[e]:[]:[],Ry=(e,t)=>{let n=Ly(e);if(!n.length)return!1;let r=new Set(Ly(t));return n.some(e=>r.has(e))},zy=(e,t)=>t?.find(t=>Ry(t.uri,e)),By=(e,t)=>t&&e.operation?.variables?.input?.uri===t?e.data?.media??void 0:void 0;K();var Vy=Iv(`
1494
+ `,Py=({source:e})=>{let[t,n]=W(!1);return U(`span`,{className:`icon`,children:e.icon&&!t?U(`img`,{src:e.icon,alt:``,onError:()=>n(!0)}):e.name.charAt(0)})},Fy=({external:e,href:t,...n})=>e||!t?U(`a`,{...n,href:t,target:`_blank`,rel:`noreferrer`}):U(Mf,{...n,href:t}),Iy=({sources:e,compact:t=!1,film:n=!1,pending:r=!1,onPickRelease:i})=>{let[a,o]=W(null),s=tc(),c=n?e.filter(e=>!s.has(e.id)):e;return!c.length&&!(n&&r)?null:t?U(`div`,{css:Ny,children:e.filter(e=>!s.has(e.id)).slice(0,5).map(e=>U(Fy,{className:`src`,style:{"--brand":jy(e)},href:e.href,external:e.external,title:`Watch on ${e.name}`,children:U(Py,{source:e})},e.id))}):G(`div`,{css:My,className:n?`watch film`:`watch`,children:[n?void 0:U(`div`,{className:`label`,children:`Watch on`}),G(`div`,{className:`list`,children:[c.length?void 0:U(ty,{className:`pending`}),c.map(e=>e.releases&&e.releases.length>1&&!n?U(Ly,{source:e,onOpenPicker:()=>o(e)},e.id):G(Fy,{className:`source${e.active?` active`:``}`,style:{"--brand":jy(e)},href:e.href,external:e.external,title:e.name,children:[U(Py,{source:e}),U(`span`,{className:`name`,children:e.name}),e.releases&&e.releases.length>1?U(`span`,{className:`count`,children:e.releases.length}):void 0,e.active?G(`span`,{className:`playing`,children:[U(`i`,{}),U(`i`,{}),U(`i`,{})]}):e.external?U(`span`,{className:`ext`,children:`↗`}):U(`span`,{className:`play`,children:`▶`})]},e.id))]}),a?.picker?U(Oy,{pluginUri:a.picker.pluginUri,origin:a.id,name:a.name,uris:(a.releases??[]).map(e=>e.uri),onPick:e=>{o(null),i?.(e)},onClose:()=>o(null)}):void 0]})},Ly=({source:e,onOpenPicker:t})=>{let n=e.releases??[],[r,i]=W(n.some(e=>e.active)),a=!!e.picker;return G(`div`,{className:`source-group`,style:{"--brand":jy(e)},children:[G(`button`,{type:`button`,className:`source${e.active?` active`:``}`,style:{"--brand":jy(e)},onClick:()=>a?t():i(e=>!e),title:`${n.length} releases on ${e.name}`,"aria-expanded":a?void 0:r,"aria-haspopup":a?`dialog`:void 0,children:[U(Py,{source:e}),U(`span`,{className:`name`,children:e.name}),U(`span`,{className:`count`,children:n.length}),U(`span`,{className:`chevron`,children:a?`›`:r?`▾`:`▸`})]}),!a&&r?U(`div`,{className:`releases`,children:n.map(e=>G(Fy,{className:`release${e.active?` active`:``}`,href:e.href,external:e.external,title:e.label,children:[U(`span`,{className:`release-label`,children:e.label}),e.active?G(`span`,{className:`playing`,children:[U(`i`,{}),U(`i`,{}),U(`i`,{})]}):e.external?U(`span`,{className:`ext`,children:`↗`}):U(`span`,{className:`play`,children:`▶`})]},e.uri))}):void 0]})},Ry=e=>e?w(e)?s(e)?.handleUris??[]:c(e)?[e]:[]:[],zy=(e,t)=>{let n=Ry(e);if(!n.length)return!1;let r=new Set(Ry(t));return n.some(e=>r.has(e))},By=(e,t)=>t?.find(t=>zy(t.uri,e)),Vy=(e,t)=>t&&e.operation?.variables?.input?.uri===t?e.data?.media??void 0:void 0;K();var Hy=Iv(`
1495
1495
  subscription MediaTracking($input: TrackingInput!) {
1496
1496
  tracking(input: $input) {
1497
1497
  _id
@@ -1530,7 +1530,7 @@ height: 100%;
1530
1530
  }
1531
1531
  }
1532
1532
  }
1533
- `),Hy=Iv(`
1533
+ `),Uy=Iv(`
1534
1534
  mutation SaveListEntry($input: SaveListEntryInput!) {
1535
1535
  saveListEntry(input: $input) {
1536
1536
  tracker
@@ -1545,7 +1545,7 @@ height: 100%;
1545
1545
  }
1546
1546
  }
1547
1547
  }
1548
- `),Uy=({uri:e,title:t,cover:n,episodeCount:r})=>{let[,i]=Ya(Hy);return async(a,o)=>{let s=await i({input:{uri:e,trackers:a,entry:o,title:t??null,cover:n??null,episodeCount:r??null}});return s.data?.saveListEntry??[{tracker:``,outcome:`FAILED`,error:s.error?.message??`The write did not reach the trackers`}]}},Wy=e=>{let t=q({uri:e,key:0}),{uri:n,key:r}=t.current;return e&&e!==n&&(t.current={uri:e,key:Ry(n,e)?r:r+1}),t.current.key},Gy=864e5,Ky=/^\d{4}(-\d{2}){0,2}$/,qy=e=>!!(e&&Ky.test(e)),Jy=e=>qy(e)&&e.length<10,Yy=1900,Xy=e=>{if(!e)return;let t=new Date(e);if(!Number.isNaN(t.getTime())&&!(t.getUTCFullYear()<Yy))return t},Zy=e=>{let t=Xy(e);if(t)return Jy(e)||t.getTime()%Gy?e:t.toISOString().slice(0,10)},Qy=(e,{locale:t}={})=>{let n=Xy(e);if(n)try{return new Intl.DateTimeFormat(t,{year:`numeric`,...Jy(e)?e.length>4?{month:`short`}:{}:{month:`short`,day:`numeric`},...qy(e)?{timeZone:`UTC`}:{}}).format(n)}catch{return}},$y=(e,t)=>t?Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()):Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),eb=(e,{locale:t,now:n=new Date,upcoming:r=!1}={})=>{let i=Xy(e);if(!i)return;let a=Math.round(($y(n,!1)-$y(i,qy(e)))/Gy);return a===0?`today`:a===1?`yesterday`:a>1&&a<30?`${a} days ago`:r&&a===-1?`tomorrow`:r&&a<-1&&-a<30?`in ${-a} days`:Qy(e,{locale:t})},tb=e=>{let t=Xy(e);if(t)return qy(e)?e:t.toISOString()},nb=e=>{if(!e||e<=0)return;let t=Math.floor(e/60),n=Math.round(e%60);return t?n?`${t}h ${n}m`:`${t}h`:`${n}m`},rb=({released:e,runtime:t,genres:n})=>{let r=Xy(e),i=r&&(qy(e)?r.getUTCFullYear():r.getFullYear());return[`Movie`,i?String(i):void 0,nb(t),n?.length?n.slice(0,3).join(`, `):void 0].filter(e=>!!e)},ib=({type:e,categories:t})=>e?e===`MOVIE`:!!t?.includes(`MOVIE`),ab=(e,t=new Date)=>{let n=Xy(e);if(!n)return;if(!qy(e))return n.getTime()>t.getTime()?1:-1;let r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()),i=n.getTime(),a=n.getUTCFullYear(),o=e.length===4?Date.UTC(a+1,0):e.length===7?Date.UTC(a,n.getUTCMonth()+1):i+864e5;return r<i?1:r<o?0:-1},ob=(e,t=new Date)=>ab(e,t)===1,sb=({status:e,nextAiringEpisode:t,episodes:n},r=new Date)=>{if(t)return t.episodeNumber+(Date.parse(t.airingAt)>r.getTime()?0:1);let i=[...n.filter(e=>ob(e.releaseDate,r)).map(e=>e.episodeNumber),e===`NOT_YET_RELEASED`?1:void 0].filter(e=>typeof e==`number`);return i.length?Math.min(...i):void 0},cb=({episodeNumber:e,releaseDate:t},n,r=new Date)=>{let i=ab(t,r);return n===void 0||e==null?i===1:e>=n&&i!==-1},lb=[`tvmaze`,`anizip`,`trakt`,`simkl`,`omdb`,`cr`,`tmdb`,`jw`,`appletv`],ub=({origin:e})=>{let t=lb.indexOf(e??``);return t===-1?lb.length:t},db=[`cr`,`appletv`],fb=({origin:e,releaseDate:t})=>Number(qy(t)||db.includes(e??``)),pb=e=>e?.handles?.map(e=>e.node).filter(e=>e.releaseDate).sort((e,t)=>fb(e)-fb(t)||ub(e)-ub(t)).at(0),mb=e=>{let t=pb(e);return t?fb(t)?Zy(t.releaseDate):t.releaseDate:e?.releaseDate??void 0},hb=e=>{let t=pb(e);return t&&!fb(t)?t.releaseDate:void 0},gb=864e5,_b=(e,t)=>{let n=Xy(e)?.getTime();if(n===void 0)return!0;let r=Date.parse(t);return(n%gb?n:n+gb)>r-gb&&n<r+gb},vb=(e,t)=>t&&e.episodeNumber===t.episodeNumber?t.airingAt:void 0,yb=(e,t=new Date)=>{let n=e.nextAiringEpisode,r=e.episodes.map(e=>({episodeNumber:e.episodeNumber,releaseDate:vb(e,n)??mb(e)})),i=sb({status:e.status,nextAiringEpisode:n,episodes:r},t);return r.map(e=>cb(e,i,t))},bb=({startDate:e,status:t,episode:n},r=new Date)=>{let i=Zy(e),a=mb(n),o=(Jy(i)?void 0:i)??a??i,s=ab(a&&!qy(a)&&_b(o,a)?a:o,r);return{released:o,upcoming:s===1||s===0&&Jy(o)&&t===`NOT_YET_RELEASED`}},xb=(e,t)=>e?.find(e=>!t.has(e.url))?.url,Sb=(e,t=2)=>{if(!Number.isFinite(e)||e<=0)return;let n=[],r=e;for(let e of Cb){let i=Math.floor(r/e.ms);if(r-=i*e.ms,i&&(n.push(`${i} ${i===1?e.singular:e.plural}`),n.length>=t))break}return n.length?n.join(`, `):void 0},Cb=[{ms:864e5,singular:`day`,plural:`days`},{ms:36e5,singular:`hour`,plural:`hours`},{ms:6e4,singular:`min`,plural:`mins`},{ms:1e3,singular:`sec`,plural:`secs`}];K();var wb=3e4,Tb=new Set,Eb,Db=()=>{let[e,t]=W(()=>Date.now());return V(()=>(Tb.add(t),Eb??=setInterval(()=>{let e=Date.now();for(let t of Tb)t(e)},wb),()=>{Tb.delete(t),!Tb.size&&Eb&&(clearInterval(Eb),Eb=void 0)}),[]),e},Ob=new Set([`cr`,`nf`,`amazon`]),kb=new Set([`nf`]),Ab={amazon:(e,t)=>p(e)&&(t===`extension`||m(h(e)))},jb=(e,t,n)=>!!t&&Ob.has(e)&&(Ab[e]?.(t,n)??!0)&&!Nt().includes(e),Mb={cru:`cr`,nfx:`nf`,nfa:`nf`,dnp:`disney`,amp:`amazon`,pva:`amazon`,prv:`amazon`,atp:`appletv`,hlu:`hulu`,mxx:`hbo`,pcp:`peacock`,pct:`peacock`,ppp:`paramount`,ppe:`paramount`,fuv:`fubo`,hdv:`hidive`,tbv:`tubi`,rkc:`roku`,ptv:`pluto`,plx:`plex`,hop:`hoopla`,stz:`starz`,acp:`amcplus`,phl:`philo`},Nb=e=>[...new Set((e?.handles??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node.origin))],Pb=e=>e?`${e} ${e===1?`Episode`:`Episodes`}`:void 0,Fb=e=>e?e.charAt(0)+e.slice(1).toLowerCase().replaceAll(`_`,` `):void 0,Ib=({source:e,value:t,scale:n})=>`${e} ${n===100?`${Math.round(t)}%`:t.toFixed(1)}`,Lb=e=>{let t=e?.filter(({title:t})=>t!==e[0]?.title)??[];return(t.find(({language:t})=>t!==e?.[0]?.language)??t[0])?.title},Rb=e=>[Pb(e.episodeCount),gp(e.type),_p(e.status)].filter(e=>!!e),zb=e=>e.ratings?.map(Ib)??[],Bb=(e,t={},n=!1,r=!1)=>{let i=Qy(Zy(e.startDate),t),a=e.status===ho.Releasing||e.status===ho.NotYetReleased?void 0:Qy(Zy(e.endDate),t),o=[e.titles?.[0]?.title,Lb(e.titles)],s=[...new Set(e.titles?.map(({title:e})=>e))].filter(e=>!o.includes(e));return[{label:`Format`,value:gp(e.type)},{label:`Episodes`,value:e.episodeCount?String(e.episodeCount):void 0},{label:e.type===go.Movie?`Length`:`Episode length`,value:e.duration?`${e.duration} min`:void 0},{label:`Status`,value:_p(e.status)},{label:r?`Releases`:`Aired`,value:i&&a&&a!==i?`${i} to ${a}`:i},{label:`Season`,value:vp(e.season,e.seasonYear)},{label:`Studios`,value:e.studios?.join(`, `)},{label:`Source`,value:Fb(e.sourceMaterial)},{label:`Genres`,value:e.genres?.join(`, `)},{label:`Tags`,value:e.tags?.join(`, `)},{label:`Also known as`,value:s.join(`, `)}].flatMap(({label:e,value:t})=>t?[{label:e,value:t}]:n?[{label:e}]:[])},Vb=e=>e?.status===`COMPLETED`?`Rewatch`:(e?.progress??0)>0?`Continue`:`Play`,Hb=(e,t)=>{let n=Vb(t),r=n===`Continue`?e.find(({episodeNumber:e})=>e===(t?.progress??0)+1):e[0];return r?.uri&&!r.unreleased?{label:n,episodeUri:r.uri}:void 0},Ub=(e,t)=>Vb(t)===`Continue`?Math.max(0,e.findLastIndex(({episodeNumber:e})=>e!=null&&e<=(t?.progress??0)+1)):0,Wb=(e,t,n)=>!!t&&(t.episodeCount==null||n==null||t.episodeCount===n)&&(t.status===`COMPLETED`||e!=null&&e>0&&e<=(t.progress??0));K();var Gb=Iv(`
1548
+ `),Wy=({uri:e,title:t,cover:n,episodeCount:r})=>{let[,i]=Ya(Uy);return async(a,o)=>{let s=await i({input:{uri:e,trackers:a,entry:o,title:t??null,cover:n??null,episodeCount:r??null}});return s.data?.saveListEntry??[{tracker:``,outcome:`FAILED`,error:s.error?.message??`The write did not reach the trackers`}]}},Gy=e=>{let t=q({uri:e,key:0}),{uri:n,key:r}=t.current;return e&&e!==n&&(t.current={uri:e,key:zy(n,e)?r:r+1}),t.current.key},Ky=864e5,qy=/^\d{4}(-\d{2}){0,2}$/,Jy=e=>!!(e&&qy.test(e)),Yy=e=>Jy(e)&&e.length<10,Xy=1900,Zy=e=>{if(!e)return;let t=new Date(e);if(!Number.isNaN(t.getTime())&&!(t.getUTCFullYear()<Xy))return t},Qy=e=>{let t=Zy(e);if(t)return Yy(e)||t.getTime()%Ky?e:t.toISOString().slice(0,10)},$y=(e,{locale:t}={})=>{let n=Zy(e);if(n)try{return new Intl.DateTimeFormat(t,{year:`numeric`,...Yy(e)?e.length>4?{month:`short`}:{}:{month:`short`,day:`numeric`},...Jy(e)?{timeZone:`UTC`}:{}}).format(n)}catch{return}},eb=(e,t)=>t?Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()):Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),tb=(e,{locale:t,now:n=new Date,upcoming:r=!1}={})=>{let i=Zy(e);if(!i)return;let a=Math.round((eb(n,!1)-eb(i,Jy(e)))/Ky);return a===0?`today`:a===1?`yesterday`:a>1&&a<30?`${a} days ago`:r&&a===-1?`tomorrow`:r&&a<-1&&-a<30?`in ${-a} days`:$y(e,{locale:t})},nb=e=>{let t=Zy(e);if(t)return Jy(e)?e:t.toISOString()},rb=e=>{if(!e||e<=0)return;let t=Math.floor(e/60),n=Math.round(e%60);return t?n?`${t}h ${n}m`:`${t}h`:`${n}m`},ib=({released:e,runtime:t,genres:n})=>{let r=Zy(e),i=r&&(Jy(e)?r.getUTCFullYear():r.getFullYear());return[`Movie`,i?String(i):void 0,rb(t),n?.length?n.slice(0,3).join(`, `):void 0].filter(e=>!!e)},ab=({type:e,categories:t})=>e?e===`MOVIE`:!!t?.includes(`MOVIE`),ob=(e,t=new Date)=>{let n=Zy(e);if(!n)return;if(!Jy(e))return n.getTime()>t.getTime()?1:-1;let r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()),i=n.getTime(),a=n.getUTCFullYear(),o=e.length===4?Date.UTC(a+1,0):e.length===7?Date.UTC(a,n.getUTCMonth()+1):i+864e5;return r<i?1:r<o?0:-1},sb=(e,t=new Date)=>ob(e,t)===1,cb=({status:e,nextAiringEpisode:t,episodes:n},r=new Date)=>{if(t)return t.episodeNumber+(Date.parse(t.airingAt)>r.getTime()?0:1);let i=[...n.filter(e=>sb(e.releaseDate,r)).map(e=>e.episodeNumber),e===`NOT_YET_RELEASED`?1:void 0].filter(e=>typeof e==`number`);return i.length?Math.min(...i):void 0},lb=({episodeNumber:e,releaseDate:t},n,r=new Date)=>{let i=ob(t,r);return n===void 0||e==null?i===1:e>=n&&i!==-1},ub=[`tvmaze`,`anizip`,`trakt`,`simkl`,`omdb`,`cr`,`tmdb`,`jw`,`appletv`],db=({origin:e})=>{let t=ub.indexOf(e??``);return t===-1?ub.length:t},fb=[`cr`,`appletv`],pb=({origin:e,releaseDate:t})=>Number(Jy(t)||fb.includes(e??``)),mb=e=>e?.handles?.map(e=>e.node).filter(e=>e.releaseDate).sort((e,t)=>pb(e)-pb(t)||db(e)-db(t)).at(0),hb=e=>{let t=mb(e);return t?pb(t)?Qy(t.releaseDate):t.releaseDate:e?.releaseDate??void 0},gb=e=>{let t=mb(e);return t&&!pb(t)?t.releaseDate:void 0},_b=864e5,vb=(e,t)=>{let n=Zy(e)?.getTime();if(n===void 0)return!0;let r=Date.parse(t);return(n%_b?n:n+_b)>r-_b&&n<r+_b},yb=(e,t)=>t&&e.episodeNumber===t.episodeNumber?t.airingAt:void 0,bb=(e,t=new Date)=>{let n=e.nextAiringEpisode,r=e.episodes.map(e=>({episodeNumber:e.episodeNumber,releaseDate:yb(e,n)??hb(e)})),i=cb({status:e.status,nextAiringEpisode:n,episodes:r},t);return r.map(e=>lb(e,i,t))},xb=({startDate:e,status:t,episode:n},r=new Date)=>{let i=Qy(e),a=hb(n),o=(Yy(i)?void 0:i)??a??i,s=ob(a&&!Jy(a)&&vb(o,a)?a:o,r);return{released:o,upcoming:s===1||s===0&&Yy(o)&&t===`NOT_YET_RELEASED`}},Sb=(e,t)=>e?.find(e=>!t.has(e.url))?.url,Cb=(e,t=2)=>{if(!Number.isFinite(e)||e<=0)return;let n=[],r=e;for(let e of wb){let i=Math.floor(r/e.ms);if(r-=i*e.ms,i&&(n.push(`${i} ${i===1?e.singular:e.plural}`),n.length>=t))break}return n.length?n.join(`, `):void 0},wb=[{ms:864e5,singular:`day`,plural:`days`},{ms:36e5,singular:`hour`,plural:`hours`},{ms:6e4,singular:`min`,plural:`mins`},{ms:1e3,singular:`sec`,plural:`secs`}];K();var Tb=3e4,Eb=new Set,Db,Ob=()=>{let[e,t]=W(()=>Date.now());return V(()=>(Eb.add(t),Db??=setInterval(()=>{let e=Date.now();for(let t of Eb)t(e)},Tb),()=>{Eb.delete(t),!Eb.size&&Db&&(clearInterval(Db),Db=void 0)}),[]),e},kb=new Set([`cr`,`nf`,`amazon`]),Ab=new Set([`nf`]),jb={amazon:(e,t)=>p(e)&&(t===`extension`||m(h(e)))},Mb=(e,t,n)=>!!t&&kb.has(e)&&(jb[e]?.(t,n)??!0)&&!Nt().includes(e),Nb={cru:`cr`,nfx:`nf`,nfa:`nf`,dnp:`disney`,amp:`amazon`,pva:`amazon`,prv:`amazon`,atp:`appletv`,hlu:`hulu`,mxx:`hbo`,pcp:`peacock`,pct:`peacock`,ppp:`paramount`,ppe:`paramount`,fuv:`fubo`,hdv:`hidive`,tbv:`tubi`,rkc:`roku`,ptv:`pluto`,plx:`plex`,hop:`hoopla`,stz:`starz`,acp:`amcplus`,phl:`philo`},Pb=e=>[...new Set((e?.handles??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node.origin))],Fb=e=>e?`${e} ${e===1?`Episode`:`Episodes`}`:void 0,Ib=e=>e?e.charAt(0)+e.slice(1).toLowerCase().replaceAll(`_`,` `):void 0,Lb=({source:e,value:t,scale:n})=>`${e} ${n===100?`${Math.round(t)}%`:t.toFixed(1)}`,Rb=e=>{let t=e?.filter(({title:t})=>t!==e[0]?.title)??[];return(t.find(({language:t})=>t!==e?.[0]?.language)??t[0])?.title},zb=e=>[Fb(e.episodeCount),gp(e.type),_p(e.status)].filter(e=>!!e),Bb=e=>e.ratings?.map(Lb)??[],Vb=(e,t={},n=!1,r=!1)=>{let i=$y(Qy(e.startDate),t),a=e.status===ho.Releasing||e.status===ho.NotYetReleased?void 0:$y(Qy(e.endDate),t),o=[e.titles?.[0]?.title,Rb(e.titles)],s=[...new Set(e.titles?.map(({title:e})=>e))].filter(e=>!o.includes(e));return[{label:`Format`,value:gp(e.type)},{label:`Episodes`,value:e.episodeCount?String(e.episodeCount):void 0},{label:e.type===go.Movie?`Length`:`Episode length`,value:e.duration?`${e.duration} min`:void 0},{label:`Status`,value:_p(e.status)},{label:r?`Releases`:`Aired`,value:i&&a&&a!==i?`${i} to ${a}`:i},{label:`Season`,value:vp(e.season,e.seasonYear)},{label:`Studios`,value:e.studios?.join(`, `)},{label:`Source`,value:Ib(e.sourceMaterial)},{label:`Genres`,value:e.genres?.join(`, `)},{label:`Tags`,value:e.tags?.join(`, `)},{label:`Also known as`,value:s.join(`, `)}].flatMap(({label:e,value:t})=>t?[{label:e,value:t}]:n?[{label:e}]:[])},Hb=e=>e?.status===`COMPLETED`?`Rewatch`:(e?.progress??0)>0?`Continue`:`Play`,Ub=(e,t)=>{let n=Hb(t),r=n===`Continue`?e.find(({episodeNumber:e})=>e===(t?.progress??0)+1):e[0];return r?.uri&&!r.unreleased?{label:n,episodeUri:r.uri}:void 0},Wb=(e,t)=>Hb(t)===`Continue`?Math.max(0,e.findLastIndex(({episodeNumber:e})=>e!=null&&e<=(t?.progress??0)+1)):0,Gb=(e,t,n)=>!!t&&(t.episodeCount==null||n==null||t.episodeCount===n)&&(t.status===`COMPLETED`||e!=null&&e>0&&e<=(t.progress??0));K();var Kb=Iv(`
1549
1549
  subscription GetMediaDetails($input: MediaInput!, $descriptionInput: MediaDescriptionInput!, $details: Boolean! = false) {
1550
1550
  media(input: $input) {
1551
1551
  ...MediaFragment
@@ -1723,7 +1723,7 @@ height: 100%;
1723
1723
  }
1724
1724
  }
1725
1725
  }
1726
- `),Kb=Iv(`
1726
+ `),qb=Iv(`
1727
1727
  subscription GetMediaOrigins($input: OriginPageInput!) {
1728
1728
  originPage(input: $input) {
1729
1729
  nodes {
@@ -1731,7 +1731,7 @@ height: 100%;
1731
1731
  }
1732
1732
  }
1733
1733
  }
1734
- `),qb=e=>{let[{data:t}]=Za({query:Vy,variables:{input:{uri:e??``}},pause:!e}),n=t?.tracking;return n&&Ry(n._id.slice(9),e)?n.summary:void 0},Jb=({media:e})=>{let t=qb(e?.uri),n=Db();if(!e)return null;let r=ib(e)&&bb({startDate:e.startDate,status:e.status,episode:e.episodes.at(0)},new Date(n)),i=r?e.episodes.map(()=>r.upcoming):yb(e,new Date(n)),a=Hb(e.episodes.map((e,t)=>({...e,unreleased:i[t]})),t);return a?G(Mf,{className:`play`,href:zf(Q.WATCH,{mediaUri:e.uri,episodeUri:a.episodeUri}),children:[U(tt,{size:20,fill:`currentColor`,"aria-hidden":`true`}),a.label]}):null},Yb=new Set(Object.values(Mb)),Xb=e=>{let[{data:t,operation:n}]=Za({query:Kb,variables:{input:{ids:e??[],filters:[_o.IsNotApiOnly]}},pause:!e}),r=n?.variables.input.ids;return{origins:t?.originPage?.nodes??[],answered:!e||e.every(e=>r?.includes(e))}},Zb=()=>{let[e,t]=W();return V(()=>{let e=!1;return ee().then(n=>{e||t(n)}),()=>{e=!0}},[]),e},Qb=e=>e.filter(e=>e.relation===`SAME_AS`&&e.node.url&&Yb.has(e.node.origin)),$b=(e,t=[])=>e?[...new Set([...Nb(e),...Qb(t).map(e=>e.node.origin)])]:[],ex=(e,t,n=[])=>{let{origins:r,answered:i}=Xb(e?$b(e,n):void 0),a=Zb();return{sources:e?nx(e,t,r,a,Qb(n)):[],answered:i}},tx=(e,t)=>{let n=q(void 0);return t&&(n.current=e),n.current!==void 0&&n.current===e},nx=(e,t,n,r,i=[])=>n.map(n=>{let a=(e.handles??[]).filter(e=>e.relation===`SAME_AS`&&e.node.origin===n.id).map(e=>e.node),o=a.at(0),s=o?.uri,c=jb(n.id,o?.url,r),l=e.uri&&s?zf(Q.WATCH,{mediaUri:t,episodeUri:e.uri,sourceUri:s}):void 0,u=a.length>1||c||o?.url!=null&&!/^https?:/.test(o.url);return{id:n.id,name:n.name??n.id,icon:n.icon,color:n.color,href:u?l:o?.url??i.find(e=>e.node.origin===n.id)?.node.url??void 0,external:!u,active:!1,releases:a.length>1?a.map(e=>({uri:e.uri,label:e.titles?.at(0)?.title??e.uri,external:!1,active:!1})):void 0}}).filter(e=>e.href).sort((e,t)=>Number(e.external)-Number(t.external)),rx=({uri:e,handles:t,except:n=[]})=>{let r=e?s(e)?.handleUrisValues:void 0,[{data:i}]=Za({query:Kb,variables:{input:{ids:[...new Set([...r?.map(e=>e.origin)??[],...t?.map(e=>e.node.origin)??[]])],filters:[_o.IsNotApiOnly]}}}),a=tc();return U(`span`,{className:`origins`,children:i?.originPage?.nodes?.map(e=>{let r=t?.filter(t=>t.node.origin===e.id&&t.node.url)??[],i=(r.find(e=>e.relation===`SAME_AS`)??r.at(0))?.node.url;if(!(!e.icon||a.has(e.id)||n.includes(e.id)))return i?U(`a`,{className:`origin`,href:i,target:`_blank`,rel:`noreferrer`,title:e.name,children:U(Ty,{icon:e.icon,name:e.name??e.id})},e.id):U(`div`,{className:`origin`,title:e.name,children:U(Ty,{icon:e.icon,name:e.name??e.id})},e.id)}).filter(Boolean)})},ix=L`
1734
+ `),Jb=e=>{let[{data:t}]=Za({query:Hy,variables:{input:{uri:e??``}},pause:!e}),n=t?.tracking;return n&&zy(n._id.slice(9),e)?n.summary:void 0},Yb=({media:e})=>{let t=Jb(e?.uri),n=Ob();if(!e)return null;let r=ab(e)&&xb({startDate:e.startDate,status:e.status,episode:e.episodes.at(0)},new Date(n)),i=r?e.episodes.map(()=>r.upcoming):bb(e,new Date(n)),a=Ub(e.episodes.map((e,t)=>({...e,unreleased:i[t]})),t);return a?G(Mf,{className:`play`,href:zf(Q.WATCH,{mediaUri:e.uri,episodeUri:a.episodeUri}),children:[U(tt,{size:20,fill:`currentColor`,"aria-hidden":`true`}),a.label]}):null},Xb=new Set(Object.values(Nb)),Zb=e=>{let[{data:t,operation:n}]=Za({query:qb,variables:{input:{ids:e??[],filters:[_o.IsNotApiOnly]}},pause:!e}),r=n?.variables.input.ids;return{origins:t?.originPage?.nodes??[],answered:!e||e.every(e=>r?.includes(e))}},Qb=()=>{let[e,t]=W();return V(()=>{let e=!1;return ee().then(n=>{e||t(n)}),()=>{e=!0}},[]),e},$b=e=>e.filter(e=>e.relation===`SAME_AS`&&e.node.url&&Xb.has(e.node.origin)),ex=(e,t=[])=>e?[...new Set([...Pb(e),...$b(t).map(e=>e.node.origin)])]:[],tx=(e,t,n=[])=>{let{origins:r,answered:i}=Zb(e?ex(e,n):void 0),a=Qb();return{sources:e?rx(e,t,r,a,$b(n)):[],answered:i}},nx=(e,t)=>{let n=q(void 0);return t&&(n.current=e),n.current!==void 0&&n.current===e},rx=(e,t,n,r,i=[])=>n.map(n=>{let a=(e.handles??[]).filter(e=>e.relation===`SAME_AS`&&e.node.origin===n.id).map(e=>e.node),o=a.at(0),s=o?.uri,c=Mb(n.id,o?.url,r),l=e.uri&&s?zf(Q.WATCH,{mediaUri:t,episodeUri:e.uri,sourceUri:s}):void 0,u=a.length>1||c||o?.url!=null&&!/^https?:/.test(o.url);return{id:n.id,name:n.name??n.id,icon:n.icon,color:n.color,href:u?l:o?.url??i.find(e=>e.node.origin===n.id)?.node.url??void 0,external:!u,active:!1,releases:a.length>1?a.map(e=>({uri:e.uri,label:e.titles?.at(0)?.title??e.uri,external:!1,active:!1})):void 0}}).filter(e=>e.href).sort((e,t)=>Number(e.external)-Number(t.external)),ix=({uri:e,handles:t,except:n=[]})=>{let r=e?s(e)?.handleUrisValues:void 0,[{data:i}]=Za({query:qb,variables:{input:{ids:[...new Set([...r?.map(e=>e.origin)??[],...t?.map(e=>e.node.origin)??[]])],filters:[_o.IsNotApiOnly]}}}),a=tc();return U(`span`,{className:`origins`,children:i?.originPage?.nodes?.map(e=>{let r=t?.filter(t=>t.node.origin===e.id&&t.node.url)??[],i=(r.find(e=>e.relation===`SAME_AS`)??r.at(0))?.node.url;if(!(!e.icon||a.has(e.id)||n.includes(e.id)))return i?U(`a`,{className:`origin`,href:i,target:`_blank`,rel:`noreferrer`,title:e.name,children:U(Ey,{icon:e.icon,name:e.name??e.id})},e.id):U(`div`,{className:`origin`,title:e.name,children:U(Ey,{icon:e.icon,name:e.name??e.id})},e.id)}).filter(Boolean)})},ax=L`
1735
1735
  border-top: 0.1rem solid rgba(255, 255, 255, 0.1);
1736
1736
 
1737
1737
  .episode {
@@ -1915,7 +1915,7 @@ height: 100%;
1915
1915
  }
1916
1916
  }
1917
1917
  }
1918
- `,ax=({episode:e,index:t,mediaUri:n,origins:r,backend:i,unreleased:a,airingAt:o,scheduled:s,now:c,watched:l,progress:u})=>{let[d,f]=W(()=>new Set),p=xb(e.thumbnails,d),m=o??s??mb(e),h=a&&o?Sb(Date.parse(o)-c):void 0,g=h?`in ${h}`:eb(m,{upcoming:a}),_=a?[]:nx(e,n,r,i),v=a?void 0:u??(l?1:void 0);return G(`div`,{className:a?`episode unreleased`:`episode`,children:[e.uri&&!a?U(Mf,{className:`episode-link`,href:zf(Q.WATCH,{mediaUri:n,episodeUri:e.uri})}):void 0,U(`div`,{className:`number`,children:e.episodeNumber}),G(`div`,{className:`thumbnail`,children:[p?U(`img`,{src:p,onError:()=>f(e=>new Set(e).add(p))}):void 0,v===void 0?void 0:U(`div`,{className:`bar`,role:`progressbar`,"aria-label":`Watched`,"aria-valuenow":Math.round(v*100),style:{width:`${v*100}%`}})]}),G(`div`,{className:`content`,children:[G(`div`,{className:`header`,children:[U(`div`,{className:`title`,children:e.titles?.at(0)?.title??(a?`Unreleased episode`:`Episode ${t+1}`)}),U(`span`,{className:`origins`,children:U(Fy,{compact:!0,sources:_})})]}),e.shortDescriptions?.at(0)?U(`div`,{className:`description`,children:U(Zv,{className:`ellipsis`,children:e.shortDescriptions?.at(0)?.shortDescription})}):void 0]}),U(`div`,{className:`side`,children:g?U(`time`,{className:`date`,dateTime:tb(m),children:g}):void 0})]})},ox=12,sx=e=>(e.handles??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node.uri),cx=({count:e=3})=>U(`div`,{className:`episodes`,css:ix,children:Array.from({length:e},(e,t)=>G(`div`,{className:`episode placeholder`,"aria-hidden":`true`,children:[U(`div`,{className:`number`}),U(ty,{className:`thumbnail`}),U(`div`,{className:`content`,children:U(`div`,{className:`header`,children:U(ty,{className:`title-pending`})})})]},t))}),lx=({media:e,tracked:t})=>{let n=Db(),r=yb(e,new Date(n)),i=r.indexOf(!0),a=new Map(e.airingSchedule?.filter(({airingAt:e})=>Date.parse(e)>n).map(({episodeNumber:e,airingAt:t})=>[e,t])),{origins:o}=Xb([...new Set(e.episodes.flatMap(Nb))]),s=Zb(),c=tl();return e.episodes.length?U(wy,{items:e.episodes,size:ox,label:`Episodes`,start:Ub(e.episodes,t),children:(l,u)=>U(`div`,{className:`episodes`,css:ix,children:l.map((l,d)=>{let f=u+d,p=el(sx(l),c),m=r[f]?a.get(l.episodeNumber):void 0;return U(ax,{episode:l,index:f,mediaUri:e.uri,origins:o,backend:s,unreleased:r[f],airingAt:vb(l,e.nextAiringEpisode)??(f===i?m??hb(l):void 0),scheduled:m,now:n,watched:Wb(l.episodeNumber,t,e.episodeCount),progress:p?.[2]?p[1]/p[2]:void 0},l.episodeNumber??l.uri??f)})})}):e.settled?U(`div`,{className:`episodes`,css:ix,children:U(`div`,{className:`empty`,children:`No episodes found`})}):U(cx,{count:Math.min(e.episodeCount||3,ox)})};Je();var ux=L`
1918
+ `,ox=({episode:e,index:t,mediaUri:n,origins:r,backend:i,unreleased:a,airingAt:o,scheduled:s,now:c,watched:l,progress:u})=>{let[d,f]=W(()=>new Set),p=Sb(e.thumbnails,d),m=o??s??hb(e),h=a&&o?Cb(Date.parse(o)-c):void 0,g=h?`in ${h}`:tb(m,{upcoming:a}),_=a?[]:rx(e,n,r,i),v=a?void 0:u??(l?1:void 0);return G(`div`,{className:a?`episode unreleased`:`episode`,children:[e.uri&&!a?U(Mf,{className:`episode-link`,href:zf(Q.WATCH,{mediaUri:n,episodeUri:e.uri})}):void 0,U(`div`,{className:`number`,children:e.episodeNumber}),G(`div`,{className:`thumbnail`,children:[p?U(`img`,{src:p,onError:()=>f(e=>new Set(e).add(p))}):void 0,v===void 0?void 0:U(`div`,{className:`bar`,role:`progressbar`,"aria-label":`Watched`,"aria-valuenow":Math.round(v*100),style:{width:`${v*100}%`}})]}),G(`div`,{className:`content`,children:[G(`div`,{className:`header`,children:[U(`div`,{className:`title`,children:e.titles?.at(0)?.title??(a?`Unreleased episode`:`Episode ${t+1}`)}),U(`span`,{className:`origins`,children:U(Iy,{compact:!0,sources:_})})]}),e.shortDescriptions?.at(0)?U(`div`,{className:`description`,children:U(Zv,{className:`ellipsis`,children:e.shortDescriptions?.at(0)?.shortDescription})}):void 0]}),U(`div`,{className:`side`,children:g?U(`time`,{className:`date`,dateTime:nb(m),children:g}):void 0})]})},sx=12,cx=e=>(e.handles??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node.uri),lx=({count:e=3})=>U(`div`,{className:`episodes`,css:ax,children:Array.from({length:e},(e,t)=>G(`div`,{className:`episode placeholder`,"aria-hidden":`true`,children:[U(`div`,{className:`number`}),U(ty,{className:`thumbnail`}),U(`div`,{className:`content`,children:U(`div`,{className:`header`,children:U(ty,{className:`title-pending`})})})]},t))}),ux=({media:e,tracked:t})=>{let n=Ob(),r=bb(e,new Date(n)),i=r.indexOf(!0),a=new Map(e.airingSchedule?.filter(({airingAt:e})=>Date.parse(e)>n).map(({episodeNumber:e,airingAt:t})=>[e,t])),{origins:o}=Zb([...new Set(e.episodes.flatMap(Pb))]),s=Qb(),c=tl();return e.episodes.length?U(Ty,{items:e.episodes,size:sx,label:`Episodes`,start:Wb(e.episodes,t),children:(l,u)=>U(`div`,{className:`episodes`,css:ax,children:l.map((l,d)=>{let f=u+d,p=el(cx(l),c),m=r[f]?a.get(l.episodeNumber):void 0;return U(ox,{episode:l,index:f,mediaUri:e.uri,origins:o,backend:s,unreleased:r[f],airingAt:yb(l,e.nextAiringEpisode)??(f===i?m??gb(l):void 0),scheduled:m,now:n,watched:Gb(l.episodeNumber,t,e.episodeCount),progress:p?.[2]?p[1]/p[2]:void 0},l.episodeNumber??l.uri??f)})})}):e.settled?U(`div`,{className:`episodes`,css:ax,children:U(`div`,{className:`empty`,children:`No episodes found`})}):U(lx,{count:Math.min(e.episodeCount||3,sx)})};Je();var dx=L`
1919
1919
  height: 70vh;
1920
1920
  .player-wrapper {
1921
1921
  position: absolute;
@@ -2054,7 +2054,7 @@ height: 70vh;
2054
2054
  }
2055
2055
  }
2056
2056
  }
2057
- `,dx=()=>globalThis.navigator?.connection,fx=e=>{let t=dx();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},px=({uri:e})=>{let[{data:t}]=Za({query:Gb,variables:{input:{uri:e},descriptionInput:{type:fo.Html}}});return U(Jb,{media:t?.media})},mx=({mediaNodes:e})=>{let[t]=Df(Rf(Q.MEDIA)),[n,r]=W(!0);V(()=>{let e=setTimeout(()=>r(!1),fy);return()=>clearTimeout(e)},[]);let i=H(()=>sy(e).filter(e=>!n||dy(e)),[e,n]),a=q(void 0);a.current=py(i,a.current);let o=a.current,s=o?.titles?.at(0)?.title,c=o?.shortDescriptions?.at(0)?.shortDescription,l=Ue(fx,()=>cy(dx())),u=Ue(js,()=>Ms().some(e=>e.state!==`connected`)),[d,f]=W(!1);V(()=>{if(!u)return;let e=setTimeout(()=>f(!0),ly);return()=>{clearTimeout(e),f(!1)}},[u]);let[p,m]=W([]),h=l||u&&!d?void 0:o?.trailers?.find(e=>!p.includes(e.uri)),g=xy(h?.url?void 0:by(o),o),[_,v]=W(!1),[y,b]=W(!0),[x,S]=W(.25),C=B(()=>{h&&m(e=>[...e,h.uri])},[h]);return G(`div`,{css:ux,className:`theater`,children:[G(`div`,{className:`player-wrapper`,style:!h?.url&&g?{backgroundImage:`url(${g})`}:void 0,children:[h?.url&&U(Kv,{url:h.url,paused:_||t,onError:C,volume:y?0:x,className:`player`}),U(`div`,{className:`shadow`})]}),G(`div`,{className:`information`,css:ux,children:[h?.url&&G(`div`,{className:`player-controls`,children:[G(`span`,{className:`playback`,children:[_?U(tt,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,onClick:()=>v(!1)}):U(mt,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,onClick:()=>v(!0)}),_?U(tt,{className:`icon-body`,size:30,onClick:()=>v(!1)}):U(mt,{className:`icon-body`,size:30,onClick:()=>v(!0)})]}),U(Yv,{defaultMuted:y,onMutedUpdate:b,defaultVolume:x,onVolumeUpdate:e=>S(e)})]}),U(`div`,{className:`title`,children:s??(o||!n?void 0:U(ty,{className:`pending`}))}),o||!n?U(Zv,{className:`short-description`,children:c}):U(ny,{count:3,className:`short-description pending`}),U(`div`,{className:`actions`,children:o?.uri?U(px,{uri:o.uri},ry(o)):void 0})]})]})};Je();function hx(e){let t=e;for(;t;){if(t.dir)return t.dir===`rtl`;t=t.parentElement}return!1}function gx(e,t){let[n,r]=W(t===`rtl`);return et(()=>{e&&(t||r(hx(e)))},[t,e]),n}var _x=typeof window<`u`?et:V;function vx(e){if(e!==void 0)switch(typeof e){case`number`:return e;case`string`:if(e.endsWith(`px`))return parseFloat(e)}}function yx({box:e,defaultHeight:t,defaultWidth:n,disabled:r,element:i,mode:a,style:o}){let{styleHeight:s,styleWidth:c}=H(()=>({styleHeight:vx(o?.height),styleWidth:vx(o?.width)}),[o?.height,o?.width]),[l,u]=W({height:t,width:n}),d=r||a===`only-height`&&s!==void 0||a===`only-width`&&c!==void 0||s!==void 0&&c!==void 0;return _x(()=>{if(i===null||d)return;let t=new ResizeObserver(e=>{for(let t of e){let{contentRect:e,target:n}=t;i===n&&u(t=>t.height===e.height&&t.width===e.width?t:{height:e.height,width:e.width})}});return t.observe(i,{box:e}),()=>{t?.unobserve(i)}},[e,d,i,s,c]),H(()=>({height:s??l.height,width:c??l.width}),[l,s,c])}function bx(e){let t=q(()=>{throw Error(`Cannot call an event handler while rendering.`)});return _x(()=>{t.current=e},[e]),B(e=>t.current?.(e),[t])}var xx=null;function Sx(e=!1){if(xx===null||e){let e=document.createElement(`div`),t=e.style;t.width=`50px`,t.height=`50px`,t.overflow=`scroll`,t.direction=`rtl`;let n=document.createElement(`div`),r=n.style;return r.width=`100px`,r.height=`100px`,e.appendChild(n),document.body.appendChild(e),e.scrollLeft>0?xx=`positive-descending`:(e.scrollLeft=1,xx=e.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(e),xx}return xx}function Cx({containerElement:e,direction:t,isRtl:n,scrollOffset:r}){if(t===`horizontal`&&n)switch(Sx()){case`negative`:return-r;case`positive-descending`:if(e){let{clientWidth:t,scrollLeft:n,scrollWidth:r}=e;return r-t-n}}return r}function wx(e,t=`Assertion error`){if(!e)throw console.error(t),Error(t)}function Tx({cachedBounds:e,itemCount:t,itemSize:n}){if(t===0)return 0;if(typeof n==`number`)return t*n;{let n=e.get(e.size===0?0:e.size-1);return wx(n!==void 0,`Unexpected bounds cache miss`),t*((n.scrollOffset+n.size)/e.size)}}function Ex({align:e,cachedBounds:t,index:n,itemCount:r,itemSize:i,containerScrollOffset:a,containerSize:o}){let s=Tx({cachedBounds:t,itemCount:r,itemSize:i}),c=t.get(n),l=Math.max(0,Math.min(s-o,c.scrollOffset)),u=Math.max(0,c.scrollOffset-o+c.size);switch(e===`smart`&&(e=a>=u&&a<=l?`auto`:`center`),e){case`start`:return l;case`end`:return u;case`center`:return c.scrollOffset<=o/2?0:c.scrollOffset+c.size/2>=s-o/2?s-o:c.scrollOffset+c.size/2-o/2;default:return a>=u&&a<=l?a:a<u?u:l}}function Dx({cachedBounds:e,containerScrollOffset:t,containerSize:n,itemCount:r,overscanCount:i}){let a=r-1,o=0,s=-1,c=0;for(;c<a;){let n=e.get(c);if(n.scrollOffset+n.size>t)break;c++}for(o=c,o=Math.max(0,o-i);c<a;){let r=e.get(c);if(r.scrollOffset+r.size>=t+n)break;c++}return s=Math.min(a,c),s=Math.min(r-1,s+i),o<0?[0,-1]:[o,s]}function Ox({itemCount:e,itemProps:t,itemSize:n}){let r=new Map;return{get(i){for(wx(i<e,`Invalid index ${i}`);r.size-1<i;){let e=r.size,a;switch(typeof n){case`function`:a=n(e,t);break;case`number`:a=n}if(e===0)r.set(e,{size:a,scrollOffset:0});else{let t=r.get(e-1);wx(t!==void 0,`Unexpected bounds cache miss for index ${i}`),r.set(e,{scrollOffset:t.scrollOffset+t.size,size:a})}}let a=r.get(i);return wx(a!==void 0,`Unexpected bounds cache miss for index ${i}`),a},set(e,t){r.set(e,t)},get size(){return r.size}}}function kx({itemCount:e,itemProps:t,itemSize:n}){return H(()=>Ox({itemCount:e,itemProps:t,itemSize:n}),[e,t,n])}function Ax({containerSize:e,itemSize:t}){let n;switch(typeof t){case`string`:wx(t.endsWith(`%`),`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`),wx(e!==void 0,`Container size must be defined if a percentage item size is specified`),n=e*parseInt(t)/100;break;default:n=t}return n}function jx({containerElement:e,containerStyle:t,defaultContainerSize:n=0,direction:r,isRtl:i=!1,itemCount:a,itemProps:o,itemSize:s,onResize:c,overscanCount:l}){let[u,d]=W([0,-1]),[f,p]=[Math.min(a-1,u[0]),Math.min(a-1,u[1])],{height:m=n,width:h=n}=yx({defaultHeight:r===`vertical`?n:void 0,defaultWidth:r===`horizontal`?n:void 0,element:e,mode:r===`vertical`?`only-height`:`only-width`,style:t}),g=q({height:0,width:0}),_=r===`vertical`?m:h,v=Ax({containerSize:_,itemSize:s});et(()=>{if(typeof c==`function`){let e=g.current;(e.height!==m||e.width!==h)&&(c({height:m,width:h},{...e}),e.height=m,e.width=h)}},[m,c,h]);let y=kx({itemCount:a,itemProps:o,itemSize:v}),b=B(e=>y.get(e),[y]),x=B(()=>Tx({cachedBounds:y,itemCount:a,itemSize:v}),[y,a,v]),S=B(t=>{let n=Cx({containerElement:e,direction:r,isRtl:i,scrollOffset:t});return Dx({cachedBounds:y,containerScrollOffset:n,containerSize:_,itemCount:a,overscanCount:l})},[y,e,_,r,i,a,l]);return _x(()=>{let t=(r===`vertical`?e?.scrollTop:e?.scrollLeft)??0;d(S(t))},[e,r,S]),_x(()=>{if(!e)return;let t=()=>{d(t=>{let{scrollLeft:n,scrollTop:o}=e,s=Cx({containerElement:e,direction:r,isRtl:i,scrollOffset:r===`vertical`?o:n}),c=Dx({cachedBounds:y,containerScrollOffset:s,containerSize:_,itemCount:a,overscanCount:l});return c[0]===t[0]&&c[1]===t[1]?t:c})};return e.addEventListener(`scroll`,t),()=>{e.removeEventListener(`scroll`,t)}},[y,e,_,r,a,l]),{getCellBounds:b,getEstimatedSize:x,scrollToIndex:bx(({align:t=`auto`,behavior:n=`auto`,containerScrollOffset:o,index:s})=>{let c=Ex({align:t,cachedBounds:y,containerScrollOffset:o,containerSize:_,index:s,itemCount:a,itemSize:v});if(e){if(c=Cx({containerElement:e,direction:r,isRtl:i,scrollOffset:c}),typeof e.scrollTo==`function`)r===`horizontal`?e.scrollTo({left:c,behavior:n||void 0}):e.scrollTo({behavior:n||void 0,top:c});else{let e=S(c);(e[0]!==f||e[1]!==p)&&d(e)}}}),startIndex:f,stopIndex:p}}function Mx(e){return H(()=>e,Object.values(e))}function Nx(e,t){if(e===t)return!0;if(!!e!=!!t||(wx(e!==void 0),wx(t!==void 0),Object.keys(e).length!==Object.keys(t).length))return!1;for(let n in e)if(!Object.is(t[n],e[n]))return!1;return!0}function Px(e,t){let{style:n,...r}=e,{style:i,...a}=t;return Nx(n,i)&&Nx(r,a)}function Fx({cellComponent:e,cellProps:t,className:n,columnCount:r,columnWidth:i,defaultHeight:a=0,defaultWidth:o=0,dir:s,gridRef:c,onCellsRendered:l,onResize:u,overscanCount:d=3,rowCount:f,rowHeight:p,style:m,...h}){let g=Mx(t),_=H(()=>Ae(e,Px),[e]),[v,y]=W(null),b=gx(v,s),{getCellBounds:x,getEstimatedSize:S,startIndex:C,scrollToIndex:w,stopIndex:T}=jx({containerElement:v,defaultContainerSize:o,direction:`horizontal`,isRtl:b,itemCount:r,itemProps:g,itemSize:i,onResize:u,overscanCount:d}),{getCellBounds:E,getEstimatedSize:D,startIndex:O,scrollToIndex:k,stopIndex:A}=jx({containerElement:v,defaultContainerSize:a,direction:`vertical`,itemCount:f,itemProps:g,itemSize:p,onResize:u,overscanCount:d});_t(c,()=>({get element(){return v},scrollToCell({behavior:e=`auto`,columnAlign:t=`auto`,columnIndex:n,rowAlign:r=`auto`,rowIndex:i}){k({align:r,behavior:e,containerScrollOffset:v?.scrollTop??0,index:i}),w({align:t,behavior:e,containerScrollOffset:v?.scrollLeft??0,index:n})},scrollToColumn({align:e=`auto`,behavior:t=`auto`,index:n}){w({align:e,behavior:t,containerScrollOffset:v?.scrollLeft??0,index:n})},scrollToRow({align:e=`auto`,behavior:t=`auto`,index:n}){k({align:e,behavior:t,containerScrollOffset:v?.scrollTop??0,index:n})}}),[v,w,k]),V(()=>{C>=0&&T>=0&&O>=0&&A>=0&&l&&l({columnStartIndex:C,columnStopIndex:T,rowStartIndex:O,rowStopIndex:A})},[l,C,T,O,A]);let j=H(()=>{let e=[];if(r>0&&f>0)for(let t=O;t<=A;t++){let n=E(t);for(let r=C;r<=T;r++){let i=x(r);e.push(ht(_,{...g,columnIndex:r,key:`${t}-${r}`,rowIndex:t,style:{position:`absolute`,left:b?void 0:0,right:b?0:void 0,transform:`translate(${b?-i.scrollOffset:i.scrollOffset}px, ${n.scrollOffset}px)`,height:f>1?n.size:`100%`,width:i.size}}))}}return e},[_,g,r,C,T,x,E,b,f,O,A]);return R(`div`,{...h,className:n,dir:s,ref:y,style:{width:`100%`,height:`100%`,...m,maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`},children:R(`div`,{className:n,style:{position:`relative`,height:D(),width:S()},children:j})})}var Ix=q,Lx={width:250,height:350},Rx=L`
2057
+ `,fx=()=>globalThis.navigator?.connection,px=e=>{let t=fx();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},mx=({uri:e})=>{let[{data:t}]=Za({query:Kb,variables:{input:{uri:e},descriptionInput:{type:fo.Html}}});return U(Yb,{media:t?.media})},hx=({mediaNodes:e})=>{let[t]=Df(Rf(Q.MEDIA)),[n,r]=W(!0);V(()=>{let e=setTimeout(()=>r(!1),py);return()=>clearTimeout(e)},[]);let i=H(()=>sy(e).filter(e=>!n||fy(e)),[e,n]),a=q(void 0);a.current=my(i,a.current);let o=a.current,s=o?.titles?.at(0)?.title,c=o?.shortDescriptions?.at(0)?.shortDescription,l=Ue(px,()=>ly(fx())),u=Ue(js,()=>Ms().some(e=>e.state===`connecting`&&!e.retry)),[d,f]=W(!1);V(()=>{if(!u)return;let e=setTimeout(()=>f(!0),uy);return()=>{clearTimeout(e),f(!1)}},[u]);let[p,m]=W([]),h=l||u&&!d?void 0:o?.trailers?.find(e=>!p.includes(e.uri)),g=o&&e.find(e=>ay(e,o)),_=Sy(h?.url?void 0:xy(g??o),o,{box:{width:globalThis.innerWidth,height:globalThis.innerHeight}}),[v,y]=W(!1),[b,x]=W(!0),[S,C]=W(.25),w=B(()=>{h&&m(e=>[...e,h.uri])},[h]);return G(`div`,{css:dx,className:`theater`,children:[G(`div`,{className:`player-wrapper`,style:!h?.url&&_?{backgroundImage:`url(${_})`}:void 0,children:[h?.url&&U(Kv,{url:h.url,paused:v||t,onError:w,volume:b?0:S,className:`player`}),U(`div`,{className:`shadow`})]}),G(`div`,{className:`information`,css:dx,children:[h?.url&&G(`div`,{className:`player-controls`,children:[G(`span`,{className:`playback`,children:[v?U(tt,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,onClick:()=>y(!1)}):U(mt,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,onClick:()=>y(!0)}),v?U(tt,{className:`icon-body`,size:30,onClick:()=>y(!1)}):U(mt,{className:`icon-body`,size:30,onClick:()=>y(!0)})]}),U(Yv,{defaultMuted:b,onMutedUpdate:x,defaultVolume:S,onVolumeUpdate:e=>C(e)})]}),U(`div`,{className:`title`,children:s??(o||!n?void 0:U(ty,{className:`pending`}))}),o||!n?U(Zv,{className:`short-description`,children:c}):U(ny,{count:3,className:`short-description pending`}),U(`div`,{className:`actions`,children:o?.uri?U(mx,{uri:o.uri},ry(o)):void 0})]})]})};Je();function gx(e){let t=e;for(;t;){if(t.dir)return t.dir===`rtl`;t=t.parentElement}return!1}function _x(e,t){let[n,r]=W(t===`rtl`);return et(()=>{e&&(t||r(gx(e)))},[t,e]),n}var vx=typeof window<`u`?et:V;function yx(e){if(e!==void 0)switch(typeof e){case`number`:return e;case`string`:if(e.endsWith(`px`))return parseFloat(e)}}function bx({box:e,defaultHeight:t,defaultWidth:n,disabled:r,element:i,mode:a,style:o}){let{styleHeight:s,styleWidth:c}=H(()=>({styleHeight:yx(o?.height),styleWidth:yx(o?.width)}),[o?.height,o?.width]),[l,u]=W({height:t,width:n}),d=r||a===`only-height`&&s!==void 0||a===`only-width`&&c!==void 0||s!==void 0&&c!==void 0;return vx(()=>{if(i===null||d)return;let t=new ResizeObserver(e=>{for(let t of e){let{contentRect:e,target:n}=t;i===n&&u(t=>t.height===e.height&&t.width===e.width?t:{height:e.height,width:e.width})}});return t.observe(i,{box:e}),()=>{t?.unobserve(i)}},[e,d,i,s,c]),H(()=>({height:s??l.height,width:c??l.width}),[l,s,c])}function xx(e){let t=q(()=>{throw Error(`Cannot call an event handler while rendering.`)});return vx(()=>{t.current=e},[e]),B(e=>t.current?.(e),[t])}var Sx=null;function Cx(e=!1){if(Sx===null||e){let e=document.createElement(`div`),t=e.style;t.width=`50px`,t.height=`50px`,t.overflow=`scroll`,t.direction=`rtl`;let n=document.createElement(`div`),r=n.style;return r.width=`100px`,r.height=`100px`,e.appendChild(n),document.body.appendChild(e),e.scrollLeft>0?Sx=`positive-descending`:(e.scrollLeft=1,Sx=e.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(e),Sx}return Sx}function wx({containerElement:e,direction:t,isRtl:n,scrollOffset:r}){if(t===`horizontal`&&n)switch(Cx()){case`negative`:return-r;case`positive-descending`:if(e){let{clientWidth:t,scrollLeft:n,scrollWidth:r}=e;return r-t-n}}return r}function Tx(e,t=`Assertion error`){if(!e)throw console.error(t),Error(t)}function Ex({cachedBounds:e,itemCount:t,itemSize:n}){if(t===0)return 0;if(typeof n==`number`)return t*n;{let n=e.get(e.size===0?0:e.size-1);return Tx(n!==void 0,`Unexpected bounds cache miss`),t*((n.scrollOffset+n.size)/e.size)}}function Dx({align:e,cachedBounds:t,index:n,itemCount:r,itemSize:i,containerScrollOffset:a,containerSize:o}){let s=Ex({cachedBounds:t,itemCount:r,itemSize:i}),c=t.get(n),l=Math.max(0,Math.min(s-o,c.scrollOffset)),u=Math.max(0,c.scrollOffset-o+c.size);switch(e===`smart`&&(e=a>=u&&a<=l?`auto`:`center`),e){case`start`:return l;case`end`:return u;case`center`:return c.scrollOffset<=o/2?0:c.scrollOffset+c.size/2>=s-o/2?s-o:c.scrollOffset+c.size/2-o/2;default:return a>=u&&a<=l?a:a<u?u:l}}function Ox({cachedBounds:e,containerScrollOffset:t,containerSize:n,itemCount:r,overscanCount:i}){let a=r-1,o=0,s=-1,c=0;for(;c<a;){let n=e.get(c);if(n.scrollOffset+n.size>t)break;c++}for(o=c,o=Math.max(0,o-i);c<a;){let r=e.get(c);if(r.scrollOffset+r.size>=t+n)break;c++}return s=Math.min(a,c),s=Math.min(r-1,s+i),o<0?[0,-1]:[o,s]}function kx({itemCount:e,itemProps:t,itemSize:n}){let r=new Map;return{get(i){for(Tx(i<e,`Invalid index ${i}`);r.size-1<i;){let e=r.size,a;switch(typeof n){case`function`:a=n(e,t);break;case`number`:a=n}if(e===0)r.set(e,{size:a,scrollOffset:0});else{let t=r.get(e-1);Tx(t!==void 0,`Unexpected bounds cache miss for index ${i}`),r.set(e,{scrollOffset:t.scrollOffset+t.size,size:a})}}let a=r.get(i);return Tx(a!==void 0,`Unexpected bounds cache miss for index ${i}`),a},set(e,t){r.set(e,t)},get size(){return r.size}}}function Ax({itemCount:e,itemProps:t,itemSize:n}){return H(()=>kx({itemCount:e,itemProps:t,itemSize:n}),[e,t,n])}function jx({containerSize:e,itemSize:t}){let n;switch(typeof t){case`string`:Tx(t.endsWith(`%`),`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`),Tx(e!==void 0,`Container size must be defined if a percentage item size is specified`),n=e*parseInt(t)/100;break;default:n=t}return n}function Mx({containerElement:e,containerStyle:t,defaultContainerSize:n=0,direction:r,isRtl:i=!1,itemCount:a,itemProps:o,itemSize:s,onResize:c,overscanCount:l}){let[u,d]=W([0,-1]),[f,p]=[Math.min(a-1,u[0]),Math.min(a-1,u[1])],{height:m=n,width:h=n}=bx({defaultHeight:r===`vertical`?n:void 0,defaultWidth:r===`horizontal`?n:void 0,element:e,mode:r===`vertical`?`only-height`:`only-width`,style:t}),g=q({height:0,width:0}),_=r===`vertical`?m:h,v=jx({containerSize:_,itemSize:s});et(()=>{if(typeof c==`function`){let e=g.current;(e.height!==m||e.width!==h)&&(c({height:m,width:h},{...e}),e.height=m,e.width=h)}},[m,c,h]);let y=Ax({itemCount:a,itemProps:o,itemSize:v}),b=B(e=>y.get(e),[y]),x=B(()=>Ex({cachedBounds:y,itemCount:a,itemSize:v}),[y,a,v]),S=B(t=>{let n=wx({containerElement:e,direction:r,isRtl:i,scrollOffset:t});return Ox({cachedBounds:y,containerScrollOffset:n,containerSize:_,itemCount:a,overscanCount:l})},[y,e,_,r,i,a,l]);return vx(()=>{let t=(r===`vertical`?e?.scrollTop:e?.scrollLeft)??0;d(S(t))},[e,r,S]),vx(()=>{if(!e)return;let t=()=>{d(t=>{let{scrollLeft:n,scrollTop:o}=e,s=wx({containerElement:e,direction:r,isRtl:i,scrollOffset:r===`vertical`?o:n}),c=Ox({cachedBounds:y,containerScrollOffset:s,containerSize:_,itemCount:a,overscanCount:l});return c[0]===t[0]&&c[1]===t[1]?t:c})};return e.addEventListener(`scroll`,t),()=>{e.removeEventListener(`scroll`,t)}},[y,e,_,r,a,l]),{getCellBounds:b,getEstimatedSize:x,scrollToIndex:xx(({align:t=`auto`,behavior:n=`auto`,containerScrollOffset:o,index:s})=>{let c=Dx({align:t,cachedBounds:y,containerScrollOffset:o,containerSize:_,index:s,itemCount:a,itemSize:v});if(e){if(c=wx({containerElement:e,direction:r,isRtl:i,scrollOffset:c}),typeof e.scrollTo==`function`)r===`horizontal`?e.scrollTo({left:c,behavior:n||void 0}):e.scrollTo({behavior:n||void 0,top:c});else{let e=S(c);(e[0]!==f||e[1]!==p)&&d(e)}}}),startIndex:f,stopIndex:p}}function Nx(e){return H(()=>e,Object.values(e))}function Px(e,t){if(e===t)return!0;if(!!e!=!!t||(Tx(e!==void 0),Tx(t!==void 0),Object.keys(e).length!==Object.keys(t).length))return!1;for(let n in e)if(!Object.is(t[n],e[n]))return!1;return!0}function Fx(e,t){let{style:n,...r}=e,{style:i,...a}=t;return Px(n,i)&&Px(r,a)}function Ix({cellComponent:e,cellProps:t,className:n,columnCount:r,columnWidth:i,defaultHeight:a=0,defaultWidth:o=0,dir:s,gridRef:c,onCellsRendered:l,onResize:u,overscanCount:d=3,rowCount:f,rowHeight:p,style:m,...h}){let g=Nx(t),_=H(()=>Ae(e,Fx),[e]),[v,y]=W(null),b=_x(v,s),{getCellBounds:x,getEstimatedSize:S,startIndex:C,scrollToIndex:w,stopIndex:T}=Mx({containerElement:v,defaultContainerSize:o,direction:`horizontal`,isRtl:b,itemCount:r,itemProps:g,itemSize:i,onResize:u,overscanCount:d}),{getCellBounds:E,getEstimatedSize:D,startIndex:O,scrollToIndex:k,stopIndex:A}=Mx({containerElement:v,defaultContainerSize:a,direction:`vertical`,itemCount:f,itemProps:g,itemSize:p,onResize:u,overscanCount:d});_t(c,()=>({get element(){return v},scrollToCell({behavior:e=`auto`,columnAlign:t=`auto`,columnIndex:n,rowAlign:r=`auto`,rowIndex:i}){k({align:r,behavior:e,containerScrollOffset:v?.scrollTop??0,index:i}),w({align:t,behavior:e,containerScrollOffset:v?.scrollLeft??0,index:n})},scrollToColumn({align:e=`auto`,behavior:t=`auto`,index:n}){w({align:e,behavior:t,containerScrollOffset:v?.scrollLeft??0,index:n})},scrollToRow({align:e=`auto`,behavior:t=`auto`,index:n}){k({align:e,behavior:t,containerScrollOffset:v?.scrollTop??0,index:n})}}),[v,w,k]),V(()=>{C>=0&&T>=0&&O>=0&&A>=0&&l&&l({columnStartIndex:C,columnStopIndex:T,rowStartIndex:O,rowStopIndex:A})},[l,C,T,O,A]);let j=H(()=>{let e=[];if(r>0&&f>0)for(let t=O;t<=A;t++){let n=E(t);for(let r=C;r<=T;r++){let i=x(r);e.push(ht(_,{...g,columnIndex:r,key:`${t}-${r}`,rowIndex:t,style:{position:`absolute`,left:b?void 0:0,right:b?0:void 0,transform:`translate(${b?-i.scrollOffset:i.scrollOffset}px, ${n.scrollOffset}px)`,height:f>1?n.size:`100%`,width:i.size}}))}}return e},[_,g,r,C,T,x,E,b,f,O,A]);return R(`div`,{...h,className:n,dir:s,ref:y,style:{width:`100%`,height:`100%`,...m,maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`},children:R(`div`,{className:n,style:{position:`relative`,height:D(),width:S()},children:j})})}var Lx=q,Rx={width:250,height:350},zx=L`
2058
2058
  &.card {
2059
2059
  background-color: #191919;
2060
2060
  background-size: cover;
@@ -2131,7 +2131,7 @@ height: 70vh;
2131
2131
  aspect-ratio: 5 / 7;
2132
2132
  }
2133
2133
  }
2134
- `,zx=({media:e,to:t,ellipsis:n=!0,standIn:r=!1,...i})=>{let a=e.titles?.at(0)?.title,o=xy(e.covers,e,{standIn:r,box:Lx});return G(`div`,{...i,css:Rx,className:`card category-item${n?``:` full-title`}`,style:{...typeof i.style==`object`?i.style:void 0,backgroundImage:o&&`url(${o})`},children:[U(Mf,{tabIndex:-1,to:t,className:`card link`}),U(`div`,{className:`information`,children:U(`div`,{className:`title`,children:U(Mf,{to:t,className:`title-text`,children:n?U(Zv,{children:a},a):a})})})]})};Je();var Bx=L`
2134
+ `,Bx=({media:e,to:t,ellipsis:n=!0,standIn:r=!1,...i})=>{let a=e.titles?.at(0)?.title,o=Sy(e.covers,e,{standIn:r,box:Rx});return G(`div`,{...i,css:zx,className:`card category-item${n?``:` full-title`}`,style:{...typeof i.style==`object`?i.style:void 0,backgroundImage:o&&`url(${o})`},children:[U(Mf,{tabIndex:-1,to:t,className:`card link`}),U(`div`,{className:`information`,children:U(`div`,{className:`title`,children:U(Mf,{to:t,className:`title-text`,children:n?U(Zv,{children:a},a):a})})})]})};Je();var Vx=L`
2135
2135
  cursor: grab;
2136
2136
  &:active {
2137
2137
  cursor: grabbing;
@@ -2139,7 +2139,7 @@ height: 70vh;
2139
2139
  &.active * {
2140
2140
  pointer-events: none;
2141
2141
  }
2142
- `,Vx=({children:e,isDragging:t,setIsDragging:n})=>{if(`ontouchstart`in document.documentElement)return U(z,{children:e});let[r,i]=W(null),[a,o]=W(!1),[s,c]=W(),l=q({startX:0,startY:0,scrollLeft:0,scrollTop:0}),u=H(()=>globalThis,[]),d=B(e=>{if(!(e.target instanceof HTMLElement)||e.offsetX>e.target.clientWidth||e.offsetY>e.target.clientHeight||!r||!r.contains(e.target))return;e.preventDefault();let t=r.children.item(0);if(t){let n=e.pageX-t.offsetLeft,r=e.pageY-t.offsetTop,i=t.scrollLeft,a=t.scrollTop;l.current={startX:n,startY:r,scrollLeft:i,scrollTop:a}}o(!0)},[o,n,c,r]),f=B(e=>{o(!1),n(!1),u.removeEventListener(`mousemove`,p),s&&clearTimeout(s),c(globalThis.setTimeout(()=>n(!1),50))},[o,n,c,s,r]),p=B(e=>{if(!a||!r)return;e.preventDefault();let t=r.children.item(0);if(t){let n=e.pageX-t.offsetLeft,r=e.pageY-t.offsetTop,i=n-l.current.startX,a=r-l.current.startY;t.scrollLeft=l.current.scrollLeft-i,t.scrollTop=l.current.scrollTop-a}n(!0)},[a,r]);return V(()=>{if(r)return u.addEventListener(`mousedown`,d),u.addEventListener(`mouseup`,f),u.addEventListener(`mousemove`,p),()=>{u.removeEventListener(`mousedown`,d),u.removeEventListener(`mouseup`,f),u.removeEventListener(`mousemove`,p)}},[r,a,n,s,d,f,p]),U(`div`,{ref:e=>i(e),className:`draggable ${t?`active`:``}`,css:Bx,children:e})};K();var Hx=L`
2142
+ `,Hx=({children:e,isDragging:t,setIsDragging:n})=>{if(`ontouchstart`in document.documentElement)return U(z,{children:e});let[r,i]=W(null),[a,o]=W(!1),[s,c]=W(),l=q({startX:0,startY:0,scrollLeft:0,scrollTop:0}),u=H(()=>globalThis,[]),d=B(e=>{if(!(e.target instanceof HTMLElement)||e.offsetX>e.target.clientWidth||e.offsetY>e.target.clientHeight||!r||!r.contains(e.target))return;e.preventDefault();let t=r.children.item(0);if(t){let n=e.pageX-t.offsetLeft,r=e.pageY-t.offsetTop,i=t.scrollLeft,a=t.scrollTop;l.current={startX:n,startY:r,scrollLeft:i,scrollTop:a}}o(!0)},[o,n,c,r]),f=B(e=>{o(!1),n(!1),u.removeEventListener(`mousemove`,p),s&&clearTimeout(s),c(globalThis.setTimeout(()=>n(!1),50))},[o,n,c,s,r]),p=B(e=>{if(!a||!r)return;e.preventDefault();let t=r.children.item(0);if(t){let n=e.pageX-t.offsetLeft,r=e.pageY-t.offsetTop,i=n-l.current.startX,a=r-l.current.startY;t.scrollLeft=l.current.scrollLeft-i,t.scrollTop=l.current.scrollTop-a}n(!0)},[a,r]);return V(()=>{if(r)return u.addEventListener(`mousedown`,d),u.addEventListener(`mouseup`,f),u.addEventListener(`mousemove`,p),()=>{u.removeEventListener(`mousedown`,d),u.removeEventListener(`mouseup`,f),u.removeEventListener(`mousemove`,p)}},[r,a,n,s,d,f,p]),U(`div`,{ref:e=>i(e),className:`draggable ${t?`active`:``}`,css:Vx,children:e})};K();var Ux=L`
2143
2143
  display: grid;
2144
2144
  background-color: rgb(35, 35, 35);
2145
2145
  border-radius: 1rem;
@@ -2206,7 +2206,7 @@ a {
2206
2206
  background-size: cover;
2207
2207
  background-position: center;
2208
2208
  }
2209
- `,Ux=({ref:e,media:t,...n})=>{let r=H(()=>t?.titles?.at(0)?.title,[t]),i=H(()=>t?.shortDescriptions?.at(0)?.shortDescription,[t]),a=xy(t?.covers,t),[o,s]=W([]),c=H(()=>t?.trailers.filter(e=>!o.includes(e.uri)).at(0),[o]),l=B(()=>{c&&s([...o,c.uri])},[c,o]);return G(`div`,{ref:e,className:`title-hovercard`,css:Hx,...n,children:[c?.url?U(Kv,{volume:0,url:c?.url,onError:l,redirectTo:zf(Q.MEDIA,{uri:t.uri}),className:`title-hovercard-player`}):a?U(Mf,{className:`trailer-fallback-cover`,style:{backgroundImage:`url(${a})`},to:zf(Q.MEDIA,{uri:t.uri})}):void 0,U(Mf,{to:zf(Q.MEDIA,{uri:t.uri}),children:G(`div`,{className:`content`,children:[U(`div`,{className:`title`,children:r}),U(`div`,{className:`top`,children:G(`span`,{className:`episodes`,children:[t.episodeCount??`?`,` Episodes`]})}),U(Zv,{className:`description`,children:i})]})})]})};Je();var Wx=L`
2209
+ `,Wx=({ref:e,media:t,...n})=>{let r=H(()=>t?.titles?.at(0)?.title,[t]),i=H(()=>t?.shortDescriptions?.at(0)?.shortDescription,[t]),a=Sy(t?.covers,t),[o,s]=W([]),c=H(()=>t?.trailers.filter(e=>!o.includes(e.uri)).at(0),[o]),l=B(()=>{c&&s([...o,c.uri])},[c,o]);return G(`div`,{ref:e,className:`title-hovercard`,css:Ux,...n,children:[c?.url?U(Kv,{volume:0,url:c?.url,onError:l,redirectTo:zf(Q.MEDIA,{uri:t.uri}),className:`title-hovercard-player`}):a?U(Mf,{className:`trailer-fallback-cover`,style:{backgroundImage:`url(${a})`},to:zf(Q.MEDIA,{uri:t.uri})}):void 0,U(Mf,{to:zf(Q.MEDIA,{uri:t.uri}),children:G(`div`,{className:`content`,children:[U(`div`,{className:`title`,children:r}),U(`div`,{className:`top`,children:G(`span`,{className:`episodes`,children:[t.episodeCount??`?`,` Episodes`]})}),U(Zv,{className:`description`,children:i})]})})]})};Je();var Gx=L`
2210
2210
  display: flex;
2211
2211
  flex-direction: column;
2212
2212
  position: relative;
@@ -2287,7 +2287,7 @@ position: relative;
2287
2287
  display: none;
2288
2288
  }
2289
2289
  }
2290
- `,Gx=({style:e,mediaNodes:t,columnIndex:n})=>{let r=t[n];if(!r)return null;let[i,a]=W(!1),{x:o,y:s,strategy:c,refs:l,context:u}=Fg({open:i,onOpenChange:a,whileElementsMounted:St,placement:`top`,middleware:[fh(({rects:e})=>-e.reference.height/2-e.floating.height/2),ph({crossAxis:!0,padding:25})]}),d=Hh(u,{restMs:400,handleClose:Xg()}),{styles:f}=Kg(u,{initial:{opacity:0,transform:`scale(0.8)`},open:{opacity:1,transform:`scale(1)`},duration:150}),{getReferenceProps:p,getFloatingProps:m}=zg([d]);return G(z,{children:[i&&U(lg,{children:U(Ux,{media:r,ref:l.setFloating,style:{...f,position:c,top:s??0,left:o??0,zIndex:jr.hoverCard},...m()})}),U(zx,{media:r,to:zf(Q.MEDIA,{uri:r.uri}),standIn:!0,style:{...e,width:250,marginLeft:`var(--card-gutter, 100px)`},onMouseEnter:e=>{e.target instanceof HTMLElement&&l.setReference(e.target)},...p()})]})},Kx=({title:e,titleTo:t,mediaNodes:n})=>{let[r,i]=W(0),[a,o]=W(0),[s,c]=W(!1),l=Ix(null),u=B(e=>{let t=l.current;t&&t.scrollToColumn({index:e===`left`?r<=0?0:r:a+1>=n.length?n.length-1:a,behavior:`smooth`})},[r,a,n.length,l]),[d,f]=W(!1);return V(()=>{let e=setTimeout(()=>f(!0),5e3);return()=>clearTimeout(e)},[]),G(`div`,{css:Wx,children:[t?U(Mf,{to:t,className:`title`,children:e}):U(`span`,{className:`title`,children:e}),U(`div`,{className:`list-container`,children:n.length||d?G(z,{children:[U(Vx,{isDragging:s,setIsDragging:c,children:U(Fx,{gridRef:l,className:`virtual-list`,cellComponent:Gx,cellProps:{mediaNodes:n},columnCount:n.length,columnWidth:260,rowCount:1,rowHeight:350,overscanCount:5,onCellsRendered:({columnStartIndex:e,columnStopIndex:t})=>{i(e),o(t)}})}),U(`button`,{className:`scroll-button left`,onClick:()=>u(`left`),children:U(rt,{})}),U(`button`,{className:`scroll-button right`,onClick:()=>u(`right`),children:U(at,{})})]}):U(`div`,{className:`pending`,children:Array.from({length:8},(e,t)=>U(ty,{},t))})})]})};K();var qx=L`
2290
+ `,Kx=({style:e,mediaNodes:t,columnIndex:n})=>{let r=t[n];if(!r)return null;let[i,a]=W(!1),{x:o,y:s,strategy:c,refs:l,context:u}=Fg({open:i,onOpenChange:a,whileElementsMounted:St,placement:`top`,middleware:[fh(({rects:e})=>-e.reference.height/2-e.floating.height/2),ph({crossAxis:!0,padding:25})]}),d=Hh(u,{restMs:400,handleClose:Xg()}),{styles:f}=Kg(u,{initial:{opacity:0,transform:`scale(0.8)`},open:{opacity:1,transform:`scale(1)`},duration:150}),{getReferenceProps:p,getFloatingProps:m}=zg([d]);return G(z,{children:[i&&U(lg,{children:U(Wx,{media:r,ref:l.setFloating,style:{...f,position:c,top:s??0,left:o??0,zIndex:jr.hoverCard},...m()})}),U(Bx,{media:r,to:zf(Q.MEDIA,{uri:r.uri}),standIn:!0,style:{...e,width:250,marginLeft:`var(--card-gutter, 100px)`},onMouseEnter:e=>{e.target instanceof HTMLElement&&l.setReference(e.target)},...p()})]})},qx=({title:e,titleTo:t,mediaNodes:n})=>{let[r,i]=W(0),[a,o]=W(0),[s,c]=W(!1),l=Lx(null),u=B(e=>{let t=l.current;t&&t.scrollToColumn({index:e===`left`?r<=0?0:r:a+1>=n.length?n.length-1:a,behavior:`smooth`})},[r,a,n.length,l]),[d,f]=W(!1);return V(()=>{let e=setTimeout(()=>f(!0),5e3);return()=>clearTimeout(e)},[]),G(`div`,{css:Gx,children:[t?U(Mf,{to:t,className:`title`,children:e}):U(`span`,{className:`title`,children:e}),U(`div`,{className:`list-container`,children:n.length||d?G(z,{children:[U(Hx,{isDragging:s,setIsDragging:c,children:U(Ix,{gridRef:l,className:`virtual-list`,cellComponent:Kx,cellProps:{mediaNodes:n},columnCount:n.length,columnWidth:260,rowCount:1,rowHeight:350,overscanCount:5,onCellsRendered:({columnStartIndex:e,columnStopIndex:t})=>{i(e),o(t)}})}),U(`button`,{className:`scroll-button left`,onClick:()=>u(`left`),children:U(rt,{})}),U(`button`,{className:`scroll-button right`,onClick:()=>u(`right`),children:U(at,{})})]}):U(`div`,{className:`pending`,children:Array.from({length:8},(e,t)=>U(ty,{},t))})})]})};K();var Jx=L`
2291
2291
  position: relative;
2292
2292
  overflow: hidden;
2293
2293
  transition: max-height 0.3s ease-in-out;
@@ -2325,7 +2325,7 @@ transition: max-height 0.3s ease-in-out;
2325
2325
  width: 100%;
2326
2326
  background-color: rgb(35, 35, 35);
2327
2327
  }
2328
- `,Jx=({children:e,collapsedHeight:t=200,...n})=>{let[r,i]=W(!1),[a,o]=W(!1),s=q(null),[c,l]=W(0);V(()=>{if(!s.current)return;let e=new ResizeObserver(()=>{if(s.current){let e=s.current.scrollHeight;l(e),o(e>t)}});return e.observe(s.current),()=>e.disconnect()},[t]);let u=()=>i(!r);return G(`div`,{...n,ref:s,css:qx,className:`${n.className||``} ${r?`expanded`:`collapsed`}`,children:[U(`div`,{className:`content`,children:e}),a&&!r?U(`div`,{className:`fade-overlay`}):void 0,a?U(`button`,{className:`toggle-button`,onClick:u,children:r?`Collapse`:`Expand`}):void 0]})},Yx=`this build of the worker exposes no traceGraph, so there is nothing to read a trace from`,Xx=async()=>await st(()=>import(`./worker-KoBi1osA.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url),Zx=async e=>{let t=await Xx();if(typeof t.traceGraph!=`function`)throw Error(Yx);return t.traceGraph(e)},Qx=async e=>{let t=await Xx();if(typeof t.traceAnswer!=`function`)throw Error(Yx);return t.traceAnswer(e)},$x=[`graph`,`store`],eS=({uri:e,search:t}={})=>{let n=zf(Q.DEBUG_TRACE),r=new URLSearchParams;e&&r.set(`uri`,e);let i=iS(t??``);for(let e of $x)for(let t of i.getAll(e))r.append(e,t);let a=r.toString();return a?`${n}?${a}`:n},tS=e=>{let t=iS(oS(e)),n=new URLSearchParams;for(let e of $x)for(let r of t.getAll(e))n.append(e,r);let r=n.toString();return r?`?${r}`:``},nS=(e,t=`graph`)=>{let n=iS(e);return n.set(t,`1`),`${zf(Q.DEBUG_TRACE)}?${n.toString()}`},rS=e=>{let t=iS(e);t.delete(`store`);let n=t.toString();return`${zf(Q.DEBUG_TRACE)}${n?`?${n}`:``}`},iS=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),aS=typeof location>`u`?``:location.search,oS=(e=``)=>{let t=iS(aS);for(let[n,r]of iS(e))t.set(n,r);return t.toString()},sS=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e).get(`uri`)??``,cS={PREQUEL:`SEQUEL`,ADAPTATION:`SOURCE`,COMPILATION:`CONTAINS`,SIDE_STORY:`PARENT`},lS=e=>{let t=new Set,n=[];for(let r of e){if(!r?.from||!r?.to||r.from===r.to)continue;let e=cS[r.relation],i=e?{from:r.to,to:r.from,relation:e}:r,a=`${i.from}\u0000${i.to}\u0000${i.relation}`;t.has(a)||(t.add(a),n.push(i))}return n},uS=new Set([`TV`,`TV_SHORT`,`MOVIE`,`SPECIAL`,`OVA`,`ONA`,`MUSIC`]),dS=e=>!e||uS.has(e),fS=e=>[...new Set((e.nodes??[]).map(e=>e.format??``).filter(Boolean))].sort(),pS=(e,t)=>{let n=(e.nodes??[]).filter(t),r=new Set(n.map(e=>e.uri));return{nodes:n,edges:(e.edges??[]).filter(e=>r.has(e.from)&&r.has(e.to))}},mS=e=>`${e.from}\u0000${e.to}\u0000${e.relation}`,hS=(e,t)=>{if(!e)return{nodes:new Set,edges:new Set};if(e.kind===`node`){let n=t.filter(t=>t.from===e.uri||t.to===e.uri);return{nodes:new Set([e.uri]),edges:new Set(n.map(mS))}}let n=t.find(t=>mS(t)===e.key);return n?{nodes:new Set([n.from,n.to]),edges:new Set([e.key])}:{nodes:new Set,edges:new Set}},gS=e=>e.titles?.[0]?.title||e.uri,_S=e=>[...e].sort((e,t)=>(e.startDate??`9999`).localeCompare(t.startDate??`9999`)||gS(e).localeCompare(gS(t))),vS=(e,t)=>{let n=new Map(e.map(e=>[e.uri,0]));for(let r=0;r<e.length;r++){let e=!1;for(let r of t){let t=n.get(r.from),i=n.get(r.to);t!==void 0&&i!==void 0&&i<t+1&&(n.set(r.to,t+1),e=!0)}if(!e)break}let r=[...new Set(n.values())].sort((e,t)=>e-t),i=new Map(r.map((e,t)=>[e,t]));for(let[e,t]of n)n.set(e,i.get(t)??0);return n},yS=(e,t=`story`)=>{let n=lS(e.edges??[]),r=new Set((e.nodes??[]).map(e=>e.uri)),i=n.filter(e=>r.has(e.from)&&r.has(e.to)),a=_S(e.nodes??[]),o=t===`graph`?vS(a,i):void 0,s=[...new Set(a.map(e=>e.startDate??``))],c=new Map(s.map((e,t)=>[e,t])),l=new Map,u=a.map(e=>{let t=o?o.get(e.uri)??0:c.get(e.startDate??``)??0,n=l.get(t)??0;return l.set(t,n+1),{...e,column:t,row:n}}),d=[];if(t===`story`)for(let e=0;e<u.length-1;e++){let t=u[e],n=u[e+1];n.column>t.column&&d.push({from:t.uri,to:n.uri})}return{nodes:u,edges:i,chain:d,columns:Math.max(0,...u.map(e=>e.column+1)),rows:Math.max(0,...l.values())}},bS={ADAPTATION:`Adaptation`,PREQUEL:`Prequel`,SEQUEL:`Sequel`,PARENT:`Parent story`,SIDE_STORY:`Side story`,CHARACTER:`Character`,SUMMARY:`Summary`,ALTERNATIVE:`Alternative`,SPIN_OFF:`Spin off`,SOURCE:`Source`,COMPILATION:`Compilation`,CONTAINS:`Contains`,OTHER:`Related`},xS=[`SOURCE`,`PREQUEL`,`SEQUEL`,`PARENT`,`SIDE_STORY`,`SPIN_OFF`,`ALTERNATIVE`,`ADAPTATION`,`SUMMARY`,`COMPILATION`,`CONTAINS`,`CHARACTER`,`OTHER`],SS=e=>{let t=xS.indexOf(e);return t===-1?xS.length:t},CS=e=>e&&bS[e]||bS.OTHER,wS={TV:`TV`,TV_SHORT:`TV Short`,MOVIE:`Movie`,SPECIAL:`Special`,OVA:`OVA`,ONA:`ONA`,MUSIC:`Music`,MANGA:`Manga`,NOVEL:`Light Novel`,ONE_SHOT:`One Shot`},TS=e=>e?wS[e]||e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):void 0,ES=e=>[...e].sort((e,t)=>SS(e.relation)-SS(t.relation)),DS=e=>e.filter(e=>dS(e.format)),OS=3,kS=L`
2328
+ `,Yx=({children:e,collapsedHeight:t=200,...n})=>{let[r,i]=W(!1),[a,o]=W(!1),s=q(null),[c,l]=W(0);V(()=>{if(!s.current)return;let e=new ResizeObserver(()=>{if(s.current){let e=s.current.scrollHeight;l(e),o(e>t)}});return e.observe(s.current),()=>e.disconnect()},[t]);let u=()=>i(!r);return G(`div`,{...n,ref:s,css:Jx,className:`${n.className||``} ${r?`expanded`:`collapsed`}`,children:[U(`div`,{className:`content`,children:e}),a&&!r?U(`div`,{className:`fade-overlay`}):void 0,a?U(`button`,{className:`toggle-button`,onClick:u,children:r?`Collapse`:`Expand`}):void 0]})},Xx=`this build of the worker exposes no traceGraph, so there is nothing to read a trace from`,Zx=async()=>await st(()=>import(`./worker-Bqm03xpO.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url),Qx=async e=>{let t=await Zx();if(typeof t.traceGraph!=`function`)throw Error(Xx);return t.traceGraph(e)},$x=async e=>{let t=await Zx();if(typeof t.traceAnswer!=`function`)throw Error(Xx);return t.traceAnswer(e)},eS=[`graph`,`store`],tS=({uri:e,search:t}={})=>{let n=zf(Q.DEBUG_TRACE),r=new URLSearchParams;e&&r.set(`uri`,e);let i=aS(t??``);for(let e of eS)for(let t of i.getAll(e))r.append(e,t);let a=r.toString();return a?`${n}?${a}`:n},nS=e=>{let t=aS(sS(e)),n=new URLSearchParams;for(let e of eS)for(let r of t.getAll(e))n.append(e,r);let r=n.toString();return r?`?${r}`:``},rS=(e,t=`graph`)=>{let n=aS(e);return n.set(t,`1`),`${zf(Q.DEBUG_TRACE)}?${n.toString()}`},iS=e=>{let t=aS(e);t.delete(`store`);let n=t.toString();return`${zf(Q.DEBUG_TRACE)}${n?`?${n}`:``}`},aS=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),oS=typeof location>`u`?``:location.search,sS=(e=``)=>{let t=aS(oS);for(let[n,r]of aS(e))t.set(n,r);return t.toString()},cS=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e).get(`uri`)??``,lS={PREQUEL:`SEQUEL`,ADAPTATION:`SOURCE`,COMPILATION:`CONTAINS`,SIDE_STORY:`PARENT`},uS=e=>{let t=new Set,n=[];for(let r of e){if(!r?.from||!r?.to||r.from===r.to)continue;let e=lS[r.relation],i=e?{from:r.to,to:r.from,relation:e}:r,a=`${i.from}\u0000${i.to}\u0000${i.relation}`;t.has(a)||(t.add(a),n.push(i))}return n},dS=new Set([`TV`,`TV_SHORT`,`MOVIE`,`SPECIAL`,`OVA`,`ONA`,`MUSIC`]),fS=e=>!e||dS.has(e),pS=e=>[...new Set((e.nodes??[]).map(e=>e.format??``).filter(Boolean))].sort(),mS=(e,t)=>{let n=(e.nodes??[]).filter(t),r=new Set(n.map(e=>e.uri));return{nodes:n,edges:(e.edges??[]).filter(e=>r.has(e.from)&&r.has(e.to))}},hS=e=>`${e.from}\u0000${e.to}\u0000${e.relation}`,gS=(e,t)=>{if(!e)return{nodes:new Set,edges:new Set};if(e.kind===`node`){let n=t.filter(t=>t.from===e.uri||t.to===e.uri);return{nodes:new Set([e.uri]),edges:new Set(n.map(hS))}}let n=t.find(t=>hS(t)===e.key);return n?{nodes:new Set([n.from,n.to]),edges:new Set([e.key])}:{nodes:new Set,edges:new Set}},_S=e=>e.titles?.[0]?.title||e.uri,vS=e=>[...e].sort((e,t)=>(e.startDate??`9999`).localeCompare(t.startDate??`9999`)||_S(e).localeCompare(_S(t))),yS=(e,t)=>{let n=new Map(e.map(e=>[e.uri,0]));for(let r=0;r<e.length;r++){let e=!1;for(let r of t){let t=n.get(r.from),i=n.get(r.to);t!==void 0&&i!==void 0&&i<t+1&&(n.set(r.to,t+1),e=!0)}if(!e)break}let r=[...new Set(n.values())].sort((e,t)=>e-t),i=new Map(r.map((e,t)=>[e,t]));for(let[e,t]of n)n.set(e,i.get(t)??0);return n},bS=(e,t=`story`)=>{let n=uS(e.edges??[]),r=new Set((e.nodes??[]).map(e=>e.uri)),i=n.filter(e=>r.has(e.from)&&r.has(e.to)),a=vS(e.nodes??[]),o=t===`graph`?yS(a,i):void 0,s=[...new Set(a.map(e=>e.startDate??``))],c=new Map(s.map((e,t)=>[e,t])),l=new Map,u=a.map(e=>{let t=o?o.get(e.uri)??0:c.get(e.startDate??``)??0,n=l.get(t)??0;return l.set(t,n+1),{...e,column:t,row:n}}),d=[];if(t===`story`)for(let e=0;e<u.length-1;e++){let t=u[e],n=u[e+1];n.column>t.column&&d.push({from:t.uri,to:n.uri})}return{nodes:u,edges:i,chain:d,columns:Math.max(0,...u.map(e=>e.column+1)),rows:Math.max(0,...l.values())}},xS={ADAPTATION:`Adaptation`,PREQUEL:`Prequel`,SEQUEL:`Sequel`,PARENT:`Parent story`,SIDE_STORY:`Side story`,CHARACTER:`Character`,SUMMARY:`Summary`,ALTERNATIVE:`Alternative`,SPIN_OFF:`Spin off`,SOURCE:`Source`,COMPILATION:`Compilation`,CONTAINS:`Contains`,OTHER:`Related`},SS=[`SOURCE`,`PREQUEL`,`SEQUEL`,`PARENT`,`SIDE_STORY`,`SPIN_OFF`,`ALTERNATIVE`,`ADAPTATION`,`SUMMARY`,`COMPILATION`,`CONTAINS`,`CHARACTER`,`OTHER`],CS=e=>{let t=SS.indexOf(e);return t===-1?SS.length:t},wS=e=>e&&xS[e]||xS.OTHER,TS={TV:`TV`,TV_SHORT:`TV Short`,MOVIE:`Movie`,SPECIAL:`Special`,OVA:`OVA`,ONA:`ONA`,MUSIC:`Music`,MANGA:`Manga`,NOVEL:`Light Novel`,ONE_SHOT:`One Shot`},ES=e=>e?TS[e]||e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):void 0,DS=e=>[...e].sort((e,t)=>CS(e.relation)-CS(t.relation)),OS=e=>e.filter(e=>fS(e.format)),kS=3,AS=L`
2329
2329
  & > h2 {
2330
2330
  display: flex;
2331
2331
  align-items: center;
@@ -2341,7 +2341,7 @@ transition: max-height 0.3s ease-in-out;
2341
2341
  gap: 1.2rem;
2342
2342
 
2343
2343
  @media (min-width: 768px) {
2344
- grid-template-columns: repeat(${OS}, minmax(0, 1fr));
2344
+ grid-template-columns: repeat(${kS}, minmax(0, 1fr));
2345
2345
  }
2346
2346
  }
2347
2347
 
@@ -2373,7 +2373,7 @@ transition: max-height 0.3s ease-in-out;
2373
2373
  display: none;
2374
2374
  }
2375
2375
  }
2376
- `,AS=L`
2376
+ `,jS=L`
2377
2377
  display: flex;
2378
2378
  align-items: stretch;
2379
2379
  gap: 1.2rem;
@@ -2430,7 +2430,7 @@ transition: max-height 0.3s ease-in-out;
2430
2430
  font-size: 1.25rem;
2431
2431
  color: rgba(255, 255, 255, 0.55);
2432
2432
  }
2433
- `,jS=({edge:e,search:t,route:n})=>{let r=xy(e.node.covers,e.node),i=e.node.titles?.at(0)?.title,a=[TS(e.format),_p(e.node.status)].filter(Boolean).join(` · `);return G(Mf,{className:`relation-card`,css:AS,to:`${zf(n,{uri:d(e.node.uri)})}${t}`,children:[r?U(`img`,{className:`cover`,src:r,alt:``}):U(`div`,{className:`cover`}),G(`div`,{className:`body`,children:[U(`div`,{className:`relation`,children:CS(e.relation)}),U(`div`,{className:`title`,children:i??e.node.uri}),a?U(`div`,{className:`meta`,children:a}):void 0]})]})},MS=({relations:e,action:t,route:n=Q.MEDIA,pending:r=!1})=>{let i=tS(Tf()),a=ES(DS(e));return a.length?G(`section`,{className:`relations`,css:kS,"data-relations":!0,children:[G(`h2`,{children:[U(`span`,{children:`Relations`}),t]}),U(wy,{items:a,size:OS,label:`Relations`,children:e=>U(`div`,{className:`grid`,children:e.map(e=>U(jS,{edge:e,search:i,route:n},`${e.relation}:${e.node.uri}`))})})]}):r?G(`section`,{className:`relations placeholder`,css:kS,"aria-hidden":`true`,children:[U(`h2`,{children:U(ty,{className:`pending`})}),U(`div`,{className:`grid`,children:Array.from({length:OS},(e,t)=>U(ty,{className:`pending`},t))}),U(ty,{className:`pages`})]}):null},NS=L`
2433
+ `,MS=({edge:e,search:t,route:n})=>{let r=Sy(e.node.covers,e.node),i=e.node.titles?.at(0)?.title,a=[ES(e.format),_p(e.node.status)].filter(Boolean).join(` · `);return G(Mf,{className:`relation-card`,css:jS,to:`${zf(n,{uri:d(e.node.uri)})}${t}`,children:[r?U(`img`,{className:`cover`,src:r,alt:``}):U(`div`,{className:`cover`}),G(`div`,{className:`body`,children:[U(`div`,{className:`relation`,children:wS(e.relation)}),U(`div`,{className:`title`,children:i??e.node.uri}),a?U(`div`,{className:`meta`,children:a}):void 0]})]})},NS=({relations:e,action:t,route:n=Q.MEDIA,pending:r=!1})=>{let i=nS(Tf()),a=DS(OS(e));return a.length?G(`section`,{className:`relations`,css:AS,"data-relations":!0,children:[G(`h2`,{children:[U(`span`,{children:`Relations`}),t]}),U(Ty,{items:a,size:kS,label:`Relations`,children:e=>U(`div`,{className:`grid`,children:e.map(e=>U(MS,{edge:e,search:i,route:n},`${e.relation}:${e.node.uri}`))})})]}):r?G(`section`,{className:`relations placeholder`,css:AS,"aria-hidden":`true`,children:[U(`h2`,{children:U(ty,{className:`pending`})}),U(`div`,{className:`grid`,children:Array.from({length:kS},(e,t)=>U(ty,{className:`pending`},t))}),U(ty,{className:`pages`})]}):null},PS=L`
2434
2434
  & > h2 {
2435
2435
  margin: 0 0 1.2rem;
2436
2436
  font-size: 1.8rem;
@@ -2459,13 +2459,13 @@ transition: max-height 0.3s ease-in-out;
2459
2459
  background: #fff;
2460
2460
  color: #000;
2461
2461
  }
2462
- `,PS=(e,t)=>e&&e.length>1&&!e.some(e=>t.includes(e.uri))?e[0].uri:void 0,FS=({seasons:e,currentUris:t,href:n})=>{let r=PS(e,t);return!e||e.length<2?null:r?U(Ff,{to:n(d(r)),replace:!0}):G(`section`,{className:`seasons`,css:NS,"data-seasons":!0,children:[U(`h2`,{children:`Seasons`}),U(`nav`,{children:e.map(e=>G(Mf,{href:n(d(e.uri)),"aria-current":t.includes(e.uri)?`page`:void 0,children:[`Season `,e.number]},e.uri))})]})};function IS(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=IS(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var LS={value:()=>{}};function RS(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new zS(n)}function zS(e){this._=e}function BS(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}zS.prototype=RS.prototype={constructor:zS,on:function(e,t){var n=this._,r=BS(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=VS(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=HS(n[i],e.name,t);else if(t==null)for(i in n)n[i]=HS(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new zS(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function VS(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function HS(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=LS,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var US={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function WS(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),US.hasOwnProperty(t)?{space:US[t],local:e}:e}function GS(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function KS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function qS(e){var t=WS(e);return(t.local?KS:GS)(t)}function JS(){}function YS(e){return e==null?JS:function(){return this.querySelector(e)}}function XS(e){typeof e!=`function`&&(e=YS(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new Rw(r,this._parents)}function ZS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function QS(){return[]}function $S(e){return e==null?QS:function(){return this.querySelectorAll(e)}}function eC(e){return function(){return ZS(e.apply(this,arguments))}}function tC(e){e=typeof e==`function`?eC(e):$S(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new Rw(r,i)}function nC(e){return function(){return this.matches(e)}}function rC(e){return function(t){return t.matches(e)}}var iC=Array.prototype.find;function aC(e){return function(){return iC.call(this.children,e)}}function oC(){return this.firstElementChild}function sC(e){return this.select(e==null?oC:aC(typeof e==`function`?e:rC(e)))}var cC=Array.prototype.filter;function lC(){return Array.from(this.children)}function uC(e){return function(){return cC.call(this.children,e)}}function dC(e){return this.selectAll(e==null?lC:uC(typeof e==`function`?e:rC(e)))}function fC(e){typeof e!=`function`&&(e=nC(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Rw(r,this._parents)}function pC(e){return Array(e.length)}function mC(){return new Rw(this._enter||this._groups.map(pC),this._parents)}function hC(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}hC.prototype={constructor:hC,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function gC(e){return function(){return e}}function _C(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new hC(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function vC(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new hC(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function yC(e){return e.__data__}function bC(e,t){if(!arguments.length)return Array.from(this,yC);var n=t?vC:_C,r=this._parents,i=this._groups;typeof e!=`function`&&(e=gC(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=xC(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new Rw(o,r),o._enter=s,o._exit=c,o}function xC(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function SC(){return new Rw(this._exit||this._groups.map(pC),this._parents)}function CC(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function wC(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new Rw(s,this._parents)}function TC(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function EC(e){e||=DC;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new Rw(i,this._parents).order()}function DC(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function OC(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function kC(){return Array.from(this)}function AC(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function jC(){let e=0;for(let t of this)++e;return e}function MC(){return!this.node()}function NC(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function PC(e){return function(){this.removeAttribute(e)}}function FC(e){return function(){this.removeAttributeNS(e.space,e.local)}}function IC(e,t){return function(){this.setAttribute(e,t)}}function LC(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function RC(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function zC(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function BC(e,t){var n=WS(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?FC:PC:typeof t==`function`?n.local?zC:RC:n.local?LC:IC)(n,t))}function VC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function HC(e){return function(){this.style.removeProperty(e)}}function UC(e,t,n){return function(){this.style.setProperty(e,t,n)}}function WC(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function GC(e,t,n){return arguments.length>1?this.each((t==null?HC:typeof t==`function`?WC:UC)(e,t,n??``)):KC(this.node(),e)}function KC(e,t){return e.style.getPropertyValue(t)||VC(e).getComputedStyle(e,null).getPropertyValue(t)}function qC(e){return function(){delete this[e]}}function JC(e,t){return function(){this[e]=t}}function YC(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function XC(e,t){return arguments.length>1?this.each((t==null?qC:typeof t==`function`?YC:JC)(e,t)):this.node()[e]}function ZC(e){return e.trim().split(/^|\s+/)}function QC(e){return e.classList||new $C(e)}function $C(e){this._node=e,this._names=ZC(e.getAttribute(`class`)||``)}$C.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function ew(e,t){for(var n=QC(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function tw(e,t){for(var n=QC(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function nw(e){return function(){ew(this,e)}}function rw(e){return function(){tw(this,e)}}function iw(e,t){return function(){(t.apply(this,arguments)?ew:tw)(this,e)}}function aw(e,t){var n=ZC(e+``);if(arguments.length<2){for(var r=QC(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?iw:t?nw:rw)(n,t))}function ow(){this.textContent=``}function sw(e){return function(){this.textContent=e}}function cw(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function lw(e){return arguments.length?this.each(e==null?ow:(typeof e==`function`?cw:sw)(e)):this.node().textContent}function uw(){this.innerHTML=``}function dw(e){return function(){this.innerHTML=e}}function fw(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function pw(e){return arguments.length?this.each(e==null?uw:(typeof e==`function`?fw:dw)(e)):this.node().innerHTML}function mw(){this.nextSibling&&this.parentNode.appendChild(this)}function hw(){return this.each(mw)}function gw(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _w(){return this.each(gw)}function vw(e){var t=typeof e==`function`?e:qS(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function yw(){return null}function bw(e,t){var n=typeof e==`function`?e:qS(e),r=t==null?yw:typeof t==`function`?t:YS(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function xw(){var e=this.parentNode;e&&e.removeChild(this)}function Sw(){return this.each(xw)}function Cw(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ww(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Tw(e){return this.select(e?ww:Cw)}function Ew(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Dw(e){return function(t){e.call(this,t,this.__data__)}}function Ow(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function kw(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Aw(e,t,n){return function(){var r=this.__on,i,a=Dw(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function jw(e,t,n){var r=Ow(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}}else{for(s=t?Aw:kw,i=0;i<a;++i)this.each(s(r[i],t,n));return this}}function Mw(e,t,n){var r=VC(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Nw(e,t){return function(){return Mw(this,e,t)}}function Pw(e,t){return function(){return Mw(this,e,t.apply(this,arguments))}}function Fw(e,t){return this.each((typeof t==`function`?Pw:Nw)(e,t))}function*Iw(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var Lw=[null];function Rw(e,t){this._groups=e,this._parents=t}function zw(){return new Rw([[document.documentElement]],Lw)}function Bw(){return this}Rw.prototype=zw.prototype={constructor:Rw,select:XS,selectAll:tC,selectChild:sC,selectChildren:dC,filter:fC,data:bC,enter:mC,exit:SC,join:CC,merge:wC,selection:Bw,order:TC,sort:EC,call:OC,nodes:kC,node:AC,size:jC,empty:MC,each:NC,attr:BC,style:GC,property:XC,classed:aw,text:lw,html:pw,raise:hw,lower:_w,append:vw,insert:bw,remove:Sw,clone:Tw,datum:Ew,on:jw,dispatch:Fw,[Symbol.iterator]:Iw};function Vw(e){return typeof e==`string`?new Rw([[document.querySelector(e)]],[document.documentElement]):new Rw([[e]],Lw)}function Hw(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Uw(e,t){if(e=Hw(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var Ww={passive:!1},Gw={capture:!0,passive:!1};function Kw(e){e.stopImmediatePropagation()}function qw(e){e.preventDefault(),e.stopImmediatePropagation()}function Jw(e){var t=e.document.documentElement,n=Vw(e).on(`dragstart.drag`,qw,Gw);`onselectstart`in t?n.on(`selectstart.drag`,qw,Gw):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Yw(e,t){var n=e.document.documentElement,r=Vw(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,qw,Gw),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Xw=e=>()=>e;function Zw(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Zw.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Qw(e){return!e.ctrlKey&&!e.button}function $w(){return this.parentNode}function eT(e,t){return t??{x:e.x,y:e.y}}function tT(){return navigator.maxTouchPoints||`ontouchstart`in this}function nT(){var e=Qw,t=$w,n=eT,r=tT,i={},a=RS(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Ww).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!u&&e.call(this,n,r)){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(Vw(n.view).on(`mousemove.drag`,m,Gw).on(`mouseup.drag`,h,Gw),Jw(n.view),Kw(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(qw(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){Vw(e.view).on(`mousemove.drag mouseup.drag`,null),Yw(e.view,l),qw(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(Kw(n),c(`start`,n,i[s]))}function _(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(qw(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(Kw(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=Uw(l||r,t),p,m,h;if((h=n.call(e,new Zw(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=Uw(l||a,t),_=o}u.call(r,e,new Zw(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Xw(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:Xw(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:Xw(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:Xw(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function rT(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function iT(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function aT(){}var oT=.7,sT=1/oT,cT=`\\s*([+-]?\\d+)\\s*`,lT=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,uT=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,dT=/^#([0-9a-f]{3,8})$/,fT=RegExp(`^rgb\\(${cT},${cT},${cT}\\)$`),pT=RegExp(`^rgb\\(${uT},${uT},${uT}\\)$`),mT=RegExp(`^rgba\\(${cT},${cT},${cT},${lT}\\)$`),hT=RegExp(`^rgba\\(${uT},${uT},${uT},${lT}\\)$`),gT=RegExp(`^hsl\\(${lT},${uT},${uT}\\)$`),_T=RegExp(`^hsla\\(${lT},${uT},${uT},${lT}\\)$`),vT={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};rT(aT,CT,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yT,formatHex:yT,formatHex8:bT,formatHsl:xT,formatRgb:ST,toString:ST});function yT(){return this.rgb().formatHex()}function bT(){return this.rgb().formatHex8()}function xT(){return IT(this).formatHsl()}function ST(){return this.rgb().formatRgb()}function CT(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=dT.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?wT(t):n===3?new OT(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?TT(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?TT(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=fT.exec(e))?new OT(t[1],t[2],t[3],1):(t=pT.exec(e))?new OT(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=mT.exec(e))?TT(t[1],t[2],t[3],t[4]):(t=hT.exec(e))?TT(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=gT.exec(e))?FT(t[1],t[2]/100,t[3]/100,1):(t=_T.exec(e))?FT(t[1],t[2]/100,t[3]/100,t[4]):vT.hasOwnProperty(e)?wT(vT[e]):e===`transparent`?new OT(NaN,NaN,NaN,0):null}function wT(e){return new OT(e>>16&255,e>>8&255,e&255,1)}function TT(e,t,n,r){return r<=0&&(e=t=n=NaN),new OT(e,t,n,r)}function ET(e){return e instanceof aT||(e=CT(e)),e?(e=e.rgb(),new OT(e.r,e.g,e.b,e.opacity)):new OT}function DT(e,t,n,r){return arguments.length===1?ET(e):new OT(e,t,n,r??1)}function OT(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}rT(OT,DT,iT(aT,{brighter(e){return e=e==null?sT:sT**+e,new OT(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?oT:oT**+e,new OT(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new OT(NT(this.r),NT(this.g),NT(this.b),MT(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:kT,formatHex:kT,formatHex8:AT,formatRgb:jT,toString:jT}));function kT(){return`#${PT(this.r)}${PT(this.g)}${PT(this.b)}`}function AT(){return`#${PT(this.r)}${PT(this.g)}${PT(this.b)}${PT((isNaN(this.opacity)?1:this.opacity)*255)}`}function jT(){let e=MT(this.opacity);return`${e===1?`rgb(`:`rgba(`}${NT(this.r)}, ${NT(this.g)}, ${NT(this.b)}${e===1?`)`:`, ${e})`}`}function MT(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function NT(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function PT(e){return e=NT(e),(e<16?`0`:``)+e.toString(16)}function FT(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new RT(e,t,n,r)}function IT(e){if(e instanceof RT)return new RT(e.h,e.s,e.l,e.opacity);if(e instanceof aT||(e=CT(e)),!e)return new RT;if(e instanceof RT)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new RT(o,s,c,e.opacity)}function LT(e,t,n,r){return arguments.length===1?IT(e):new RT(e,t,n,r??1)}function RT(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}rT(RT,LT,iT(aT,{brighter(e){return e=e==null?sT:sT**+e,new RT(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?oT:oT**+e,new RT(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new OT(VT(e>=240?e-240:e+120,i,r),VT(e,i,r),VT(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new RT(zT(this.h),BT(this.s),BT(this.l),MT(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=MT(this.opacity);return`${e===1?`hsl(`:`hsla(`}${zT(this.h)}, ${BT(this.s)*100}%, ${BT(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function zT(e){return e=(e||0)%360,e<0?e+360:e}function BT(e){return Math.max(0,Math.min(1,e||0))}function VT(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var HT=e=>()=>e;function UT(e,t){return function(n){return e+n*t}}function WT(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function GT(e){return(e=+e)==1?KT:function(t,n){return n-t?WT(t,n,e):HT(isNaN(t)?n:t)}}function KT(e,t){var n=t-e;return n?UT(e,n):HT(isNaN(e)?t:e)}var qT=(function e(t){var n=GT(t);function r(e,t){var r=n((e=DT(e)).r,(t=DT(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=KT(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function JT(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function YT(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function XT(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o=0;o<r;++o)i[o]=aE(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function ZT(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function QT(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function $T(e,t){var n={},r={},i;for(i in typeof e==`object`&&e||(e={}),typeof t==`object`&&t||(t={}),t)i in e?n[i]=aE(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var eE=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tE=new RegExp(eE.source,`g`);function nE(e){return function(){return e}}function rE(e){return function(t){return e(t)+``}}function iE(e,t){var n=eE.lastIndex=tE.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=eE.exec(e))&&(i=tE.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:QT(r,i)})),n=tE.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?rE(c[0].x):nE(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function aE(e,t){var n=typeof t,r;return t==null||n===`boolean`?HT(t):(n===`number`?QT:n===`string`?(r=CT(t))?(t=r,qT):iE:t instanceof CT?qT:t instanceof Date?ZT:YT(t)?JT:Array.isArray(t)?XT:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?$T:QT)(e,t)}var oE=180/Math.PI,sE={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cE(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*oE,skewX:Math.atan(c)*oE,scaleX:o,scaleY:s}}var lE;function uE(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?sE:cE(t.a,t.b,t.c,t.d,t.e,t.f)}function dE(e){return e==null||(lE||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),lE.setAttribute(`transform`,e),!(e=lE.transform.baseVal.consolidate()))?sE:(e=e.matrix,cE(e.a,e.b,e.c,e.d,e.e,e.f))}function fE(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:QT(e,i)},{i:c-2,x:QT(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:QT(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:QT(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:QT(e,n)},{i:s-2,x:QT(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var pE=fE(uE,`px, `,`px)`,`deg)`),mE=fE(dE,`, `,`)`,`)`),hE=1e-12;function gE(e){return((e=Math.exp(e))+1/e)/2}function _E(e){return((e=Math.exp(e))-1/e)/2}function vE(e){return((e=Math.exp(2*e))-1)/(e+1)}var yE=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<hE)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=gE(y),c=s/(n*g)*(i*vE(t*r+y)-_E(y));return[a+c*d,o+c*f,s*i/gE(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),bE=0,xE=0,SE=0,CE=1e3,wE,TE,EE=0,DE=0,OE=0,kE=typeof performance==`object`&&performance.now?performance:Date,AE=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function jE(){return DE||=(AE(ME),kE.now()+OE)}function ME(){DE=0}function NE(){this._call=this._time=this._next=null}NE.prototype=PE.prototype={constructor:NE,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?jE():+n)+(t==null?0:+t),!this._next&&TE!==this&&(TE?TE._next=this:wE=this,TE=this),this._call=e,this._time=n,zE()},stop:function(){this._call&&(this._call=null,this._time=1/0,zE())}};function PE(e,t,n){var r=new NE;return r.restart(e,t,n),r}function FE(){jE(),++bE;for(var e=wE,t;e;)(t=DE-e._time)>=0&&e._call.call(void 0,t),e=e._next;--bE}function IE(){DE=(EE=kE.now())+OE,bE=xE=0;try{FE()}finally{bE=0,RE(),DE=0}}function LE(){var e=kE.now(),t=e-EE;t>CE&&(OE-=t,EE=e)}function RE(){for(var e,t=wE,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:wE=n);TE=e,zE(r)}function zE(e){bE||(xE&&=clearTimeout(xE),e-DE>24?(e<1/0&&(xE=setTimeout(IE,e-kE.now()-OE)),SE&&=clearInterval(SE)):(SE||=(EE=kE.now(),setInterval(LE,CE)),bE=1,AE(IE)))}function BE(e,t,n){var r=new NE;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var VE=RS(`start`,`end`,`cancel`,`interrupt`),HE=[];function UE(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;qE(e,n,{name:t,index:r,group:i,on:VE,tween:HE,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function WE(e,t){var n=KE(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function GE(e,t){var n=KE(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function KE(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function qE(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=PE(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return BE(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(BE(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function JE(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n)(r=n[o]).name===t?(i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]):a=!1;a&&delete e.__transition}}function YE(e){return this.each(function(){JE(this,e)})}function XE(e,t){var n,r;return function(){var i=GE(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function ZE(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=GE(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function QE(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=KE(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?XE:ZE)(n,e,t))}function $E(e,t,n){var r=e._id;return e.each(function(){var e=GE(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return KE(e,r).value[t]}}function eD(e,t){var n;return(typeof t==`number`?QT:t instanceof CT?qT:(n=CT(t))?(t=n,qT):iE)(e,t)}function tD(e){return function(){this.removeAttribute(e)}}function nD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rD(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function iD(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function aD(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function oD(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function sD(e,t){var n=WS(e),r=n===`transform`?mE:eD;return this.attrTween(e,typeof t==`function`?(n.local?oD:aD)(n,r,$E(this,`attr.`+e,t)):t==null?(n.local?nD:tD)(n):(n.local?iD:rD)(n,r,t))}function cD(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function lD(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function uD(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&lD(e,i)),n}return i._value=t,i}function dD(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&cD(e,i)),n}return i._value=t,i}function fD(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=WS(e);return this.tween(n,(r.local?uD:dD)(r,t))}function pD(e,t){return function(){WE(this,e).delay=+t.apply(this,arguments)}}function mD(e,t){return t=+t,function(){WE(this,e).delay=t}}function hD(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?pD:mD)(t,e)):KE(this.node(),t).delay}function gD(e,t){return function(){GE(this,e).duration=+t.apply(this,arguments)}}function _D(e,t){return t=+t,function(){GE(this,e).duration=t}}function vD(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?gD:_D)(t,e)):KE(this.node(),t).duration}function yD(e,t){if(typeof t!=`function`)throw Error();return function(){GE(this,e).ease=t}}function bD(e){var t=this._id;return arguments.length?this.each(yD(t,e)):KE(this.node(),t).ease}function xD(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();GE(this,e).ease=n}}function SD(e){if(typeof e!=`function`)throw Error();return this.each(xD(this._id,e))}function CD(e){typeof e!=`function`&&(e=nC(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new QD(r,this._parents,this._name,this._id)}function wD(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new QD(o,this._parents,this._name,this._id)}function TD(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function ED(e,t,n){var r,i,a=TD(t)?WE:GE;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function DD(e,t){var n=this._id;return arguments.length<2?KE(this.node(),n).on.on(e):this.each(ED(n,e,t))}function OD(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function kD(){return this.on(`end.remove`,OD(this._id))}function AD(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=YS(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,UE(l[f],t,n,f,l,KE(u,n)));return new QD(a,this._parents,t,n)}function jD(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=$S(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=KE(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&UE(p,t,n,h,f,m);a.push(f),o.push(u)}return new QD(a,o,t,n)}var MD=zw.prototype.constructor;function ND(){return new MD(this._groups,this._parents)}function PD(e,t){var n,r,i;return function(){var a=KC(this,e),o=(this.style.removeProperty(e),KC(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function FD(e){return function(){this.style.removeProperty(e)}}function ID(e,t,n){var r,i=n+``,a;return function(){var o=KC(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function LD(e,t,n){var r,i,a;return function(){var o=KC(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),KC(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function RD(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=GE(this,e),l=c.on,u=c.value[a]==null?s||=FD(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function zD(e,t,n){var r=(e+=``)==`transform`?pE:eD;return t==null?this.styleTween(e,PD(e,r)).on(`end.style.`+e,FD(e)):typeof t==`function`?this.styleTween(e,LD(e,r,$E(this,`style.`+e,t))).each(RD(this._id,e)):this.styleTween(e,ID(e,r,t),n).on(`end.style.`+e,null)}function BD(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function VD(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&BD(e,a,n)),r}return a._value=t,a}function HD(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,VD(e,t,n??``))}function UD(e){return function(){this.textContent=e}}function WD(e){return function(){var t=e(this);this.textContent=t??``}}function GD(e){return this.tween(`text`,typeof e==`function`?WD($E(this,`text`,e)):UD(e==null?``:e+``))}function KD(e){return function(t){this.textContent=e.call(this,t)}}function qD(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&KD(r)),t}return r._value=e,r}function JD(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,qD(e))}function YD(){for(var e=this._name,t=this._id,n=$D(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=KE(c,t);UE(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new QD(r,this._parents,e,n)}function XD(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=GE(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var ZD=0;function QD(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function $D(){return++ZD}var eO=zw.prototype;QD.prototype={constructor:QD,select:AD,selectAll:jD,selectChild:eO.selectChild,selectChildren:eO.selectChildren,filter:CD,merge:wD,selection:ND,transition:YD,call:eO.call,nodes:eO.nodes,node:eO.node,size:eO.size,empty:eO.empty,each:eO.each,on:DD,attr:sD,attrTween:fD,style:zD,styleTween:HD,text:GD,textTween:JD,remove:kD,tween:QE,delay:hD,duration:vD,ease:bD,easeVarying:SD,end:XD,[Symbol.iterator]:eO[Symbol.iterator]};function tO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var nO={time:null,delay:0,duration:250,ease:tO};function rO(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function iO(e){var t,n;e instanceof QD?(t=e._id,e=e._name):(t=$D(),(n=nO).time=jE(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&UE(c,e,t,l,o,n||rO(c,t));return new QD(r,this._parents,e,t)}zw.prototype.interrupt=YE,zw.prototype.transition=iO;var aO=e=>()=>e;function oO(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function sO(e,t,n){this.k=e,this.x=t,this.y=n}sO.prototype={constructor:sO,scale:function(e){return e===1?this:new sO(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new sO(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var cO=new sO(1,0,0);lO.prototype=sO.prototype;function lO(e){for(;!e.__zoom;)if(!(e=e.parentNode))return cO;return e.__zoom}function uO(e){e.stopImmediatePropagation()}function dO(e){e.preventDefault(),e.stopImmediatePropagation()}function fO(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function pO(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function mO(){return this.__zoom||cO}function hO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function gO(){return navigator.maxTouchPoints||`ontouchstart`in this}function _O(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function vO(){var e=fO,t=pO,n=_O,r=hO,i=gO,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=yE,l=RS(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,mO).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,mO),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(cO.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new sO(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new sO(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new sO(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Vw(this.that).datum();l.call(e,this.that,new oO(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=Uw(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],JE(this),s.start();dO(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Vw(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=Uw(t,i),l=t.clientX,u=t.clientY;Jw(t.view),uO(t),a.mouse=[c,this.__zoom.invert(c)],JE(this),a.start();function d(e){if(dO(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=Uw(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Yw(e.view,a.moved),dO(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=Uw(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);dO(r),s>0?Vw(this).transition().duration(s).call(x,d,c,r):Vw(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(uO(t),s=0;s<i;++s)c=r[s],l=Uw(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),JE(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(dO(e),s=0;s<a;++s)c=i[s],l=Uw(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(uO(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=Uw(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=Vw(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:aO(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:aO(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:aO(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:aO([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var yO={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},bO=[[-1/0,-1/0],[1/0,1/0]],xO=[`Enter`,` `,`Escape`],SO={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},CO;(function(e){e.Strict=`strict`,e.Loose=`loose`})(CO||={});var wO;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(wO||={});var TO;(function(e){e.Partial=`partial`,e.Full=`full`})(TO||={});var EO={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},DO;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(DO||={});var OO;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(OO||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var kO={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top},AO=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,jO=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),MO=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),NO=(e,t=[0,0])=>{let{width:n,height:r}=pk(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},PO=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):MO(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,qO(e,ZO(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?YO(r):{x:0,y:0,width:0,height:0}},FO=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=qO(n,ZO(e)),r=!0)}),r?YO(n):{x:0,y:0,width:0,height:0}},IO=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=$O(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},LO=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function RO(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=pk(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function zO({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=uk(FO(RO(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function BO({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,yO.error005());else{let{width:e,height:t}=pk(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&fk(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=fk(d)?UO(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,yO.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function VO({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=LO(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var HO=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),UO=(e={x:0,y:0},t,n)=>({x:HO(e.x,t[0][0],t[1][0]-(n?.width??0)),y:HO(e.y,t[0][1],t[1][1]-(n?.height??0))});function WO(e,t,n){let{width:r,height:i}=pk(n),{x:a,y:o}=n.internals.positionAbsolute;return UO(e,[[a,o],[a+r,o+i]],t)}var GO=(e,t,n)=>e<t?HO(Math.abs(e-t),1,t)/t:e>n?-HO(Math.abs(e-n),1,t)/t:0,KO=(e,t,n=15,r=40)=>[GO(e.x,r,t.width-r)*n,GO(e.y,r,t.height-r)*n],qO=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),JO=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),YO=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),XO=(e,t=[0,0])=>{let{x:n,y:r}=MO(e)?e.internals.positionAbsolute:NO(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},ZO=(e,t=[0,0])=>{let{x:n,y:r}=MO(e)?e.internals.positionAbsolute:NO(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},QO=(e,t)=>YO(qO(JO(e),JO(t))),$O=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},ek=(e,t)=>$O(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),tk=e=>nk(e.width)&&nk(e.height)&&nk(e.x)&&nk(e.y),nk=e=>!isNaN(e)&&isFinite(e),rk=(e,t)=>(e,t)=>{},ik=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ak=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?ik(s,o):s},ok=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function sk(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ck(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=sk(e,n),i=sk(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=sk(e.top??e.y??0,n),i=sk(e.bottom??e.y??0,n),a=sk(e.left??e.x??0,t),o=sk(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function lk(e,t,n,r,i,a){let{x:o,y:s}=ok(e,[t,n,r]),{x:c,y:l}=ok({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var uk=(e,t,n,r,i,a)=>{let o=ck(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=HO(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=lk(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},dk=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function fk(e){return e!=null&&e!==`parent`}function pk(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function mk(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function hk(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function gk(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function _k(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function vk(e){return{...SO,...e||{}}}function yk(e){return e===null?null:e?`valid`:`invalid`}function bk(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Ek(e),s=ak({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?ik(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var xk=e=>({width:e.offsetWidth,height:e.offsetHeight}),Sk=e=>e?.getRootNode?.()||window?.document,Ck=[`INPUT`,`SELECT`,`TEXTAREA`];function wk(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Ck.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Tk=e=>`clientX`in e,Ek=(e,t)=>{let n=Tk(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},Dk=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...xk(t)}})};function Ok({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function kk(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ak({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case $.Left:return[t-kk(t-r,a),n];case $.Right:return[t+kk(r-t,a),n];case $.Top:return[t,n-kk(n-i,a)];case $.Bottom:return[t,n+kk(i-n,a)]}}function jk({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,curvature:o=.25}){let[s,c]=Ak({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Ak({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Ok({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function Mk({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function Nk({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function Pk({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=qO(ZO(e),ZO(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),ek({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},YO(a))>0}var Fk=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Ik=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Lk=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,yO.error006()),t;let r=n.getEdgeId||Fk,i;return i=AO(e)?{...e}:{...e,id:r(e)},Ik(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Rk({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Mk({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var zk={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},Bk=({source:e,sourcePosition:t=$.Bottom,target:n})=>t===$.Left||t===$.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Vk=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Hk({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=zk[t],c=zk[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Bk({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=Mk({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function Uk(e,t,n,r){let i=Math.min(Vk(e,t)/2,Vk(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function Wk({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Hk({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=Uk(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function Gk(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Kk(e){let{sourceNode:t,targetNode:n}=e;if(!Gk(t)||!Gk(n))return null;let r=t.internals.handleBounds||qk(t.handles),i=n.internals.handleBounds||qk(n.handles),a=Yk(r?.source??[],e.sourceHandle),o=Yk(e.connectionMode===CO.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,yO.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=Jk(t,a,s),u=Jk(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function qk(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function Jk(e,t,n=$.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??pk(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case $.Top:return{x:i+o/2,y:a};case $.Right:return{x:i+o,y:a+s/2};case $.Bottom:return{x:i+o/2,y:a+s};case $.Left:return{x:i,y:a+s/2}}}function Yk(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Xk(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Zk(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=Xk(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var Qk=1e3,$k=10,eA={nodeOrigin:[0,0],nodeExtent:bO,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},tA={...eA,checkEquality:!0};function nA(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function rA(e,t,n){let r=nA(eA,n);for(let n of e.values())if(n.parentId)cA(n,e,t,r);else{let e=UO(NO(n,r.nodeOrigin),fk(n.extent)?n.extent:r.nodeExtent,pk(n));n.internals.positionAbsolute=e}}function iA(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function aA(e){return e===`manual`}function oA(e,t,n,r={}){let i=nA(tA,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!aA(i.zIndexMode)?Qk:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=UO(NO(u,i.nodeOrigin),fk(u.extent)?u.extent:i.nodeExtent,pk(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:iA(u,e),z:lA(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}e.measured!==void 0&&e.measured.width!==void 0&&e.measured.height!==void 0||e.hidden||(c=!1),u.parentId&&cA(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function sA(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function cA(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=nA(eA,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}sA(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*$k),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=uA(e,u,o,s,a&&!aA(c)?Qk:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function lA(e,t,n){let r=nk(e.zIndex)?e.zIndex:0;return aA(n)?r:r+(e.selected?t:0)}function uA(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=pk(e),l=NO(e,n),u=fk(e.extent)?UO(l,e.extent,c):l,d=UO({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=WO(d,c,t));let f=lA(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function dA(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=QO(a.get(n.parentId)?.expandedRect??XO(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=pk(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function fA(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=xk(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=fk(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=WO(h,s,n))}else m&&(h=UO(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:Dk(`source`,r.nodeElement,p,d,e.id),target:Dk(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&cA(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:XO(g,i)}))}}if(f.length>0){let e=dA(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function pA({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function mA(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function hA(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;mA(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),mA(`target`,s,c,e,i,o),t.set(r.id,r)}}function gA(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:gA(n,t):!1}function _A(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function vA(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!gA(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function yA({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function bA({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=ik(a,t);return{x:o.x-a.x,y:o.y-a.y}}function xA({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=Vw(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?JO(FO(s)):null,x=v&&l?bA({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:ik(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=BO({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=yA({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=KO(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,m&&y||o||!b||i.get(b)?.selected||_(),y&&m&&b&&e?.(b);let v=bk(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=vA(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=yA({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=nT().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=bk(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Ek(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=bk(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Ek(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Ek(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p)p&&s.size>0&&t().updateNodePositions(s,!1);else if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=yA({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!_A(t,`.${g}`,v))&&(!_||_A(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function SA(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())ek(i,XO(e))>0&&r.push(e);return r}var CA=250;function wA(e,t,n,r){let i=[],a=1/0,o=SA(e,n,t+CA);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Jk(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function TA(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Jk(o,c,c.position,!0)}:c}function EA(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function DA(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var OA=()=>!0;function kA(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=OA,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Sk(e.target),E=0,D,{x:O,y:k}=Ek(e),A=EA(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=TA(i,A,r,c,t);if(!N)return;let P=Ek(e,j),ee=!1,te=null,ne=!1,F=null;function I(){if(!u||!j)return;let[e,t]=KO(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(I)}let re={...N,nodeId:i,type:A,position:N.position},ie=c.get(i),ae={inProgress:!0,isValid:null,from:Jk(ie,re,$.Left,!0),fromHandle:re,fromPosition:re.position,fromNode:ie,to:P,toHandle:null,toPosition:kO[re.position],toNode:null,pointer:P};function oe(){M=!0,y(ae),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&oe();function se(e){if(!M){let{x:t,y:n}=Ek(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;oe()}if(!x()||!re){ce(e);return}let a=b();P=Ek(e,j),D=wA(ak(P,a,!1,[1,1]),n,c,re),ee||=(I(),!0);let s=AA(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});F=s.handleDomNode,te=s.connection,ne=DA(!!D,s.isValid);let u=c.get(i),f=u?Jk(u,re,$.Left,!0):ae.from,p={...ae,from:f,isValid:ne,to:s.toHandle&&ne?ok({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:ne&&s.toHandle?s.toHandle.position:kO[re.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),ae=p}function ce(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||F)&&te&&ne&&h?.(te);let{inProgress:t,...n}=ae,r={...n,toPosition:ae.toHandle?ae.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),ee=!1,ne=!1,te=null,F=null,T.removeEventListener(`mousemove`,se),T.removeEventListener(`mouseup`,ce),T.removeEventListener(`touchmove`,se),T.removeEventListener(`touchend`,ce)}}T.addEventListener(`mousemove`,se),T.addEventListener(`mouseup`,ce),T.addEventListener(`touchmove`,se),T.addEventListener(`touchend`,ce)}function AA(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=OA,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Ek(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=EA(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===CO.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=TA(t,e,a,u,n,!0)}return _}var jA={onPointerDown:kA,isValid:AA};function MA({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Vw(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&dk()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=vO().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:Uw}}var NA=e=>({x:e.x,y:e.y,zoom:e.k}),PA=({x:e,y:t,zoom:n})=>cO.translate(e,t).scale(n),FA=(e,t)=>e.target.closest(`.${t}`),IA=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),LA=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,RA=(e,t=0,n=LA,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},zA=e=>{let t=e.ctrlKey&&dk()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function BA({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(FA(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=Uw(u),t=d*2**zA(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===wO.Vertical?0:u.deltaX*f,m=i===wO.Horizontal?0:u.deltaY*f;!dk()&&u.shiftKey&&i!==wO.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=NA(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function VA({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=FA(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function HA({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=NA(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function UA({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&IA(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,NA(a.transform))}}function WA({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&IA(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=NA(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function GA({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(FA(f,`${u}-flow__node`)||FA(f,`${u}-flow__edge`)||FA(f,`${u}-flow__selection`)||FA(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||FA(f,c)&&h||FA(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function KA({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=vO().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=Vw(e).call(f);y({x:i.x,y:i.y,zoom:HO(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(zA);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?aE:yE).transform(RA(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,panActivationKeyPressed:S=!1,zoomActivationKeyPressed:C,lib:w,onTransformChange:T,connectionInProgress:E,paneClickDistance:D,selectionOnDrag:O}){r&&!l.isZoomingOrPanning&&v();let k=i&&!C&&!r;f.clickDistance(O?1/0:!nk(D)||D<0?0:D);let A=k?BA({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):VA({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,A,{passive:!1});let j=HA({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,j);let M=UA({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,M);let N=WA({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,N);let P=GA({panActivationKeyPressed:S,zoomActivationKeyPressed:C,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:w,connectionInProgress:E});f.filter(P),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=PA(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=PA(e);return await g(n,t),n}function x(e){if(p){let t=PA(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?lO(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?aE:yE).scaleTo(RA(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?aE:yE).scaleBy(RA(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!nk(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var qA;(function(e){e.Line=`line`,e.Handle=`handle`})(qA||={});function JA({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function YA(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function XA(e,t){return Math.max(0,t-e)}function ZA(e,t){return Math.max(0,e-t)}function QA(e,t,n){return Math.max(0,t-e,e-n)}function $A(e,t){return e?!t:t}function ej(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=QA(E,h,g),j=QA(D,_,v);if(o){let e=0,t=0;c&&w<0?e=XA(y+w+O,o[0][0]):!c&&w>0&&(e=ZA(y+E+O,o[1][0])),l&&T<0?t=XA(b+T+k,o[0][1]):!l&&T>0&&(t=ZA(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=ZA(y+w,s[0][0]):!c&&w<0&&(e=XA(y+E,s[1][0])),l&&T>0?t=ZA(b+T,s[0][1]):!l&&T<0&&(t=XA(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=QA(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?ZA(b+k+E/C,o[1][1])*C:XA(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?XA(b+E/C,s[1][1])*C:ZA(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=QA(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?ZA(y+D*C+O,o[1][0])/C:XA(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?XA(y+D*C,s[1][0])/C:ZA(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=($A(c,l)?-w:w)/C:w=($A(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var tj={width:0,height:0,x:0,y:0},nj={...tj,pointerX:0,pointerY:0,aspectRatio:1};function rj(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function ij({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=Vw(e),o={controlDirection:YA(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...tj},h={...nj};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:YA(e)};let g,_=null,v=[],y,b,x,S=!1,C=nT().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=bk(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=fk(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=rj(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=bk(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=ej(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let ee=JA({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),te={...m,direction:ee};p?.(e,te)!==!1&&(S=!0,d?.(e,te),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var aj=t((t=>{var n=(Je(),e(qe)),r=Wd();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=n.useRef,c=n.useEffect,l=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),oj=n(t(((e,t)=>{t.exports=aj()}))(),1),sj=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},cj=e=>e?sj(e):sj;Je();var{useDebugValue:lj}=Ge,{useSyncExternalStoreWithSelector:uj}=oj.default,dj=e=>e;function fj(e,t=dj,n){let r=uj(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return lj(r),r}var pj=(e,t)=>{let n=cj(e),r=(e,r=t)=>fj(n,e,r);return Object.assign(r,n),r},mj=(e,t)=>e?pj(e,t):pj;function hj(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}ft(),Je();var gj=nt(null),_j=gj.Provider,vj=yO.error001(`react`);function yj(e,t){let n=Ze(gj);if(n===null)throw Error(vj);return fj(n,e,t)}function bj(){let e=Ze(gj);if(e===null)throw Error(vj);return H(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var xj={display:`none`},Sj={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Cj=`react-flow__node-desc`,wj=`react-flow__edge-desc`,Tj=`react-flow__aria-live`,Ej=e=>e.ariaLiveMessage,Dj=e=>e.ariaLabelConfig;function Oj({rfId:e}){let t=yj(Ej);return R(`div`,{id:`${Tj}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Sj,children:t})}function kj({rfId:e,disableKeyboardA11y:t}){let n=yj(Dj);return R(ot,{children:[R(`div`,{id:`${Cj}-${e}`,style:xj,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),R(`div`,{id:`${wj}-${e}`,style:xj,children:n[`edge.a11yDescription.default`]}),!t&&R(Oj,{rfId:e})]})}var Aj=gt(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return R(`div`,{className:IS([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Aj.displayName=`Panel`;var jj=`https://reactflow.dev?utm_source=attribution`;function Mj({proOptions:e,position:t=`bottom-right`}){return V(()=>{},[]),e?.hideAttribution?null:R(Aj,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${jj}`,children:R(`a`,{href:jj,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var Nj=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Pj=e=>e.id;function Fj(e,t){return hj(e.selectedNodes.map(Pj),t.selectedNodes.map(Pj))&&hj(e.selectedEdges.map(Pj),t.selectedEdges.map(Pj))}function Ij({onSelectionChange:e}){let t=bj(),{selectedNodes:n,selectedEdges:r}=yj(Nj,Fj);return V(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Lj=e=>!!e.onSelectionChangeHandlers;function Rj({onSelectionChange:e}){let t=yj(Lj);return e||t?R(Ij,{onSelectionChange:e}):null}var zj=[0,0],Bj={x:0,y:0,zoom:1},Vj=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],Hj=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Uj={translateExtent:bO,nodeOrigin:zj,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Wj(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=yj(Hj,hj),l=bj();V(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Uj,s()}),[]);let u=q(Uj);return V(()=>{for(let s of Vj){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:vk(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},Vj.map(t=>e[t])),null}function Gj(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function Kj(e){let[t,n]=W(e===`system`?null:e);return V(()=>{if(e!==`system`){n(e);return}let t=Gj(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?Gj()?.matches?`dark`:`light`:t}var qj=typeof document<`u`?document:null;function Jj(e=null,t={target:qj,actInsideInputWithModifier:!0}){let[n,r]=W(!1),i=q(!1),a=q(new Set([])),[o,s]=H(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
2462
+ `,FS=(e,t)=>e&&e.length>1&&!e.some(e=>t.includes(e.uri))?e[0].uri:void 0,IS=({seasons:e,currentUris:t,href:n})=>{let r=FS(e,t);return!e||e.length<2?null:r?U(Ff,{to:n(d(r)),replace:!0}):G(`section`,{className:`seasons`,css:PS,"data-seasons":!0,children:[U(`h2`,{children:`Seasons`}),U(`nav`,{children:e.map(e=>G(Mf,{href:n(d(e.uri)),"aria-current":t.includes(e.uri)?`page`:void 0,children:[`Season `,e.number]},e.uri))})]})};function LS(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=LS(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var RS={value:()=>{}};function zS(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new BS(n)}function BS(e){this._=e}function VS(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}BS.prototype=zS.prototype={constructor:BS,on:function(e,t){var n=this._,r=VS(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=HS(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=US(n[i],e.name,t);else if(t==null)for(i in n)n[i]=US(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new BS(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function HS(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function US(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=RS,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var WS={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function GS(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),WS.hasOwnProperty(t)?{space:WS[t],local:e}:e}function KS(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function qS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function JS(e){var t=GS(e);return(t.local?qS:KS)(t)}function YS(){}function XS(e){return e==null?YS:function(){return this.querySelector(e)}}function ZS(e){typeof e!=`function`&&(e=XS(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new zw(r,this._parents)}function QS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function $S(){return[]}function eC(e){return e==null?$S:function(){return this.querySelectorAll(e)}}function tC(e){return function(){return QS(e.apply(this,arguments))}}function nC(e){e=typeof e==`function`?tC(e):eC(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new zw(r,i)}function rC(e){return function(){return this.matches(e)}}function iC(e){return function(t){return t.matches(e)}}var aC=Array.prototype.find;function oC(e){return function(){return aC.call(this.children,e)}}function sC(){return this.firstElementChild}function cC(e){return this.select(e==null?sC:oC(typeof e==`function`?e:iC(e)))}var lC=Array.prototype.filter;function uC(){return Array.from(this.children)}function dC(e){return function(){return lC.call(this.children,e)}}function fC(e){return this.selectAll(e==null?uC:dC(typeof e==`function`?e:iC(e)))}function pC(e){typeof e!=`function`&&(e=rC(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new zw(r,this._parents)}function mC(e){return Array(e.length)}function hC(){return new zw(this._enter||this._groups.map(mC),this._parents)}function gC(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}gC.prototype={constructor:gC,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function _C(e){return function(){return e}}function vC(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new gC(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function yC(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new gC(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function bC(e){return e.__data__}function xC(e,t){if(!arguments.length)return Array.from(this,bC);var n=t?yC:vC,r=this._parents,i=this._groups;typeof e!=`function`&&(e=_C(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=SC(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new zw(o,r),o._enter=s,o._exit=c,o}function SC(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function CC(){return new zw(this._exit||this._groups.map(mC),this._parents)}function wC(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function TC(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new zw(s,this._parents)}function EC(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function DC(e){e||=OC;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new zw(i,this._parents).order()}function OC(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function kC(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function AC(){return Array.from(this)}function jC(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function MC(){let e=0;for(let t of this)++e;return e}function NC(){return!this.node()}function PC(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function FC(e){return function(){this.removeAttribute(e)}}function IC(e){return function(){this.removeAttributeNS(e.space,e.local)}}function LC(e,t){return function(){this.setAttribute(e,t)}}function RC(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function zC(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function BC(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function VC(e,t){var n=GS(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?IC:FC:typeof t==`function`?n.local?BC:zC:n.local?RC:LC)(n,t))}function HC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function UC(e){return function(){this.style.removeProperty(e)}}function WC(e,t,n){return function(){this.style.setProperty(e,t,n)}}function GC(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function KC(e,t,n){return arguments.length>1?this.each((t==null?UC:typeof t==`function`?GC:WC)(e,t,n??``)):qC(this.node(),e)}function qC(e,t){return e.style.getPropertyValue(t)||HC(e).getComputedStyle(e,null).getPropertyValue(t)}function JC(e){return function(){delete this[e]}}function YC(e,t){return function(){this[e]=t}}function XC(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ZC(e,t){return arguments.length>1?this.each((t==null?JC:typeof t==`function`?XC:YC)(e,t)):this.node()[e]}function QC(e){return e.trim().split(/^|\s+/)}function $C(e){return e.classList||new ew(e)}function ew(e){this._node=e,this._names=QC(e.getAttribute(`class`)||``)}ew.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function tw(e,t){for(var n=$C(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function nw(e,t){for(var n=$C(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function rw(e){return function(){tw(this,e)}}function iw(e){return function(){nw(this,e)}}function aw(e,t){return function(){(t.apply(this,arguments)?tw:nw)(this,e)}}function ow(e,t){var n=QC(e+``);if(arguments.length<2){for(var r=$C(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?aw:t?rw:iw)(n,t))}function sw(){this.textContent=``}function cw(e){return function(){this.textContent=e}}function lw(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function uw(e){return arguments.length?this.each(e==null?sw:(typeof e==`function`?lw:cw)(e)):this.node().textContent}function dw(){this.innerHTML=``}function fw(e){return function(){this.innerHTML=e}}function pw(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function mw(e){return arguments.length?this.each(e==null?dw:(typeof e==`function`?pw:fw)(e)):this.node().innerHTML}function hw(){this.nextSibling&&this.parentNode.appendChild(this)}function gw(){return this.each(hw)}function _w(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function vw(){return this.each(_w)}function yw(e){var t=typeof e==`function`?e:JS(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function bw(){return null}function xw(e,t){var n=typeof e==`function`?e:JS(e),r=t==null?bw:typeof t==`function`?t:XS(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Sw(){var e=this.parentNode;e&&e.removeChild(this)}function Cw(){return this.each(Sw)}function ww(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Tw(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ew(e){return this.select(e?Tw:ww)}function Dw(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Ow(e){return function(t){e.call(this,t,this.__data__)}}function kw(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Aw(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function jw(e,t,n){return function(){var r=this.__on,i,a=Ow(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Mw(e,t,n){var r=kw(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}}else{for(s=t?jw:Aw,i=0;i<a;++i)this.each(s(r[i],t,n));return this}}function Nw(e,t,n){var r=HC(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Pw(e,t){return function(){return Nw(this,e,t)}}function Fw(e,t){return function(){return Nw(this,e,t.apply(this,arguments))}}function Iw(e,t){return this.each((typeof t==`function`?Fw:Pw)(e,t))}function*Lw(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var Rw=[null];function zw(e,t){this._groups=e,this._parents=t}function Bw(){return new zw([[document.documentElement]],Rw)}function Vw(){return this}zw.prototype=Bw.prototype={constructor:zw,select:ZS,selectAll:nC,selectChild:cC,selectChildren:fC,filter:pC,data:xC,enter:hC,exit:CC,join:wC,merge:TC,selection:Vw,order:EC,sort:DC,call:kC,nodes:AC,node:jC,size:MC,empty:NC,each:PC,attr:VC,style:KC,property:ZC,classed:ow,text:uw,html:mw,raise:gw,lower:vw,append:yw,insert:xw,remove:Cw,clone:Ew,datum:Dw,on:Mw,dispatch:Iw,[Symbol.iterator]:Lw};function Hw(e){return typeof e==`string`?new zw([[document.querySelector(e)]],[document.documentElement]):new zw([[e]],Rw)}function Uw(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ww(e,t){if(e=Uw(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var Gw={passive:!1},Kw={capture:!0,passive:!1};function qw(e){e.stopImmediatePropagation()}function Jw(e){e.preventDefault(),e.stopImmediatePropagation()}function Yw(e){var t=e.document.documentElement,n=Hw(e).on(`dragstart.drag`,Jw,Kw);`onselectstart`in t?n.on(`selectstart.drag`,Jw,Kw):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Xw(e,t){var n=e.document.documentElement,r=Hw(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,Jw,Kw),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Zw=e=>()=>e;function Qw(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Qw.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function $w(e){return!e.ctrlKey&&!e.button}function eT(){return this.parentNode}function tT(e,t){return t??{x:e.x,y:e.y}}function nT(){return navigator.maxTouchPoints||`ontouchstart`in this}function rT(){var e=$w,t=eT,n=tT,r=nT,i={},a=zS(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Gw).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!u&&e.call(this,n,r)){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(Hw(n.view).on(`mousemove.drag`,m,Kw).on(`mouseup.drag`,h,Kw),Yw(n.view),qw(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(Jw(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){Hw(e.view).on(`mousemove.drag mouseup.drag`,null),Xw(e.view,l),Jw(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(qw(n),c(`start`,n,i[s]))}function _(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(Jw(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(qw(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=Ww(l||r,t),p,m,h;if((h=n.call(e,new Qw(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=Ww(l||a,t),_=o}u.call(r,e,new Qw(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Zw(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:Zw(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:Zw(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:Zw(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function iT(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function aT(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function oT(){}var sT=.7,cT=1/sT,lT=`\\s*([+-]?\\d+)\\s*`,uT=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,dT=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,fT=/^#([0-9a-f]{3,8})$/,pT=RegExp(`^rgb\\(${lT},${lT},${lT}\\)$`),mT=RegExp(`^rgb\\(${dT},${dT},${dT}\\)$`),hT=RegExp(`^rgba\\(${lT},${lT},${lT},${uT}\\)$`),gT=RegExp(`^rgba\\(${dT},${dT},${dT},${uT}\\)$`),_T=RegExp(`^hsl\\(${uT},${dT},${dT}\\)$`),vT=RegExp(`^hsla\\(${uT},${dT},${dT},${uT}\\)$`),yT={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};iT(oT,wT,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:bT,formatHex:bT,formatHex8:xT,formatHsl:ST,formatRgb:CT,toString:CT});function bT(){return this.rgb().formatHex()}function xT(){return this.rgb().formatHex8()}function ST(){return LT(this).formatHsl()}function CT(){return this.rgb().formatRgb()}function wT(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=fT.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?TT(t):n===3?new kT(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ET(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ET(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=pT.exec(e))?new kT(t[1],t[2],t[3],1):(t=mT.exec(e))?new kT(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=hT.exec(e))?ET(t[1],t[2],t[3],t[4]):(t=gT.exec(e))?ET(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=_T.exec(e))?IT(t[1],t[2]/100,t[3]/100,1):(t=vT.exec(e))?IT(t[1],t[2]/100,t[3]/100,t[4]):yT.hasOwnProperty(e)?TT(yT[e]):e===`transparent`?new kT(NaN,NaN,NaN,0):null}function TT(e){return new kT(e>>16&255,e>>8&255,e&255,1)}function ET(e,t,n,r){return r<=0&&(e=t=n=NaN),new kT(e,t,n,r)}function DT(e){return e instanceof oT||(e=wT(e)),e?(e=e.rgb(),new kT(e.r,e.g,e.b,e.opacity)):new kT}function OT(e,t,n,r){return arguments.length===1?DT(e):new kT(e,t,n,r??1)}function kT(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}iT(kT,OT,aT(oT,{brighter(e){return e=e==null?cT:cT**+e,new kT(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?sT:sT**+e,new kT(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new kT(PT(this.r),PT(this.g),PT(this.b),NT(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:AT,formatHex:AT,formatHex8:jT,formatRgb:MT,toString:MT}));function AT(){return`#${FT(this.r)}${FT(this.g)}${FT(this.b)}`}function jT(){return`#${FT(this.r)}${FT(this.g)}${FT(this.b)}${FT((isNaN(this.opacity)?1:this.opacity)*255)}`}function MT(){let e=NT(this.opacity);return`${e===1?`rgb(`:`rgba(`}${PT(this.r)}, ${PT(this.g)}, ${PT(this.b)}${e===1?`)`:`, ${e})`}`}function NT(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function PT(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function FT(e){return e=PT(e),(e<16?`0`:``)+e.toString(16)}function IT(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new zT(e,t,n,r)}function LT(e){if(e instanceof zT)return new zT(e.h,e.s,e.l,e.opacity);if(e instanceof oT||(e=wT(e)),!e)return new zT;if(e instanceof zT)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new zT(o,s,c,e.opacity)}function RT(e,t,n,r){return arguments.length===1?LT(e):new zT(e,t,n,r??1)}function zT(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}iT(zT,RT,aT(oT,{brighter(e){return e=e==null?cT:cT**+e,new zT(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?sT:sT**+e,new zT(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new kT(HT(e>=240?e-240:e+120,i,r),HT(e,i,r),HT(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new zT(BT(this.h),VT(this.s),VT(this.l),NT(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=NT(this.opacity);return`${e===1?`hsl(`:`hsla(`}${BT(this.h)}, ${VT(this.s)*100}%, ${VT(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function BT(e){return e=(e||0)%360,e<0?e+360:e}function VT(e){return Math.max(0,Math.min(1,e||0))}function HT(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var UT=e=>()=>e;function WT(e,t){return function(n){return e+n*t}}function GT(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function KT(e){return(e=+e)==1?qT:function(t,n){return n-t?GT(t,n,e):UT(isNaN(t)?n:t)}}function qT(e,t){var n=t-e;return n?WT(e,n):UT(isNaN(e)?t:e)}var JT=(function e(t){var n=KT(t);function r(e,t){var r=n((e=OT(e)).r,(t=OT(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=qT(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function YT(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function XT(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ZT(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o=0;o<r;++o)i[o]=oE(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function QT(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function $T(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function eE(e,t){var n={},r={},i;for(i in typeof e==`object`&&e||(e={}),typeof t==`object`&&t||(t={}),t)i in e?n[i]=oE(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var tE=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,nE=new RegExp(tE.source,`g`);function rE(e){return function(){return e}}function iE(e){return function(t){return e(t)+``}}function aE(e,t){var n=tE.lastIndex=nE.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=tE.exec(e))&&(i=nE.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:$T(r,i)})),n=nE.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?iE(c[0].x):rE(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function oE(e,t){var n=typeof t,r;return t==null||n===`boolean`?UT(t):(n===`number`?$T:n===`string`?(r=wT(t))?(t=r,JT):aE:t instanceof wT?JT:t instanceof Date?QT:XT(t)?YT:Array.isArray(t)?ZT:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?eE:$T)(e,t)}var sE=180/Math.PI,cE={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function lE(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*sE,skewX:Math.atan(c)*sE,scaleX:o,scaleY:s}}var uE;function dE(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?cE:lE(t.a,t.b,t.c,t.d,t.e,t.f)}function fE(e){return e==null||(uE||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),uE.setAttribute(`transform`,e),!(e=uE.transform.baseVal.consolidate()))?cE:(e=e.matrix,lE(e.a,e.b,e.c,e.d,e.e,e.f))}function pE(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:$T(e,i)},{i:c-2,x:$T(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:$T(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:$T(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:$T(e,n)},{i:s-2,x:$T(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var mE=pE(dE,`px, `,`px)`,`deg)`),hE=pE(fE,`, `,`)`,`)`),gE=1e-12;function _E(e){return((e=Math.exp(e))+1/e)/2}function vE(e){return((e=Math.exp(e))-1/e)/2}function yE(e){return((e=Math.exp(2*e))-1)/(e+1)}var bE=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<gE)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=_E(y),c=s/(n*g)*(i*yE(t*r+y)-vE(y));return[a+c*d,o+c*f,s*i/_E(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),xE=0,SE=0,CE=0,wE=1e3,TE,EE,DE=0,OE=0,kE=0,AE=typeof performance==`object`&&performance.now?performance:Date,jE=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ME(){return OE||=(jE(NE),AE.now()+kE)}function NE(){OE=0}function PE(){this._call=this._time=this._next=null}PE.prototype=FE.prototype={constructor:PE,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?ME():+n)+(t==null?0:+t),!this._next&&EE!==this&&(EE?EE._next=this:TE=this,EE=this),this._call=e,this._time=n,BE()},stop:function(){this._call&&(this._call=null,this._time=1/0,BE())}};function FE(e,t,n){var r=new PE;return r.restart(e,t,n),r}function IE(){ME(),++xE;for(var e=TE,t;e;)(t=OE-e._time)>=0&&e._call.call(void 0,t),e=e._next;--xE}function LE(){OE=(DE=AE.now())+kE,xE=SE=0;try{IE()}finally{xE=0,zE(),OE=0}}function RE(){var e=AE.now(),t=e-DE;t>wE&&(kE-=t,DE=e)}function zE(){for(var e,t=TE,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:TE=n);EE=e,BE(r)}function BE(e){xE||(SE&&=clearTimeout(SE),e-OE>24?(e<1/0&&(SE=setTimeout(LE,e-AE.now()-kE)),CE&&=clearInterval(CE)):(CE||=(DE=AE.now(),setInterval(RE,wE)),xE=1,jE(LE)))}function VE(e,t,n){var r=new PE;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var HE=zS(`start`,`end`,`cancel`,`interrupt`),UE=[];function WE(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;JE(e,n,{name:t,index:r,group:i,on:HE,tween:UE,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function GE(e,t){var n=qE(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function KE(e,t){var n=qE(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function qE(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function JE(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=FE(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return VE(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(VE(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function YE(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n)(r=n[o]).name===t?(i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]):a=!1;a&&delete e.__transition}}function XE(e){return this.each(function(){YE(this,e)})}function ZE(e,t){var n,r;return function(){var i=KE(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function QE(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=KE(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function $E(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=qE(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?ZE:QE)(n,e,t))}function eD(e,t,n){var r=e._id;return e.each(function(){var e=KE(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return qE(e,r).value[t]}}function tD(e,t){var n;return(typeof t==`number`?$T:t instanceof wT?JT:(n=wT(t))?(t=n,JT):aE)(e,t)}function nD(e){return function(){this.removeAttribute(e)}}function rD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function iD(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function aD(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function oD(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function sD(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function cD(e,t){var n=GS(e),r=n===`transform`?hE:tD;return this.attrTween(e,typeof t==`function`?(n.local?sD:oD)(n,r,eD(this,`attr.`+e,t)):t==null?(n.local?rD:nD)(n):(n.local?aD:iD)(n,r,t))}function lD(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function uD(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function dD(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&uD(e,i)),n}return i._value=t,i}function fD(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&lD(e,i)),n}return i._value=t,i}function pD(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=GS(e);return this.tween(n,(r.local?dD:fD)(r,t))}function mD(e,t){return function(){GE(this,e).delay=+t.apply(this,arguments)}}function hD(e,t){return t=+t,function(){GE(this,e).delay=t}}function gD(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?mD:hD)(t,e)):qE(this.node(),t).delay}function _D(e,t){return function(){KE(this,e).duration=+t.apply(this,arguments)}}function vD(e,t){return t=+t,function(){KE(this,e).duration=t}}function yD(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?_D:vD)(t,e)):qE(this.node(),t).duration}function bD(e,t){if(typeof t!=`function`)throw Error();return function(){KE(this,e).ease=t}}function xD(e){var t=this._id;return arguments.length?this.each(bD(t,e)):qE(this.node(),t).ease}function SD(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();KE(this,e).ease=n}}function CD(e){if(typeof e!=`function`)throw Error();return this.each(SD(this._id,e))}function wD(e){typeof e!=`function`&&(e=rC(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new $D(r,this._parents,this._name,this._id)}function TD(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new $D(o,this._parents,this._name,this._id)}function ED(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function DD(e,t,n){var r,i,a=ED(t)?GE:KE;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function OD(e,t){var n=this._id;return arguments.length<2?qE(this.node(),n).on.on(e):this.each(DD(n,e,t))}function kD(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function AD(){return this.on(`end.remove`,kD(this._id))}function jD(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=XS(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,WE(l[f],t,n,f,l,qE(u,n)));return new $D(a,this._parents,t,n)}function MD(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=eC(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=qE(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&WE(p,t,n,h,f,m);a.push(f),o.push(u)}return new $D(a,o,t,n)}var ND=Bw.prototype.constructor;function PD(){return new ND(this._groups,this._parents)}function FD(e,t){var n,r,i;return function(){var a=qC(this,e),o=(this.style.removeProperty(e),qC(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ID(e){return function(){this.style.removeProperty(e)}}function LD(e,t,n){var r,i=n+``,a;return function(){var o=qC(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function RD(e,t,n){var r,i,a;return function(){var o=qC(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),qC(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function zD(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=KE(this,e),l=c.on,u=c.value[a]==null?s||=ID(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function BD(e,t,n){var r=(e+=``)==`transform`?mE:tD;return t==null?this.styleTween(e,FD(e,r)).on(`end.style.`+e,ID(e)):typeof t==`function`?this.styleTween(e,RD(e,r,eD(this,`style.`+e,t))).each(zD(this._id,e)):this.styleTween(e,LD(e,r,t),n).on(`end.style.`+e,null)}function VD(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function HD(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&VD(e,a,n)),r}return a._value=t,a}function UD(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,HD(e,t,n??``))}function WD(e){return function(){this.textContent=e}}function GD(e){return function(){var t=e(this);this.textContent=t??``}}function KD(e){return this.tween(`text`,typeof e==`function`?GD(eD(this,`text`,e)):WD(e==null?``:e+``))}function qD(e){return function(t){this.textContent=e.call(this,t)}}function JD(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&qD(r)),t}return r._value=e,r}function YD(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,JD(e))}function XD(){for(var e=this._name,t=this._id,n=eO(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=qE(c,t);WE(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new $D(r,this._parents,e,n)}function ZD(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=KE(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var QD=0;function $D(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function eO(){return++QD}var tO=Bw.prototype;$D.prototype={constructor:$D,select:jD,selectAll:MD,selectChild:tO.selectChild,selectChildren:tO.selectChildren,filter:wD,merge:TD,selection:PD,transition:XD,call:tO.call,nodes:tO.nodes,node:tO.node,size:tO.size,empty:tO.empty,each:tO.each,on:OD,attr:cD,attrTween:pD,style:BD,styleTween:UD,text:KD,textTween:YD,remove:AD,tween:$E,delay:gD,duration:yD,ease:xD,easeVarying:CD,end:ZD,[Symbol.iterator]:tO[Symbol.iterator]};function nO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var rO={time:null,delay:0,duration:250,ease:nO};function iO(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function aO(e){var t,n;e instanceof $D?(t=e._id,e=e._name):(t=eO(),(n=rO).time=ME(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&WE(c,e,t,l,o,n||iO(c,t));return new $D(r,this._parents,e,t)}Bw.prototype.interrupt=XE,Bw.prototype.transition=aO;var oO=e=>()=>e;function sO(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function cO(e,t,n){this.k=e,this.x=t,this.y=n}cO.prototype={constructor:cO,scale:function(e){return e===1?this:new cO(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new cO(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var lO=new cO(1,0,0);uO.prototype=cO.prototype;function uO(e){for(;!e.__zoom;)if(!(e=e.parentNode))return lO;return e.__zoom}function dO(e){e.stopImmediatePropagation()}function fO(e){e.preventDefault(),e.stopImmediatePropagation()}function pO(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function mO(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function hO(){return this.__zoom||lO}function gO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _O(){return navigator.maxTouchPoints||`ontouchstart`in this}function vO(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function yO(){var e=pO,t=mO,n=vO,r=gO,i=_O,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=bE,l=zS(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,hO).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,hO),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(lO.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new cO(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new cO(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new cO(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Hw(this.that).datum();l.call(e,this.that,new sO(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=Ww(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],YE(this),s.start();fO(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Hw(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=Ww(t,i),l=t.clientX,u=t.clientY;Yw(t.view),dO(t),a.mouse=[c,this.__zoom.invert(c)],YE(this),a.start();function d(e){if(fO(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=Ww(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Xw(e.view,a.moved),fO(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=Ww(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);fO(r),s>0?Hw(this).transition().duration(s).call(x,d,c,r):Hw(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(dO(t),s=0;s<i;++s)c=r[s],l=Ww(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),YE(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(fO(e),s=0;s<a;++s)c=i[s],l=Ww(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(dO(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=Ww(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=Hw(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:oO(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:oO(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:oO(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:oO([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var bO={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},xO=[[-1/0,-1/0],[1/0,1/0]],SO=[`Enter`,` `,`Escape`],CO={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},wO;(function(e){e.Strict=`strict`,e.Loose=`loose`})(wO||={});var TO;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(TO||={});var EO;(function(e){e.Partial=`partial`,e.Full=`full`})(EO||={});var DO={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},OO;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(OO||={});var kO;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(kO||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var AO={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top},jO=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,MO=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),NO=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),PO=(e,t=[0,0])=>{let{width:n,height:r}=mk(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},FO=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):NO(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,JO(e,QO(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?XO(r):{x:0,y:0,width:0,height:0}},IO=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=JO(n,QO(e)),r=!0)}),r?XO(n):{x:0,y:0,width:0,height:0}},LO=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=ek(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},RO=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function zO(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=mk(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function BO({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=dk(IO(zO(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function VO({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,bO.error005());else{let{width:e,height:t}=mk(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&pk(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=pk(d)?WO(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,bO.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function HO({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=RO(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var UO=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),WO=(e={x:0,y:0},t,n)=>({x:UO(e.x,t[0][0],t[1][0]-(n?.width??0)),y:UO(e.y,t[0][1],t[1][1]-(n?.height??0))});function GO(e,t,n){let{width:r,height:i}=mk(n),{x:a,y:o}=n.internals.positionAbsolute;return WO(e,[[a,o],[a+r,o+i]],t)}var KO=(e,t,n)=>e<t?UO(Math.abs(e-t),1,t)/t:e>n?-UO(Math.abs(e-n),1,t)/t:0,qO=(e,t,n=15,r=40)=>[KO(e.x,r,t.width-r)*n,KO(e.y,r,t.height-r)*n],JO=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),YO=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),XO=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),ZO=(e,t=[0,0])=>{let{x:n,y:r}=NO(e)?e.internals.positionAbsolute:PO(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},QO=(e,t=[0,0])=>{let{x:n,y:r}=NO(e)?e.internals.positionAbsolute:PO(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},$O=(e,t)=>XO(JO(YO(e),YO(t))),ek=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},tk=(e,t)=>ek(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),nk=e=>rk(e.width)&&rk(e.height)&&rk(e.x)&&rk(e.y),rk=e=>!isNaN(e)&&isFinite(e),ik=(e,t)=>(e,t)=>{},ak=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ok=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?ak(s,o):s},sk=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function ck(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function lk(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=ck(e,n),i=ck(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=ck(e.top??e.y??0,n),i=ck(e.bottom??e.y??0,n),a=ck(e.left??e.x??0,t),o=ck(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function uk(e,t,n,r,i,a){let{x:o,y:s}=sk(e,[t,n,r]),{x:c,y:l}=sk({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var dk=(e,t,n,r,i,a)=>{let o=lk(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=UO(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=uk(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},fk=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function pk(e){return e!=null&&e!==`parent`}function mk(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function hk(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function gk(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function _k(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function vk(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function yk(e){return{...CO,...e||{}}}function bk(e){return e===null?null:e?`valid`:`invalid`}function xk(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Dk(e),s=ok({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?ak(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Sk=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ck=e=>e?.getRootNode?.()||window?.document,wk=[`INPUT`,`SELECT`,`TEXTAREA`];function Tk(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?wk.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Ek=e=>`clientX`in e,Dk=(e,t)=>{let n=Ek(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},Ok=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Sk(t)}})};function kk({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Ak(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function jk({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case $.Left:return[t-Ak(t-r,a),n];case $.Right:return[t+Ak(r-t,a),n];case $.Top:return[t,n-Ak(n-i,a)];case $.Bottom:return[t,n+Ak(i-n,a)]}}function Mk({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,curvature:o=.25}){let[s,c]=jk({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=jk({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=kk({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function Nk({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function Pk({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function Fk({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=JO(QO(e),QO(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),tk({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},XO(a))>0}var Ik=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Lk=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Rk=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,bO.error006()),t;let r=n.getEdgeId||Ik,i;return i=jO(e)?{...e}:{...e,id:r(e)},Lk(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function zk({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Nk({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Bk={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},Vk=({source:e,sourcePosition:t=$.Bottom,target:n})=>t===$.Left||t===$.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Hk=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Uk({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=Bk[t],c=Bk[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Vk({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=Nk({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function Wk(e,t,n,r){let i=Math.min(Hk(e,t)/2,Hk(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function Gk({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Uk({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=Wk(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function Kk(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function qk(e){let{sourceNode:t,targetNode:n}=e;if(!Kk(t)||!Kk(n))return null;let r=t.internals.handleBounds||Jk(t.handles),i=n.internals.handleBounds||Jk(n.handles),a=Xk(r?.source??[],e.sourceHandle),o=Xk(e.connectionMode===wO.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,bO.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=Yk(t,a,s),u=Yk(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function Jk(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function Yk(e,t,n=$.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??mk(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case $.Top:return{x:i+o/2,y:a};case $.Right:return{x:i+o,y:a+s/2};case $.Bottom:return{x:i+o/2,y:a+s};case $.Left:return{x:i,y:a+s/2}}}function Xk(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Zk(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Qk(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=Zk(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var $k=1e3,eA=10,tA={nodeOrigin:[0,0],nodeExtent:xO,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},nA={...tA,checkEquality:!0};function rA(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function iA(e,t,n){let r=rA(tA,n);for(let n of e.values())if(n.parentId)lA(n,e,t,r);else{let e=WO(PO(n,r.nodeOrigin),pk(n.extent)?n.extent:r.nodeExtent,mk(n));n.internals.positionAbsolute=e}}function aA(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function oA(e){return e===`manual`}function sA(e,t,n,r={}){let i=rA(nA,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!oA(i.zIndexMode)?$k:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=WO(PO(u,i.nodeOrigin),pk(u.extent)?u.extent:i.nodeExtent,mk(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:aA(u,e),z:uA(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}e.measured!==void 0&&e.measured.width!==void 0&&e.measured.height!==void 0||e.hidden||(c=!1),u.parentId&&lA(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function cA(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function lA(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=rA(tA,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}cA(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*eA),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=dA(e,u,o,s,a&&!oA(c)?$k:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function uA(e,t,n){let r=rk(e.zIndex)?e.zIndex:0;return oA(n)?r:r+(e.selected?t:0)}function dA(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=mk(e),l=PO(e,n),u=pk(e.extent)?WO(l,e.extent,c):l,d=WO({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=GO(d,c,t));let f=uA(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function fA(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=$O(a.get(n.parentId)?.expandedRect??ZO(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=mk(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function pA(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=Sk(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=pk(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=GO(h,s,n))}else m&&(h=WO(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:Ok(`source`,r.nodeElement,p,d,e.id),target:Ok(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&lA(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:ZO(g,i)}))}}if(f.length>0){let e=fA(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function mA({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function hA(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function gA(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;hA(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),hA(`target`,s,c,e,i,o),t.set(r.id,r)}}function _A(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:_A(n,t):!1}function vA(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function yA(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!_A(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function bA({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function xA({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=ak(a,t);return{x:o.x-a.x,y:o.y-a.y}}function SA({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=Hw(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?YO(IO(s)):null,x=v&&l?xA({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:ak(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=VO({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=bA({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=qO(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,m&&y||o||!b||i.get(b)?.selected||_(),y&&m&&b&&e?.(b);let v=xk(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=yA(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=bA({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=rT().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=xk(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Dk(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=xk(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Dk(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Dk(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p)p&&s.size>0&&t().updateNodePositions(s,!1);else if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=bA({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!vA(t,`.${g}`,v))&&(!_||vA(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function CA(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())tk(i,ZO(e))>0&&r.push(e);return r}var wA=250;function TA(e,t,n,r){let i=[],a=1/0,o=CA(e,n,t+wA);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Yk(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function EA(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Yk(o,c,c.position,!0)}:c}function DA(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function OA(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var kA=()=>!0;function AA(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=kA,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Ck(e.target),E=0,D,{x:O,y:k}=Dk(e),A=DA(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=EA(i,A,r,c,t);if(!N)return;let P=Dk(e,j),ee=!1,te=null,ne=!1,F=null;function I(){if(!u||!j)return;let[e,t]=qO(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(I)}let re={...N,nodeId:i,type:A,position:N.position},ie=c.get(i),ae={inProgress:!0,isValid:null,from:Yk(ie,re,$.Left,!0),fromHandle:re,fromPosition:re.position,fromNode:ie,to:P,toHandle:null,toPosition:AO[re.position],toNode:null,pointer:P};function oe(){M=!0,y(ae),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&oe();function se(e){if(!M){let{x:t,y:n}=Dk(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;oe()}if(!x()||!re){ce(e);return}let a=b();P=Dk(e,j),D=TA(ok(P,a,!1,[1,1]),n,c,re),ee||=(I(),!0);let s=jA(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});F=s.handleDomNode,te=s.connection,ne=OA(!!D,s.isValid);let u=c.get(i),f=u?Yk(u,re,$.Left,!0):ae.from,p={...ae,from:f,isValid:ne,to:s.toHandle&&ne?sk({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:ne&&s.toHandle?s.toHandle.position:AO[re.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),ae=p}function ce(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||F)&&te&&ne&&h?.(te);let{inProgress:t,...n}=ae,r={...n,toPosition:ae.toHandle?ae.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),ee=!1,ne=!1,te=null,F=null,T.removeEventListener(`mousemove`,se),T.removeEventListener(`mouseup`,ce),T.removeEventListener(`touchmove`,se),T.removeEventListener(`touchend`,ce)}}T.addEventListener(`mousemove`,se),T.addEventListener(`mouseup`,ce),T.addEventListener(`touchmove`,se),T.addEventListener(`touchend`,ce)}function jA(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=kA,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Dk(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=DA(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===wO.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=EA(t,e,a,u,n,!0)}return _}var MA={onPointerDown:AA,isValid:jA};function NA({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Hw(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&fk()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=yO().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:Ww}}var PA=e=>({x:e.x,y:e.y,zoom:e.k}),FA=({x:e,y:t,zoom:n})=>lO.translate(e,t).scale(n),IA=(e,t)=>e.target.closest(`.${t}`),LA=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),RA=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,zA=(e,t=0,n=RA,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},BA=e=>{let t=e.ctrlKey&&fk()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function VA({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(IA(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=Ww(u),t=d*2**BA(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===TO.Vertical?0:u.deltaX*f,m=i===TO.Horizontal?0:u.deltaY*f;!fk()&&u.shiftKey&&i!==TO.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=PA(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function HA({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=IA(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function UA({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=PA(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function WA({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&LA(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,PA(a.transform))}}function GA({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&LA(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=PA(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function KA({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(IA(f,`${u}-flow__node`)||IA(f,`${u}-flow__edge`)||IA(f,`${u}-flow__selection`)||IA(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||IA(f,c)&&h||IA(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function qA({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=yO().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=Hw(e).call(f);y({x:i.x,y:i.y,zoom:UO(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(BA);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?oE:bE).transform(zA(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,panActivationKeyPressed:S=!1,zoomActivationKeyPressed:C,lib:w,onTransformChange:T,connectionInProgress:E,paneClickDistance:D,selectionOnDrag:O}){r&&!l.isZoomingOrPanning&&v();let k=i&&!C&&!r;f.clickDistance(O?1/0:!rk(D)||D<0?0:D);let A=k?VA({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):HA({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,A,{passive:!1});let j=UA({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,j);let M=WA({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,M);let N=GA({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,N);let P=KA({panActivationKeyPressed:S,zoomActivationKeyPressed:C,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:w,connectionInProgress:E});f.filter(P),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=FA(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=FA(e);return await g(n,t),n}function x(e){if(p){let t=FA(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?uO(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?oE:bE).scaleTo(zA(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?oE:bE).scaleBy(zA(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!rk(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var JA;(function(e){e.Line=`line`,e.Handle=`handle`})(JA||={});function YA({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function XA(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function ZA(e,t){return Math.max(0,t-e)}function QA(e,t){return Math.max(0,e-t)}function $A(e,t,n){return Math.max(0,t-e,e-n)}function ej(e,t){return e?!t:t}function tj(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=$A(E,h,g),j=$A(D,_,v);if(o){let e=0,t=0;c&&w<0?e=ZA(y+w+O,o[0][0]):!c&&w>0&&(e=QA(y+E+O,o[1][0])),l&&T<0?t=ZA(b+T+k,o[0][1]):!l&&T>0&&(t=QA(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=QA(y+w,s[0][0]):!c&&w<0&&(e=ZA(y+E,s[1][0])),l&&T>0?t=QA(b+T,s[0][1]):!l&&T<0&&(t=ZA(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=$A(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?QA(b+k+E/C,o[1][1])*C:ZA(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?ZA(b+E/C,s[1][1])*C:QA(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=$A(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?QA(y+D*C+O,o[1][0])/C:ZA(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?ZA(y+D*C,s[1][0])/C:QA(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(ej(c,l)?-w:w)/C:w=(ej(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var nj={width:0,height:0,x:0,y:0},rj={...nj,pointerX:0,pointerY:0,aspectRatio:1};function ij(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function aj({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=Hw(e),o={controlDirection:XA(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...nj},h={...rj};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:XA(e)};let g,_=null,v=[],y,b,x,S=!1,C=rT().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=xk(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=pk(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=ij(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=xk(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=tj(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let ee=YA({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),te={...m,direction:ee};p?.(e,te)!==!1&&(S=!0,d?.(e,te),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var oj=t((t=>{var n=(Je(),e(qe)),r=Wd();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=n.useRef,c=n.useEffect,l=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),sj=n(t(((e,t)=>{t.exports=oj()}))(),1),cj=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},lj=e=>e?cj(e):cj;Je();var{useDebugValue:uj}=Ge,{useSyncExternalStoreWithSelector:dj}=sj.default,fj=e=>e;function pj(e,t=fj,n){let r=dj(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return uj(r),r}var mj=(e,t)=>{let n=lj(e),r=(e,r=t)=>pj(n,e,r);return Object.assign(r,n),r},hj=(e,t)=>e?mj(e,t):mj;function gj(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}ft(),Je();var _j=nt(null),vj=_j.Provider,yj=bO.error001(`react`);function bj(e,t){let n=Ze(_j);if(n===null)throw Error(yj);return pj(n,e,t)}function xj(){let e=Ze(_j);if(e===null)throw Error(yj);return H(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Sj={display:`none`},Cj={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},wj=`react-flow__node-desc`,Tj=`react-flow__edge-desc`,Ej=`react-flow__aria-live`,Dj=e=>e.ariaLiveMessage,Oj=e=>e.ariaLabelConfig;function kj({rfId:e}){let t=bj(Dj);return R(`div`,{id:`${Ej}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Cj,children:t})}function Aj({rfId:e,disableKeyboardA11y:t}){let n=bj(Oj);return R(ot,{children:[R(`div`,{id:`${wj}-${e}`,style:Sj,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),R(`div`,{id:`${Tj}-${e}`,style:Sj,children:n[`edge.a11yDescription.default`]}),!t&&R(kj,{rfId:e})]})}var jj=gt(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return R(`div`,{className:LS([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});jj.displayName=`Panel`;var Mj=`https://reactflow.dev?utm_source=attribution`;function Nj({proOptions:e,position:t=`bottom-right`}){return V(()=>{},[]),e?.hideAttribution?null:R(jj,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Mj}`,children:R(`a`,{href:Mj,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var Pj=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Fj=e=>e.id;function Ij(e,t){return gj(e.selectedNodes.map(Fj),t.selectedNodes.map(Fj))&&gj(e.selectedEdges.map(Fj),t.selectedEdges.map(Fj))}function Lj({onSelectionChange:e}){let t=xj(),{selectedNodes:n,selectedEdges:r}=bj(Pj,Ij);return V(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Rj=e=>!!e.onSelectionChangeHandlers;function zj({onSelectionChange:e}){let t=bj(Rj);return e||t?R(Lj,{onSelectionChange:e}):null}var Bj=[0,0],Vj={x:0,y:0,zoom:1},Hj=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],Uj=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Wj={translateExtent:xO,nodeOrigin:Bj,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Gj(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=bj(Uj,gj),l=xj();V(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Wj,s()}),[]);let u=q(Wj);return V(()=>{for(let s of Hj){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:yk(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},Hj.map(t=>e[t])),null}function Kj(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function qj(e){let[t,n]=W(e===`system`?null:e);return V(()=>{if(e!==`system`){n(e);return}let t=Kj(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?Kj()?.matches?`dark`:`light`:t}var Jj=typeof document<`u`?document:null;function Yj(e=null,t={target:Jj,actInsideInputWithModifier:!0}){let[n,r]=W(!1),i=q(!1),a=q(new Set([])),[o,s]=H(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
2463
2463
  `).replace(`
2464
2464
 
2465
2465
  `,`
2466
2466
  +`).split(`
2467
- `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return V(()=>{let n=t?.target??qj,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&wk(e))return!1;let n=Xj(e.code,s);if(a.current.add(e[n]),Yj(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=Xj(e.code,s);Yj(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function Yj(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Xj(e,t){return t.includes(e)?`code`:`key`}var Zj=()=>{let e=bj();return H(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=uk(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return ak(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=ok(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Qj(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)$j(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function $j(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing)}}function eM(e,t){return Qj(e,t)}function tM(e,t){return Qj(e,t)}function nM(e,t){return{id:e,type:`select`,selected:t}}function rM(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);(a.selected!==void 0||e)&&a.selected!==e&&(n&&(a.selected=e),r.push(nM(a.id,e)))}return r}function iM({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function aM(e){return{id:e.id,type:`remove`}}var oM=rk(`React Flow`,`https://reactflow.dev/`);function sM(e,t,n={}){return Lk(e,t,{...n,onError:n.onError??oM})}var cM=e=>jO(e),lM=e=>AO(e);function uM(e){return gt(e)}var dM=typeof window<`u`?et:V;function fM(e){let[t,n]=W(BigInt(0)),[r]=W(()=>pM(()=>n(e=>e+BigInt(1))));return dM(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function pM(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var mM=nt(null);function hM({children:e}){let t=bj(),n=fM(B(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=iM({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=fM(B(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(iM({items:s,lookup:o}))},[])),i=H(()=>({nodeQueue:n,edgeQueue:r}),[]);return R(mM.Provider,{value:i,children:e})}function gM(){let e=Ze(mM);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var _M=e=>!!e.panZoom;function vM(){let e=Zj(),t=bj(),n=gM(),r=yj(_M),i=H(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=cM(e)?e:n.get(e.id),a=i.parentId?hk(i.position,i.measured,i.parentId,n,r):i.position;return XO({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&cM(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&lM(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await VO({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(aM);o?.(f),c(e)}if(m){let e=d.map(aM);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=tk(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=XO(s?r:a),l=ek(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=tk(e)?e:a(e);if(!r)return!1;let i=ek(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return PO(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??_k();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return H(()=>({...i,...e,viewportInitialized:r}),[r])}var yM=e=>e.selected,bM=typeof window<`u`?window:void 0;function xM({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=bj(),{deleteElements:r}=vM(),i=Jj(e,{actInsideInputWithModifier:!1}),a=Jj(t,{target:bM});V(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(yM),edges:e.filter(yM)}),n.setState({nodesSelectionActive:!1})}},[i]),V(()=>{n.setState({multiSelectionActive:a})},[a])}function SM(e){let t=bj();V(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=xk(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,yO.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var CM={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},wM=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function TM({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=wO.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:m=!0,children:h,noWheelClassName:g,noPanClassName:_,onViewportChange:v,isControlledViewport:y,paneClickDistance:b,selectionOnDrag:x}){let S=bj(),C=q(null),{userSelectionActive:w,lib:T,connectionInProgress:E}=yj(wM,hj),D=Jj(p),O=q();SM(C);let k=B(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),y||S.setState({transform:e})},[v,y]);return V(()=>{if(C.current){O.current=KA({domNode:C.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=S.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=S.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=O.current.getViewport();return S.setState({panZoom:O.current,transform:[e,t,n],domNode:C.current.closest(`.react-flow`)}),()=>{O.current?.destroy()}}},[]),V(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:D,preventScrolling:m,noPanClassName:_,userSelectionActive:w,noWheelClassName:g,lib:T,onTransformChange:k,connectionInProgress:E,selectionOnDrag:x,paneClickDistance:b})},[e,t,n,r,i,a,o,s,c,D,m,_,w,g,T,k,E,x,b]),R(`div`,{className:`react-flow__renderer`,ref:C,style:CM,children:h})}var EM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function DM(){let{userSelectionActive:e,userSelectionRect:t}=yj(EM,hj);return e&&t?R(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var OM=(e,t)=>n=>{n.target===t.current&&e?.(n)},kM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function AM({isSelecting:e,selectionKeyPressed:t,selectionMode:n=TO.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=q(0),_=bj(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=yj(kM,hj),C=y&&(e||v),w=q(null),T=q(),E=q(new Set),D=q(new Set),O=q(!1),k=q(!1),A=q({x:0,y:0}),j=q(!1),M=e=>{k.current||O.current||_.getState().connection.inProgress?(k.current=!1,O.current=!1):(l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1}))},N=e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():u?.(e)},P=d?e=>d(e):void 0,ee=e=>{k.current&&=(e.stopPropagation(),!1)},te=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(T.current=i?.getBoundingClientRect(),!T.current)return;let s=n.target===w.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:c,y:l}=Ek(n.nativeEvent,T.current),u=ak({x:c,y:l},a);_.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(n.stopPropagation(),n.preventDefault())};function ne(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=ok(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set(IO(a,m,i,n===TO.Partial,!0).map(e=>e.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}gk(h,E.current)||c(rM(a,E.current,!0)),gk(g,D.current)||l(rM(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function F(){if(!i||!T.current)return;let[e,t]=KO(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(F);return}let{x:t,y:n}=A.current;ne(t,n),g.current=requestAnimationFrame(F)})}let I=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};V(()=>()=>I(),[]);let re=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Ek(e.nativeEvent,T.current);A.current={x:o,y:c};let l=ok({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(F(),!0),ne(o,c)},ie=e=>{C?e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),I()):e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0)},ae=e=>{e.target?.releasePointerCapture?.(e.pointerId),I()},oe=r===!0||Array.isArray(r)&&r.includes(0);return R(`div`,{className:IS([`react-flow__pane`,{draggable:oe,dragging:b,selection:e}]),onClick:C?void 0:OM(M,w),onContextMenu:OM(N,w),onWheel:OM(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?re:p,onPointerUp:ie,onPointerCancel:C?ae:void 0,onPointerDownCapture:C?te:void 0,onClickCapture:C?ee:void 0,onPointerLeave:m,ref:w,style:CM,children:[h,R(DM,{})]})}function jM({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);l?(t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])):c?.(`012`,yO.error012(e))}function MM({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=bj(),[c,l]=W(!1),u=q();return V(()=>{if(!t)return u.current=xA({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{jM({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),V(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var NM=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function PM(){let e=bj();return B(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=NM(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=ik(t,i));let{position:a,positionAbsolute:s}=BO({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var FM=nt(null),IM=FM.Provider;FM.Consumer;var LM=()=>Ze(FM),RM=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),zM=nt(null);function BM({children:e}){let t=yj(RM,hj);return R(zM.Provider,{value:t,children:e})}function VM(){let e=Ze(zM);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var HM={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},UM=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return HM;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===CO.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function WM({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=bj(),_=LM(),{connectOnClick:v,noPanClassName:y,rfId:b}=VM(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=yj(UM(_,m,e),hj);_||g.getState().onError?.(`010`,yO.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(sM(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Tk(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();jA.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return R(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:IS([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=Sk(t.target),h=n||c,{connection:v,isValid:y}=jA.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var GM=Ae(uM(WM));function KM({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return R(ot,{children:[e?.label,R(GM,{type:`source`,position:n,isConnectable:t})]})}function qM({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return R(ot,{children:[R(GM,{type:`target`,position:n,isConnectable:t}),e?.label,R(GM,{type:`source`,position:r,isConnectable:t})]})}function JM(){return null}function YM({data:e,isConnectable:t,targetPosition:n=$.Top}){return R(ot,{children:[R(GM,{type:`target`,position:n,isConnectable:t}),e?.label]})}var XM={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},ZM={input:KM,default:qM,output:YM,group:JM};function QM(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var $M=e=>{let{width:t,height:n,x:r,y:i}=FO(e.nodeLookup,{filter:e=>!!e.selected});return{width:nk(t)?t:null,height:nk(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function eN({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=bj(),{width:i,height:a,transformString:o,userSelectionActive:s}=yj($M,hj),c=PM(),l=q(null);V(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(MM({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return R(`div`,{className:IS([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:R(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(XM,e.key)&&(e.preventDefault(),c({direction:XM[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var tN=typeof window<`u`?window:void 0,nN=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function rN({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:ee,isControlledViewport:te}){let{nodesSelectionActive:ne,userSelectionActive:F}=yj(nN,hj),I=Jj(l,{target:tN}),re=Jj(h,{target:tN}),ie=re||w,ae=re||b,oe=u&&ie!==!0,se=I||F||oe;return xM({deleteKeyCode:c,multiSelectionKeyCode:m}),R(TM,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:ae,panActivationKeyPressed:re,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!I&&ie,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:ee,isControlledViewport:te,paneClickDistance:s,selectionOnDrag:oe,children:R(AM,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ie,autoPanOnSelection:T,isSelecting:!!se,selectionMode:d,selectionKeyPressed:I,paneClickDistance:s,selectionOnDrag:oe,children:[e,ne&&R(eN,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}rN.displayName=`FlowRenderer`;var iN=Ae(rN),aN=e=>t=>e?IO(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function oN(e){return yj(B(aN(e),[e]),hj)}var sN=e=>e.updateNodeInternals;function cN(){let e=yj(sN),[t]=W(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return V(()=>()=>{t?.disconnect()},[t]),t}function lN({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=bj(),a=q(null),o=q(null),s=q(e.sourcePosition),c=q(e.targetPosition),l=q(t),u=n&&!!e.internals.handleBounds;return V(()=>{!a.current||e.hidden||u&&o.current===a.current||(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),V(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),V(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function uN({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=yj(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},hj),S=y.type||`default`,C=g?.[S]||ZM[S];C===void 0&&(v?.(`003`,yO.error003(S)),S=`default`,C=g?.default||ZM.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=bj(),k=mk(y),A=lN({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=MM({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=PM();if(y.hidden)return null;let N=pk(y),P=QM(y),ee=T||w||t||n||r||i,te=n?e=>n(e,{...b.userNode}):void 0,ne=r?e=>r(e,{...b.userNode}):void 0,F=i?e=>i(e,{...b.userNode}):void 0,I=a?e=>a(e,{...b.userNode}):void 0,re=o?e=>o(e,{...b.userNode}):void 0,ie=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&jM({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},ae=t=>{if(!(wk(t.nativeEvent)||m)){if(xO.includes(t.key)&&T){let n=t.key===`Escape`;jM({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(XM,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:XM[t.key],factor:t.shiftKey?4:1})}}},oe=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(IO(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return R(`div`,{className:IS([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:ee?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:te,onMouseMove:ne,onMouseLeave:F,onContextMenu:I,onClick:ie,onDoubleClick:re,onKeyDown:D?ae:void 0,tabIndex:D?0:void 0,onFocus:D?oe:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${Cj}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:R(IM,{value:e,children:R(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var dN=Ae(uN),fN=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function pN(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=yj(fN,hj),a=oN(e.onlyRenderVisibleElements),o=cN();return R(`div`,{className:`react-flow__nodes`,style:CM,children:a.map(a=>R(dN,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}pN.displayName=`NodeRenderer`;var mN=Ae(pN);function hN(e){return yj(B(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&Pk({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),hj)}var gN=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return R(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},_N=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return R(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},vN={[OO.Arrow]:gN,[OO.ArrowClosed]:_N};function yN(e){let t=bj();return H(()=>Object.prototype.hasOwnProperty.call(vN,e)?vN[e]:(t.getState().onError?.(`009`,yO.error009(e)),null),[e])}var bN=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=yN(t);return c?R(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:R(c,{color:n,strokeWidth:o})}):null},xN=({defaultColor:e,rfId:t})=>{let n=yj(e=>e.edges),r=yj(e=>e.defaultEdgeOptions),i=H(()=>Zk(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?R(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:R(`defs`,{children:i.map(e=>R(bN,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};xN.displayName=`MarkerDefinitions`;var SN=Ae(xN);function CN({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=W({x:1,y:0,width:0,height:0}),p=IS([`react-flow__edge-textwrapper`,l]),m=q(null);return V(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?R(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&R(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),R(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}CN.displayName=`EdgeText`;var wN=Ae(CN);function TN({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return R(ot,{children:[R(`path`,{...u,d:e,fill:`none`,className:IS([`react-flow__edge-path`,u.className])}),l?R(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&nk(t)&&nk(n)?R(wN,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function EN({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function DN({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=EN({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=EN({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Ok({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function ON(e){return Ae(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=DN({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return R(TN,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var kN=ON({isInternal:!1}),AN=ON({isInternal:!0});kN.displayName=`SimpleBezierEdge`,AN.displayName=`SimpleBezierEdgeInternal`;function jN(e){return Ae(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Wk({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return R(TN,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var MN=jN({isInternal:!1}),NN=jN({isInternal:!0});MN.displayName=`SmoothStepEdge`,NN.displayName=`SmoothStepEdgeInternal`;function PN(e){return Ae(({id:t,...n})=>{let r=e.isInternal?void 0:t;return R(MN,{...n,id:r,pathOptions:H(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var FN=PN({isInternal:!1}),IN=PN({isInternal:!0});FN.displayName=`StepEdge`,IN.displayName=`StepEdgeInternal`;function LN(e){return Ae(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Rk({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return R(TN,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var RN=LN({isInternal:!1}),zN=LN({isInternal:!0});RN.displayName=`StraightEdge`,zN.displayName=`StraightEdgeInternal`;function BN(e){return Ae(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=jk({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return R(TN,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var VN=BN({isInternal:!1}),HN=BN({isInternal:!0});VN.displayName=`BezierEdge`,HN.displayName=`BezierEdgeInternal`;var UN={default:HN,straight:zN,step:IN,smoothstep:NN,simplebezier:AN},WN={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},GN=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,KN=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,qN=`react-flow__edgeupdater`;function JN({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return R(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:IS([qN,`${qN}-${s}`]),cx:GN(t,r,e),cy:KN(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function YN({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=bj(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;jA.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return R(ot,{children:[(e===!0||e===`source`)&&R(JN,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&R(JN,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function XN({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=yj(t=>t.edgeLookup.get(e)),b=yj(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||UN[x];S===void 0&&(_?.(`011`,yO.error011(x)),x=`default`,S=h?.default||UN.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=q(null),[D,O]=W(!1),[k,A]=W(!1),j=bj(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:ee,targetY:te,sourcePosition:ne,targetPosition:F}=yj(B(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return WN;let i=Kk({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=Nk({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||WN,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex,_]),hj),I=H(()=>y.markerStart?`url('#${Xk(y.markerStart,m)}')`:void 0,[y.markerStart,m]),re=H(()=>y.markerEnd?`url('#${Xk(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||ee===null||te===null)return null;let ie=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},ae=a?e=>{a(e,{...y})}:void 0,oe=o?e=>{o(e,{...y})}:void 0,se=s?e=>{s(e,{...y})}:void 0,ce=c?e=>{c(e,{...y})}:void 0,le=l?e=>{l(e,{...y})}:void 0;return R(`svg`,{style:{zIndex:M},children:R(`g`,{className:IS([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:ie,onDoubleClick:ae,onContextMenu:oe,onMouseEnter:se,onMouseMove:ce,onMouseLeave:le,onKeyDown:C?t=>{if(!v&&xO.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${wj}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&R(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:ee,targetY:te,sourcePosition:ne,targetPosition:F,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:I,markerEnd:re,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&R(YN,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:ee,targetY:te,sourcePosition:ne,targetPosition:F,setUpdateHover:O,setReconnecting:A})]})})}var ZN=Ae(XN),QN=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function $N({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=yj(QN,hj),b=hN(t);return R(`div`,{className:`react-flow__edges`,children:[R(SN,{defaultColor:e,rfId:n}),b.map(e=>R(ZN,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}$N.displayName=`EdgeRenderer`;var eP=Ae($N),tP=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function nP({children:e}){let t=bj(),n=q(null),[r]=W(()=>t.getState().transform);return dM(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=tP(r)))};return r(),t.subscribe(r)},[t]),R(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:tP(r)},children:e})}function rP(e){let t=vM(),n=q(!1);V(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var iP=e=>e.panZoom?.syncViewport;function aP(e){let t=yj(iP),n=bj();return V(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function oP(e){return e.connection.inProgress?{...e.connection,to:ak(e.connection.to,e.transform)}:{...e.connection}}function sP(e){return e?t=>e(oP(t)):oP}function cP(e){return yj(sP(e),hj)}var lP=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function uP({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=yj(lP,hj);return a&&i&&c?R(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:R(`g`,{className:IS([`react-flow__connection`,yk(s)]),children:R(dP,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var dP=({style:e,type:t=DO.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=cP();if(!i)return;if(n)return R(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:yk(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case DO.Bezier:[m]=jk(h);break;case DO.SimpleBezier:[m]=DN(h);break;case DO.Step:[m]=Wk({...h,borderRadius:0});break;case DO.SmoothStep:[m]=Wk(h);break;default:[m]=Rk(h)}return R(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};dP.displayName=`ConnectionLine`;var fP={};function pP(e=fP){q(e),bj(),V(()=>{},[e])}function mP(){bj(),q(!1),V(()=>{},[])}function hP({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:ee,panOnScrollSpeed:te,panOnScrollMode:ne,zoomOnDoubleClick:F,panOnDrag:I,autoPanOnSelection:re,onPaneClick:ie,onPaneMouseEnter:ae,onPaneMouseMove:oe,onPaneMouseLeave:se,onPaneScroll:ce,onPaneContextMenu:le,paneClickDistance:ue,nodeClickDistance:de,onEdgeContextMenu:fe,onEdgeMouseEnter:pe,onEdgeMouseMove:me,onEdgeMouseLeave:he,reconnectRadius:ge,onReconnect:_e,onReconnectStart:ve,onReconnectEnd:ye,noDragClassName:be,noWheelClassName:xe,noPanClassName:Se,disableKeyboardA11y:Ce,nodeExtent:we,rfId:Te,viewport:Ee,onViewportChange:L,nodesDraggable:De}){return pP(e),pP(t),mP(),rP(n),aP(Ee),R(iN,{onPaneClick:ie,onPaneMouseEnter:ae,onPaneMouseMove:oe,onPaneMouseLeave:se,onPaneContextMenu:le,onPaneScroll:ce,paneClickDistance:ue,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:F,panOnScroll:ee,panOnScrollSpeed:te,panOnScrollMode:ne,panOnDrag:I,autoPanOnSelection:re,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:be,noWheelClassName:xe,noPanClassName:Se,disableKeyboardA11y:Ce,onViewportChange:L,isControlledViewport:!!Ee,children:R(nP,{children:[R(eP,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:_e,onReconnectStart:ve,onReconnectEnd:ye,onlyRenderVisibleElements:T,onEdgeContextMenu:fe,onEdgeMouseEnter:pe,onEdgeMouseMove:me,onEdgeMouseLeave:he,reconnectRadius:ge,defaultMarkerColor:M,noPanClassName:Se,disableKeyboardA11y:Ce,rfId:Te}),R(uP,{style:h,type:m,component:g,containerStyle:_}),R(`div`,{className:`react-flow__edgelabel-renderer`}),R(mN,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:de,onlyRenderVisibleElements:T,noPanClassName:Se,noDragClassName:be,disableKeyboardA11y:Ce,nodeExtent:we,rfId:Te,nodesDraggable:De}),R(`div`,{className:`react-flow__viewport-portal`})]})})}hP.displayName=`GraphView`;var gP=Ae(hP),_P=rk(`React Flow`,`https://reactflow.dev/`),vP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??bO;hA(h,g,_);let{nodesInitialized:x}=oA(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=uk(FO(p,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:bO,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:CO.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...EO},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:_P,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:SO,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},yP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>mj((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await zO({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...vP({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=oA(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();hA(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=fA(e,n,r,i,a,o,l);d&&(rA(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=Jk(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=dA(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(eM(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(tM(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?i(e.map(e=>nM(e,!0))):(i(rM(r,new Set([...e]),!0)),a(rM(n)))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?a(e.map(e=>nM(e,!0))):(a(rM(n,new Set([...e]))),i(rM(r,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(nM(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(nM(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,nM(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,nM(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(oA(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return pA({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...EO}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...vP()})}},Object.is);function bP({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=W(()=>yP({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return R(_j,{value:m,children:R(hM,{children:R(BM,{children:p})})})}function xP({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return Ze(gj)?R(ot,{children:e}):R(bP,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var SP={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function CP({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onBeforeDelete:te,connectionMode:ne,connectionLineType:F=DO.Bezier,connectionLineStyle:I,connectionLineComponent:re,connectionLineContainerStyle:ie,deleteKeyCode:ae=`Backspace`,selectionKeyCode:oe=`Shift`,selectionOnDrag:se=!1,selectionMode:ce=TO.Full,panActivationKeyCode:le=`Space`,multiSelectionKeyCode:ue=dk()?`Meta`:`Control`,zoomActivationKeyCode:de=dk()?`Meta`:`Control`,snapToGrid:fe,snapGrid:pe,onlyRenderVisibleElements:me=!1,selectNodesOnDrag:he,nodesDraggable:ge,autoPanOnNodeFocus:_e,nodesConnectable:ve,nodesFocusable:ye,nodeOrigin:be=zj,edgesFocusable:xe,edgesReconnectable:Se,elementsSelectable:Ce=!0,defaultViewport:we=Bj,minZoom:Te=.5,maxZoom:Ee=2,translateExtent:L=bO,preventScrolling:De=!0,nodeExtent:Oe,defaultMarkerColor:ke=`#b1b1b7`,zoomOnScroll:Ae=!0,zoomOnPinch:je=!0,panOnScroll:Me=!1,panOnScrollSpeed:Ne=.5,panOnScrollMode:Pe=wO.Free,zoomOnDoubleClick:Fe=!0,panOnDrag:Ie=!0,onPaneClick:Le,onPaneMouseEnter:Re,onPaneMouseMove:ze,onPaneMouseLeave:Be,onPaneScroll:Ve,onPaneContextMenu:He,paneClickDistance:Ue=1,nodeClickDistance:We=0,children:Ge,onReconnect:Ke,onReconnectStart:qe,onReconnectEnd:Je,onEdgeContextMenu:Ye,onEdgeDoubleClick:z,onEdgeMouseEnter:Xe,onEdgeMouseMove:Ze,onEdgeMouseLeave:Qe,reconnectRadius:$e=10,onNodesChange:et,onEdgesChange:tt,noDragClassName:nt=`nodrag`,noWheelClassName:rt=`nowheel`,noPanClassName:it=`nopan`,fitView:at,fitViewOptions:ot,connectOnClick:st,attributionPosition:V,proOptions:ct,defaultEdgeOptions:lt,elevateNodesOnSelect:ut=!0,elevateEdgesOnSelect:H=!1,disableKeyboardA11y:dt=!1,autoPanOnConnect:ft,autoPanOnNodeDrag:pt,autoPanOnSelection:U=!0,autoPanSpeed:W,connectionRadius:mt,isValidConnection:ht,onError:gt,style:_t,id:G,nodeDragThreshold:K,connectionDragThreshold:vt,viewport:q,onViewportChange:yt,width:bt,height:xt,colorMode:St=`light`,debug:Ct,onScroll:wt,ariaLabelConfig:Tt,zIndexMode:Et=`basic`,...Dt},Ot){let kt=G||`1`,At=Kj(St),jt=B(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),wt?.(e)},[wt]);return R(`div`,{"data-testid":`rf__wrapper`,...Dt,onScroll:jt,style:{..._t,...SP},ref:Ot,className:IS([`react-flow`,i,At]),id:G,role:`application`,children:R(xP,{nodes:e,edges:t,width:bt,height:xt,fitView:at,fitViewOptions:ot,minZoom:Te,maxZoom:Ee,nodeOrigin:be,nodeExtent:Oe,zIndexMode:Et,children:[R(Wj,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:ge,autoPanOnNodeFocus:_e,nodesConnectable:ve,nodesFocusable:ye,edgesFocusable:xe,edgesReconnectable:Se,elementsSelectable:Ce,elevateNodesOnSelect:ut,elevateEdgesOnSelect:H,minZoom:Te,maxZoom:Ee,nodeExtent:Oe,onNodesChange:et,onEdgesChange:tt,snapToGrid:fe,snapGrid:pe,connectionMode:ne,translateExtent:L,connectOnClick:st,defaultEdgeOptions:lt,fitView:at,fitViewOptions:ot,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:it,nodeOrigin:be,rfId:kt,autoPanOnConnect:ft,autoPanOnNodeDrag:pt,autoPanSpeed:W,onError:gt,connectionRadius:mt,isValidConnection:ht,selectNodesOnDrag:he,nodeDragThreshold:K,connectionDragThreshold:vt,onBeforeDelete:te,debug:Ct,ariaLabelConfig:Tt,zIndexMode:Et}),R(gP,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:F,connectionLineStyle:I,connectionLineComponent:re,connectionLineContainerStyle:ie,selectionKeyCode:oe,selectionOnDrag:se,selectionMode:ce,deleteKeyCode:ae,multiSelectionKeyCode:ue,panActivationKeyCode:le,zoomActivationKeyCode:de,onlyRenderVisibleElements:me,defaultViewport:we,translateExtent:L,minZoom:Te,maxZoom:Ee,preventScrolling:De,zoomOnScroll:Ae,zoomOnPinch:je,zoomOnDoubleClick:Fe,panOnScroll:Me,panOnScrollSpeed:Ne,panOnScrollMode:Pe,panOnDrag:Ie,autoPanOnSelection:U,onPaneClick:Le,onPaneMouseEnter:Re,onPaneMouseMove:ze,onPaneMouseLeave:Be,onPaneScroll:Ve,onPaneContextMenu:He,paneClickDistance:Ue,nodeClickDistance:We,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onReconnect:Ke,onReconnectStart:qe,onReconnectEnd:Je,onEdgeContextMenu:Ye,onEdgeDoubleClick:z,onEdgeMouseEnter:Xe,onEdgeMouseMove:Ze,onEdgeMouseLeave:Qe,reconnectRadius:$e,defaultMarkerColor:ke,noDragClassName:nt,noWheelClassName:rt,noPanClassName:it,rfId:kt,disableKeyboardA11y:dt,nodeExtent:Oe,viewport:q,onViewportChange:yt,nodesDraggable:ge}),R(Rj,{onSelectionChange:k}),Ge,R(Mj,{proOptions:ct,position:V}),R(kj,{rfId:kt,disableKeyboardA11y:dt})]})})}var wP=uM(CP);yO.error014();function TP({dimensions:e,lineWidth:t,variant:n,className:r}){return R(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:IS([`react-flow__background-pattern`,n,r])})}function EP({radius:e,className:t}){return R(`circle`,{cx:e,cy:e,r:e,className:IS([`react-flow__background-pattern`,`dots`,t])})}var DP;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(DP||={});var OP={[DP.Dots]:1,[DP.Lines]:1,[DP.Cross]:6},kP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function AP({id:e,variant:t=DP.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=q(null),{transform:f,patternId:p}=yj(kP,hj),m=r||OP[t],h=t===DP.Dots,g=t===DP.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]+x[0]/2,b[1]*f[2]+x[1]/2],C=`${p}${e||``}`;return R(`svg`,{className:IS([`react-flow__background`,l]),style:{...c,...CM,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[R(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?R(EP,{radius:y/2,className:u}):R(TP,{dimensions:x,lineWidth:i,variant:t,className:u})}),R(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}AP.displayName=`Background`;var jP=Ae(AP);function MP(){return R(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:R(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function NP(){return R(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:R(`path`,{d:`M0 0h32v4.2H0z`})})}function PP(){return R(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:R(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function FP(){return R(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:R(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function IP(){return R(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:R(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function LP({children:e,className:t,...n}){return R(`button`,{type:`button`,className:IS([`react-flow__controls-button`,t]),...n,children:e})}var RP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function zP({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=bj(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=yj(RP,hj),{zoomIn:y,zoomOut:b,fitView:x}=vM();return R(Aj,{className:IS([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&R(ot,{children:[R(LP,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:R(MP,{})}),R(LP,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:R(NP,{})})]}),n&&R(LP,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:R(PP,{})}),r&&R(LP,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:R(h?IP:FP,{})}),u]})}zP.displayName=`Controls`,Ae(zP);function BP({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return R(`rect`,{className:IS([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var VP=Ae(BP),HP=e=>e.nodes.map(e=>e.id),UP=e=>e instanceof Function?e:()=>e;function WP({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=VP,onClick:o}){let s=yj(HP,hj),c=UP(t),l=UP(e),u=UP(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return R(ot,{children:s.map(e=>R(KP,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function GP({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=yj(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=pk(r);return{node:r,x:i,y:a,width:o,height:s}},hj);return!l||l.hidden||!mk(l)?null:R(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var KP=Ae(GP),qP=Ae(WP),JP=200,YP=150,XP=e=>!e.hidden,ZP=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]},n=!1;for(let t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?QO(FO(e.nodeLookup,{filter:XP}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},QP=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,$P=(e,t)=>QP(e.viewBB,t.viewBB)&&QP(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,eF=`react-flow__minimap-desc`;function tF({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=bj(),S=q(null),{boundingRect:C,panZoom:w,viewBB:T,rfId:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=yj(ZP,$P),j=e?.width??JP,M=e?.height??YP,N=C.width/j,P=C.height/M,ee=Math.max(N,P),te=ee*j,ne=ee*M,F=b*ee,I=C.x-(te-C.width)/2-F,re=C.y-(ne-C.height)/2-F,ie=te+F*2,ae=ne+F*2,oe=`${eF}-${E}`,se=q(0),ce=q();se.current=ee,V(()=>{let e=x.getState().panZoom;if(S.current&&e)return ce.current=MA({domNode:S.current,panZoom:e,getTransform:()=>x.getState().transform,getViewScale:()=>se.current}),()=>{ce.current?.destroy()}},[w]),V(()=>{ce.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let le=p?e=>{let[t,n]=ce.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ue=B((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),de=m?ue:void 0,fe=_??A[`minimap.ariaLabel`];return R(Aj,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*ee:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:IS([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:R(`svg`,{width:j,height:M,viewBox:`${I} ${re} ${ie} ${ae}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":oe,ref:S,onClick:le,children:[fe&&R(`title`,{id:oe,children:fe}),R(qP,{onClick:de,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),R(`path`,{className:`react-flow__minimap-mask`,d:`M${I-F},${re-F}h${ie+F*2}v${ae+F*2}h${-ie-F*2}z
2468
- M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}tF.displayName=`MiniMap`,Ae(tF);var nF=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,rF={[qA.Line]:`right`,[qA.Handle]:`bottom-right`};function iF({nodeId:e,position:t,variant:n=qA.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=LM(),y=typeof e==`string`?e:v,b=bj(),x=q(null),S=n===qA.Handle,C=yj(B(nF(S&&p),[S,p]),hj),w=q(null),T=t??rF[n];V(()=>{if(x.current&&y)return w.current||=ij({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=dA([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...hk({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return R(`div`,{className:IS([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}Ae(iF);var aF=40,oF=280,sF=98,cF=24,lF=e=>{let t=e.split(/\s+/).filter(Boolean),n=[],r=``;for(let e of t){let t=r?`${r} ${e}`:e;if(t.length<=cF)r=t;else{if(n.length===1)break;r&&n.push(r),r=e}}r&&n.length<2&&n.push(r);let i=n.slice(0,2);return i.join(` `).length<e.length&&i.length&&(i[i.length-1]=`${i[i.length-1].slice(0,23)}…`),i.length?i:[e.slice(0,cF)]},uF=(e,t)=>{let n=hS(t.hover,e.edges),r=new Set(e.nodes.map(e=>e.uri)),i=e.nodes.map(e=>{let r=gS(e);return{id:e.uri,type:`work`,position:{x:aF+e.column*oF,y:aF+e.row*sF},width:190,height:74,draggable:!1,selectable:!1,data:{uri:e.uri,title:r,lines:lF(r),meta:[TS(e.format),e.episodeCount?`${e.episodeCount} ep`:void 0].filter(Boolean).join(` · `),current:t.current.has(e.uri),lit:n.nodes.has(e.uri)}}}),a=e=>t.hover?.kind===`node`&&(e.from===t.hover.uri||e.to===t.hover.uri),o=e.chain.filter(e=>r.has(e.from)&&r.has(e.to)).map(e=>({id:`chain\u0000${e.from}\u0000${e.to}`,type:`chain`,source:e.from,target:e.to,data:{kind:`chain`,label:``,lit:a(e)}})),s=e.edges.filter(e=>r.has(e.from)&&r.has(e.to)).map(e=>{let t=mS(e);return{id:t,type:`relation`,source:e.from,target:e.to,data:{kind:`relation`,label:CS(e.relation).toUpperCase(),lit:n.edges.has(t)}}});return{nodes:i,edges:[...o,...s]}};K();var dF=L`
2467
+ `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return V(()=>{let n=t?.target??Jj,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&Tk(e))return!1;let n=Zj(e.code,s);if(a.current.add(e[n]),Xj(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=Zj(e.code,s);Xj(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function Xj(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Zj(e,t){return t.includes(e)?`code`:`key`}var Qj=()=>{let e=xj();return H(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=dk(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return ok(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=sk(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function $j(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)eM(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function eM(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing)}}function tM(e,t){return $j(e,t)}function nM(e,t){return $j(e,t)}function rM(e,t){return{id:e,type:`select`,selected:t}}function iM(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);(a.selected!==void 0||e)&&a.selected!==e&&(n&&(a.selected=e),r.push(rM(a.id,e)))}return r}function aM({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function oM(e){return{id:e.id,type:`remove`}}var sM=ik(`React Flow`,`https://reactflow.dev/`);function cM(e,t,n={}){return Rk(e,t,{...n,onError:n.onError??sM})}var lM=e=>MO(e),uM=e=>jO(e);function dM(e){return gt(e)}var fM=typeof window<`u`?et:V;function pM(e){let[t,n]=W(BigInt(0)),[r]=W(()=>mM(()=>n(e=>e+BigInt(1))));return fM(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function mM(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var hM=nt(null);function gM({children:e}){let t=xj(),n=pM(B(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=aM({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=pM(B(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(aM({items:s,lookup:o}))},[])),i=H(()=>({nodeQueue:n,edgeQueue:r}),[]);return R(hM.Provider,{value:i,children:e})}function _M(){let e=Ze(hM);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var vM=e=>!!e.panZoom;function yM(){let e=Qj(),t=xj(),n=_M(),r=bj(vM),i=H(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=lM(e)?e:n.get(e.id),a=i.parentId?gk(i.position,i.measured,i.parentId,n,r):i.position;return ZO({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&lM(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&uM(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await HO({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(oM);o?.(f),c(e)}if(m){let e=d.map(oM);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=nk(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=ZO(s?r:a),l=tk(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=nk(e)?e:a(e);if(!r)return!1;let i=tk(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return FO(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??vk();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return H(()=>({...i,...e,viewportInitialized:r}),[r])}var bM=e=>e.selected,xM=typeof window<`u`?window:void 0;function SM({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=xj(),{deleteElements:r}=yM(),i=Yj(e,{actInsideInputWithModifier:!1}),a=Yj(t,{target:xM});V(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(bM),edges:e.filter(bM)}),n.setState({nodesSelectionActive:!1})}},[i]),V(()=>{n.setState({multiSelectionActive:a})},[a])}function CM(e){let t=xj();V(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Sk(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,bO.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var wM={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},TM=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function EM({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=TO.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:m=!0,children:h,noWheelClassName:g,noPanClassName:_,onViewportChange:v,isControlledViewport:y,paneClickDistance:b,selectionOnDrag:x}){let S=xj(),C=q(null),{userSelectionActive:w,lib:T,connectionInProgress:E}=bj(TM,gj),D=Yj(p),O=q();CM(C);let k=B(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),y||S.setState({transform:e})},[v,y]);return V(()=>{if(C.current){O.current=qA({domNode:C.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=S.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=S.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=O.current.getViewport();return S.setState({panZoom:O.current,transform:[e,t,n],domNode:C.current.closest(`.react-flow`)}),()=>{O.current?.destroy()}}},[]),V(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:D,preventScrolling:m,noPanClassName:_,userSelectionActive:w,noWheelClassName:g,lib:T,onTransformChange:k,connectionInProgress:E,selectionOnDrag:x,paneClickDistance:b})},[e,t,n,r,i,a,o,s,c,D,m,_,w,g,T,k,E,x,b]),R(`div`,{className:`react-flow__renderer`,ref:C,style:wM,children:h})}var DM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function OM(){let{userSelectionActive:e,userSelectionRect:t}=bj(DM,gj);return e&&t?R(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var kM=(e,t)=>n=>{n.target===t.current&&e?.(n)},AM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function jM({isSelecting:e,selectionKeyPressed:t,selectionMode:n=EO.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=q(0),_=xj(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=bj(AM,gj),C=y&&(e||v),w=q(null),T=q(),E=q(new Set),D=q(new Set),O=q(!1),k=q(!1),A=q({x:0,y:0}),j=q(!1),M=e=>{k.current||O.current||_.getState().connection.inProgress?(k.current=!1,O.current=!1):(l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1}))},N=e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():u?.(e)},P=d?e=>d(e):void 0,ee=e=>{k.current&&=(e.stopPropagation(),!1)},te=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(T.current=i?.getBoundingClientRect(),!T.current)return;let s=n.target===w.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:c,y:l}=Dk(n.nativeEvent,T.current),u=ok({x:c,y:l},a);_.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(n.stopPropagation(),n.preventDefault())};function ne(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=sk(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set(LO(a,m,i,n===EO.Partial,!0).map(e=>e.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}_k(h,E.current)||c(iM(a,E.current,!0)),_k(g,D.current)||l(iM(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function F(){if(!i||!T.current)return;let[e,t]=qO(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(F);return}let{x:t,y:n}=A.current;ne(t,n),g.current=requestAnimationFrame(F)})}let I=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};V(()=>()=>I(),[]);let re=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Dk(e.nativeEvent,T.current);A.current={x:o,y:c};let l=sk({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(F(),!0),ne(o,c)},ie=e=>{C?e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),I()):e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0)},ae=e=>{e.target?.releasePointerCapture?.(e.pointerId),I()},oe=r===!0||Array.isArray(r)&&r.includes(0);return R(`div`,{className:LS([`react-flow__pane`,{draggable:oe,dragging:b,selection:e}]),onClick:C?void 0:kM(M,w),onContextMenu:kM(N,w),onWheel:kM(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?re:p,onPointerUp:ie,onPointerCancel:C?ae:void 0,onPointerDownCapture:C?te:void 0,onClickCapture:C?ee:void 0,onPointerLeave:m,ref:w,style:wM,children:[h,R(OM,{})]})}function MM({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);l?(t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])):c?.(`012`,bO.error012(e))}function NM({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=xj(),[c,l]=W(!1),u=q();return V(()=>{if(!t)return u.current=SA({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{MM({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),V(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var PM=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function FM(){let e=xj();return B(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=PM(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=ak(t,i));let{position:a,positionAbsolute:s}=VO({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var IM=nt(null),LM=IM.Provider;IM.Consumer;var RM=()=>Ze(IM),zM=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),BM=nt(null);function VM({children:e}){let t=bj(zM,gj);return R(BM.Provider,{value:t,children:e})}function HM(){let e=Ze(BM);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var UM={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},WM=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return UM;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===wO.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function GM({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=xj(),_=RM(),{connectOnClick:v,noPanClassName:y,rfId:b}=HM(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=bj(WM(_,m,e),gj);_||g.getState().onError?.(`010`,bO.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(cM(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Ek(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();MA.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return R(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:LS([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=Ck(t.target),h=n||c,{connection:v,isValid:y}=MA.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var KM=Ae(dM(GM));function qM({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return R(ot,{children:[e?.label,R(KM,{type:`source`,position:n,isConnectable:t})]})}function JM({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return R(ot,{children:[R(KM,{type:`target`,position:n,isConnectable:t}),e?.label,R(KM,{type:`source`,position:r,isConnectable:t})]})}function YM(){return null}function XM({data:e,isConnectable:t,targetPosition:n=$.Top}){return R(ot,{children:[R(KM,{type:`target`,position:n,isConnectable:t}),e?.label]})}var ZM={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},QM={input:qM,default:JM,output:XM,group:YM};function $M(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var eN=e=>{let{width:t,height:n,x:r,y:i}=IO(e.nodeLookup,{filter:e=>!!e.selected});return{width:rk(t)?t:null,height:rk(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function tN({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=xj(),{width:i,height:a,transformString:o,userSelectionActive:s}=bj(eN,gj),c=FM(),l=q(null);V(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(NM({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return R(`div`,{className:LS([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:R(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(ZM,e.key)&&(e.preventDefault(),c({direction:ZM[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var nN=typeof window<`u`?window:void 0,rN=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function iN({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:ee,isControlledViewport:te}){let{nodesSelectionActive:ne,userSelectionActive:F}=bj(rN,gj),I=Yj(l,{target:nN}),re=Yj(h,{target:nN}),ie=re||w,ae=re||b,oe=u&&ie!==!0,se=I||F||oe;return SM({deleteKeyCode:c,multiSelectionKeyCode:m}),R(EM,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:ae,panActivationKeyPressed:re,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!I&&ie,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:ee,isControlledViewport:te,paneClickDistance:s,selectionOnDrag:oe,children:R(jM,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ie,autoPanOnSelection:T,isSelecting:!!se,selectionMode:d,selectionKeyPressed:I,paneClickDistance:s,selectionOnDrag:oe,children:[e,ne&&R(tN,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}iN.displayName=`FlowRenderer`;var aN=Ae(iN),oN=e=>t=>e?LO(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function sN(e){return bj(B(oN(e),[e]),gj)}var cN=e=>e.updateNodeInternals;function lN(){let e=bj(cN),[t]=W(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return V(()=>()=>{t?.disconnect()},[t]),t}function uN({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=xj(),a=q(null),o=q(null),s=q(e.sourcePosition),c=q(e.targetPosition),l=q(t),u=n&&!!e.internals.handleBounds;return V(()=>{!a.current||e.hidden||u&&o.current===a.current||(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),V(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),V(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function dN({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=bj(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},gj),S=y.type||`default`,C=g?.[S]||QM[S];C===void 0&&(v?.(`003`,bO.error003(S)),S=`default`,C=g?.default||QM.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=xj(),k=hk(y),A=uN({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=NM({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=FM();if(y.hidden)return null;let N=mk(y),P=$M(y),ee=T||w||t||n||r||i,te=n?e=>n(e,{...b.userNode}):void 0,ne=r?e=>r(e,{...b.userNode}):void 0,F=i?e=>i(e,{...b.userNode}):void 0,I=a?e=>a(e,{...b.userNode}):void 0,re=o?e=>o(e,{...b.userNode}):void 0,ie=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&MM({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},ae=t=>{if(!(Tk(t.nativeEvent)||m)){if(SO.includes(t.key)&&T){let n=t.key===`Escape`;MM({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(ZM,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:ZM[t.key],factor:t.shiftKey?4:1})}}},oe=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(LO(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return R(`div`,{className:LS([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:ee?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:te,onMouseMove:ne,onMouseLeave:F,onContextMenu:I,onClick:ie,onDoubleClick:re,onKeyDown:D?ae:void 0,tabIndex:D?0:void 0,onFocus:D?oe:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${wj}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:R(LM,{value:e,children:R(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var fN=Ae(dN),pN=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function mN(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=bj(pN,gj),a=sN(e.onlyRenderVisibleElements),o=lN();return R(`div`,{className:`react-flow__nodes`,style:wM,children:a.map(a=>R(fN,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}mN.displayName=`NodeRenderer`;var hN=Ae(mN);function gN(e){return bj(B(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&Fk({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),gj)}var _N=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return R(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},vN=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return R(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},yN={[kO.Arrow]:_N,[kO.ArrowClosed]:vN};function bN(e){let t=xj();return H(()=>Object.prototype.hasOwnProperty.call(yN,e)?yN[e]:(t.getState().onError?.(`009`,bO.error009(e)),null),[e])}var xN=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=bN(t);return c?R(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:R(c,{color:n,strokeWidth:o})}):null},SN=({defaultColor:e,rfId:t})=>{let n=bj(e=>e.edges),r=bj(e=>e.defaultEdgeOptions),i=H(()=>Qk(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?R(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:R(`defs`,{children:i.map(e=>R(xN,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};SN.displayName=`MarkerDefinitions`;var CN=Ae(SN);function wN({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=W({x:1,y:0,width:0,height:0}),p=LS([`react-flow__edge-textwrapper`,l]),m=q(null);return V(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?R(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&R(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),R(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}wN.displayName=`EdgeText`;var TN=Ae(wN);function EN({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return R(ot,{children:[R(`path`,{...u,d:e,fill:`none`,className:LS([`react-flow__edge-path`,u.className])}),l?R(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&rk(t)&&rk(n)?R(TN,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function DN({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function ON({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=DN({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=DN({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=kk({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function kN(e){return Ae(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=ON({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return R(EN,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var AN=kN({isInternal:!1}),jN=kN({isInternal:!0});AN.displayName=`SimpleBezierEdge`,jN.displayName=`SimpleBezierEdgeInternal`;function MN(e){return Ae(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Gk({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return R(EN,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var NN=MN({isInternal:!1}),PN=MN({isInternal:!0});NN.displayName=`SmoothStepEdge`,PN.displayName=`SmoothStepEdgeInternal`;function FN(e){return Ae(({id:t,...n})=>{let r=e.isInternal?void 0:t;return R(NN,{...n,id:r,pathOptions:H(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var IN=FN({isInternal:!1}),LN=FN({isInternal:!0});IN.displayName=`StepEdge`,LN.displayName=`StepEdgeInternal`;function RN(e){return Ae(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=zk({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return R(EN,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var zN=RN({isInternal:!1}),BN=RN({isInternal:!0});zN.displayName=`StraightEdge`,BN.displayName=`StraightEdgeInternal`;function VN(e){return Ae(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Mk({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return R(EN,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var HN=VN({isInternal:!1}),UN=VN({isInternal:!0});HN.displayName=`BezierEdge`,UN.displayName=`BezierEdgeInternal`;var WN={default:UN,straight:BN,step:LN,smoothstep:PN,simplebezier:jN},GN={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},KN=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,qN=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,JN=`react-flow__edgeupdater`;function YN({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return R(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:LS([JN,`${JN}-${s}`]),cx:KN(t,r,e),cy:qN(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function XN({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=xj(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;MA.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return R(ot,{children:[(e===!0||e===`source`)&&R(YN,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&R(YN,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function ZN({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=bj(t=>t.edgeLookup.get(e)),b=bj(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||WN[x];S===void 0&&(_?.(`011`,bO.error011(x)),x=`default`,S=h?.default||WN.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=q(null),[D,O]=W(!1),[k,A]=W(!1),j=xj(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:ee,targetY:te,sourcePosition:ne,targetPosition:F}=bj(B(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return GN;let i=qk({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=Pk({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||GN,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex,_]),gj),I=H(()=>y.markerStart?`url('#${Zk(y.markerStart,m)}')`:void 0,[y.markerStart,m]),re=H(()=>y.markerEnd?`url('#${Zk(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||ee===null||te===null)return null;let ie=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},ae=a?e=>{a(e,{...y})}:void 0,oe=o?e=>{o(e,{...y})}:void 0,se=s?e=>{s(e,{...y})}:void 0,ce=c?e=>{c(e,{...y})}:void 0,le=l?e=>{l(e,{...y})}:void 0;return R(`svg`,{style:{zIndex:M},children:R(`g`,{className:LS([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:ie,onDoubleClick:ae,onContextMenu:oe,onMouseEnter:se,onMouseMove:ce,onMouseLeave:le,onKeyDown:C?t=>{if(!v&&SO.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${Tj}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&R(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:ee,targetY:te,sourcePosition:ne,targetPosition:F,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:I,markerEnd:re,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&R(XN,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:ee,targetY:te,sourcePosition:ne,targetPosition:F,setUpdateHover:O,setReconnecting:A})]})})}var QN=Ae(ZN),$N=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function eP({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=bj($N,gj),b=gN(t);return R(`div`,{className:`react-flow__edges`,children:[R(CN,{defaultColor:e,rfId:n}),b.map(e=>R(QN,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}eP.displayName=`EdgeRenderer`;var tP=Ae(eP),nP=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function rP({children:e}){let t=xj(),n=q(null),[r]=W(()=>t.getState().transform);return fM(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=nP(r)))};return r(),t.subscribe(r)},[t]),R(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:nP(r)},children:e})}function iP(e){let t=yM(),n=q(!1);V(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var aP=e=>e.panZoom?.syncViewport;function oP(e){let t=bj(aP),n=xj();return V(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function sP(e){return e.connection.inProgress?{...e.connection,to:ok(e.connection.to,e.transform)}:{...e.connection}}function cP(e){return e?t=>e(sP(t)):sP}function lP(e){return bj(cP(e),gj)}var uP=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function dP({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=bj(uP,gj);return a&&i&&c?R(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:R(`g`,{className:LS([`react-flow__connection`,bk(s)]),children:R(fP,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var fP=({style:e,type:t=OO.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=lP();if(!i)return;if(n)return R(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:bk(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case OO.Bezier:[m]=Mk(h);break;case OO.SimpleBezier:[m]=ON(h);break;case OO.Step:[m]=Gk({...h,borderRadius:0});break;case OO.SmoothStep:[m]=Gk(h);break;default:[m]=zk(h)}return R(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};fP.displayName=`ConnectionLine`;var pP={};function mP(e=pP){q(e),xj(),V(()=>{},[e])}function hP(){xj(),q(!1),V(()=>{},[])}function gP({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:ee,panOnScrollSpeed:te,panOnScrollMode:ne,zoomOnDoubleClick:F,panOnDrag:I,autoPanOnSelection:re,onPaneClick:ie,onPaneMouseEnter:ae,onPaneMouseMove:oe,onPaneMouseLeave:se,onPaneScroll:ce,onPaneContextMenu:le,paneClickDistance:ue,nodeClickDistance:de,onEdgeContextMenu:fe,onEdgeMouseEnter:pe,onEdgeMouseMove:me,onEdgeMouseLeave:he,reconnectRadius:ge,onReconnect:_e,onReconnectStart:ve,onReconnectEnd:ye,noDragClassName:be,noWheelClassName:xe,noPanClassName:Se,disableKeyboardA11y:Ce,nodeExtent:we,rfId:Te,viewport:Ee,onViewportChange:L,nodesDraggable:De}){return mP(e),mP(t),hP(),iP(n),oP(Ee),R(aN,{onPaneClick:ie,onPaneMouseEnter:ae,onPaneMouseMove:oe,onPaneMouseLeave:se,onPaneContextMenu:le,onPaneScroll:ce,paneClickDistance:ue,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:F,panOnScroll:ee,panOnScrollSpeed:te,panOnScrollMode:ne,panOnDrag:I,autoPanOnSelection:re,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:be,noWheelClassName:xe,noPanClassName:Se,disableKeyboardA11y:Ce,onViewportChange:L,isControlledViewport:!!Ee,children:R(rP,{children:[R(tP,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:_e,onReconnectStart:ve,onReconnectEnd:ye,onlyRenderVisibleElements:T,onEdgeContextMenu:fe,onEdgeMouseEnter:pe,onEdgeMouseMove:me,onEdgeMouseLeave:he,reconnectRadius:ge,defaultMarkerColor:M,noPanClassName:Se,disableKeyboardA11y:Ce,rfId:Te}),R(dP,{style:h,type:m,component:g,containerStyle:_}),R(`div`,{className:`react-flow__edgelabel-renderer`}),R(hN,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:de,onlyRenderVisibleElements:T,noPanClassName:Se,noDragClassName:be,disableKeyboardA11y:Ce,nodeExtent:we,rfId:Te,nodesDraggable:De}),R(`div`,{className:`react-flow__viewport-portal`})]})})}gP.displayName=`GraphView`;var _P=Ae(gP),vP=ik(`React Flow`,`https://reactflow.dev/`),yP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??xO;gA(h,g,_);let{nodesInitialized:x}=sA(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=dk(IO(p,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:xO,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:wO.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...DO},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:vP,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:CO,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},bP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>hj((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await BO({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...yP({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=sA(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();gA(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=pA(e,n,r,i,a,o,l);d&&(iA(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=Yk(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=fA(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(tM(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(nM(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?i(e.map(e=>rM(e,!0))):(i(iM(r,new Set([...e]),!0)),a(iM(n)))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?a(e.map(e=>rM(e,!0))):(a(iM(n,new Set([...e]))),i(iM(r,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(rM(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(rM(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,rM(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,rM(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(sA(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return mA({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...DO}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...yP()})}},Object.is);function xP({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=W(()=>bP({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return R(vj,{value:m,children:R(gM,{children:R(VM,{children:p})})})}function SP({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return Ze(_j)?R(ot,{children:e}):R(xP,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var CP={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function wP({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onBeforeDelete:te,connectionMode:ne,connectionLineType:F=OO.Bezier,connectionLineStyle:I,connectionLineComponent:re,connectionLineContainerStyle:ie,deleteKeyCode:ae=`Backspace`,selectionKeyCode:oe=`Shift`,selectionOnDrag:se=!1,selectionMode:ce=EO.Full,panActivationKeyCode:le=`Space`,multiSelectionKeyCode:ue=fk()?`Meta`:`Control`,zoomActivationKeyCode:de=fk()?`Meta`:`Control`,snapToGrid:fe,snapGrid:pe,onlyRenderVisibleElements:me=!1,selectNodesOnDrag:he,nodesDraggable:ge,autoPanOnNodeFocus:_e,nodesConnectable:ve,nodesFocusable:ye,nodeOrigin:be=Bj,edgesFocusable:xe,edgesReconnectable:Se,elementsSelectable:Ce=!0,defaultViewport:we=Vj,minZoom:Te=.5,maxZoom:Ee=2,translateExtent:L=xO,preventScrolling:De=!0,nodeExtent:Oe,defaultMarkerColor:ke=`#b1b1b7`,zoomOnScroll:Ae=!0,zoomOnPinch:je=!0,panOnScroll:Me=!1,panOnScrollSpeed:Ne=.5,panOnScrollMode:Pe=TO.Free,zoomOnDoubleClick:Fe=!0,panOnDrag:Ie=!0,onPaneClick:Le,onPaneMouseEnter:Re,onPaneMouseMove:ze,onPaneMouseLeave:Be,onPaneScroll:Ve,onPaneContextMenu:He,paneClickDistance:Ue=1,nodeClickDistance:We=0,children:Ge,onReconnect:Ke,onReconnectStart:qe,onReconnectEnd:Je,onEdgeContextMenu:Ye,onEdgeDoubleClick:z,onEdgeMouseEnter:Xe,onEdgeMouseMove:Ze,onEdgeMouseLeave:Qe,reconnectRadius:$e=10,onNodesChange:et,onEdgesChange:tt,noDragClassName:nt=`nodrag`,noWheelClassName:rt=`nowheel`,noPanClassName:it=`nopan`,fitView:at,fitViewOptions:ot,connectOnClick:st,attributionPosition:V,proOptions:ct,defaultEdgeOptions:lt,elevateNodesOnSelect:ut=!0,elevateEdgesOnSelect:H=!1,disableKeyboardA11y:dt=!1,autoPanOnConnect:ft,autoPanOnNodeDrag:pt,autoPanOnSelection:U=!0,autoPanSpeed:W,connectionRadius:mt,isValidConnection:ht,onError:gt,style:_t,id:G,nodeDragThreshold:K,connectionDragThreshold:vt,viewport:q,onViewportChange:yt,width:bt,height:xt,colorMode:St=`light`,debug:Ct,onScroll:wt,ariaLabelConfig:Tt,zIndexMode:Et=`basic`,...Dt},Ot){let kt=G||`1`,At=qj(St),jt=B(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),wt?.(e)},[wt]);return R(`div`,{"data-testid":`rf__wrapper`,...Dt,onScroll:jt,style:{..._t,...CP},ref:Ot,className:LS([`react-flow`,i,At]),id:G,role:`application`,children:R(SP,{nodes:e,edges:t,width:bt,height:xt,fitView:at,fitViewOptions:ot,minZoom:Te,maxZoom:Ee,nodeOrigin:be,nodeExtent:Oe,zIndexMode:Et,children:[R(Gj,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:ge,autoPanOnNodeFocus:_e,nodesConnectable:ve,nodesFocusable:ye,edgesFocusable:xe,edgesReconnectable:Se,elementsSelectable:Ce,elevateNodesOnSelect:ut,elevateEdgesOnSelect:H,minZoom:Te,maxZoom:Ee,nodeExtent:Oe,onNodesChange:et,onEdgesChange:tt,snapToGrid:fe,snapGrid:pe,connectionMode:ne,translateExtent:L,connectOnClick:st,defaultEdgeOptions:lt,fitView:at,fitViewOptions:ot,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:it,nodeOrigin:be,rfId:kt,autoPanOnConnect:ft,autoPanOnNodeDrag:pt,autoPanSpeed:W,onError:gt,connectionRadius:mt,isValidConnection:ht,selectNodesOnDrag:he,nodeDragThreshold:K,connectionDragThreshold:vt,onBeforeDelete:te,debug:Ct,ariaLabelConfig:Tt,zIndexMode:Et}),R(_P,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:F,connectionLineStyle:I,connectionLineComponent:re,connectionLineContainerStyle:ie,selectionKeyCode:oe,selectionOnDrag:se,selectionMode:ce,deleteKeyCode:ae,multiSelectionKeyCode:ue,panActivationKeyCode:le,zoomActivationKeyCode:de,onlyRenderVisibleElements:me,defaultViewport:we,translateExtent:L,minZoom:Te,maxZoom:Ee,preventScrolling:De,zoomOnScroll:Ae,zoomOnPinch:je,zoomOnDoubleClick:Fe,panOnScroll:Me,panOnScrollSpeed:Ne,panOnScrollMode:Pe,panOnDrag:Ie,autoPanOnSelection:U,onPaneClick:Le,onPaneMouseEnter:Re,onPaneMouseMove:ze,onPaneMouseLeave:Be,onPaneScroll:Ve,onPaneContextMenu:He,paneClickDistance:Ue,nodeClickDistance:We,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onReconnect:Ke,onReconnectStart:qe,onReconnectEnd:Je,onEdgeContextMenu:Ye,onEdgeDoubleClick:z,onEdgeMouseEnter:Xe,onEdgeMouseMove:Ze,onEdgeMouseLeave:Qe,reconnectRadius:$e,defaultMarkerColor:ke,noDragClassName:nt,noWheelClassName:rt,noPanClassName:it,rfId:kt,disableKeyboardA11y:dt,nodeExtent:Oe,viewport:q,onViewportChange:yt,nodesDraggable:ge}),R(zj,{onSelectionChange:k}),Ge,R(Nj,{proOptions:ct,position:V}),R(Aj,{rfId:kt,disableKeyboardA11y:dt})]})})}var TP=dM(wP);bO.error014();function EP({dimensions:e,lineWidth:t,variant:n,className:r}){return R(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:LS([`react-flow__background-pattern`,n,r])})}function DP({radius:e,className:t}){return R(`circle`,{cx:e,cy:e,r:e,className:LS([`react-flow__background-pattern`,`dots`,t])})}var OP;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(OP||={});var kP={[OP.Dots]:1,[OP.Lines]:1,[OP.Cross]:6},AP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function jP({id:e,variant:t=OP.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=q(null),{transform:f,patternId:p}=bj(AP,gj),m=r||kP[t],h=t===OP.Dots,g=t===OP.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]+x[0]/2,b[1]*f[2]+x[1]/2],C=`${p}${e||``}`;return R(`svg`,{className:LS([`react-flow__background`,l]),style:{...c,...wM,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[R(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?R(DP,{radius:y/2,className:u}):R(EP,{dimensions:x,lineWidth:i,variant:t,className:u})}),R(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}jP.displayName=`Background`;var MP=Ae(jP);function NP(){return R(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:R(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function PP(){return R(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:R(`path`,{d:`M0 0h32v4.2H0z`})})}function FP(){return R(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:R(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function IP(){return R(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:R(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function LP(){return R(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:R(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function RP({children:e,className:t,...n}){return R(`button`,{type:`button`,className:LS([`react-flow__controls-button`,t]),...n,children:e})}var zP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function BP({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=xj(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=bj(zP,gj),{zoomIn:y,zoomOut:b,fitView:x}=yM();return R(jj,{className:LS([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&R(ot,{children:[R(RP,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:R(NP,{})}),R(RP,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:R(PP,{})})]}),n&&R(RP,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:R(FP,{})}),r&&R(RP,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:R(h?LP:IP,{})}),u]})}BP.displayName=`Controls`,Ae(BP);function VP({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return R(`rect`,{className:LS([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var HP=Ae(VP),UP=e=>e.nodes.map(e=>e.id),WP=e=>e instanceof Function?e:()=>e;function GP({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=HP,onClick:o}){let s=bj(UP,gj),c=WP(t),l=WP(e),u=WP(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return R(ot,{children:s.map(e=>R(qP,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function KP({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=bj(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=mk(r);return{node:r,x:i,y:a,width:o,height:s}},gj);return!l||l.hidden||!hk(l)?null:R(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var qP=Ae(KP),JP=Ae(GP),YP=200,XP=150,ZP=e=>!e.hidden,QP=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]},n=!1;for(let t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?$O(IO(e.nodeLookup,{filter:ZP}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},$P=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,eF=(e,t)=>$P(e.viewBB,t.viewBB)&&$P(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,tF=`react-flow__minimap-desc`;function nF({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=xj(),S=q(null),{boundingRect:C,panZoom:w,viewBB:T,rfId:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=bj(QP,eF),j=e?.width??YP,M=e?.height??XP,N=C.width/j,P=C.height/M,ee=Math.max(N,P),te=ee*j,ne=ee*M,F=b*ee,I=C.x-(te-C.width)/2-F,re=C.y-(ne-C.height)/2-F,ie=te+F*2,ae=ne+F*2,oe=`${tF}-${E}`,se=q(0),ce=q();se.current=ee,V(()=>{let e=x.getState().panZoom;if(S.current&&e)return ce.current=NA({domNode:S.current,panZoom:e,getTransform:()=>x.getState().transform,getViewScale:()=>se.current}),()=>{ce.current?.destroy()}},[w]),V(()=>{ce.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let le=p?e=>{let[t,n]=ce.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ue=B((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),de=m?ue:void 0,fe=_??A[`minimap.ariaLabel`];return R(jj,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*ee:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:LS([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:R(`svg`,{width:j,height:M,viewBox:`${I} ${re} ${ie} ${ae}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":oe,ref:S,onClick:le,children:[fe&&R(`title`,{id:oe,children:fe}),R(JP,{onClick:de,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),R(`path`,{className:`react-flow__minimap-mask`,d:`M${I-F},${re-F}h${ie+F*2}v${ae+F*2}h${-ie-F*2}z
2468
+ M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}nF.displayName=`MiniMap`,Ae(nF);var rF=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,iF={[JA.Line]:`right`,[JA.Handle]:`bottom-right`};function aF({nodeId:e,position:t,variant:n=JA.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=RM(),y=typeof e==`string`?e:v,b=xj(),x=q(null),S=n===JA.Handle,C=bj(B(rF(S&&p),[S,p]),gj),w=q(null),T=t??iF[n];V(()=>{if(x.current&&y)return w.current||=aj({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=fA([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...gk({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return R(`div`,{className:LS([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}Ae(aF);var oF=40,sF=280,cF=98,lF=24,uF=e=>{let t=e.split(/\s+/).filter(Boolean),n=[],r=``;for(let e of t){let t=r?`${r} ${e}`:e;if(t.length<=lF)r=t;else{if(n.length===1)break;r&&n.push(r),r=e}}r&&n.length<2&&n.push(r);let i=n.slice(0,2);return i.join(` `).length<e.length&&i.length&&(i[i.length-1]=`${i[i.length-1].slice(0,23)}…`),i.length?i:[e.slice(0,lF)]},dF=(e,t)=>{let n=gS(t.hover,e.edges),r=new Set(e.nodes.map(e=>e.uri)),i=e.nodes.map(e=>{let r=_S(e);return{id:e.uri,type:`work`,position:{x:oF+e.column*sF,y:oF+e.row*cF},width:190,height:74,draggable:!1,selectable:!1,data:{uri:e.uri,title:r,lines:uF(r),meta:[ES(e.format),e.episodeCount?`${e.episodeCount} ep`:void 0].filter(Boolean).join(` · `),current:t.current.has(e.uri),lit:n.nodes.has(e.uri)}}}),a=e=>t.hover?.kind===`node`&&(e.from===t.hover.uri||e.to===t.hover.uri),o=e.chain.filter(e=>r.has(e.from)&&r.has(e.to)).map(e=>({id:`chain\u0000${e.from}\u0000${e.to}`,type:`chain`,source:e.from,target:e.to,data:{kind:`chain`,label:``,lit:a(e)}})),s=e.edges.filter(e=>r.has(e.from)&&r.has(e.to)).map(e=>{let t=hS(e);return{id:t,type:`relation`,source:e.from,target:e.to,data:{kind:`relation`,label:wS(e.relation).toUpperCase(),lit:n.edges.has(t)}}});return{nodes:i,edges:[...o,...s]}};K();var fF=L`
2469
2469
  display: inline-flex;
2470
2470
  align-items: center;
2471
2471
  gap: 0.6rem;
@@ -2487,7 +2487,7 @@ transition: max-height 0.3s ease-in-out;
2487
2487
  }
2488
2488
 
2489
2489
  svg { width: 1.5rem; height: 1.5rem; }
2490
- `,fF=L`
2490
+ `,pF=L`
2491
2491
  display: flex;
2492
2492
  align-items: center;
2493
2493
  justify-content: center;
@@ -2679,7 +2679,7 @@ transition: max-height 0.3s ease-in-out;
2679
2679
 
2680
2680
  /* the text alone is a thin target, so each label carries an invisible pad it can be caught by */
2681
2681
  .label-hit { fill: transparent; cursor: pointer; }
2682
- `,pF=nt(()=>{}),mF=({data:e})=>{let t=Ze(hF);return G(Mf,{className:`work-node${e.current?` current`:``}${e.lit?` lit`:``}`,to:t(e.uri),title:e.title,children:[U(GM,{type:`target`,position:$.Left}),U(`div`,{className:`title`,children:e.lines.map(e=>U(`div`,{children:e},e))}),e.meta?U(`div`,{className:`meta`,children:e.meta}):void 0,U(GM,{type:`source`,position:$.Right})]})},hF=nt(e=>e),gF=(e,t,n,r)=>{let i=n>=e,a=Math.max(20,Math.abs(n-e)/2)*(i?1:-1);return`M ${e} ${t} C ${e+a} ${t}, ${n-a} ${r}, ${n} ${r}`},_F=({data:e,sourceX:t,sourceY:n,targetX:r,targetY:i})=>U(`path`,{className:`chain${e?.lit?` lit`:``}`,d:gF(t,n,r,i)}),vF=({id:e,data:t,sourceX:n,sourceY:r,targetX:i,targetY:a})=>{let o=Ze(pF),s=t?.label??``,c=t?.lit?` lit`:``,l=(e,t)=>e+(t-e)*.34,u=l(n,i),d=l(r,a)-6,f=s.length*6.4+12;return G(z,{children:[U(`path`,{className:`edge${c}`,d:gF(n,r,i,a)}),G(`g`,{className:`label`,onPointerEnter:()=>o({kind:`edge`,key:e}),onPointerLeave:()=>o(void 0),children:[U(`rect`,{className:`label-hit`,x:u-f/2,y:d-11,width:f,height:15}),U(`text`,{className:`edge-label${c}`,x:u,y:d,children:s})]})]})},yF={work:mF},bF={chain:_F,relation:vF},xF=({franchise:e,currentUris:t,route:n})=>{let r=tS(Tf()),i=B(e=>`${zf(n,{uri:d(e)})}${r}`,[n,r]),a=H(()=>fS(e),[e]),[o,s]=W(()=>new Set(a.filter(dS))),c=[...o].every(dS)?`story`:`graph`,l=H(()=>yS(pS(e,e=>!e.format||o.has(e.format)),c),[e,o,c]),[u,f]=W(void 0),p=H(()=>new Set(t),[t]),{nodes:m,edges:h}=H(()=>uF(l,{current:p,hover:u}),[l,p,u]),g=B((e,t)=>f({kind:`node`,uri:t.id}),[]),_=B(()=>f(void 0),[]),v=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return G(z,{children:[U(`div`,{className:`bar`,children:U(`div`,{className:`title`,children:`Series`})}),G(`div`,{className:`canvas`,"data-canvas":!0,children:[a.length?G(`div`,{className:`kinds`,onPointerDown:e=>e.stopPropagation(),children:[U(`div`,{className:`legend`,children:`Show`}),a.map(e=>G(`label`,{className:o.has(e)?`on`:void 0,children:[U(`input`,{type:`checkbox`,checked:o.has(e),onChange:()=>v(e)}),U(`span`,{children:TS(e)})]},e))]}):void 0,U(hF.Provider,{value:i,children:U(pF.Provider,{value:f,children:U(wP,{nodes:m,edges:h,nodeTypes:yF,edgeTypes:bF,onNodeMouseEnter:g,onNodeMouseLeave:_,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,fitView:!0,minZoom:.05,maxZoom:20,"aria-label":`Every work in this series, in order`,children:U(jP,{variant:DP.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.14)`})})})})]})]})},SF=({franchise:e,currentUris:t,route:n=Q.MEDIA})=>{let[r,i]=W(!1),{refs:a,context:o}=Fg({open:r,onOpenChange:i}),{getReferenceProps:s,getFloatingProps:c}=zg([kg(o),Ng(o,{outsidePress:!0}),Vg(o,{role:`dialog`})]);return!e||(e.nodes?.length??0)<2?null:G(z,{children:[G(`button`,{type:`button`,css:dF,ref:a.setReference,...s(),"data-franchise-open":!0,children:[U(__,{}),`See detailed relation graph`]}),r?U(lg,{children:U(Tg,{lockScroll:!0,css:fF,"data-franchise":!0,children:U(bg,{context:o,children:G(`div`,{className:`sheet`,ref:a.setFloating,...c(),children:[U(xF,{franchise:e,currentUris:t,route:n}),U(`button`,{type:`button`,className:`close`,"aria-label":`Close`,onClick:()=>i(!1),children:U(k_,{})})]})})})}):void 0]})},CF=e=>`tracking:${e}`;K();var wF=L`
2682
+ `,mF=nt(()=>{}),hF=({data:e})=>{let t=Ze(gF);return G(Mf,{className:`work-node${e.current?` current`:``}${e.lit?` lit`:``}`,to:t(e.uri),title:e.title,children:[U(KM,{type:`target`,position:$.Left}),U(`div`,{className:`title`,children:e.lines.map(e=>U(`div`,{children:e},e))}),e.meta?U(`div`,{className:`meta`,children:e.meta}):void 0,U(KM,{type:`source`,position:$.Right})]})},gF=nt(e=>e),_F=(e,t,n,r)=>{let i=n>=e,a=Math.max(20,Math.abs(n-e)/2)*(i?1:-1);return`M ${e} ${t} C ${e+a} ${t}, ${n-a} ${r}, ${n} ${r}`},vF=({data:e,sourceX:t,sourceY:n,targetX:r,targetY:i})=>U(`path`,{className:`chain${e?.lit?` lit`:``}`,d:_F(t,n,r,i)}),yF=({id:e,data:t,sourceX:n,sourceY:r,targetX:i,targetY:a})=>{let o=Ze(mF),s=t?.label??``,c=t?.lit?` lit`:``,l=(e,t)=>e+(t-e)*.34,u=l(n,i),d=l(r,a)-6,f=s.length*6.4+12;return G(z,{children:[U(`path`,{className:`edge${c}`,d:_F(n,r,i,a)}),G(`g`,{className:`label`,onPointerEnter:()=>o({kind:`edge`,key:e}),onPointerLeave:()=>o(void 0),children:[U(`rect`,{className:`label-hit`,x:u-f/2,y:d-11,width:f,height:15}),U(`text`,{className:`edge-label${c}`,x:u,y:d,children:s})]})]})},bF={work:hF},xF={chain:vF,relation:yF},SF=({franchise:e,currentUris:t,route:n})=>{let r=nS(Tf()),i=B(e=>`${zf(n,{uri:d(e)})}${r}`,[n,r]),a=H(()=>pS(e),[e]),[o,s]=W(()=>new Set(a.filter(fS))),c=[...o].every(fS)?`story`:`graph`,l=H(()=>bS(mS(e,e=>!e.format||o.has(e.format)),c),[e,o,c]),[u,f]=W(void 0),p=H(()=>new Set(t),[t]),{nodes:m,edges:h}=H(()=>dF(l,{current:p,hover:u}),[l,p,u]),g=B((e,t)=>f({kind:`node`,uri:t.id}),[]),_=B(()=>f(void 0),[]),v=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return G(z,{children:[U(`div`,{className:`bar`,children:U(`div`,{className:`title`,children:`Series`})}),G(`div`,{className:`canvas`,"data-canvas":!0,children:[a.length?G(`div`,{className:`kinds`,onPointerDown:e=>e.stopPropagation(),children:[U(`div`,{className:`legend`,children:`Show`}),a.map(e=>G(`label`,{className:o.has(e)?`on`:void 0,children:[U(`input`,{type:`checkbox`,checked:o.has(e),onChange:()=>v(e)}),U(`span`,{children:ES(e)})]},e))]}):void 0,U(gF.Provider,{value:i,children:U(mF.Provider,{value:f,children:U(TP,{nodes:m,edges:h,nodeTypes:bF,edgeTypes:xF,onNodeMouseEnter:g,onNodeMouseLeave:_,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,fitView:!0,minZoom:.05,maxZoom:20,"aria-label":`Every work in this series, in order`,children:U(MP,{variant:OP.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.14)`})})})})]})]})},CF=({franchise:e,currentUris:t,route:n=Q.MEDIA})=>{let[r,i]=W(!1),{refs:a,context:o}=Fg({open:r,onOpenChange:i}),{getReferenceProps:s,getFloatingProps:c}=zg([kg(o),Ng(o,{outsidePress:!0}),Vg(o,{role:`dialog`})]);return!e||(e.nodes?.length??0)<2?null:G(z,{children:[G(`button`,{type:`button`,css:fF,ref:a.setReference,...s(),"data-franchise-open":!0,children:[U(__,{}),`See detailed relation graph`]}),r?U(lg,{children:U(Tg,{lockScroll:!0,css:pF,"data-franchise":!0,children:U(bg,{context:o,children:G(`div`,{className:`sheet`,ref:a.setFloating,...c(),children:[U(SF,{franchise:e,currentUris:t,route:n}),U(`button`,{type:`button`,className:`close`,"aria-label":`Close`,onClick:()=>i(!1),children:U(k_,{})})]})})})}):void 0]})},wF=e=>`tracking:${e}`;K();var TF=L`
2683
2683
  display: flex;
2684
2684
  flex-direction: column;
2685
2685
  gap: 0.8rem;
@@ -2706,7 +2706,7 @@ transition: max-height 0.3s ease-in-out;
2706
2706
  &:hover { background: rgba(255, 255, 255, 0.08); }
2707
2707
  &:disabled { opacity: 0.5; cursor: default; }
2708
2708
  }
2709
- `,TF=e=>e===1?`1 entry`:`${e} entries`,EF=({storage:e,onUnlock:t,onAdd:n})=>{let[r,i]=W(!1);if(!e)return null;let a=e=>async()=>{i(!0);try{await e()}finally{i(!1)}},o=e.location===`ACCOUNT`,s=e.signedIn===!0&&e.locked,c=[s?G(`div`,{className:`line`,children:[U(`span`,{children:`Stub: your FKN account's list is locked on this device`}),U(`button`,{type:`button`,disabled:r,onClick:a(t),children:`Unlock`})]},`locked`):void 0,o&&!s&&e.held>0?G(`div`,{className:`line`,children:[G(`span`,{children:[`Stub: `,TF(e.held),` saved on this device before you signed in`]}),U(`button`,{type:`button`,disabled:r,onClick:a(n),children:`Add to my FKN account`})]},`held`):void 0,o&&!s&&e.waiting?U(`div`,{className:`line`,children:`Stub: some changes have not reached your FKN account yet.`},`waiting`):void 0,e.error?G(`div`,{className:`line problem`,children:[`Stub: `,e.error]},`error`):void 0].filter(Boolean);return c.length?U(`div`,{css:wF,className:`stub-list-notice`,role:`status`,children:c}):null},DF=L`
2709
+ `,EF=e=>e===1?`1 entry`:`${e} entries`,DF=({storage:e,onUnlock:t,onAdd:n})=>{let[r,i]=W(!1);if(!e)return null;let a=e=>async()=>{i(!0);try{await e()}finally{i(!1)}},o=e.location===`ACCOUNT`,s=e.signedIn===!0&&e.locked,c=[s?G(`div`,{className:`line`,children:[U(`span`,{children:`Stub: your FKN account's list is locked on this device`}),U(`button`,{type:`button`,disabled:r,onClick:a(t),children:`Unlock`})]},`locked`):void 0,o&&!s&&e.held>0?G(`div`,{className:`line`,children:[G(`span`,{children:[`Stub: `,EF(e.held),` saved on this device before you signed in`]}),U(`button`,{type:`button`,disabled:r,onClick:a(n),children:`Add to my FKN account`})]},`held`):void 0,o&&!s&&e.waiting?U(`div`,{className:`line`,children:`Stub: some changes have not reached your FKN account yet.`},`waiting`):void 0,e.error?G(`div`,{className:`line problem`,children:[`Stub: `,e.error]},`error`):void 0].filter(Boolean);return c.length?U(`div`,{css:TF,className:`stub-list-notice`,role:`status`,children:c}):null},OF=L`
2710
2710
  display: flex;
2711
2711
  align-items: center;
2712
2712
  flex-wrap: wrap;
@@ -2725,7 +2725,7 @@ transition: max-height 0.3s ease-in-out;
2725
2725
  cursor: pointer;
2726
2726
  &:disabled { opacity: 0.5; cursor: default; }
2727
2727
  }
2728
- `,OF=e=>e.remove?`the removal`:[e.status===void 0?void 0:`the status`,e.progress===void 0?void 0:`episode ${e.progress}`,e.score===void 0?void 0:`the score`].filter(Boolean).join(` and `),kF=({answer:e,state:{failed:t,refused:n},queue:r})=>{let{id:i,name:a}=e.tracker;return G(z,{children:[t?G(`div`,{css:DF,className:`note`,"data-note":i,children:[a,` did not save `,OF(t.fields),`: `,t.error,U(`button`,{type:`button`,disabled:!Dc(e),onClick:()=>r.retry(i),children:`Retry`})]}):void 0,n?G(`div`,{css:DF,className:`note`,"data-note":i,children:[a,` did not save: `,n,U(`button`,{type:`button`,onClick:()=>r.dismiss(i),children:`Dismiss`})]}):void 0]})};K();var AF=[o_,m_,C_],jF=[`bad`,`neutral`,`good`],MF={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10,POINT_100:100},NF=L`
2728
+ `,kF=e=>e.remove?`the removal`:[e.status===void 0?void 0:`the status`,e.progress===void 0?void 0:`episode ${e.progress}`,e.score===void 0?void 0:`the score`].filter(Boolean).join(` and `),AF=({answer:e,state:{failed:t,refused:n},queue:r})=>{let{id:i,name:a}=e.tracker;return G(z,{children:[t?G(`div`,{css:OF,className:`note`,"data-note":i,children:[a,` did not save `,kF(t.fields),`: `,t.error,U(`button`,{type:`button`,disabled:!Dc(e),onClick:()=>r.retry(i),children:`Retry`})]}):void 0,n?G(`div`,{css:OF,className:`note`,"data-note":i,children:[a,` did not save: `,n,U(`button`,{type:`button`,onClick:()=>r.dismiss(i),children:`Dismiss`})]}):void 0]})};K();var jF=[o_,m_,C_],MF=[`bad`,`neutral`,`good`],NF={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10,POINT_100:100},PF=L`
2729
2729
  position: relative;
2730
2730
  display: flex;
2731
2731
 
@@ -2750,7 +2750,7 @@ transition: max-height 0.3s ease-in-out;
2750
2750
  .caption { font-size: 1.2rem; color: rgba(255, 255, 255, 0.6); }
2751
2751
  .exact { display: flex; align-items: center; gap: 0.6rem; font-size: 1.2rem; color: rgba(255, 255, 255, 0.6); }
2752
2752
  .exact input { width: 7rem; }
2753
- `,PF=({score:e,scale:t,size:n=16})=>{let r=Sc(e,t);if(t===`POINT_3`){let e=AF[r-1]??m_;return U(e,{size:n,"aria-hidden":`true`})}return U(`span`,{className:`value`,children:r})},FF=(e,t)=>{let n=Sc(e,t);return t===`POINT_3`?`${n} out of 3 (${jF[n-1]})`:`${n} out of ${MF[t]??100}`},IF=({score:e,scale:t,mixed:n,disabled:r,clearable:i=!0,onPick:a})=>{let[o,s]=W(!1),[c,l]=W(``),u=q(null),d=q(null),{refs:f,floatingStyles:p}=Fg({open:o,placement:`bottom-start`,whileElementsMounted:St,middleware:[fh(6),mh({padding:8})]}),m=gh([d,f.setReference]),h=xc(e),g=h?Sc(e,t):void 0,_=()=>{s(!1),d.current?.focus()},v=e=>{a(e),_()};V(()=>{if(!o)return;u.current?.querySelector(`.menu button[aria-pressed="true"], .menu button`)?.focus();let e=e=>{u.current?.contains(e.target)||s(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[o]);let y=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),_();return}let t={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];if(!t||e.target.tagName===`INPUT`)return;let n=[...u.current.querySelectorAll(`.menu button, .menu input`)];n[(n.indexOf(document.activeElement)+t+n.length)%n.length]?.focus(),e.preventDefault()},b=t===`POINT_10_DECIMAL`,x=()=>{let e=Number(c);c!==``&&Number.isFinite(e)&&v(Vc(Math.min(100,Math.max(1,Math.round(b?e*10:e))),t))};return G(`span`,{css:NF,ref:u,children:[G(`button`,{ref:m,type:`button`,className:`star`,"aria-label":`Score, ${h?FF(e,t):`none`}`,"aria-haspopup":`dialog`,"aria-expanded":o,disabled:r,onClick:()=>s(e=>!e),children:[U(T_,{size:18,"aria-hidden":`true`,fill:h?`#facc15`:`none`,stroke:h?`#facc15`:`rgba(255, 255, 255, 0.45)`}),h?U(PF,{score:e,scale:t}):void 0]}),o?G(`div`,{ref:f.setFloating,style:p,className:`menu`,role:`dialog`,"aria-label":`Score`,onKeyDown:y,children:[U(`div`,{className:`grid${t===`POINT_3`?` faces`:``}`,children:zc[t].map((e,n)=>{let r=Sc(e,t),i=AF[n];return U(`button`,{type:`button`,"aria-label":FF(e,t),"aria-pressed":g===r,onClick:()=>v(Vc(e,t)),children:t===`POINT_3`&&i?U(i,{size:16,"aria-hidden":`true`}):t===`POINT_100`?e/10:r},e)})}),t===`POINT_100`||b?G(`label`,{className:`exact`,children:[`Exact`,U(`input`,{type:`number`,name:`score-exact`,min:b?.1:1,max:b?10:100,step:b?.1:1,value:c,onInput:e=>l(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&x()}})]}):void 0,n?G(`span`,{className:`caption`,children:[`Out of `,MF[t]]}):void 0,h&&i?U(`button`,{type:`button`,onClick:()=>v(null),children:`No score`}):void 0]}):void 0]})};K();var LF={blocked:()=>`The browser blocked the sign-in window: allow pop-ups, then press Log in again.`,unsupported:e=>`Sign in to ${e} in this browser, then press Log in again.`},RF=L`
2753
+ `,FF=({score:e,scale:t,size:n=16})=>{let r=Sc(e,t);if(t===`POINT_3`){let e=jF[r-1]??m_;return U(e,{size:n,"aria-hidden":`true`})}return U(`span`,{className:`value`,children:r})},IF=(e,t)=>{let n=Sc(e,t);return t===`POINT_3`?`${n} out of 3 (${MF[n-1]})`:`${n} out of ${NF[t]??100}`},LF=({score:e,scale:t,mixed:n,disabled:r,clearable:i=!0,onPick:a})=>{let[o,s]=W(!1),[c,l]=W(``),u=q(null),d=q(null),{refs:f,floatingStyles:p}=Fg({open:o,placement:`bottom-start`,whileElementsMounted:St,middleware:[fh(6),mh({padding:8})]}),m=gh([d,f.setReference]),h=xc(e),g=h?Sc(e,t):void 0,_=()=>{s(!1),d.current?.focus()},v=e=>{a(e),_()};V(()=>{if(!o)return;u.current?.querySelector(`.menu button[aria-pressed="true"], .menu button`)?.focus();let e=e=>{u.current?.contains(e.target)||s(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[o]);let y=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),_();return}let t={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];if(!t||e.target.tagName===`INPUT`)return;let n=[...u.current.querySelectorAll(`.menu button, .menu input`)];n[(n.indexOf(document.activeElement)+t+n.length)%n.length]?.focus(),e.preventDefault()},b=t===`POINT_10_DECIMAL`,x=()=>{let e=Number(c);c!==``&&Number.isFinite(e)&&v(Vc(Math.min(100,Math.max(1,Math.round(b?e*10:e))),t))};return G(`span`,{css:PF,ref:u,children:[G(`button`,{ref:m,type:`button`,className:`star`,"aria-label":`Score, ${h?IF(e,t):`none`}`,"aria-haspopup":`dialog`,"aria-expanded":o,disabled:r,onClick:()=>s(e=>!e),children:[U(T_,{size:18,"aria-hidden":`true`,fill:h?`#facc15`:`none`,stroke:h?`#facc15`:`rgba(255, 255, 255, 0.45)`}),h?U(FF,{score:e,scale:t}):void 0]}),o?G(`div`,{ref:f.setFloating,style:p,className:`menu`,role:`dialog`,"aria-label":`Score`,onKeyDown:y,children:[U(`div`,{className:`grid${t===`POINT_3`?` faces`:``}`,children:zc[t].map((e,n)=>{let r=Sc(e,t),i=jF[n];return U(`button`,{type:`button`,"aria-label":IF(e,t),"aria-pressed":g===r,onClick:()=>v(Vc(e,t)),children:t===`POINT_3`&&i?U(i,{size:16,"aria-hidden":`true`}):t===`POINT_100`?e/10:r},e)})}),t===`POINT_100`||b?G(`label`,{className:`exact`,children:[`Exact`,U(`input`,{type:`number`,name:`score-exact`,min:b?.1:1,max:b?10:100,step:b?.1:1,value:c,onInput:e=>l(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&x()}})]}):void 0,n?G(`span`,{className:`caption`,children:[`Out of `,NF[t]]}):void 0,h&&i?U(`button`,{type:`button`,onClick:()=>v(null),children:`No score`}):void 0]}):void 0]})};K();var RF={blocked:()=>`The browser blocked the sign-in window: allow pop-ups, then press Log in again.`,unsupported:e=>`Sign in to ${e} in this browser, then press Log in again.`},zF=L`
2754
2754
  margin-top: 2rem;
2755
2755
  display: flex;
2756
2756
  flex-direction: column;
@@ -2889,7 +2889,7 @@ transition: max-height 0.3s ease-in-out;
2889
2889
  .chip > label { margin: 0 -0.4rem; padding: 0 0.4rem; }
2890
2890
  .chip .login-button { padding: 0 0.6rem; }
2891
2891
  }
2892
- `,zF={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10},BF=(e,t)=>{let n=t??`POINT_100`;return`${Sc(e,n)} / ${zF[n]??100}`},VF=`REMOVE`,HF=``,UF=({answer:e})=>U(`span`,{className:`logo`,style:e.tracker.color?{color:e.tracker.color}:void 0,children:e.tracker.icon?U(`img`,{src:e.tracker.icon,alt:``}):e.tracker.name.slice(0,1)}),WF=e=>e.state===`PAUSED`||e.state===`ERROR`?Oc(e):void 0,GF=({answer:e,failed:t})=>t||e.state===`ERROR`?U(`span`,{className:`badge red`,"data-badge":`red`}):e.state===`PAUSED`?U(`span`,{className:`badge amber`,"data-badge":`amber`}):null,KF=({name:e,shown:t,scale:n,mixed:r,disabled:i,listed:a,removable:o,onChange:s,dots:c={},movie:l=!1,statuses:u,clearable:d})=>{let[f,p]=W(),m=q(void 0),h=q(()=>{}),g=t.total,_=()=>{if(clearTimeout(m.current),f===void 0)return;let e=Number(f);if(p(void 0),f.trim()===``||!Number.isFinite(e))return;let n=Math.max(0,Math.min(g??1/0,Math.floor(e)));n!==t.progress&&s({progress:n},!0)};h.current=_;let v=t.status===`COMPLETED`||t.progress>=(g??1);return G(`div`,{className:`group edit`,children:[U(IF,{score:t.score,scale:n,mixed:r,disabled:i||!a&&!t.status&&!t.progress,clearable:d,onPick:e=>s({score:e},!0)}),c.SCORE,G(`select`,{name:`${e}-status`,"aria-label":`Status`,value:t.status??``,disabled:i,onChange:e=>{let t=e.currentTarget.value;s(t===VF?{remove:!0}:{status:t},!0)},children:[t.status?void 0:U(`option`,{value:``,disabled:!0,children:`Add to list`}),Object.entries(Tc).filter(([e])=>!u||u.includes(e)).map(([e,t])=>U(`option`,{value:e,children:t},e)),o?U(`option`,{value:VF,children:`Remove from list`}):void 0]}),c.STATUS,l?G(z,{children:[G(`button`,{type:`button`,className:`watched${v?` on`:``}`,"aria-pressed":v,disabled:i,onClick:()=>s(v?{progress:0,...t.status===`COMPLETED`?{status:`PLANNING`}:{}}:{progress:g??1,status:`COMPLETED`},!0),children:[U(Ye,{size:14,"aria-hidden":`true`}),`Watched`]}),c.PROGRESS]}):G(`span`,{className:`progress-field`,children:[U(`label`,{for:`${e}-progress`,className:`word`,children:`Episodes`}),U(`input`,{id:`${e}-progress`,type:`number`,inputMode:`numeric`,name:`${e}-progress`,min:0,max:g??void 0,disabled:i,value:f??t.progress,onInput:e=>{p(e.currentTarget.value),clearTimeout(m.current),m.current=setTimeout(()=>h.current(),1e3)},onBlur:_,onKeyDown:e=>{e.key===`Enter`&&_(),e.key===`Escape`&&(clearTimeout(m.current),p(void 0),e.stopPropagation())}}),g?G(`span`,{className:`of`,children:[`/ `,g]}):void 0,c.PROGRESS,U(`button`,{type:`button`,className:`more`,"aria-label":`One episode more`,disabled:i||g!=null&&t.progress>=g,onClick:()=>s({progress:t.progress+1},!1),children:U(v_,{size:14,"aria-hidden":`true`})})]}),!l&&!i&&g&&t.progress===g&&t.status!==`COMPLETED`&&(!u||u.includes(`COMPLETED`))?U(`button`,{type:`button`,onClick:()=>s({status:`COMPLETED`},!0),children:`Mark completed`}):void 0,!l&&!i&&g&&t.status===`COMPLETED`&&t.progress<g?G(`button`,{type:`button`,onClick:()=>s({progress:g},!0),children:[`Set `,g,` / `,g]}):void 0]})},qF=({answer:e,className:t,busy:n,open:r,onOpen:i,card:a,children:o})=>{let s=q(null),{refs:c,floatingStyles:l,context:u}=Fg({open:r,onOpenChange:(e,t,n)=>{let r=c.floating.current?.contains(document.activeElement)??!1;(e||!r||n!==`hover`&&n!==`safe-polygon`)&&(e&&n===`hover`&&document.activeElement?.closest(`[data-card]`)||(!e&&r&&n===`escape-key`&&s.current?.focus(),i(e)))},placement:`bottom-end`,strategy:`fixed`,whileElementsMounted:St,middleware:[fh(8),mh({padding:8}),ph({padding:8})]}),{getReferenceProps:d}=zg([kg(u)]),{getReferenceProps:f,getFloatingProps:p}=zg([Hh(u,{mouseOnly:!0,delay:{open:100},handleClose:Xg()}),Lg(u),Ng(u)]),m=e.tracker.name;return G(`span`,{ref:c.setReference,className:t,"data-chip":e.tracker.id,"aria-busy":n?`true`:void 0,...f(),children:[U(`button`,{ref:s,type:`button`,className:`logo-button`,"aria-label":`${m} entry`,"aria-haspopup":`dialog`,"aria-expanded":r,...d(),children:U(UF,{answer:e})}),o,r?U(`div`,{ref:c.setFloating,style:l,className:`card`,role:`dialog`,"aria-label":`${m} entry`,"data-card":e.tracker.id,...p(),children:a()}):void 0]})},JF=({tracking:e,episodeCount:t,movie:n=!1,watched:r,counted:i,onSaveFields:a,onRemove:o,signIns:s={},prefs:c,onPrefs:l})=>{let[,u]=W(0),[d,f]=W({}),[p,m]=W(``),[h,g]=W(new Set),[_,v]=W({}),[y,b]=W(),x=q({onSaveFields:a,onRemove:o,tracking:e,episodeCount:t});x.current={onSaveFields:a,onRemove:o,tracking:e,episodeCount:t};let S=H(()=>Uc({send:async(e,t)=>{let n=await(t.remove?x.current.onRemove([e]):x.current.onSaveFields([e],t));return n.find(t=>t.tracker===e)??n[0]??{outcome:`FAILED`,error:`The write did not reach the trackers`}},shape:(e,t)=>{let{tracking:n,episodeCount:r}=x.current,i=n?.answers.find(t=>t.tracker.id===e);return i&&Lc(i,t,{...kc(n,r),...t})},steps:e=>Rc(x.current.tracking,e),onChange:e=>{if(u(e=>e+1),!e)return;let t=x.current.tracking?.answers.find(t=>t.tracker.id===e.tracker)?.tracker.name??e.tracker,n=e.outcome===`SAVED`||e.outcome===`QUEUED`;m(n?`${e.fields.remove?`Removed from`:`Saved to`} ${t}`:`${t} did not save: ${e.error??e.outcome.toLowerCase()}`),!n&&S.idle()&&f({})}}),[]),C=q(new Map),w=q(new Map),T=i??w.current,E=(e,t,n)=>{for(let[t,{progress:n}]of Object.entries(e))n!==void 0&&C.current.set(t,n);S.stage(e,t,n)};V(()=>{let e=()=>{document.visibilityState===`hidden`&&S.flush()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),S.flush()}},[]);let D=kc(e,t),O=t=>{let n=e?.answers.find(e=>e.tracker.id===t);return n&&jc(n,D.total)};V(()=>{f(e=>S.idle()?{}:Object.fromEntries(Object.entries(e).flatMap(([e,t])=>{let n=e===HF?D:O(e);return n?[[e,Nc(t,n)]]:[]})))},[e]);let k=Mc(D,d[HF]),A=r&&e&&k.status!==`COMPLETED`?Gc({...r,movie:n},e,c.targets,t):{},j=e=>T.has(e)&&T.get(e)===r?.episode,M=e?.answers.filter(({tracker:{id:e}})=>A[e]&&!j(e)&&A[e].progress>(C.current.get(e)??0))??[];V(()=>{let t=M.filter(Dc);if(r&&e&&r.played>=.85)for(let t of e.answers){let e=Pc(t,c.targets[t.tracker.id]);e.kind===`check`&&e.sendable&&T.set(t.tracker.id,r.episode)}t.length&&E(Object.fromEntries(t.map(({tracker:{id:e}})=>[e,A[e]])),!0)},[r,e,c]);let N=e?.answers.filter(e=>e.state!==`NO_ID`)??[];if(e!==void 0&&!N.length)return null;let P=N.map(e=>({answer:e,target:Pc(e,c.targets[e.tracker.id])})),ee=P.filter(({target:e})=>e.kind===`check`&&e.sendable).map(({answer:e})=>e),te=!ee.length,ne=Bc(ee.map(e=>e.tracker.scoreScale)),F=(e,t)=>{t.remove||f(n=>({...n,[e]:{...n[e],...t}}))},I=(e,t)=>{F(HF,e);let n={...k,...e},r={};for(let{answer:t,target:i}of P){if(i.kind!==`check`||!i.checked)continue;let a=t.tracker.id;if(!Dc(t)){S.fail(a,e,Oc(t));continue}let o=Lc(t,e,n);o&&(r[a]=o)}E(r,t)},re=(e,t,n)=>{let r=e.tracker.id,i=Mc(jc(e,D.total),d[r]);F(r,t);let a=Lc(e,t,{...i,...t});a&&E({[r]:a},n,!0)},ie=e=>{let t=S.state(e.tracker.id);return t.failed?.fields.remove&&e.state===`NOT_LISTED`?{...t,failed:void 0}:!t.failed&&M.includes(e)&&!Dc(e)?{...t,failed:{fields:A[e.tracker.id],error:Oc(e)}}:t},ae=(e,t)=>{t||S.drop(e),!t&&!S.state(e).busy&&C.current.delete(e),l({...c,targets:{...c.targets,[e]:t}})},oe=e=>{let t=s[e.tracker.id],n=e.tracker.id;if(!t||h.has(n))return;let r=t();g(e=>new Set(e).add(n)),v(({[n]:e,...t})=>t),r.then(t=>LF[t]?.(e.tracker.name),e=>e instanceof Error?e.message:String(e)).then(e=>{e&&v(t=>({...t,[n]:e})),g(e=>{let t=new Set(e);return t.delete(n),t})})},se=(e,t)=>U(`button`,{type:`button`,className:t,"aria-label":`Log in to ${e.tracker.name}`,disabled:!s[e.tracker.id]||h.has(e.tracker.id),onClick:()=>oe(e),children:h.has(e.tracker.id)?`Logging in`:`Log in`}),ce=(e,t)=>{let r=e.tracker.id,i=e.tracker.name,a=G(`div`,{className:`head`,children:[U(UF,{answer:e}),i,e.tracker.account?U(`span`,{className:`account`,children:e.tracker.account}):void 0]});if(t.kind===`loading`)return a;if(t.kind===`login`)return G(z,{children:[a,U(`span`,{className:`why`,children:`Signed out`}),se(e)]});if(t.kind===`cannot`)return G(z,{children:[a,G(`span`,{className:`why`,children:[i,` cannot track this media: `,t.reason]})]});let o=Dc(e),s=jc(e,D.total),c=Bc([e.tracker.scoreScale]);return G(z,{children:[a,U(KF,{name:`card-${r}`,movie:n,statuses:e.tracker.statuses,clearable:e.tracker.canClearScore!==!1,shown:Mc(s,d[r]),scale:c.scale,mixed:!1,disabled:!o,listed:e.state===`LISTED`,removable:o&&Ic(e),onChange:(t,n)=>re(e,t,n)}),o?void 0:U(`span`,{className:`why`,children:Oc(e)})]})},le=e=>N.filter(e=>e.state===`LISTED`).map(t=>`${t.tracker.name} ${e(t)??`none`}`).join(`, `),ue=(e,t)=>D.differs.includes(e)?U(`span`,{className:`differs`,"data-differs":e,title:le(t)}):void 0;return G(`section`,{css:RF,className:`tracking-compact`,"aria-label":`Quick tracking`,children:[G(`div`,{className:`row`,children:[U(KF,{name:`compact`,movie:n,shown:k,scale:ne?.scale??`POINT_100`,mixed:ne?.mixed??!1,disabled:te,listed:N.some(e=>e.state===`LISTED`),removable:ee.some(Ic),onChange:I,dots:{SCORE:ue(`SCORE`,e=>xc(e.entry?.score)?BF(e.entry.score,e.tracker.scoreScale):void 0),STATUS:ue(`STATUS`,e=>e.entry?.status?Tc[e.entry.status]:void 0),PROGRESS:ue(`PROGRESS`,e=>e.entry?.progress==null?void 0:String(e.entry.progress))}}),G(`div`,{className:`group platforms`,children:[e===void 0?U(`span`,{className:`chip loading`,children:U(`span`,{className:`slot`,role:`img`,"aria-label":`Trackers loading`,children:U(f_,{size:14,className:`spin`,"aria-hidden":`true`})})}):void 0,P.map(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name,i={answer:e,open:y===n,onOpen:e=>b(t=>e?n:t===n?void 0:t),card:()=>ce(e,t)};if(t.kind===`loading`)return U(qF,{...i,className:`chip loading`,busy:!0,children:U(`span`,{className:`slot`,role:`img`,"aria-label":`${r} loading`,children:U(f_,{size:14,className:`spin`,"aria-hidden":`true`})})},n);if(t.kind===`login`)return U(qF,{...i,className:`chip login`,children:se(e,`login-button`)},n);if(t.kind===`cannot`)return U(qF,{...i,className:`chip cannot`,children:U(`span`,{className:`slot`,role:`img`,"aria-label":`${r} cannot track this media: ${t.reason}`,children:U(g_,{size:14,"aria-hidden":`true`})})},n);let{busy:a,failed:o}=ie(e),s=WF(e);return G(qF,{...i,className:`chip${t.checked?``:` off`}`,busy:a,children:[G(`label`,{children:[U(`input`,{type:`checkbox`,className:`sr-only`,name:`compact-target-${n}`,"aria-label":`Save to ${r}`,"aria-describedby":s?`compact-hint-${n}`:void 0,checked:t.checked,onChange:e=>ae(n,e.currentTarget.checked)}),U(`span`,{className:`slot`,children:a?U(f_,{size:14,className:`spin`,"aria-hidden":`true`}):t.checked?U(`span`,{className:`check`,children:U(Ye,{size:11,"aria-hidden":`true`})}):U(`span`,{className:`ring`})})]}),U(GF,{answer:e,failed:o}),s?U(`span`,{id:`compact-hint-${n}`,className:`sr-only`,children:s}):void 0]},n)})]})]}),U(`div`,{className:`notes`,children:P.flatMap(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name;return[_[n]&&e.state===`SIGNED_OUT`?U(`div`,{className:`note`,"data-note":n,children:_[n]},`${n}-sign-in`):void 0,U(kF,{answer:e,state:ie(e),queue:S},`${n}-problems`),t.kind===`check`&&t.sendable&&Fc(e,D.total)?G(`div`,{className:`note`,"data-note":n,children:[r,`: set progress on its card`]},`${n}-count`):void 0].filter(Boolean)})}),U(`div`,{className:`sr-only`,role:`status`,children:p})]})};K();var YF=Iv(`
2892
+ `,BF={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10},VF=(e,t)=>{let n=t??`POINT_100`;return`${Sc(e,n)} / ${BF[n]??100}`},HF=`REMOVE`,UF=``,WF=({answer:e})=>U(`span`,{className:`logo`,style:e.tracker.color?{color:e.tracker.color}:void 0,children:e.tracker.icon?U(`img`,{src:e.tracker.icon,alt:``}):e.tracker.name.slice(0,1)}),GF=e=>e.state===`PAUSED`||e.state===`ERROR`?Oc(e):void 0,KF=({answer:e,failed:t})=>t||e.state===`ERROR`?U(`span`,{className:`badge red`,"data-badge":`red`}):e.state===`PAUSED`?U(`span`,{className:`badge amber`,"data-badge":`amber`}):null,qF=({name:e,shown:t,scale:n,mixed:r,disabled:i,listed:a,removable:o,onChange:s,dots:c={},movie:l=!1,statuses:u,clearable:d})=>{let[f,p]=W(),m=q(void 0),h=q(()=>{}),g=t.total,_=()=>{if(clearTimeout(m.current),f===void 0)return;let e=Number(f);if(p(void 0),f.trim()===``||!Number.isFinite(e))return;let n=Math.max(0,Math.min(g??1/0,Math.floor(e)));n!==t.progress&&s({progress:n},!0)};h.current=_;let v=t.status===`COMPLETED`||t.progress>=(g??1);return G(`div`,{className:`group edit`,children:[U(LF,{score:t.score,scale:n,mixed:r,disabled:i||!a&&!t.status&&!t.progress,clearable:d,onPick:e=>s({score:e},!0)}),c.SCORE,G(`select`,{name:`${e}-status`,"aria-label":`Status`,value:t.status??``,disabled:i,onChange:e=>{let t=e.currentTarget.value;s(t===HF?{remove:!0}:{status:t},!0)},children:[t.status?void 0:U(`option`,{value:``,disabled:!0,children:`Add to list`}),Object.entries(Tc).filter(([e])=>!u||u.includes(e)).map(([e,t])=>U(`option`,{value:e,children:t},e)),o?U(`option`,{value:HF,children:`Remove from list`}):void 0]}),c.STATUS,l?G(z,{children:[G(`button`,{type:`button`,className:`watched${v?` on`:``}`,"aria-pressed":v,disabled:i,onClick:()=>s(v?{progress:0,...t.status===`COMPLETED`?{status:`PLANNING`}:{}}:{progress:g??1,status:`COMPLETED`},!0),children:[U(Ye,{size:14,"aria-hidden":`true`}),`Watched`]}),c.PROGRESS]}):G(`span`,{className:`progress-field`,children:[U(`label`,{for:`${e}-progress`,className:`word`,children:`Episodes`}),U(`input`,{id:`${e}-progress`,type:`number`,inputMode:`numeric`,name:`${e}-progress`,min:0,max:g??void 0,disabled:i,value:f??t.progress,onInput:e=>{p(e.currentTarget.value),clearTimeout(m.current),m.current=setTimeout(()=>h.current(),1e3)},onBlur:_,onKeyDown:e=>{e.key===`Enter`&&_(),e.key===`Escape`&&(clearTimeout(m.current),p(void 0),e.stopPropagation())}}),g?G(`span`,{className:`of`,children:[`/ `,g]}):void 0,c.PROGRESS,U(`button`,{type:`button`,className:`more`,"aria-label":`One episode more`,disabled:i||g!=null&&t.progress>=g,onClick:()=>s({progress:t.progress+1},!1),children:U(v_,{size:14,"aria-hidden":`true`})})]}),!l&&!i&&g&&t.progress===g&&t.status!==`COMPLETED`&&(!u||u.includes(`COMPLETED`))?U(`button`,{type:`button`,onClick:()=>s({status:`COMPLETED`},!0),children:`Mark completed`}):void 0,!l&&!i&&g&&t.status===`COMPLETED`&&t.progress<g?G(`button`,{type:`button`,onClick:()=>s({progress:g},!0),children:[`Set `,g,` / `,g]}):void 0]})},JF=({answer:e,className:t,busy:n,open:r,onOpen:i,card:a,children:o})=>{let s=q(null),{refs:c,floatingStyles:l,context:u}=Fg({open:r,onOpenChange:(e,t,n)=>{let r=c.floating.current?.contains(document.activeElement)??!1;(e||!r||n!==`hover`&&n!==`safe-polygon`)&&(e&&n===`hover`&&document.activeElement?.closest(`[data-card]`)||(!e&&r&&n===`escape-key`&&s.current?.focus(),i(e)))},placement:`bottom-end`,strategy:`fixed`,whileElementsMounted:St,middleware:[fh(8),mh({padding:8}),ph({padding:8})]}),{getReferenceProps:d}=zg([kg(u)]),{getReferenceProps:f,getFloatingProps:p}=zg([Hh(u,{mouseOnly:!0,delay:{open:100},handleClose:Xg()}),Lg(u),Ng(u)]),m=e.tracker.name;return G(`span`,{ref:c.setReference,className:t,"data-chip":e.tracker.id,"aria-busy":n?`true`:void 0,...f(),children:[U(`button`,{ref:s,type:`button`,className:`logo-button`,"aria-label":`${m} entry`,"aria-haspopup":`dialog`,"aria-expanded":r,...d(),children:U(WF,{answer:e})}),o,r?U(`div`,{ref:c.setFloating,style:l,className:`card`,role:`dialog`,"aria-label":`${m} entry`,"data-card":e.tracker.id,...p(),children:a()}):void 0]})},YF=({tracking:e,episodeCount:t,movie:n=!1,watched:r,counted:i,onSaveFields:a,onRemove:o,signIns:s={},prefs:c,onPrefs:l})=>{let[,u]=W(0),[d,f]=W({}),[p,m]=W(``),[h,g]=W(new Set),[_,v]=W({}),[y,b]=W(),x=q({onSaveFields:a,onRemove:o,tracking:e,episodeCount:t});x.current={onSaveFields:a,onRemove:o,tracking:e,episodeCount:t};let S=H(()=>Uc({send:async(e,t)=>{let n=await(t.remove?x.current.onRemove([e]):x.current.onSaveFields([e],t));return n.find(t=>t.tracker===e)??n[0]??{outcome:`FAILED`,error:`The write did not reach the trackers`}},shape:(e,t)=>{let{tracking:n,episodeCount:r}=x.current,i=n?.answers.find(t=>t.tracker.id===e);return i&&Lc(i,t,{...kc(n,r),...t})},steps:e=>Rc(x.current.tracking,e),onChange:e=>{if(u(e=>e+1),!e)return;let t=x.current.tracking?.answers.find(t=>t.tracker.id===e.tracker)?.tracker.name??e.tracker,n=e.outcome===`SAVED`||e.outcome===`QUEUED`;m(n?`${e.fields.remove?`Removed from`:`Saved to`} ${t}`:`${t} did not save: ${e.error??e.outcome.toLowerCase()}`),!n&&S.idle()&&f({})}}),[]),C=q(new Map),w=q(new Map),T=i??w.current,E=(e,t,n)=>{for(let[t,{progress:n}]of Object.entries(e))n!==void 0&&C.current.set(t,n);S.stage(e,t,n)};V(()=>{let e=()=>{document.visibilityState===`hidden`&&S.flush()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),S.flush()}},[]);let D=kc(e,t),O=t=>{let n=e?.answers.find(e=>e.tracker.id===t);return n&&jc(n,D.total)};V(()=>{f(e=>S.idle()?{}:Object.fromEntries(Object.entries(e).flatMap(([e,t])=>{let n=e===UF?D:O(e);return n?[[e,Nc(t,n)]]:[]})))},[e]);let k=Mc(D,d[UF]),A=r&&e&&k.status!==`COMPLETED`?Gc({...r,movie:n},e,c.targets,t):{},j=e=>T.has(e)&&T.get(e)===r?.episode,M=e?.answers.filter(({tracker:{id:e}})=>A[e]&&!j(e)&&A[e].progress>(C.current.get(e)??0))??[];V(()=>{let t=M.filter(Dc);if(r&&e&&r.played>=.85)for(let t of e.answers){let e=Pc(t,c.targets[t.tracker.id]);e.kind===`check`&&e.sendable&&T.set(t.tracker.id,r.episode)}t.length&&E(Object.fromEntries(t.map(({tracker:{id:e}})=>[e,A[e]])),!0)},[r,e,c]);let N=e?.answers.filter(e=>e.state!==`NO_ID`)??[];if(e!==void 0&&!N.length)return null;let P=N.map(e=>({answer:e,target:Pc(e,c.targets[e.tracker.id])})),ee=P.filter(({target:e})=>e.kind===`check`&&e.sendable).map(({answer:e})=>e),te=!ee.length,ne=Bc(ee.map(e=>e.tracker.scoreScale)),F=(e,t)=>{t.remove||f(n=>({...n,[e]:{...n[e],...t}}))},I=(e,t)=>{F(UF,e);let n={...k,...e},r={};for(let{answer:t,target:i}of P){if(i.kind!==`check`||!i.checked)continue;let a=t.tracker.id;if(!Dc(t)){S.fail(a,e,Oc(t));continue}let o=Lc(t,e,n);o&&(r[a]=o)}E(r,t)},re=(e,t,n)=>{let r=e.tracker.id,i=Mc(jc(e,D.total),d[r]);F(r,t);let a=Lc(e,t,{...i,...t});a&&E({[r]:a},n,!0)},ie=e=>{let t=S.state(e.tracker.id);return t.failed?.fields.remove&&e.state===`NOT_LISTED`?{...t,failed:void 0}:!t.failed&&M.includes(e)&&!Dc(e)?{...t,failed:{fields:A[e.tracker.id],error:Oc(e)}}:t},ae=(e,t)=>{t||S.drop(e),!t&&!S.state(e).busy&&C.current.delete(e),l({...c,targets:{...c.targets,[e]:t}})},oe=e=>{let t=s[e.tracker.id],n=e.tracker.id;if(!t||h.has(n))return;let r=t();g(e=>new Set(e).add(n)),v(({[n]:e,...t})=>t),r.then(t=>RF[t]?.(e.tracker.name),e=>e instanceof Error?e.message:String(e)).then(e=>{e&&v(t=>({...t,[n]:e})),g(e=>{let t=new Set(e);return t.delete(n),t})})},se=(e,t)=>U(`button`,{type:`button`,className:t,"aria-label":`Log in to ${e.tracker.name}`,disabled:!s[e.tracker.id]||h.has(e.tracker.id),onClick:()=>oe(e),children:h.has(e.tracker.id)?`Logging in`:`Log in`}),ce=(e,t)=>{let r=e.tracker.id,i=e.tracker.name,a=G(`div`,{className:`head`,children:[U(WF,{answer:e}),i,e.tracker.account?U(`span`,{className:`account`,children:e.tracker.account}):void 0]});if(t.kind===`loading`)return a;if(t.kind===`login`)return G(z,{children:[a,U(`span`,{className:`why`,children:`Signed out`}),se(e)]});if(t.kind===`cannot`)return G(z,{children:[a,G(`span`,{className:`why`,children:[i,` cannot track this media: `,t.reason]})]});let o=Dc(e),s=jc(e,D.total),c=Bc([e.tracker.scoreScale]);return G(z,{children:[a,U(qF,{name:`card-${r}`,movie:n,statuses:e.tracker.statuses,clearable:e.tracker.canClearScore!==!1,shown:Mc(s,d[r]),scale:c.scale,mixed:!1,disabled:!o,listed:e.state===`LISTED`,removable:o&&Ic(e),onChange:(t,n)=>re(e,t,n)}),o?void 0:U(`span`,{className:`why`,children:Oc(e)})]})},le=e=>N.filter(e=>e.state===`LISTED`).map(t=>`${t.tracker.name} ${e(t)??`none`}`).join(`, `),ue=(e,t)=>D.differs.includes(e)?U(`span`,{className:`differs`,"data-differs":e,title:le(t)}):void 0;return G(`section`,{css:zF,className:`tracking-compact`,"aria-label":`Quick tracking`,children:[G(`div`,{className:`row`,children:[U(qF,{name:`compact`,movie:n,shown:k,scale:ne?.scale??`POINT_100`,mixed:ne?.mixed??!1,disabled:te,listed:N.some(e=>e.state===`LISTED`),removable:ee.some(Ic),onChange:I,dots:{SCORE:ue(`SCORE`,e=>xc(e.entry?.score)?VF(e.entry.score,e.tracker.scoreScale):void 0),STATUS:ue(`STATUS`,e=>e.entry?.status?Tc[e.entry.status]:void 0),PROGRESS:ue(`PROGRESS`,e=>e.entry?.progress==null?void 0:String(e.entry.progress))}}),G(`div`,{className:`group platforms`,children:[e===void 0?U(`span`,{className:`chip loading`,children:U(`span`,{className:`slot`,role:`img`,"aria-label":`Trackers loading`,children:U(f_,{size:14,className:`spin`,"aria-hidden":`true`})})}):void 0,P.map(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name,i={answer:e,open:y===n,onOpen:e=>b(t=>e?n:t===n?void 0:t),card:()=>ce(e,t)};if(t.kind===`loading`)return U(JF,{...i,className:`chip loading`,busy:!0,children:U(`span`,{className:`slot`,role:`img`,"aria-label":`${r} loading`,children:U(f_,{size:14,className:`spin`,"aria-hidden":`true`})})},n);if(t.kind===`login`)return U(JF,{...i,className:`chip login`,children:se(e,`login-button`)},n);if(t.kind===`cannot`)return U(JF,{...i,className:`chip cannot`,children:U(`span`,{className:`slot`,role:`img`,"aria-label":`${r} cannot track this media: ${t.reason}`,children:U(g_,{size:14,"aria-hidden":`true`})})},n);let{busy:a,failed:o}=ie(e),s=GF(e);return G(JF,{...i,className:`chip${t.checked?``:` off`}`,busy:a,children:[G(`label`,{children:[U(`input`,{type:`checkbox`,className:`sr-only`,name:`compact-target-${n}`,"aria-label":`Save to ${r}`,"aria-describedby":s?`compact-hint-${n}`:void 0,checked:t.checked,onChange:e=>ae(n,e.currentTarget.checked)}),U(`span`,{className:`slot`,children:a?U(f_,{size:14,className:`spin`,"aria-hidden":`true`}):t.checked?U(`span`,{className:`check`,children:U(Ye,{size:11,"aria-hidden":`true`})}):U(`span`,{className:`ring`})})]}),U(KF,{answer:e,failed:o}),s?U(`span`,{id:`compact-hint-${n}`,className:`sr-only`,children:s}):void 0]},n)})]})]}),U(`div`,{className:`notes`,children:P.flatMap(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name;return[_[n]&&e.state===`SIGNED_OUT`?U(`div`,{className:`note`,"data-note":n,children:_[n]},`${n}-sign-in`):void 0,U(AF,{answer:e,state:ie(e),queue:S},`${n}-problems`),t.kind===`check`&&t.sendable&&Fc(e,D.total)?G(`div`,{className:`note`,"data-note":n,children:[r,`: set progress on its card`]},`${n}-count`):void 0].filter(Boolean)})}),U(`div`,{className:`sr-only`,role:`status`,children:p})]})};K();var XF=Iv(`
2893
2893
  mutation DeleteListEntry($input: DeleteListEntryInput!) {
2894
2894
  deleteListEntry(input: $input) {
2895
2895
  tracker
@@ -2897,7 +2897,7 @@ transition: max-height 0.3s ease-in-out;
2897
2897
  error
2898
2898
  }
2899
2899
  }
2900
- `),XF=Iv(`
2900
+ `),ZF=Iv(`
2901
2901
  subscription StubTrackerStorage {
2902
2902
  stubTrackerStorage {
2903
2903
  location
@@ -2908,7 +2908,7 @@ transition: max-height 0.3s ease-in-out;
2908
2908
  error
2909
2909
  }
2910
2910
  }
2911
- `),ZF=Iv(`
2911
+ `),QF=Iv(`
2912
2912
  mutation AddHeldStubEntries {
2913
2913
  addHeldStubEntries {
2914
2914
  location
@@ -2919,7 +2919,7 @@ transition: max-height 0.3s ease-in-out;
2919
2919
  error
2920
2920
  }
2921
2921
  }
2922
- `),QF=e=>[{tracker:``,outcome:`FAILED`,error:e??`The write did not reach the trackers`}],$F=e=>e.state===`LOADING`,eI=e=>!$F(e)&&e.state!==`NO_ID`,tI=(e,t)=>e&&t?.answers.some(t=>$F(t)&&e.answers.some(e=>e.tracker.id===t.tracker.id&&eI(e)))?e:t??void 0,nI=e=>e.state===vo.Ambiguous,rI=(e,t)=>e&&e._id!==CF(t)&&e.answers.some(nI)?{...e,answers:e.answers.map(e=>nI(e)?{...e,state:vo.Loading}:e)}:e,iI=e=>e&&{...e,summary:null,disagreements:[],answers:e.answers.map(e=>e.state===vo.NoId?e:{...e,state:vo.Loading,entry:null})},aI=(e,t)=>{let[n,r]=W({episode:t,played:0});return V(()=>{if(!e)return;let n=!1;return e.onReport(({paused:i,time:a})=>{n||=!i;let o=e.duration?.()??0,s=o>0?i?0:a/o:e.ended?.()?Number(n):0;r(e=>e.episode!==t||s>e.played?{episode:t,played:s}:e)})},[e,t]),n},oI=({work:e,address:t,uri:n,title:r,cover:i,episodeCount:a,movie:o,prefsStore:s=fc,notice:c=!0,link:l,episode:u,sameWork:d,counted:f})=>{let p=n??e,[{data:m}]=Za({query:Vy,variables:{input:{uri:p}},pause:!p}),h=H(()=>rI(m?.tracking,p),[m?.tracking,p]),g=q(void 0);g.current=tI(rI(g.current,p),h);let _=!!(n&&Ry(e,t)),v=Uy({uri:n,title:r,cover:i,episodeCount:a}),[,y]=Ya(YF),[{data:b}]=Za({query:XF,pause:!c}),[,x]=Ya(ZF),[S,C]=W(s.read),[w]=W(d?void 0:l),T=aI(l===w?void 0:l,u),E=m?.tracking?.answers;return V(()=>{E&&pe(E,ce,$t)},[E]),V(()=>pc(()=>C(s.read())),[s]),G(z,{children:[U(JF,{tracking:_?g.current:iI(g.current),episodeCount:_?a:void 0,movie:o,watched:T,counted:f,onSaveFields:v,onRemove:async e=>{let t=await y({input:{uri:n,trackers:e}});return t.data?.deleteListEntry??QF(t.error?.message)},signIns:Mt,prefs:S,onPrefs:e=>{s.write(e),C(e)}}),U(EF,{storage:b?.stubTrackerStorage,onUnlock:async()=>{await Es()&&await Kt()},onAdd:()=>x({})})]})},sI=e=>{let t=Wy(e.uri??e.work),n=q({work:e.work,counted:new Map}),r=n.current.work===e.work;return r||(n.current={work:e.work,counted:new Map}),U(oI,{...e,sameWork:r,counted:n.current.counted},`${e.work} ${t}`)},cI=({onClose:e,children:t,...n})=>{let{refs:r,context:i}=Fg({open:!0,onOpenChange:(t,n)=>{n?.target===r.reference.current&&e()}}),{getReferenceProps:a,getFloatingProps:o}=zg([kg(i,{keyboardHandlers:!1})]);return U(lg,{children:U(Tg,{lockScroll:!0,...n,ref:r.setReference,...a(),children:U(bg,{context:i,initialFocus:r.floating,children:U(`div`,{className:`modal`,ref:r.setFloating,...o(),children:t})})})})},lI=L`
2922
+ `),$F=e=>[{tracker:``,outcome:`FAILED`,error:e??`The write did not reach the trackers`}],eI=e=>e.state===`LOADING`,tI=e=>!eI(e)&&e.state!==`NO_ID`,nI=(e,t)=>e&&t?.answers.some(t=>eI(t)&&e.answers.some(e=>e.tracker.id===t.tracker.id&&tI(e)))?e:t??void 0,rI=e=>e.state===vo.Ambiguous,iI=(e,t)=>e&&e._id!==wF(t)&&e.answers.some(rI)?{...e,answers:e.answers.map(e=>rI(e)?{...e,state:vo.Loading}:e)}:e,aI=e=>e&&{...e,summary:null,disagreements:[],answers:e.answers.map(e=>e.state===vo.NoId?e:{...e,state:vo.Loading,entry:null})},oI=(e,t)=>{let[n,r]=W({episode:t,played:0});return V(()=>{if(!e)return;let n=!1;return e.onReport(({paused:i,time:a})=>{n||=!i;let o=e.duration?.()??0,s=o>0?i?0:a/o:e.ended?.()?Number(n):0;r(e=>e.episode!==t||s>e.played?{episode:t,played:s}:e)})},[e,t]),n},sI=({work:e,address:t,uri:n,title:r,cover:i,episodeCount:a,movie:o,prefsStore:s=fc,notice:c=!0,link:l,episode:u,sameWork:d,counted:f})=>{let p=n??e,[{data:m}]=Za({query:Hy,variables:{input:{uri:p}},pause:!p}),h=H(()=>iI(m?.tracking,p),[m?.tracking,p]),g=q(void 0);g.current=nI(iI(g.current,p),h);let _=!!(n&&zy(e,t)),v=Wy({uri:n,title:r,cover:i,episodeCount:a}),[,y]=Ya(XF),[{data:b}]=Za({query:ZF,pause:!c}),[,x]=Ya(QF),[S,C]=W(s.read),[w]=W(d?void 0:l),T=oI(l===w?void 0:l,u),E=m?.tracking?.answers;return V(()=>{E&&pe(E,ce,$t)},[E]),V(()=>pc(()=>C(s.read())),[s]),G(z,{children:[U(YF,{tracking:_?g.current:aI(g.current),episodeCount:_?a:void 0,movie:o,watched:T,counted:f,onSaveFields:v,onRemove:async e=>{let t=await y({input:{uri:n,trackers:e}});return t.data?.deleteListEntry??$F(t.error?.message)},signIns:Mt,prefs:S,onPrefs:e=>{s.write(e),C(e)}}),U(DF,{storage:b?.stubTrackerStorage,onUnlock:async()=>{await Es()&&await Kt()},onAdd:()=>x({})})]})},cI=e=>{let t=Gy(e.uri??e.work),n=q({work:e.work,counted:new Map}),r=n.current.work===e.work;return r||(n.current={work:e.work,counted:new Map}),U(sI,{...e,sameWork:r,counted:n.current.counted},`${e.work} ${t}`)},lI=({onClose:e,children:t,...n})=>{let{refs:r,context:i}=Fg({open:!0,onOpenChange:(t,n)=>{n?.target===r.reference.current&&e()}}),{getReferenceProps:a,getFloatingProps:o}=zg([kg(i,{keyboardHandlers:!1})]);return U(lg,{children:U(Tg,{lockScroll:!0,...n,ref:r.setReference,...a(),children:U(bg,{context:i,initialFocus:r.floating,children:U(`div`,{className:`modal`,ref:r.setFloating,...o(),children:t})})})})},uI=L`
2923
2923
  font-size: 1.2rem;
2924
2924
  padding: 0.15rem 0.6rem;
2925
2925
  border: 1px solid rgba(255, 255, 255, 0.25);
@@ -2927,7 +2927,7 @@ transition: max-height 0.3s ease-in-out;
2927
2927
  white-space: nowrap;
2928
2928
 
2929
2929
  &:hover { border-color: rgba(255, 255, 255, 0.5); }
2930
- `,uI=({uri:e})=>{let t=oS(Tf());return!e||!kt(`?${t}`,`http://d/`)?null:U(Mf,{css:lI,"data-trace-link":e,href:eS({uri:e,search:t}),title:`what the graph holds for this uri`,children:`graph trace`})},dI=({episode:e,mediaUri:t,sources:n,settled:r,startDate:i,status:a,genres:o})=>{let s=Db(),{released:c,upcoming:l}=bb({startDate:i,status:a,episode:e},new Date(s)),u=!l&&e?.uri&&n.some(t=>!t.external||!!e?.handles?.some(({relation:e,node:n})=>e===`SAME_AS`&&n.origin===t.id&&jb(n.origin,n.url,`extension`)))?zf(Q.WATCH,{mediaUri:t,episodeUri:e.uri}):void 0,d=Qy(c),f=!l&&!n.length,p=l?d&&`Releases ${d}`:f&&r?`No sources yet`:void 0,m=!u&&!l&&!r&&(f||n.some(e=>e.external&&jb(e.id,e.href,`extension`)));return G(`div`,{className:`movie`,children:[U(`div`,{className:`facts`,children:rb({released:c,runtime:e?.runtime,genres:o}).join(` · `)}),u||p||m?G(`div`,{className:m?`play-bar held`:`play-bar`,children:[u?G(Mf,{className:`play`,href:u,children:[U(tt,{size:20,fill:`currentColor`,"aria-hidden":`true`}),`Play`]}):void 0,p?U(`span`,{className:`when`,children:p}):void 0]}):void 0]})};K();var fI=L`
2930
+ `,dI=({uri:e})=>{let t=sS(Tf());return!e||!kt(`?${t}`,`http://d/`)?null:U(Mf,{css:uI,"data-trace-link":e,href:tS({uri:e,search:t}),title:`what the graph holds for this uri`,children:`graph trace`})},fI=({episode:e,mediaUri:t,sources:n,settled:r,startDate:i,status:a,genres:o})=>{let s=Ob(),{released:c,upcoming:l}=xb({startDate:i,status:a,episode:e},new Date(s)),u=!l&&e?.uri&&n.some(t=>!t.external||!!e?.handles?.some(({relation:e,node:n})=>e===`SAME_AS`&&n.origin===t.id&&Mb(n.origin,n.url,`extension`)))?zf(Q.WATCH,{mediaUri:t,episodeUri:e.uri}):void 0,d=$y(c),f=!l&&!n.length,p=l?d&&`Releases ${d}`:f&&r?`No sources yet`:void 0,m=!u&&!l&&!r&&(f||n.some(e=>e.external&&Mb(e.id,e.href,`extension`)));return G(`div`,{className:`movie`,children:[U(`div`,{className:`facts`,children:ib({released:c,runtime:e?.runtime,genres:o}).join(` · `)}),u||p||m?G(`div`,{className:m?`play-bar held`:`play-bar`,children:[u?G(Mf,{className:`play`,href:u,children:[U(tt,{size:20,fill:`currentColor`,"aria-hidden":`true`}),`Play`]}):void 0,p?U(`span`,{className:`when`,children:p}):void 0]}):void 0]})};K();var pI=L`
2931
2931
  z-index: ${jr.mediaModal};
2932
2932
  padding: 5rem 1rem;
2933
2933
  background-color: hsla(0, 0%, 0%, 0.439);
@@ -3200,7 +3200,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3200
3200
  }
3201
3201
  }
3202
3202
  }
3203
- `,pI=({mediaNodes:e})=>{let t=Sf(),n={...t,uri:o(t.uri)},[,r]=wf(),i=zy(n.uri,e),[s,c]=W(n.uri);V(()=>{c(e=>e&&a(e,n.uri??``)?e:n.uri)},[n.uri]);let[{data:l,operation:u}]=Za({query:Gb,variables:{input:{uri:s},descriptionInput:{type:fo.Html}},pause:!s}),d=l?.media??i,f=By({data:l,operation:u},s),p=H(()=>d?.titles?.at(0)?.title,[d]),m=!!(l?.media&&ib(l.media)),h=m?l?.media?.episodes.at(0):void 0,{sources:g,answered:v}=ex(h,d?.uri??``,d?.handles),y=tx(s,f?.settled&&v),b=qb(l?.media?.uri),x=H(()=>d&&`descriptions`in d&&d.descriptions.sort((e,t)=>t.description.length-e.description.length)?.at(0)?.description,[d]),S=xy(d?.covers,d),[C,w]=W([]),[T,E]=W(),D=H(()=>{let e=(d?.trailers??[]).filter(e=>!C.includes(e.uri));return e.find(e=>e.uri===T)??e.at(0)},[d?.trailers,C,T]),O=xy(D?.url?void 0:by(d),d);V(()=>{D?.uri&&D.uri!==T&&E(D.uri)},[D?.uri,T]);let k=B(()=>{D&&w([...C,D.uri])},[D,C]),[A,j]=W(!0),M=tS(Tf()),[N,P]=W(!1),[ee,te]=W(!0),[ne,F]=W(.25),I=q(void 0),re=l?.media?.handles.map(e=>e.node.uri)??[];return V(()=>{!PS(l?.media?.seasons,re)&&_(d?.uri,n.uri,I.current)&&(I.current=d.uri,r(`${zf(Q.MEDIA,{uri:d.uri})}${location.search}`,{replace:!0}))},[d?.uri,n.uri]),A?G(cI,{"data-party-scroll":!0,css:fI,onClose:()=>j(!1),children:[G(`div`,{className:`trailer`,style:!D?.url&&O?{backgroundImage:`url(${O})`}:{},children:[D?.url?U(Kv,{url:D.url,className:`player`,onError:k,paused:N,volume:ee?0:ne},D.url):void 0,G(`div`,{className:`player-controls ${D?.url?``:`hidden`}`,children:[G(`span`,{className:`playback`,children:[N?U(tt,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,onClick:()=>P(!1)}):U(mt,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,onClick:()=>P(!0)}),N?U(tt,{className:`icon-body`,size:30,onClick:()=>P(!1)}):U(mt,{className:`icon-body`,size:30,onClick:()=>P(!0)})]}),U(Yv,{defaultMuted:ee,onMutedUpdate:te,defaultVolume:ne,onVolumeUpdate:e=>F(e)})]})]}),G(`div`,{className:`content`,children:[G(`div`,{className:`header`,children:[p||y?U(`span`,{className:`title`,children:p}):U(ty,{className:`title-pending`}),U(uI,{uri:d?.uri}),U(rx,{uri:l?.media?.uri,handles:d?.handles,except:$b(h,d?.handles)}),U(Mf,{className:`more`,href:`${zf(Q.TITLE,{uri:d?.uri??n.uri})}${M}`,children:`More details`})]}),m&&d?U(dI,{episode:h,mediaUri:d.uri,sources:g,settled:y,startDate:`startDate`in d?d.startDate:void 0,status:`status`in d?d.status:void 0,genres:`genres`in d?d.genres:void 0}):void 0,U(sI,{work:s,address:n.uri,uri:f?.uri,title:p,cover:S,episodeCount:f?.episodeCount,movie:m}),x?U(Jx,{collapsedHeight:200,className:`description`,children:U(`div`,{dangerouslySetInnerHTML:{__html:x}})}):y?void 0:U(ny,{count:5,className:`description pending`}),m?U(Fy,{film:!0,sources:g,pending:!y}):void 0,U(MS,{relations:d&&`relations`in d?d.relations??[]:[],action:U(SF,{franchise:d&&`franchise`in d?d.franchise:void 0,currentUris:d?.handles?.map(e=>e.node.uri)??[]})},s),U(FS,{seasons:l?.media?.seasons,currentUris:re,href:e=>`${zf(Q.MEDIA,{uri:e})}${M}`}),m||!l?.media?void 0:U(`div`,{className:`episode-list`,children:f?U(lx,{media:f,tracked:b},s):U(cx,{})})]})]}):U(Ff,{to:`/`})},mI=[{label:`All`,value:null},{label:`Anime`,value:uo.Anime},{label:`Series`,value:uo.Series},{label:`Movies`,value:uo.Movie}],hI=L`
3203
+ `,mI=({mediaNodes:e})=>{let t=Sf(),n={...t,uri:o(t.uri)},[,r]=wf(),i=By(n.uri,e),[s,c]=W(n.uri);V(()=>{c(e=>e&&a(e,n.uri??``)?e:n.uri)},[n.uri]);let[{data:l,operation:u}]=Za({query:Kb,variables:{input:{uri:s},descriptionInput:{type:fo.Html}},pause:!s}),d=l?.media??i,f=Vy({data:l,operation:u},s),p=H(()=>d?.titles?.at(0)?.title,[d]),m=!!(l?.media&&ab(l.media)),h=m?l?.media?.episodes.at(0):void 0,{sources:g,answered:v}=tx(h,d?.uri??``,d?.handles),y=nx(s,f?.settled&&v),b=Jb(l?.media?.uri),x=H(()=>d&&`descriptions`in d&&d.descriptions.sort((e,t)=>t.description.length-e.description.length)?.at(0)?.description,[d]),S=Sy(d?.covers,d),[C,w]=W([]),[T,E]=W(),D=H(()=>{let e=(d?.trailers??[]).filter(e=>!C.includes(e.uri));return e.find(e=>e.uri===T)??e.at(0)},[d?.trailers,C,T]),O=Sy(D?.url?void 0:xy(d),d);V(()=>{D?.uri&&D.uri!==T&&E(D.uri)},[D?.uri,T]);let k=B(()=>{D&&w([...C,D.uri])},[D,C]),[A,j]=W(!0),M=nS(Tf()),[N,P]=W(!1),[ee,te]=W(!0),[ne,F]=W(.25),I=q(void 0),re=l?.media?.handles.map(e=>e.node.uri)??[];return V(()=>{!FS(l?.media?.seasons,re)&&_(d?.uri,n.uri,I.current)&&(I.current=d.uri,r(`${zf(Q.MEDIA,{uri:d.uri})}${location.search}`,{replace:!0}))},[d?.uri,n.uri]),A?G(lI,{"data-party-scroll":!0,css:pI,onClose:()=>j(!1),children:[G(`div`,{className:`trailer`,style:!D?.url&&O?{backgroundImage:`url(${O})`}:{},children:[D?.url?U(Kv,{url:D.url,className:`player`,onError:k,paused:N,volume:ee?0:ne},D.url):void 0,G(`div`,{className:`player-controls ${D?.url?``:`hidden`}`,children:[G(`span`,{className:`playback`,children:[N?U(tt,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,onClick:()=>P(!1)}):U(mt,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,onClick:()=>P(!0)}),N?U(tt,{className:`icon-body`,size:30,onClick:()=>P(!1)}):U(mt,{className:`icon-body`,size:30,onClick:()=>P(!0)})]}),U(Yv,{defaultMuted:ee,onMutedUpdate:te,defaultVolume:ne,onVolumeUpdate:e=>F(e)})]})]}),G(`div`,{className:`content`,children:[G(`div`,{className:`header`,children:[p||y?U(`span`,{className:`title`,children:p}):U(ty,{className:`title-pending`}),U(dI,{uri:d?.uri}),U(ix,{uri:l?.media?.uri,handles:d?.handles,except:ex(h,d?.handles)}),U(Mf,{className:`more`,href:`${zf(Q.TITLE,{uri:d?.uri??n.uri})}${M}`,children:`More details`})]}),m&&d?U(fI,{episode:h,mediaUri:d.uri,sources:g,settled:y,startDate:`startDate`in d?d.startDate:void 0,status:`status`in d?d.status:void 0,genres:`genres`in d?d.genres:void 0}):void 0,U(cI,{work:s,address:n.uri,uri:f?.uri,title:p,cover:S,episodeCount:f?.episodeCount,movie:m}),x?U(Yx,{collapsedHeight:200,className:`description`,children:U(`div`,{dangerouslySetInnerHTML:{__html:x}})}):y?void 0:U(ny,{count:5,className:`description pending`}),m?U(Iy,{film:!0,sources:g,pending:!y}):void 0,U(NS,{relations:d&&`relations`in d?d.relations??[]:[],action:U(CF,{franchise:d&&`franchise`in d?d.franchise:void 0,currentUris:d?.handles?.map(e=>e.node.uri)??[]})},s),U(IS,{seasons:l?.media?.seasons,currentUris:re,href:e=>`${zf(Q.MEDIA,{uri:e})}${M}`}),m||!l?.media?void 0:U(`div`,{className:`episode-list`,children:f?U(ux,{media:f,tracked:b},s):U(lx,{})})]})]}):U(Ff,{to:`/`})},hI=[{label:`All`,value:null},{label:`Anime`,value:uo.Anime},{label:`Series`,value:uo.Series},{label:`Movies`,value:uo.Movie}],gI=L`
3204
3204
  display: flex;
3205
3205
  gap: 0.6rem;
3206
3206
 
@@ -3222,7 +3222,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3222
3222
  color: #000;
3223
3223
  border-color: #fff;
3224
3224
  }
3225
- `,gI=({value:e,onChange:t})=>U(`div`,{css:hI,children:mI.map(n=>U(`button`,{className:e===n.value?`tab active`:`tab`,onClick:()=>t(n.value),children:n.label},n.label))}),_I=e=>{let t=e.uri??``;return[e._id??``,...t.match(/^ag:\((.*)\)$/)?.[1]?.split(`,`)??[t]].filter(Boolean)},vI=(e,t)=>{let n=new Map;t.forEach((e,t)=>{for(let r of e)n.has(r)||n.set(r,t)});let r=e=>Math.min(..._I(e).map(e=>n.get(e)??1/0)),i=[],a=[];for(let t of e)(r(t)<1/0?i:a).push(t);return i.sort((e,t)=>r(e)-r(t)),[...i,...a]},yI=e=>e.filter(e=>e.popularity!=null).map(_I).filter(e=>e.length);K();var bI=Iv(`
3225
+ `,_I=({value:e,onChange:t})=>U(`div`,{css:gI,children:hI.map(n=>U(`button`,{className:e===n.value?`tab active`:`tab`,onClick:()=>t(n.value),children:n.label},n.label))}),vI=e=>{let t=e.uri??``;return[e._id??``,...t.match(/^ag:\((.*)\)$/)?.[1]?.split(`,`)??[t]].filter(Boolean)},yI=(e,t)=>{let n=new Map;t.forEach((e,t)=>{for(let r of e)n.has(r)||n.set(r,t)});let r=e=>Math.min(...vI(e).map(e=>n.get(e)??1/0)),i=[],a=[];for(let t of e)(r(t)<1/0?i:a).push(t);return i.sort((e,t)=>r(e)-r(t)),[...i,...a]},bI=e=>e.filter(e=>e.popularity!=null).map(vI).filter(e=>e.length);K();var xI=Iv(`
3226
3226
  subscription GetReleasingMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
3227
3227
  mediaPage(input: $input) {
3228
3228
  nodes {
@@ -3257,13 +3257,13 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3257
3257
  }
3258
3258
  }
3259
3259
  }
3260
- `),xI=L`
3260
+ `),SI=L`
3261
3261
  .category-bar {
3262
3262
  position: relative;
3263
3263
  z-index: ${jr.categoryBar};
3264
3264
  padding: 1.5rem 3rem 0.5rem;
3265
3265
  }
3266
- `,SI=os(),CI={season:$f(SI.season),year:SI.year},wI=dp(CI),TI={categories:[uo.Movie]},EI={categories:[uo.Series]},DI={anime:[`season`],movie:[`movies`],series:[`shows`],stub:[`season`,`movies`,`shows`]}[br],OI=(e,t)=>{let[{data:n}]=Za({query:bI,variables:{input:e,shortDescriptionInput:{count:1}},pause:!DI.includes(t)}),r=n?.mediaPage?.nodes,i=q([]);return H(()=>{if(!r?.length||t!==`season`)return r||[];let e=vI(r,i.current);return i.current=yI(e),e},[r])},kI=()=>{let[e]=Df(Rf(Q.MEDIA)),[t,n]=W(null),r={season:OI({season:CI.season,seasonYear:CI.year,sorts:[mo.PopularityDesc],...t?{categories:[t]}:{}},`season`),movies:OI(TI,`movies`),shows:OI(EI,`shows`)};return G(`div`,{css:xI,children:[U(mx,{mediaNodes:r[DI[0]]}),br===`stub`?U(`div`,{className:`category-bar`,children:U(gI,{value:t,onChange:n})}):void 0,DI.includes(`season`)&&U(Kx,{title:`Current season`,titleTo:wI,mediaNodes:r.season}),DI.includes(`movies`)&&(!t||t===uo.Movie)&&U(Kx,{title:`Popular movies`,mediaNodes:r.movies}),DI.includes(`shows`)&&(!t||t===uo.Series)&&U(Kx,{title:`Popular shows`,mediaNodes:r.shows}),e&&U(pI,{mediaNodes:[...r.season,...r.movies,...r.shows]})]})},AI=e=>e>=75?`good`:e>=60?`mixed`:`poor`,jI={good:C_,mixed:m_,poor:o_},MI={good:`#4ade80`,mixed:`#fb923c`,poor:`#f87171`},NI=L`
3266
+ `,CI=os(),wI={season:$f(CI.season),year:CI.year},TI=dp(wI),EI={categories:[uo.Movie]},DI={categories:[uo.Series]},OI={anime:[`season`],movie:[`movies`],series:[`shows`],stub:[`season`,`movies`,`shows`]}[br],kI=(e,t)=>{let[{data:n}]=Za({query:xI,variables:{input:e,shortDescriptionInput:{count:1}},pause:!OI.includes(t)}),r=n?.mediaPage?.nodes,i=q([]);return H(()=>{if(!r?.length||t!==`season`)return r||[];let e=yI(r,i.current);return i.current=bI(e),e},[r])},AI=()=>{let[e]=Df(Rf(Q.MEDIA)),[t,n]=W(null),r={season:kI({season:wI.season,seasonYear:wI.year,sorts:[mo.PopularityDesc],...t?{categories:[t]}:{}},`season`),movies:kI(EI,`movies`),shows:kI(DI,`shows`)};return G(`div`,{css:SI,children:[U(hx,{mediaNodes:r[OI[0]]}),br===`stub`?U(`div`,{className:`category-bar`,children:U(_I,{value:t,onChange:n})}):void 0,OI.includes(`season`)&&U(qx,{title:`Current season`,titleTo:TI,mediaNodes:r.season}),OI.includes(`movies`)&&(!t||t===uo.Movie)&&U(qx,{title:`Popular movies`,mediaNodes:r.movies}),OI.includes(`shows`)&&(!t||t===uo.Series)&&U(qx,{title:`Popular shows`,mediaNodes:r.shows}),e&&U(mI,{mediaNodes:[...r.season,...r.movies,...r.shows]})]})},jI=e=>e>=75?`good`:e>=60?`mixed`:`poor`,MI={good:C_,mixed:m_,poor:o_},NI={good:`#4ade80`,mixed:`#fb923c`,poor:`#f87171`},PI=L`
3267
3267
  display: inline-flex;
3268
3268
  align-items: center;
3269
3269
  gap: 0.6rem;
@@ -3272,7 +3272,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3272
3272
  .face {
3273
3273
  display: flex;
3274
3274
  }
3275
- `,PI=({percent:e,size:t=18})=>{let n=jI[AI(e)];return G(`span`,{css:NI,"aria-label":`Rated ${e} percent`,children:[U(`span`,{className:`face`,style:{color:MI[AI(e)]},children:U(n,{size:t})}),G(`span`,{className:`value`,children:[e,`%`]})]})},FI=e=>{let t=new Map;for(let n of e)for(let e of new Set(n.voiceActors.map(e=>e.language).filter(e=>!!e)))t.set(e,(t.get(e)??0)+1);let n=[...t.keys()].sort((e,n)=>Number(n===`ja`)-Number(e===`ja`)||t.get(n)-t.get(e)||e.localeCompare(n));return{options:n.length<2?[]:n,selected:n[0]}},II=(e,t)=>e.map(e=>({...e,actors:e.voiceActors.filter(e=>(e.language??void 0)===t)})),LI={MAIN:`Main`,SUPPORTING:`Supporting`,BACKGROUND:`Background`},RI=e=>e?LI[e]??e:void 0,zI=new Intl.DisplayNames([`en`],{type:`language`}),BI=e=>/^[a-z]{2,3}$/.test(e)?zI.of(e)??e:e;K();var VI=12,HI=L`
3275
+ `,FI=({percent:e,size:t=18})=>{let n=MI[jI(e)];return G(`span`,{css:PI,"aria-label":`Rated ${e} percent`,children:[U(`span`,{className:`face`,style:{color:NI[jI(e)]},children:U(n,{size:t})}),G(`span`,{className:`value`,children:[e,`%`]})]})},II=e=>{let t=new Map;for(let n of e)for(let e of new Set(n.voiceActors.map(e=>e.language).filter(e=>!!e)))t.set(e,(t.get(e)??0)+1);let n=[...t.keys()].sort((e,n)=>Number(n===`ja`)-Number(e===`ja`)||t.get(n)-t.get(e)||e.localeCompare(n));return{options:n.length<2?[]:n,selected:n[0]}},LI=(e,t)=>e.map(e=>({...e,actors:e.voiceActors.filter(e=>(e.language??void 0)===t)})),RI={MAIN:`Main`,SUPPORTING:`Supporting`,BACKGROUND:`Background`},zI=e=>e?RI[e]??e:void 0,BI=new Intl.DisplayNames([`en`],{type:`language`}),VI=e=>/^[a-z]{2,3}$/.test(e)?BI.of(e)??e:e;K();var HI=12,UI=L`
3276
3276
  /* the footer under it stays below the fold while the page fills, rather than being pushed off it */
3277
3277
  min-height: 100vh;
3278
3278
  padding-bottom: 6rem;
@@ -3762,7 +3762,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3762
3762
  }
3763
3763
  }
3764
3764
  }
3765
- `,UI=({person:e,detail:t,actor:n})=>G(`div`,{className:n?`person actor`:`person`,children:[e.image?U(`img`,{className:`face`,src:e.image,alt:``,loading:`lazy`}):U(`div`,{className:`face`}),G(`div`,{children:[e.url?U(`a`,{className:`name`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.name}):U(`div`,{className:`name`,children:e.name}),t?U(`div`,{className:`detail`,children:t}):void 0]})]}),WI=({characters:e})=>{let t=FI(e),[n,r]=W(),i=II(e,n??t.selected);return G(`section`,{"data-characters":!0,children:[G(`h2`,{children:[U(`span`,{children:`Characters`}),t.options.length?U(`select`,{"aria-label":`Language`,value:n??t.selected,onChange:e=>r(e.currentTarget.value),children:t.options.map(e=>U(`option`,{value:e,children:BI(e)},e))}):void 0]}),U(wy,{items:i,size:VI,label:`Characters`,children:(e,t)=>U(`ul`,{className:`credits`,children:e.map((e,n)=>G(`li`,{children:[U(UI,{person:e,detail:RI(e.role)}),e.actors.length?U(`div`,{className:`actors`,children:e.actors.map(e=>U(UI,{person:e,actor:!0},e.name))}):void 0]},`${e.name}:${t+n}`))})})]})},GI=({staff:e})=>G(`section`,{"data-staff":!0,children:[U(`h2`,{children:`Staff`}),U(wy,{items:e,size:VI,label:`Staff`,children:(e,t)=>U(`ul`,{className:`credits`,children:e.map((e,n)=>U(`li`,{children:U(UI,{person:e,detail:e.roles?.join(`, `)})},`${e.name}:${t+n}`))})})]}),KI=({url:e})=>{let[t,n]=W();return V(()=>{st(()=>import(`./theme-player-BsVznGeU.js`).then(e=>n(()=>e.default)),__vite__mapDeps([5,6,3,7]),import.meta.url).catch(()=>n(()=>({url:e})=>U(`video`,{src:e,controls:!0,autoPlay:!0,playsInline:!0})))},[]),U(`div`,{className:`player`,children:t?U(t,{url:e}):void 0})},qI=({themes:e})=>{let[t,n]=W();return U(`ul`,{className:`themes`,children:e.map((e,r)=>{let i=e.video;return G(`li`,{children:[G(`div`,{className:`theme`,children:[i?U(`button`,{type:`button`,className:`toggle`,"aria-label":t===r?`Stop`:`Play`,onClick:()=>n(t===r?void 0:r),children:U(t===r?w_:tt,{size:14,fill:`currentColor`})}):U(`span`,{className:`toggle`}),G(`span`,{className:`kind`,children:[e.kind,e.sequence??``]}),U(`span`,{className:`song`,children:e.title}),U(`span`,{className:`artists`,children:e.artists.join(`, `)})]}),t===r&&i?U(KI,{url:i}):void 0]},r)})})},JI=({themes:e})=>G(`section`,{"data-themes":!0,children:[U(`h2`,{children:`Themes`}),U(wy,{items:e,size:VI,label:`Themes`,children:(e,t)=>U(qI,{themes:e},t)})]}),YI=()=>{let e=Sf(),t=o(e.uri),[,n]=wf(),r=tS(Tf()),[s,c]=W(t);V(()=>{c(e=>e&&a(e,t??``)?e:t)},[t]);let[{data:l,operation:u}]=Za({query:Gb,variables:{input:{uri:s,details:!0},descriptionInput:{type:fo.Html},details:!0},pause:!s}),d=l?.media,f=d?.handles.map(e=>e.node.uri)??[],p=By({data:l,operation:u},s),m=qb(d?.uri),h=q(void 0);et(()=>{!PS(d?.seasons,f)&&_(d?.uri,t,h.current)&&(h.current=d.uri,n(`${zf(Q.TITLE,{uri:d.uri})}${location.search}`,{replace:!0}))},[d?.uri,t]);let g=xy(d?.banners,d),v=xy(d?.covers,d),y=d?.titles.at(0)?.title,b=Lb(d?.titles),x=d?.descriptions.map(({description:e})=>e).sort((e,t)=>t.length-e.length).at(0),S=!!(d&&ib(d)),C=S?d.episodes.at(0):void 0,{sources:w,answered:T}=ex(C,d?.uri??``,d?.handles),E=tx(s,p?.settled&&T),D=i(s??``).some(e=>Cr.includes(e)),O=S&&bb({startDate:d.startDate,status:d.status,episode:d.episodes.at(0)}).upcoming,k=Bb(d??{},{},D&&!E,O),A=d?Rb(d):[],j=zb(d??{}),M=d?vp(d.season,d.seasonYear):void 0,[N,P]=W(!1),[ee,te]=W(!1),ne=q(null);et(()=>{let e=ne.current;e&&!N&&te(e.scrollHeight>e.clientHeight+1)},[x,N]),V(()=>{P(!1)},[s]);let[F,I]=W(!1),re=async()=>{if(!d)return;let e=`${location.origin}${zf(Q.TITLE,{uri:d.uri})}`;if(navigator.share)return navigator.share({title:y,url:e}).catch(()=>{});try{await navigator.clipboard.writeText(e),I(!0),setTimeout(()=>I(!1),1500)}catch{}},ie=d?.trailers.at(0)?.url;return G(`div`,{css:HI,children:[U(`div`,{className:`banner`,children:g??v?U(`div`,{className:g?`image`:`image blurred`,style:{backgroundImage:`url(${g??v})`}}):void 0}),G(`div`,{className:`body`,children:[v?U(`img`,{className:`cover`,src:v,alt:``}):U(`div`,{className:`cover`}),G(`div`,{className:`heading`,children:[M?U(`div`,{className:`season`,children:M}):E?void 0:U(`div`,{className:`season`,children:U(ty,{className:`pending`})}),U(`h1`,{children:y??(E?void 0:U(ny,{count:2,className:`pending`}))}),b?U(`div`,{className:`second`,children:b}):D&&!E?U(`div`,{className:`second`,children:U(ty,{className:`pending`})}):void 0,A.length||d?.averageScore!=null||j.length?G(`div`,{className:`chips`,children:[A.map(e=>U(`span`,{className:`chip`,children:e},e)),d?.averageScore==null?void 0:U(`span`,{className:`chip`,children:U(PI,{percent:d.averageScore,size:16})}),j.map(e=>U(`span`,{className:`chip`,children:e},e))]}):E?void 0:U(`div`,{className:`chips`,children:U(ty,{className:`pending`})}),x?U(`div`,{ref:ne,className:N?`description`:`description clamped`,dangerouslySetInnerHTML:{__html:x}}):E?void 0:U(ny,{count:5,className:`description`}),x&&(ee||N)?U(`button`,{type:`button`,className:`expand`,onClick:()=>P(!N),children:N?`Collapse`:`Expand`}):void 0,S?U(Fy,{film:!0,sources:w,pending:!E}):void 0]}),G(`div`,{className:`actions`,children:[d?G(`div`,{className:`buttons`,children:[U(Jb,{media:d}),U(`button`,{type:`button`,className:`icon`,onClick:re,"aria-label":F?`Copied`:`Share`,title:F?`Copied`:`Share`,children:U(F?Ye:S_,{size:20})}),ie?U(`a`,{className:`icon`,href:ie,target:`_blank`,rel:`noreferrer`,"aria-label":`Trailer`,title:`Trailer`,children:U(r_,{size:20})}):void 0,U(rx,{uri:d.uri,handles:d.handles,except:$b(C,d.handles)})]}):U(`div`,{className:`buttons`,children:U(ty,{className:`play-pending`})}),U(`div`,{className:`tracking`,children:U(sI,{work:s,address:t,uri:p?.uri,title:y,cover:v,episodeCount:p?.episodeCount,movie:S})})]}),k.length?U(`dl`,{className:`facts`,children:k.map(({label:e,value:t})=>t?G(`div`,{children:[U(`dt`,{children:e}),U(`dd`,{children:t})]},e):G(`div`,{className:`fact placeholder`,"aria-hidden":`true`,children:[U(`dt`,{children:e}),U(`dd`,{children:U(ty,{className:`pending`})})]},e))}):void 0,G(`div`,{className:`main`,children:[U(MS,{relations:d?.relations??[],action:U(SF,{franchise:d?.franchise,currentUris:f,route:Q.TITLE}),route:Q.TITLE,pending:D&&!E}),U(FS,{seasons:d?.seasons,currentUris:f,href:e=>`${zf(Q.TITLE,{uri:e})}${r}`}),d&&!S?G(`section`,{"data-episodes":!0,children:[U(`h2`,{children:`Episodes`}),p?U(lx,{media:p,tracked:m}):U(cx,{})]}):void 0,d?.characters?.length?U(WI,{characters:d.characters}):void 0,d?.staff?.length?U(GI,{staff:d.staff}):void 0,d?.themes?.length?U(JI,{themes:d.themes}):void 0]},s)]})]})};K();var XI=`t`,ZI=(e,t)=>`${e}?${XI}=${Math.max(0,Math.floor(t))}`,QI=e=>{let t=new URLSearchParams(e).get(XI);return t&&/^\d+$/.test(t)?Number(t):void 0},$I=(e,t,n,r,i)=>{let a=q({uris:n,guest:r,start:i});a.current={uris:n,guest:r,start:i},V(()=>{if(!e||!t)return;let n=!1,r,i=!1,o=()=>{document.visibilityState===`hidden`&&Qc.flush()};document.addEventListener(`visibilitychange`,o);let s=e.onReport(o=>{let s=e.duration?.();if(!n&&s!==0){n=!0;let{uris:t,guest:r,start:i}=a.current,c=i??el(t)?.[1];c!==void 0&&!r&&(i!==void 0||o.time<30)&&(!s||c<s)&&e.apply({...o,time:c,at:Date.now()})}let c=e.ended?.();(o.time!==r||c)&&nl(t,{time:o.time,duration:s,ended:c}),o.paused&&!i&&Qc.flush(),r=o.time,i=o.paused});return()=>{s(),document.removeEventListener(`visibilitychange`,o),Qc.flush()}},[e,t])};K();var eL=Iv(`
3765
+ `,WI=({person:e,detail:t,actor:n})=>G(`div`,{className:n?`person actor`:`person`,children:[e.image?U(`img`,{className:`face`,src:e.image,alt:``,loading:`lazy`}):U(`div`,{className:`face`}),G(`div`,{children:[e.url?U(`a`,{className:`name`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.name}):U(`div`,{className:`name`,children:e.name}),t?U(`div`,{className:`detail`,children:t}):void 0]})]}),GI=({characters:e})=>{let t=II(e),[n,r]=W(),i=LI(e,n??t.selected);return G(`section`,{"data-characters":!0,children:[G(`h2`,{children:[U(`span`,{children:`Characters`}),t.options.length?U(`select`,{"aria-label":`Language`,value:n??t.selected,onChange:e=>r(e.currentTarget.value),children:t.options.map(e=>U(`option`,{value:e,children:VI(e)},e))}):void 0]}),U(Ty,{items:i,size:HI,label:`Characters`,children:(e,t)=>U(`ul`,{className:`credits`,children:e.map((e,n)=>G(`li`,{children:[U(WI,{person:e,detail:zI(e.role)}),e.actors.length?U(`div`,{className:`actors`,children:e.actors.map(e=>U(WI,{person:e,actor:!0},e.name))}):void 0]},`${e.name}:${t+n}`))})})]})},KI=({staff:e})=>G(`section`,{"data-staff":!0,children:[U(`h2`,{children:`Staff`}),U(Ty,{items:e,size:HI,label:`Staff`,children:(e,t)=>U(`ul`,{className:`credits`,children:e.map((e,n)=>U(`li`,{children:U(WI,{person:e,detail:e.roles?.join(`, `)})},`${e.name}:${t+n}`))})})]}),qI=({url:e})=>{let[t,n]=W();return V(()=>{st(()=>import(`./theme-player-BsVznGeU.js`).then(e=>n(()=>e.default)),__vite__mapDeps([5,6,3,7]),import.meta.url).catch(()=>n(()=>({url:e})=>U(`video`,{src:e,controls:!0,autoPlay:!0,playsInline:!0})))},[]),U(`div`,{className:`player`,children:t?U(t,{url:e}):void 0})},JI=({themes:e})=>{let[t,n]=W();return U(`ul`,{className:`themes`,children:e.map((e,r)=>{let i=e.video;return G(`li`,{children:[G(`div`,{className:`theme`,children:[i?U(`button`,{type:`button`,className:`toggle`,"aria-label":t===r?`Stop`:`Play`,onClick:()=>n(t===r?void 0:r),children:U(t===r?w_:tt,{size:14,fill:`currentColor`})}):U(`span`,{className:`toggle`}),G(`span`,{className:`kind`,children:[e.kind,e.sequence??``]}),U(`span`,{className:`song`,children:e.title}),U(`span`,{className:`artists`,children:e.artists.join(`, `)})]}),t===r&&i?U(qI,{url:i}):void 0]},r)})})},YI=({themes:e})=>G(`section`,{"data-themes":!0,children:[U(`h2`,{children:`Themes`}),U(Ty,{items:e,size:HI,label:`Themes`,children:(e,t)=>U(JI,{themes:e},t)})]}),XI=()=>{let e=Sf(),t=o(e.uri),[,n]=wf(),r=nS(Tf()),[s,c]=W(t);V(()=>{c(e=>e&&a(e,t??``)?e:t)},[t]);let[{data:l,operation:u}]=Za({query:Kb,variables:{input:{uri:s,details:!0},descriptionInput:{type:fo.Html},details:!0},pause:!s}),d=l?.media,f=d?.handles.map(e=>e.node.uri)??[],p=Vy({data:l,operation:u},s),m=Jb(d?.uri),h=q(void 0);et(()=>{!FS(d?.seasons,f)&&_(d?.uri,t,h.current)&&(h.current=d.uri,n(`${zf(Q.TITLE,{uri:d.uri})}${location.search}`,{replace:!0}))},[d?.uri,t]);let g=Sy(d?.banners,d),v=Sy(d?.covers,d),y=d?.titles.at(0)?.title,b=Rb(d?.titles),x=d?.descriptions.map(({description:e})=>e).sort((e,t)=>t.length-e.length).at(0),S=!!(d&&ab(d)),C=S?d.episodes.at(0):void 0,{sources:w,answered:T}=tx(C,d?.uri??``,d?.handles),E=nx(s,p?.settled&&T),D=i(s??``).some(e=>Cr.includes(e)),O=S&&xb({startDate:d.startDate,status:d.status,episode:d.episodes.at(0)}).upcoming,k=Vb(d??{},{},D&&!E,O),A=d?zb(d):[],j=Bb(d??{}),M=d?vp(d.season,d.seasonYear):void 0,[N,P]=W(!1),[ee,te]=W(!1),ne=q(null);et(()=>{let e=ne.current;e&&!N&&te(e.scrollHeight>e.clientHeight+1)},[x,N]),V(()=>{P(!1)},[s]);let[F,I]=W(!1),re=async()=>{if(!d)return;let e=`${location.origin}${zf(Q.TITLE,{uri:d.uri})}`;if(navigator.share)return navigator.share({title:y,url:e}).catch(()=>{});try{await navigator.clipboard.writeText(e),I(!0),setTimeout(()=>I(!1),1500)}catch{}},ie=d?.trailers.at(0)?.url;return G(`div`,{css:UI,children:[U(`div`,{className:`banner`,children:g??v?U(`div`,{className:g?`image`:`image blurred`,style:{backgroundImage:`url(${g??v})`}}):void 0}),G(`div`,{className:`body`,children:[v?U(`img`,{className:`cover`,src:v,alt:``}):U(`div`,{className:`cover`}),G(`div`,{className:`heading`,children:[M?U(`div`,{className:`season`,children:M}):E?void 0:U(`div`,{className:`season`,children:U(ty,{className:`pending`})}),U(`h1`,{children:y??(E?void 0:U(ny,{count:2,className:`pending`}))}),b?U(`div`,{className:`second`,children:b}):D&&!E?U(`div`,{className:`second`,children:U(ty,{className:`pending`})}):void 0,A.length||d?.averageScore!=null||j.length?G(`div`,{className:`chips`,children:[A.map(e=>U(`span`,{className:`chip`,children:e},e)),d?.averageScore==null?void 0:U(`span`,{className:`chip`,children:U(FI,{percent:d.averageScore,size:16})}),j.map(e=>U(`span`,{className:`chip`,children:e},e))]}):E?void 0:U(`div`,{className:`chips`,children:U(ty,{className:`pending`})}),x?U(`div`,{ref:ne,className:N?`description`:`description clamped`,dangerouslySetInnerHTML:{__html:x}}):E?void 0:U(ny,{count:5,className:`description`}),x&&(ee||N)?U(`button`,{type:`button`,className:`expand`,onClick:()=>P(!N),children:N?`Collapse`:`Expand`}):void 0,S?U(Iy,{film:!0,sources:w,pending:!E}):void 0]}),G(`div`,{className:`actions`,children:[d?G(`div`,{className:`buttons`,children:[U(Yb,{media:d}),U(`button`,{type:`button`,className:`icon`,onClick:re,"aria-label":F?`Copied`:`Share`,title:F?`Copied`:`Share`,children:U(F?Ye:S_,{size:20})}),ie?U(`a`,{className:`icon`,href:ie,target:`_blank`,rel:`noreferrer`,"aria-label":`Trailer`,title:`Trailer`,children:U(r_,{size:20})}):void 0,U(ix,{uri:d.uri,handles:d.handles,except:ex(C,d.handles)})]}):U(`div`,{className:`buttons`,children:U(ty,{className:`play-pending`})}),U(`div`,{className:`tracking`,children:U(cI,{work:s,address:t,uri:p?.uri,title:y,cover:v,episodeCount:p?.episodeCount,movie:S})})]}),k.length?U(`dl`,{className:`facts`,children:k.map(({label:e,value:t})=>t?G(`div`,{children:[U(`dt`,{children:e}),U(`dd`,{children:t})]},e):G(`div`,{className:`fact placeholder`,"aria-hidden":`true`,children:[U(`dt`,{children:e}),U(`dd`,{children:U(ty,{className:`pending`})})]},e))}):void 0,G(`div`,{className:`main`,children:[U(NS,{relations:d?.relations??[],action:U(CF,{franchise:d?.franchise,currentUris:f,route:Q.TITLE}),route:Q.TITLE,pending:D&&!E}),U(IS,{seasons:d?.seasons,currentUris:f,href:e=>`${zf(Q.TITLE,{uri:e})}${r}`}),d&&!S?G(`section`,{"data-episodes":!0,children:[U(`h2`,{children:`Episodes`}),p?U(ux,{media:p,tracked:m}):U(lx,{})]}):void 0,d?.characters?.length?U(GI,{characters:d.characters}):void 0,d?.staff?.length?U(KI,{staff:d.staff}):void 0,d?.themes?.length?U(YI,{themes:d.themes}):void 0]},s)]})]})};K();var ZI=`t`,QI=(e,t)=>`${e}?${ZI}=${Math.max(0,Math.floor(t))}`,$I=e=>{let t=new URLSearchParams(e).get(ZI);return t&&/^\d+$/.test(t)?Number(t):void 0},eL=(e,t,n,r,i)=>{let a=q({uris:n,guest:r,start:i});a.current={uris:n,guest:r,start:i},V(()=>{if(!e||!t)return;let n=!1,r,i=!1,o=()=>{document.visibilityState===`hidden`&&Qc.flush()};document.addEventListener(`visibilitychange`,o);let s=e.onReport(o=>{let s=e.duration?.();if(!n&&s!==0){n=!0;let{uris:t,guest:r,start:i}=a.current,c=i??el(t)?.[1];c!==void 0&&!r&&(i!==void 0||o.time<30)&&(!s||c<s)&&e.apply({...o,time:c,at:Date.now()})}let c=e.ended?.();(o.time!==r||c)&&nl(t,{time:o.time,duration:s,ended:c}),o.paused&&!i&&Qc.flush(),r=o.time,i=o.paused});return()=>{s(),document.removeEventListener(`visibilitychange`,o),Qc.flush()}},[e,t])};K();var tL=Iv(`
3766
3766
  subscription SceneMedia($input: MediaInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
3767
3767
  media(input: $input) {
3768
3768
  ...SearchCard
@@ -3773,7 +3773,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3773
3773
  }
3774
3774
  }
3775
3775
  }
3776
- `),tL=e=>{let[t,n]=W();return V(()=>{if(!e)return;let t=!0;return Ht(e).catch(()=>({error:Hf.busy})).then(r=>{t&&n({code:e,answer:r})}),()=>{t=!1}},[e]),t&&t.code===e?t.answer:void 0},nL=(e,t)=>{let n=q(e);n.current=e,V(()=>{if(!t)return;let e=e=>{let t=e.clipboardData?.files[0];t&&!e.clipboardData.types.includes(`text/plain`)&&(e.preventDefault(),n.current(t))},r=e=>{e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()},i=e=>{let t=e.dataTransfer?.files[0];t&&(e.preventDefault(),n.current(t))};return document.addEventListener(`paste`,e),document.addEventListener(`dragover`,r),document.addEventListener(`drop`,i),()=>{document.removeEventListener(`paste`,e),document.removeEventListener(`dragover`,r),document.removeEventListener(`drop`,i)}},[t])},rL=({onPicture:e})=>{let t=q(null);return G(z,{children:[U(`button`,{type:`button`,className:`picture`,"aria-label":`Search by picture`,title:`Search by picture`,onClick:()=>t.current?.click(),children:U(u_,{size:17})}),U(`input`,{ref:t,type:`file`,accept:`image/*`,hidden:!0,onChange:t=>{let n=t.currentTarget.files?.[0];t.currentTarget.value=``,n&&e(n)}})]})},iL=({match:e,item:t})=>{let[{data:n}]=Za({query:eL,variables:{input:{uri:`anilist:${e.anilist}`},shortDescriptionInput:{count:1}}}),r=n?.media;if(!r)return U(ty,{className:`pending`});let i=r.type===go.Movie;return G(`div`,{className:`scene`,children:[t(r),U(`div`,{className:`moments`,children:e.moments.map(e=>{if(e.episode==null&&!i)return;let t=Uf(i?{...e,episode:null}:e),n=r.episodes.find(t=>t.episodeNumber===e.episode)??(i?r.episodes[0]:void 0);return n?G(Mf,{className:`moment`,href:ZI(zf(Q.WATCH,{mediaUri:r.uri,episodeUri:n.uri}),e.from),children:[U(tt,{size:14,fill:`currentColor`,"aria-hidden":`true`}),t]},t):U(`span`,{className:`moment`,children:t},t)})})]})},aL=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,oL=new Uint8Array(256);for(let e=0;e<64;e++)oL[aL.charCodeAt(e)]=e;function sL(e){let t=``,n=e.length,r=0;for(;r+2<n;r+=3){let n=e[r],i=e[r+1],a=e[r+2];t+=aL[n>>2]+aL[(n&3)<<4|i>>4]+aL[(i&15)<<2|a>>6]+aL[a&63]}if(r<n){let i=e[r];if(r+1<n){let n=e[r+1];t+=aL[i>>2]+aL[(i&3)<<4|n>>4]+aL[(n&15)<<2]}else t+=aL[i>>2]+aL[(i&3)<<4]}return t}function cL(e){let t=e.length;if(t===0)return new Uint8Array;let n=t%4,r=Math.floor(t/4),i=r*3;n===2?i+=1:n===3&&(i+=2);let a=new Uint8Array(i),o=0,s=0;for(let t=0;t<r;t++,s+=4){let t=oL[e.charCodeAt(s)],n=oL[e.charCodeAt(s+1)],r=oL[e.charCodeAt(s+2)],i=oL[e.charCodeAt(s+3)];a[o++]=t<<2|n>>4,a[o++]=(n&15)<<4|r>>2,a[o++]=(r&3)<<6|i}if(n===2){let t=oL[e.charCodeAt(s)],n=oL[e.charCodeAt(s+1)];a[o++]=t<<2|n>>4}else if(n===3){let t=oL[e.charCodeAt(s)],n=oL[e.charCodeAt(s+1)],r=oL[e.charCodeAt(s+2)];a[o++]=t<<2|n>>4,a[o++]=(n&15)<<4|r>>2}return a}var lL=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),uL=[[.3535534,.3535534,.3535534,.3535534,.3535534,.3535534,.3535534,.3535534],[.4903926,.4157348,.2777851,.09754516,-.09754516,-.2777851,-.4157348,-.4903926],[.4619398,.1913417,-.1913417,-.4619398,-.4619398,-.1913417,.1913417,.4619398],[.4157348,-.09754516,-.4903926,-.2777851,.2777851,.4903926,.09754516,-.4157348],[.3535534,-.3535534,-.3535534,.3535534,.3535534,-.3535534,-.3535534,.3535534],[.2777851,-.4903926,.09754516,.4157348,-.4157348,-.09754516,.4903926,-.2777851],[.1913417,-.4619398,.4619398,-.1913417,-.1913417,.4619398,-.4619398,.1913417],[.09754516,-.2777851,.4157348,-.4903926,.4903926,-.4157348,.2777851,-.09754516]],dL=[new Int32Array(64).fill(1),new Int32Array(64).fill(1),new Int32Array(64).fill(1)];dL[0][0]=2,dL[0][1]=2,dL[0][2]=2,dL[1][0]=2,dL[1][1]=1,dL[1][2]=1,dL[2][0]=4,dL[2][1]=2,dL[2][2]=2;function fL(e){return e>192?112+(e-192>>2):e>160?96+(e-160>>1):e>96?32+(e-96):e>64?16+(e-64>>1):e>>2}function pL(e){return e>191?63:e>160?56+(e-160>>2):e>144?48+(e-144>>1):e>112?16+(e-112):e>96?8+(e-96>>1):e>64?e-64>>2:0}function mL(e){let t=e;t>255&&(t=255),t<-256&&(t=-256);let n=Math.abs(t),r;return r=n>127?64+(n>>2):n>63?32+(n>>1):n,r=t<0?-r:r,r+128}var hL=new Float32Array(64);function gL(e){for(let t=0;t<8;t++)for(let n=0;n<8;n++){let r=0;for(let i=0;i<8;i++)r+=uL[n][i]*e[8*t+i];hL[8*t+n]=r}for(let t=0;t<8;t++)for(let n=0;n<8;n++){let r=0;for(let e=0;e<8;e++)r+=uL[n][e]*hL[8*e+t];e[8*n+t]=Math.floor(r+.499999)}}function _L(e){let t=new Uint8Array(21),n=0,r=(e,r)=>{for(let i=r-1;i>=0;i--){let r=e>>i&1,a=n>>3,o=7-(n&7);t[a]|=r<<o,n++}};r(e[0],6);for(let t=1;t<=20;t++)r(e[t],5);r(e[21],6);for(let t=22;t<=26;t++)r(e[t],5);r(e[27],6);for(let t=28;t<=32;t++)r(e[t],5);return sL(t)}function vL(e){let t=cL(e),n=0,r=e=>{let r=0;for(let i=0;i<e;i++){let e=n>>3,i=7-(n&7);r=r<<1|t[e]>>i&1,n++}return r},i=Array(33);i[0]=r(6);for(let e=1;e<=20;e++)i[e]=r(5);i[21]=r(6);for(let e=22;e<=26;e++)i[e]=r(5);i[27]=r(6);for(let e=28;e<=32;e++)i[e]=r(5);return i}function yL(e){let t=e.width,n=e.height,r=e.channels??4,i=e.data,a=new Float32Array(64),o=new Float32Array(64),s=new Float32Array(64),c=new Uint32Array(9),l=new Uint32Array(9);for(let e=0;e<=8;e++)c[e]=Math.ceil(e*t/8),l[e]=Math.ceil(e*n/8);let u=0;for(let e=0;e<8;e++){let t=l[e+1];for(let n=l[e];n<t;n++)for(let t=0;t<8;t++){let n=c[t+1],l=(e<<3)+t,d=a[l],f=o[l],p=s[l];for(let e=c[t];e<n;e++)d+=i[u],f+=i[u+1],p+=i[u+2],u+=r;a[l]=d,o[l]=f,s[l]=p}}let d=[new Int16Array(64),new Int16Array(64),new Int16Array(64)];for(let e=0;e<8;e++){let t=l[e+1]-l[e];for(let n=0;n<8;n++){let r=(c[n+1]-c[n])*t,i=(e<<3)+n;if(r!==0){let e=1/(r*256),t=a[i]*e,n=o[i]*e,c=s[i]*e,l=.299*t+.587*n+.114*c;d[0][i]=Math.floor(219*l+16.5),d[1][i]=Math.floor(126.336*(c-l)+128.5),d[2][i]=Math.floor(159.712*(t-l)+128.5)}}}gL(d[0]),gL(d[1]),gL(d[2]);let f=new Int16Array(64),p=new Int16Array(64),m=new Int16Array(64);f[0]=fL(d[0][0]>>3)>>1,p[0]=pL(d[1][0]>>3),m[0]=pL(d[2][0]>>3);for(let e=1;e<64;e++){let t=lL[e];f[e]=mL(d[0][t]>>1)>>3,p[e]=mL(d[1][t])>>3,m[e]=mL(d[2][t])>>3}let h=Array(33);for(let e=0;e<21;e++)h[e]=f[e];for(let e=0;e<6;e++)h[e+21]=p[e],h[e+21+6]=m[e];return h}var bL={extract(e){return yL(e)},encode:_L,decode:vL,distance(e,t){let n=e=>typeof e==`string`?vL(e):e,r=n(e),i=n(t),a=0,o=0,s=0;for(let e=0;e<21;e++){let t=r[e]-i[e];a+=dL[0][e]*t*t}for(let e=0;e<6;e++){let t=r[21+e]-i[21+e];o+=dL[1][e]*t*t;let n=r[27+e]-i[27+e];s+=dL[2][e]*n*n}return Math.sqrt(a)+Math.sqrt(o)+Math.sqrt(s)}},xL=Math.SQRT2;-xL,-xL;var SL=640,CL=24,wL=.25,TL=(e,t)=>{let n=e.findIndex(e=>e>t);return n<0?void 0:[n,e.findLastIndex(e=>e>t)+1]},EL=({data:e,width:t,height:n},r)=>{let i=(n,r)=>{let i=(r*t+n)*4;return Math.max(e[i],e[i+1],e[i+2])>CL},a=(e,t)=>{let n=0;for(let r=0;r<e;r++)t(r)&&n++;return n},o=TL(Array.from({length:n},(e,n)=>a(t,e=>i(e,n))),r*t);if(!o)return;let[s,c]=o,l=TL(Array.from({length:t},(e,t)=>a(c-s,e=>i(t,s+e))),r*(c-s));return l&&{x:l[0],y:s,width:l[1]-l[0],height:c-s}},DL=e=>{let t=EL(e,0)??{x:0,y:0,width:e.width,height:e.height};return t.width>t.height?t:EL(e,wL)??t},OL=e=>{let t=DL(e),n=new Uint8ClampedArray(t.width*t.height*4);for(let r=0;r<t.height;r++){let i=((t.y+r)*e.width+t.x)*4;n.set(e.data.subarray(i,i+t.width*4),r*t.width*4)}return _L(bL.extract({data:n,width:t.width,height:t.height,channels:4}))},kL=async e=>{let t=await createImageBitmap(e),n=Math.min(1,SL/t.width),r=Math.max(1,Math.round(t.width*n)),i=Math.max(1,Math.round(t.height*n)),a=new OffscreenCanvas(r,i).getContext(`2d`);return a.drawImage(t,0,0,r,i),t.close(),OL(a.getImageData(0,0,r,i))},AL=(e,t)=>{let n=e.nextAiringEpisode?.airingAt;if(!n)return;let r=new Date(n).getTime();return Number.isFinite(r)?r-t:void 0},jL=e=>e==null?void 0:`${e} episode${e===1?``:`s`}`,ML=(e,t)=>{if(!e)return;let n=e.trim().replace(/^#/,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n.length===6?n:void 0;if(!r||!/^[0-9a-f]{6}$/i.test(r))return;let i=parseInt(r,16);return`rgba(${i>>16&255}, ${i>>8&255}, ${i&255}, ${t})`},NL=e=>({"--accent":ML(e,1)??`rgba(255, 255, 255, 0.75)`,"--accent-soft":ML(e,.18)??`rgba(255, 255, 255, 0.08)`,"--accent-wash":ML(e,.07)??`rgba(255, 255, 255, 0.03)`}),PL=L`
3776
+ `),nL=e=>{let[t,n]=W();return V(()=>{if(!e)return;let t=!0;return Ht(e).catch(()=>({error:Hf.busy})).then(r=>{t&&n({code:e,answer:r})}),()=>{t=!1}},[e]),t&&t.code===e?t.answer:void 0},rL=(e,t)=>{let n=q(e);n.current=e,V(()=>{if(!t)return;let e=e=>{let t=e.clipboardData?.files[0];t&&!e.clipboardData.types.includes(`text/plain`)&&(e.preventDefault(),n.current(t))},r=e=>{e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()},i=e=>{let t=e.dataTransfer?.files[0];t&&(e.preventDefault(),n.current(t))};return document.addEventListener(`paste`,e),document.addEventListener(`dragover`,r),document.addEventListener(`drop`,i),()=>{document.removeEventListener(`paste`,e),document.removeEventListener(`dragover`,r),document.removeEventListener(`drop`,i)}},[t])},iL=({onPicture:e})=>{let t=q(null);return G(z,{children:[U(`button`,{type:`button`,className:`picture`,"aria-label":`Search by picture`,title:`Search by picture`,onClick:()=>t.current?.click(),children:U(u_,{size:17})}),U(`input`,{ref:t,type:`file`,accept:`image/*`,hidden:!0,onChange:t=>{let n=t.currentTarget.files?.[0];t.currentTarget.value=``,n&&e(n)}})]})},aL=({match:e,item:t})=>{let[{data:n}]=Za({query:tL,variables:{input:{uri:`anilist:${e.anilist}`},shortDescriptionInput:{count:1}}}),r=n?.media;if(!r)return U(ty,{className:`pending`});let i=r.type===go.Movie;return G(`div`,{className:`scene`,children:[t(r),U(`div`,{className:`moments`,children:e.moments.map(e=>{if(e.episode==null&&!i)return;let t=Uf(i?{...e,episode:null}:e),n=r.episodes.find(t=>t.episodeNumber===e.episode)??(i?r.episodes[0]:void 0);return n?G(Mf,{className:`moment`,href:QI(zf(Q.WATCH,{mediaUri:r.uri,episodeUri:n.uri}),e.from),children:[U(tt,{size:14,fill:`currentColor`,"aria-hidden":`true`}),t]},t):U(`span`,{className:`moment`,children:t},t)})})]})},oL=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,sL=new Uint8Array(256);for(let e=0;e<64;e++)sL[oL.charCodeAt(e)]=e;function cL(e){let t=``,n=e.length,r=0;for(;r+2<n;r+=3){let n=e[r],i=e[r+1],a=e[r+2];t+=oL[n>>2]+oL[(n&3)<<4|i>>4]+oL[(i&15)<<2|a>>6]+oL[a&63]}if(r<n){let i=e[r];if(r+1<n){let n=e[r+1];t+=oL[i>>2]+oL[(i&3)<<4|n>>4]+oL[(n&15)<<2]}else t+=oL[i>>2]+oL[(i&3)<<4]}return t}function lL(e){let t=e.length;if(t===0)return new Uint8Array;let n=t%4,r=Math.floor(t/4),i=r*3;n===2?i+=1:n===3&&(i+=2);let a=new Uint8Array(i),o=0,s=0;for(let t=0;t<r;t++,s+=4){let t=sL[e.charCodeAt(s)],n=sL[e.charCodeAt(s+1)],r=sL[e.charCodeAt(s+2)],i=sL[e.charCodeAt(s+3)];a[o++]=t<<2|n>>4,a[o++]=(n&15)<<4|r>>2,a[o++]=(r&3)<<6|i}if(n===2){let t=sL[e.charCodeAt(s)],n=sL[e.charCodeAt(s+1)];a[o++]=t<<2|n>>4}else if(n===3){let t=sL[e.charCodeAt(s)],n=sL[e.charCodeAt(s+1)],r=sL[e.charCodeAt(s+2)];a[o++]=t<<2|n>>4,a[o++]=(n&15)<<4|r>>2}return a}var uL=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),dL=[[.3535534,.3535534,.3535534,.3535534,.3535534,.3535534,.3535534,.3535534],[.4903926,.4157348,.2777851,.09754516,-.09754516,-.2777851,-.4157348,-.4903926],[.4619398,.1913417,-.1913417,-.4619398,-.4619398,-.1913417,.1913417,.4619398],[.4157348,-.09754516,-.4903926,-.2777851,.2777851,.4903926,.09754516,-.4157348],[.3535534,-.3535534,-.3535534,.3535534,.3535534,-.3535534,-.3535534,.3535534],[.2777851,-.4903926,.09754516,.4157348,-.4157348,-.09754516,.4903926,-.2777851],[.1913417,-.4619398,.4619398,-.1913417,-.1913417,.4619398,-.4619398,.1913417],[.09754516,-.2777851,.4157348,-.4903926,.4903926,-.4157348,.2777851,-.09754516]],fL=[new Int32Array(64).fill(1),new Int32Array(64).fill(1),new Int32Array(64).fill(1)];fL[0][0]=2,fL[0][1]=2,fL[0][2]=2,fL[1][0]=2,fL[1][1]=1,fL[1][2]=1,fL[2][0]=4,fL[2][1]=2,fL[2][2]=2;function pL(e){return e>192?112+(e-192>>2):e>160?96+(e-160>>1):e>96?32+(e-96):e>64?16+(e-64>>1):e>>2}function mL(e){return e>191?63:e>160?56+(e-160>>2):e>144?48+(e-144>>1):e>112?16+(e-112):e>96?8+(e-96>>1):e>64?e-64>>2:0}function hL(e){let t=e;t>255&&(t=255),t<-256&&(t=-256);let n=Math.abs(t),r;return r=n>127?64+(n>>2):n>63?32+(n>>1):n,r=t<0?-r:r,r+128}var gL=new Float32Array(64);function _L(e){for(let t=0;t<8;t++)for(let n=0;n<8;n++){let r=0;for(let i=0;i<8;i++)r+=dL[n][i]*e[8*t+i];gL[8*t+n]=r}for(let t=0;t<8;t++)for(let n=0;n<8;n++){let r=0;for(let e=0;e<8;e++)r+=dL[n][e]*gL[8*e+t];e[8*n+t]=Math.floor(r+.499999)}}function vL(e){let t=new Uint8Array(21),n=0,r=(e,r)=>{for(let i=r-1;i>=0;i--){let r=e>>i&1,a=n>>3,o=7-(n&7);t[a]|=r<<o,n++}};r(e[0],6);for(let t=1;t<=20;t++)r(e[t],5);r(e[21],6);for(let t=22;t<=26;t++)r(e[t],5);r(e[27],6);for(let t=28;t<=32;t++)r(e[t],5);return cL(t)}function yL(e){let t=lL(e),n=0,r=e=>{let r=0;for(let i=0;i<e;i++){let e=n>>3,i=7-(n&7);r=r<<1|t[e]>>i&1,n++}return r},i=Array(33);i[0]=r(6);for(let e=1;e<=20;e++)i[e]=r(5);i[21]=r(6);for(let e=22;e<=26;e++)i[e]=r(5);i[27]=r(6);for(let e=28;e<=32;e++)i[e]=r(5);return i}function bL(e){let t=e.width,n=e.height,r=e.channels??4,i=e.data,a=new Float32Array(64),o=new Float32Array(64),s=new Float32Array(64),c=new Uint32Array(9),l=new Uint32Array(9);for(let e=0;e<=8;e++)c[e]=Math.ceil(e*t/8),l[e]=Math.ceil(e*n/8);let u=0;for(let e=0;e<8;e++){let t=l[e+1];for(let n=l[e];n<t;n++)for(let t=0;t<8;t++){let n=c[t+1],l=(e<<3)+t,d=a[l],f=o[l],p=s[l];for(let e=c[t];e<n;e++)d+=i[u],f+=i[u+1],p+=i[u+2],u+=r;a[l]=d,o[l]=f,s[l]=p}}let d=[new Int16Array(64),new Int16Array(64),new Int16Array(64)];for(let e=0;e<8;e++){let t=l[e+1]-l[e];for(let n=0;n<8;n++){let r=(c[n+1]-c[n])*t,i=(e<<3)+n;if(r!==0){let e=1/(r*256),t=a[i]*e,n=o[i]*e,c=s[i]*e,l=.299*t+.587*n+.114*c;d[0][i]=Math.floor(219*l+16.5),d[1][i]=Math.floor(126.336*(c-l)+128.5),d[2][i]=Math.floor(159.712*(t-l)+128.5)}}}_L(d[0]),_L(d[1]),_L(d[2]);let f=new Int16Array(64),p=new Int16Array(64),m=new Int16Array(64);f[0]=pL(d[0][0]>>3)>>1,p[0]=mL(d[1][0]>>3),m[0]=mL(d[2][0]>>3);for(let e=1;e<64;e++){let t=uL[e];f[e]=hL(d[0][t]>>1)>>3,p[e]=hL(d[1][t])>>3,m[e]=hL(d[2][t])>>3}let h=Array(33);for(let e=0;e<21;e++)h[e]=f[e];for(let e=0;e<6;e++)h[e+21]=p[e],h[e+21+6]=m[e];return h}var xL={extract(e){return bL(e)},encode:vL,decode:yL,distance(e,t){let n=e=>typeof e==`string`?yL(e):e,r=n(e),i=n(t),a=0,o=0,s=0;for(let e=0;e<21;e++){let t=r[e]-i[e];a+=fL[0][e]*t*t}for(let e=0;e<6;e++){let t=r[21+e]-i[21+e];o+=fL[1][e]*t*t;let n=r[27+e]-i[27+e];s+=fL[2][e]*n*n}return Math.sqrt(a)+Math.sqrt(o)+Math.sqrt(s)}},SL=Math.SQRT2;-SL,-SL;var CL=640,wL=24,TL=.25,EL=(e,t)=>{let n=e.findIndex(e=>e>t);return n<0?void 0:[n,e.findLastIndex(e=>e>t)+1]},DL=({data:e,width:t,height:n},r)=>{let i=(n,r)=>{let i=(r*t+n)*4;return Math.max(e[i],e[i+1],e[i+2])>wL},a=(e,t)=>{let n=0;for(let r=0;r<e;r++)t(r)&&n++;return n},o=EL(Array.from({length:n},(e,n)=>a(t,e=>i(e,n))),r*t);if(!o)return;let[s,c]=o,l=EL(Array.from({length:t},(e,t)=>a(c-s,e=>i(t,s+e))),r*(c-s));return l&&{x:l[0],y:s,width:l[1]-l[0],height:c-s}},OL=e=>{let t=DL(e,0)??{x:0,y:0,width:e.width,height:e.height};return t.width>t.height?t:DL(e,TL)??t},kL=e=>{let t=OL(e),n=new Uint8ClampedArray(t.width*t.height*4);for(let r=0;r<t.height;r++){let i=((t.y+r)*e.width+t.x)*4;n.set(e.data.subarray(i,i+t.width*4),r*t.width*4)}return vL(xL.extract({data:n,width:t.width,height:t.height,channels:4}))},AL=async e=>{let t=await createImageBitmap(e),n=Math.min(1,CL/t.width),r=Math.max(1,Math.round(t.width*n)),i=Math.max(1,Math.round(t.height*n)),a=new OffscreenCanvas(r,i).getContext(`2d`);return a.drawImage(t,0,0,r,i),t.close(),kL(a.getImageData(0,0,r,i))},jL=(e,t)=>{let n=e.nextAiringEpisode?.airingAt;if(!n)return;let r=new Date(n).getTime();return Number.isFinite(r)?r-t:void 0},ML=e=>e==null?void 0:`${e} episode${e===1?``:`s`}`,NL=(e,t)=>{if(!e)return;let n=e.trim().replace(/^#/,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n.length===6?n:void 0;if(!r||!/^[0-9a-f]{6}$/i.test(r))return;let i=parseInt(r,16);return`rgba(${i>>16&255}, ${i>>8&255}, ${i&255}, ${t})`},PL=e=>({"--accent":NL(e,1)??`rgba(255, 255, 255, 0.75)`,"--accent-soft":NL(e,.18)??`rgba(255, 255, 255, 0.08)`,"--accent-wash":NL(e,.07)??`rgba(255, 255, 255, 0.03)`}),FL=L`
3777
3777
  display: grid;
3778
3778
  grid-template-columns: 15rem minmax(0, 1fr);
3779
3779
  height: 23rem;
@@ -3893,7 +3893,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3893
3893
  .description { -webkit-line-clamp: 3; }
3894
3894
  .chips { display: none; }
3895
3895
  }
3896
- `,FL=({media:e,to:t})=>{let n=Db(),r=xy(e.covers,e,{box:Lx}),i=e.covers?.find(e=>e.color)?.color,a=Sb(AL(e,n)??0),o=e.nextAiringEpisode?.episodeNumber,s=gp(e.type),c=vp(e.season,e.seasonYear),l=[s,jL(e.episodeCount)].filter(Boolean).join(` • `);return G(Mf,{to:t,css:PL,style:NL(i),children:[U(`div`,{className:`cover`,style:r?{backgroundImage:`url(${r})`}:void 0,children:G(`div`,{className:`cover-text`,children:[U(`div`,{className:`title`,children:e.titles?.at(0)?.title}),c&&U(`div`,{className:`season`,children:c})]})}),G(`div`,{className:`detail`,children:[G(`div`,{className:`detail-top`,children:[U(`div`,{children:a&&o!=null?G(z,{children:[G(`div`,{className:`airing-label`,children:[`Ep `,o,` airing in`]}),U(`div`,{className:`airing-value airing`,children:a})]}):U(`div`,{className:`airing-value`,children:_p(e.status)??`Unknown status`})}),e.averageScore!=null&&U(PI,{percent:e.averageScore})]}),l&&U(`div`,{className:`meta`,children:l}),U(`div`,{className:`description`,children:e.shortDescriptions?.at(0)?.shortDescription}),U(`div`,{className:`chips`,children:e.genres?.slice(0,2).map(e=>U(`span`,{className:`chip`,children:e.toLowerCase()},e))})]})]})},IL=L`
3896
+ `,IL=({media:e,to:t})=>{let n=Ob(),r=Sy(e.covers,e,{box:Rx}),i=e.covers?.find(e=>e.color)?.color,a=Cb(jL(e,n)??0),o=e.nextAiringEpisode?.episodeNumber,s=gp(e.type),c=vp(e.season,e.seasonYear),l=[s,ML(e.episodeCount)].filter(Boolean).join(` • `);return G(Mf,{to:t,css:FL,style:PL(i),children:[U(`div`,{className:`cover`,style:r?{backgroundImage:`url(${r})`}:void 0,children:G(`div`,{className:`cover-text`,children:[U(`div`,{className:`title`,children:e.titles?.at(0)?.title}),c&&U(`div`,{className:`season`,children:c})]})}),G(`div`,{className:`detail`,children:[G(`div`,{className:`detail-top`,children:[U(`div`,{children:a&&o!=null?G(z,{children:[G(`div`,{className:`airing-label`,children:[`Ep `,o,` airing in`]}),U(`div`,{className:`airing-value airing`,children:a})]}):U(`div`,{className:`airing-value`,children:_p(e.status)??`Unknown status`})}),e.averageScore!=null&&U(FI,{percent:e.averageScore})]}),l&&U(`div`,{className:`meta`,children:l}),U(`div`,{className:`description`,children:e.shortDescriptions?.at(0)?.shortDescription}),U(`div`,{className:`chips`,children:e.genres?.slice(0,2).map(e=>U(`span`,{className:`chip`,children:e.toLowerCase()},e))})]})]})},LL=L`
3897
3897
  display: grid;
3898
3898
  grid-template-columns: 5rem minmax(0, 1fr) 11rem 11rem 17rem;
3899
3899
  align-items: center;
@@ -3972,7 +3972,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3972
3972
  .score { display: none; }
3973
3973
  .chips { display: none; }
3974
3974
  }
3975
- `,LL=({media:e,to:t})=>{let n=Db(),r=xy(e.covers,e,{box:Lx}),i=e.covers?.find(e=>e.color)?.color,a=Sb(AL(e,n)??0,1),o=e.nextAiringEpisode?.episodeNumber;return G(Mf,{to:t,css:IL,style:NL(i),children:[U(`div`,{className:`cover`,style:r?{backgroundImage:`url(${r})`}:void 0}),G(`div`,{className:`heading`,children:[U(`div`,{className:`title`,children:e.titles?.at(0)?.title}),U(`div`,{className:`chips`,children:e.genres?.slice(0,5).map(e=>U(`span`,{className:`chip`,children:e.toLowerCase()},e))})]}),G(`div`,{className:`column score`,children:[e.averageScore!=null&&U(PI,{percent:e.averageScore,size:17}),e.popularity!=null&&G(`span`,{className:`secondary`,children:[e.popularity.toLocaleString(),` users`]})]}),G(`div`,{className:`column format`,children:[U(`span`,{children:gp(e.type)}),e.episodeCount!=null&&U(`span`,{className:`secondary`,children:jL(e.episodeCount)})]}),G(`div`,{className:`column`,children:[U(`span`,{children:_p(e.status)}),a&&o!=null&&G(`span`,{className:`secondary airing`,children:[`Ep `,o,` airing in `,a]})]})]})},RL={grid:l_,card:c_,list:d_},zL=L`
3975
+ `,RL=({media:e,to:t})=>{let n=Ob(),r=Sy(e.covers,e,{box:Rx}),i=e.covers?.find(e=>e.color)?.color,a=Cb(jL(e,n)??0,1),o=e.nextAiringEpisode?.episodeNumber;return G(Mf,{to:t,css:LL,style:PL(i),children:[U(`div`,{className:`cover`,style:r?{backgroundImage:`url(${r})`}:void 0}),G(`div`,{className:`heading`,children:[U(`div`,{className:`title`,children:e.titles?.at(0)?.title}),U(`div`,{className:`chips`,children:e.genres?.slice(0,5).map(e=>U(`span`,{className:`chip`,children:e.toLowerCase()},e))})]}),G(`div`,{className:`column score`,children:[e.averageScore!=null&&U(FI,{percent:e.averageScore,size:17}),e.popularity!=null&&G(`span`,{className:`secondary`,children:[e.popularity.toLocaleString(),` users`]})]}),G(`div`,{className:`column format`,children:[U(`span`,{children:gp(e.type)}),e.episodeCount!=null&&U(`span`,{className:`secondary`,children:ML(e.episodeCount)})]}),G(`div`,{className:`column`,children:[U(`span`,{children:_p(e.status)}),a&&o!=null&&G(`span`,{className:`secondary airing`,children:[`Ep `,o,` airing in `,a]})]})]})},zL={grid:l_,card:c_,list:d_},BL=L`
3976
3976
  display: inline-flex;
3977
3977
  gap: 0.4rem;
3978
3978
  padding: 0.4rem;
@@ -3999,7 +3999,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3999
3999
  background: rgba(255, 255, 255, 0.12);
4000
4000
  color: #fff;
4001
4001
  }
4002
- `,BL=({mode:e,onChange:t})=>U(`div`,{css:zL,role:`group`,"aria-label":`Result layout`,children:rl.map(n=>{let r=RL[n.value];return U(`button`,{type:`button`,title:n.label,"aria-label":n.label,"aria-pressed":e===n.value,onClick:()=>t(n.value),children:U(r,{size:18})},n.value)})});K();var VL=L`
4002
+ `,VL=({mode:e,onChange:t})=>U(`div`,{css:BL,role:`group`,"aria-label":`Result layout`,children:rl.map(n=>{let r=zL[n.value];return U(`button`,{type:`button`,title:n.label,"aria-label":n.label,"aria-pressed":e===n.value,onClick:()=>t(n.value),children:U(r,{size:18})},n.value)})});K();var HL=L`
4003
4003
  display: flex;
4004
4004
  flex-direction: column;
4005
4005
  gap: 0.7rem;
@@ -4048,7 +4048,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4048
4048
  }
4049
4049
 
4050
4050
  .control.open .chevron { transform: rotate(180deg); }
4051
- `,HL=L`
4051
+ `,UL=L`
4052
4052
  z-index: ${jr.filterMenu};
4053
4053
  width: max-content;
4054
4054
  min-width: 22rem;
@@ -4122,7 +4122,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4122
4122
  font-size: 1.4rem;
4123
4123
  color: rgba(255, 255, 255, 0.4);
4124
4124
  }
4125
- `,UL=({label:e,placeholder:t=`Any`,options:n,selected:r,onChange:i,multiple:a=!1,searchable:o=!1,allowCustom:s=!1})=>{let[c,l]=W(!1),[u,d]=W(``),f=`filter-${e.toLowerCase().replace(/[^a-z]+/g,`-`)}`,{refs:p,floatingStyles:m,context:h}=Fg({open:c,onOpenChange:e=>{l(e),e||d(``)},placement:`bottom-start`,whileElementsMounted:St,middleware:[fh(6),mh({padding:8}),ph({padding:8}),hh({padding:8,apply:({availableHeight:e,elements:t})=>{t.floating.style.maxHeight=`${Math.max(160,e)}px`}})]}),{getReferenceProps:g,getFloatingProps:_}=zg([kg(h),Ng(h),Vg(h,{role:`listbox`})]),v=r.map(e=>n.find(t=>t.value===e)?.label??e).join(`, `),y=H(()=>{let e=u.trim().toLowerCase(),t=e?n.filter(t=>t.label.toLowerCase().includes(e)):n;return!s||!e||t.some(t=>t.label.toLowerCase()===e)?t:[{value:u.trim(),label:u.trim()},...t]},[n,u,s]),b=e=>{a?i(r.includes(e)?r.filter(t=>t!==e):[...r,e]):(i(r.includes(e)?[]:[e]),l(!1),d(``))};return G(`div`,{css:VL,children:[U(`span`,{className:`label`,id:f,children:e}),G(`button`,{ref:p.setReference,type:`button`,className:c?`control open`:`control`,"aria-labelledby":f,...g(),children:[U(`span`,{className:r.length?`value`:`value any`,children:r.length?v:t}),U($g,{size:16,className:`chevron`})]}),c&&U(lg,{children:U(bg,{context:h,modal:!1,initialFocus:o?0:-1,children:G(`div`,{ref:p.setFloating,css:HL,style:m,..._(),children:[o&&G(`div`,{className:`filter`,children:[U(b_,{size:15}),U(`input`,{type:`text`,value:u,placeholder:`Filter ${e.toLowerCase()}`,"aria-label":`Filter ${e.toLowerCase()}`,onInput:e=>d(e.currentTarget.value)})]}),U(`div`,{className:`options`,children:y.length?y.map(e=>G(`button`,{type:`button`,role:`option`,"aria-selected":r.includes(e.value),className:r.includes(e.value)?`option selected`:`option`,onClick:()=>b(e.value),children:[U(Ye,{size:16,className:r.includes(e.value)?`tick`:`tick hidden`}),U(`span`,{children:e.label})]},e.value)):G(`div`,{className:`empty`,children:[`Nothing matches “`,u,`”.`]})})]})})})]})},WL=({label:e,children:t})=>G(`div`,{css:VL,children:[U(`span`,{className:`label`,children:e}),t]});K();var GL=br===`movie`||br===`series`;Iv(`
4125
+ `,WL=({label:e,placeholder:t=`Any`,options:n,selected:r,onChange:i,multiple:a=!1,searchable:o=!1,allowCustom:s=!1})=>{let[c,l]=W(!1),[u,d]=W(``),f=`filter-${e.toLowerCase().replace(/[^a-z]+/g,`-`)}`,{refs:p,floatingStyles:m,context:h}=Fg({open:c,onOpenChange:e=>{l(e),e||d(``)},placement:`bottom-start`,whileElementsMounted:St,middleware:[fh(6),mh({padding:8}),ph({padding:8}),hh({padding:8,apply:({availableHeight:e,elements:t})=>{t.floating.style.maxHeight=`${Math.max(160,e)}px`}})]}),{getReferenceProps:g,getFloatingProps:_}=zg([kg(h),Ng(h),Vg(h,{role:`listbox`})]),v=r.map(e=>n.find(t=>t.value===e)?.label??e).join(`, `),y=H(()=>{let e=u.trim().toLowerCase(),t=e?n.filter(t=>t.label.toLowerCase().includes(e)):n;return!s||!e||t.some(t=>t.label.toLowerCase()===e)?t:[{value:u.trim(),label:u.trim()},...t]},[n,u,s]),b=e=>{a?i(r.includes(e)?r.filter(t=>t!==e):[...r,e]):(i(r.includes(e)?[]:[e]),l(!1),d(``))};return G(`div`,{css:HL,children:[U(`span`,{className:`label`,id:f,children:e}),G(`button`,{ref:p.setReference,type:`button`,className:c?`control open`:`control`,"aria-labelledby":f,...g(),children:[U(`span`,{className:r.length?`value`:`value any`,children:r.length?v:t}),U($g,{size:16,className:`chevron`})]}),c&&U(lg,{children:U(bg,{context:h,modal:!1,initialFocus:o?0:-1,children:G(`div`,{ref:p.setFloating,css:UL,style:m,..._(),children:[o&&G(`div`,{className:`filter`,children:[U(b_,{size:15}),U(`input`,{type:`text`,value:u,placeholder:`Filter ${e.toLowerCase()}`,"aria-label":`Filter ${e.toLowerCase()}`,onInput:e=>d(e.currentTarget.value)})]}),U(`div`,{className:`options`,children:y.length?y.map(e=>G(`button`,{type:`button`,role:`option`,"aria-selected":r.includes(e.value),className:r.includes(e.value)?`option selected`:`option`,onClick:()=>b(e.value),children:[U(Ye,{size:16,className:r.includes(e.value)?`tick`:`tick hidden`}),U(`span`,{children:e.label})]},e.value)):G(`div`,{className:`empty`,children:[`Nothing matches “`,u,`”.`]})})]})})})]})},GL=({label:e,children:t})=>G(`div`,{css:HL,children:[U(`span`,{className:`label`,children:e}),t]});K();var KL=br===`movie`||br===`series`;Iv(`
4126
4126
  fragment SearchCard on Media {
4127
4127
  ...MediaFragment
4128
4128
  score
@@ -4165,7 +4165,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4165
4165
  airingAt
4166
4166
  }
4167
4167
  }
4168
- `);var KL=Iv(`
4168
+ `);var qL=Iv(`
4169
4169
  subscription SearchMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
4170
4170
  mediaPage(input: $input) {
4171
4171
  nodes {
@@ -4173,7 +4173,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4173
4173
  }
4174
4174
  }
4175
4175
  }
4176
- `),qL=L`
4176
+ `),JL=L`
4177
4177
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
4178
4178
  min-height: 100vh;
4179
4179
 
@@ -4364,7 +4364,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4364
4364
  .grid > .pending { width: 100%; height: auto; aspect-ratio: 5 / 7; }
4365
4365
  .cards > .pending { height: 17rem; }
4366
4366
  }
4367
- `,JL=(()=>{let e=[];for(let t=ap();t>=ip;t--)e.push({value:String(t),label:String(t)});return e})(),YL=e=>({...e.query?{search:e.query}:{sorts:[mo.PopularityDesc]},...e.category?{categories:[e.category]}:{},...e.status?{status:e.status}:{},...e.season?{season:e.season}:{},...e.year?{seasonYear:e.year}:{},...e.formats.length?{formats:e.formats}:{},...e.genres.length?{genres:e.genres}:{},...e.tags.length?{tags:e.tags}:{}}),XL=()=>{let e=Tf(),[,t]=wf(),n=H(()=>sp(e),[e]),r=GL?void 0:mp(e),i=tL(r),a=!r&&bp(n),[o,s]=W(!1);V(()=>{s(!1)},[e]);let c=e=>{s(!1),kL(e).then(e=>t(pp(e),{replace:e===r}),()=>s(!0))};nL(c,!GL);let l=e=>t(dp({...n,...e}),{replace:!0}),[u,d]=W(n.query),f=q(null);V(()=>{document.activeElement!==f.current&&d(e=>e.trim()===n.query?e:n.query)},[n.query]);let[p,m]=W(()=>document.activeElement?.matches(`header input`)?``:n.query);V(()=>{let e=setTimeout(()=>m(n.query),350);return()=>clearTimeout(e)},[n.query]);let h=p!==n.query,g={...n,query:p},_=H(()=>YL(g),[lp(g)]),[{data:v}]=Za({query:KL,variables:{input:_,shortDescriptionInput:{count:1}},pause:!!r||!bp(g)}),[y,b]=W(cl),x=e=>{b(e),ll(e)},[S,C]=W(!1);V(()=>{C(!1);let e=setTimeout(()=>C(!0),5e3);return()=>clearTimeout(e)},[e,_]);let w=q(v),T=q(_);v!==w.current&&(w.current=v,T.current=_);let E=a&&!h&&T.current===_?v?.mediaPage?.nodes??[]:[],D=!!(n.season&&n.year),{genreOptions:O,tagOptions:k,genreKeys:A}=H(()=>{let e=new Map(Xf[br].map(e=>[e.toLowerCase(),e])),t=new Map;for(let t of n.genres)e.set(t.toLowerCase(),t);for(let e of n.tags)t.set(e.toLowerCase(),e);let r=(n,r)=>{!e.has(r.toLowerCase())&&!t.has(r.toLowerCase())&&n.set(r.toLowerCase(),r)};if(D)for(let t of E)for(let n of t.genres??[])r(e,n);for(let e of E)for(let n of e.tags??[])r(t,n);let i=(e,t)=>e.localeCompare(t);return{genreKeys:new Set(e.keys()),genreOptions:[...e.values()].sort(i).map(e=>({value:e,label:e})),tagOptions:[...t.values()].sort(i).map(e=>({value:e,label:e}))}},[E,n.genres,n.tags,D]),j=[...n.genres,...n.tags],M=e=>A.has(e.toLowerCase()),N=e=>l({genres:e.filter(M),tags:e.filter(e=>!M(e))}),P={grid:{className:`grid`,item:e=>U(zx,{media:e,to:zf(Q.MEDIA,{uri:e.uri}),ellipsis:!1})},card:{className:`cards`,item:e=>U(FL,{media:e,to:zf(Q.MEDIA,{uri:e.uri})})},list:{className:`rows`,item:e=>U(LL,{media:e,to:zf(Q.MEDIA,{uri:e.uri})})}}[y],ee=U(`div`,{className:P.className,children:Array.from({length:12},(e,t)=>U(ty,{className:`pending`},t))}),te=[...n.year?[{key:`year`,label:String(n.year),clear:{year:null}}]:[],...n.season?[{key:`season`,label:qf.find(e=>e.value===n.season).label,clear:{season:null}}]:[],...n.status?[{key:`status`,label:Kf.find(e=>e.value===n.status).label,clear:{status:null}}]:[],...n.category?[{key:`category`,label:Jf.find(e=>e.value===n.category).label,clear:{category:null}}]:[],...n.formats.map(e=>({key:`format:${e}`,label:Gf.find(t=>t.value===e).label,clear:{formats:n.formats.filter(t=>t!==e)}})),...n.genres.map(e=>({key:`genre:${e}`,label:e,clear:{genres:n.genres.filter(t=>t!==e)}})),...n.tags.map(e=>({key:`tag:${e}`,label:e,clear:{tags:n.tags.filter(t=>t!==e)}}))];return G(`div`,{css:qL,children:[G(`div`,{className:`heading-row`,children:[U(`div`,{className:`heading`,children:r?`Scene search`:hp(n)}),U(BL,{mode:y,onChange:x})]}),r?G(`div`,{className:`credit`,children:[`Scenes found by `,U(`a`,{href:`https://trace.moe`,target:`_blank`,rel:`noreferrer noopener`,children:`trace.moe`})]}):void 0,G(`div`,{className:`filters`,children:[U(WL,{label:`Search`,children:G(`div`,{className:`text-field`,children:[U(b_,{size:17}),U(`input`,{ref:f,type:`text`,value:u,placeholder:`Any title`,"aria-label":`Search by title`,onInput:e=>{let t=e.currentTarget.value;d(t),l({query:t})}}),GL?void 0:U(rL,{onPicture:c})]})}),U(UL,{label:GL?`Genres`:`Genres & Tags`,options:[...O,...k],selected:j,onChange:N,multiple:!0,searchable:!0,allowCustom:!GL}),U(UL,{label:`Year`,options:JL,selected:n.year?[String(n.year)]:[],onChange:e=>l({year:e.length?Number(e[0]):null}),searchable:!0}),GL?void 0:G(z,{children:[U(UL,{label:`Season`,options:qf,selected:n.season?[n.season]:[],onChange:e=>l({season:e[0]??null})}),U(UL,{label:`Format`,options:Gf,selected:n.formats,onChange:e=>l({formats:e}),multiple:!0}),U(UL,{label:`Airing Status`,options:Kf,selected:n.status?[n.status]:[],onChange:e=>l({status:e[0]??null})})]}),br===`stub`?U(UL,{label:`Category`,options:Jf,selected:n.category?[n.category]:[],onChange:e=>l({category:e[0]??null})}):void 0]}),G(`div`,{className:`chips`,children:[te.map(e=>G(`button`,{type:`button`,className:`chip`,"aria-label":`Remove ${e.label}`,onClick:()=>l(e.clear),children:[e.label,U(k_,{size:14})]},e.key)),te.length>1&&U(`button`,{type:`button`,className:`chip-clear`,onClick:()=>l({category:null,status:null,season:null,year:null,formats:[],genres:[],tags:[]}),children:`Clear filters`})]}),o?U(`div`,{className:`status`,children:`This picture could not be read.`}):r?i?`error`in i?U(`div`,{className:`status`,children:i.error}):i.matches.length?U(`div`,{className:P.className,children:i.matches.map(e=>U(iL,{match:e,item:P.item},e.anilist))}):U(`div`,{className:`status`,children:`No results found.`}):ee:E.length?U(`div`,{className:P.className,children:E.map(P.item)}):a?S?U(`div`,{className:`status`,children:`No results found.`}):ee:U(`div`,{className:`status`,children:yp(n)?`Add a title or another filter.`:`Search by title, or pick a filter.`})]})},ZL=L`
4367
+ `,YL=(()=>{let e=[];for(let t=ap();t>=ip;t--)e.push({value:String(t),label:String(t)});return e})(),XL=e=>({...e.query?{search:e.query}:{sorts:[mo.PopularityDesc]},...e.category?{categories:[e.category]}:{},...e.status?{status:e.status}:{},...e.season?{season:e.season}:{},...e.year?{seasonYear:e.year}:{},...e.formats.length?{formats:e.formats}:{},...e.genres.length?{genres:e.genres}:{},...e.tags.length?{tags:e.tags}:{}}),ZL=()=>{let e=Tf(),[,t]=wf(),n=H(()=>sp(e),[e]),r=KL?void 0:mp(e),i=nL(r),a=!r&&bp(n),[o,s]=W(!1);V(()=>{s(!1)},[e]);let c=e=>{s(!1),AL(e).then(e=>t(pp(e),{replace:e===r}),()=>s(!0))};rL(c,!KL);let l=e=>t(dp({...n,...e}),{replace:!0}),[u,d]=W(n.query),f=q(null);V(()=>{document.activeElement!==f.current&&d(e=>e.trim()===n.query?e:n.query)},[n.query]);let[p,m]=W(()=>document.activeElement?.matches(`header input`)?``:n.query);V(()=>{let e=setTimeout(()=>m(n.query),350);return()=>clearTimeout(e)},[n.query]);let h=p!==n.query,g={...n,query:p},_=H(()=>XL(g),[lp(g)]),[{data:v}]=Za({query:qL,variables:{input:_,shortDescriptionInput:{count:1}},pause:!!r||!bp(g)}),[y,b]=W(cl),x=e=>{b(e),ll(e)},[S,C]=W(!1);V(()=>{C(!1);let e=setTimeout(()=>C(!0),5e3);return()=>clearTimeout(e)},[e,_]);let w=q(v),T=q(_);v!==w.current&&(w.current=v,T.current=_);let E=a&&!h&&T.current===_?v?.mediaPage?.nodes??[]:[],D=!!(n.season&&n.year),{genreOptions:O,tagOptions:k,genreKeys:A}=H(()=>{let e=new Map(Xf[br].map(e=>[e.toLowerCase(),e])),t=new Map;for(let t of n.genres)e.set(t.toLowerCase(),t);for(let e of n.tags)t.set(e.toLowerCase(),e);let r=(n,r)=>{!e.has(r.toLowerCase())&&!t.has(r.toLowerCase())&&n.set(r.toLowerCase(),r)};if(D)for(let t of E)for(let n of t.genres??[])r(e,n);for(let e of E)for(let n of e.tags??[])r(t,n);let i=(e,t)=>e.localeCompare(t);return{genreKeys:new Set(e.keys()),genreOptions:[...e.values()].sort(i).map(e=>({value:e,label:e})),tagOptions:[...t.values()].sort(i).map(e=>({value:e,label:e}))}},[E,n.genres,n.tags,D]),j=[...n.genres,...n.tags],M=e=>A.has(e.toLowerCase()),N=e=>l({genres:e.filter(M),tags:e.filter(e=>!M(e))}),P={grid:{className:`grid`,item:e=>U(Bx,{media:e,to:zf(Q.MEDIA,{uri:e.uri}),ellipsis:!1})},card:{className:`cards`,item:e=>U(IL,{media:e,to:zf(Q.MEDIA,{uri:e.uri})})},list:{className:`rows`,item:e=>U(RL,{media:e,to:zf(Q.MEDIA,{uri:e.uri})})}}[y],ee=U(`div`,{className:P.className,children:Array.from({length:12},(e,t)=>U(ty,{className:`pending`},t))}),te=[...n.year?[{key:`year`,label:String(n.year),clear:{year:null}}]:[],...n.season?[{key:`season`,label:qf.find(e=>e.value===n.season).label,clear:{season:null}}]:[],...n.status?[{key:`status`,label:Kf.find(e=>e.value===n.status).label,clear:{status:null}}]:[],...n.category?[{key:`category`,label:Jf.find(e=>e.value===n.category).label,clear:{category:null}}]:[],...n.formats.map(e=>({key:`format:${e}`,label:Gf.find(t=>t.value===e).label,clear:{formats:n.formats.filter(t=>t!==e)}})),...n.genres.map(e=>({key:`genre:${e}`,label:e,clear:{genres:n.genres.filter(t=>t!==e)}})),...n.tags.map(e=>({key:`tag:${e}`,label:e,clear:{tags:n.tags.filter(t=>t!==e)}}))];return G(`div`,{css:JL,children:[G(`div`,{className:`heading-row`,children:[U(`div`,{className:`heading`,children:r?`Scene search`:hp(n)}),U(VL,{mode:y,onChange:x})]}),r?G(`div`,{className:`credit`,children:[`Scenes found by `,U(`a`,{href:`https://trace.moe`,target:`_blank`,rel:`noreferrer noopener`,children:`trace.moe`})]}):void 0,G(`div`,{className:`filters`,children:[U(GL,{label:`Search`,children:G(`div`,{className:`text-field`,children:[U(b_,{size:17}),U(`input`,{ref:f,type:`text`,value:u,placeholder:`Any title`,"aria-label":`Search by title`,onInput:e=>{let t=e.currentTarget.value;d(t),l({query:t})}}),KL?void 0:U(iL,{onPicture:c})]})}),U(WL,{label:KL?`Genres`:`Genres & Tags`,options:[...O,...k],selected:j,onChange:N,multiple:!0,searchable:!0,allowCustom:!KL}),U(WL,{label:`Year`,options:YL,selected:n.year?[String(n.year)]:[],onChange:e=>l({year:e.length?Number(e[0]):null}),searchable:!0}),KL?void 0:G(z,{children:[U(WL,{label:`Season`,options:qf,selected:n.season?[n.season]:[],onChange:e=>l({season:e[0]??null})}),U(WL,{label:`Format`,options:Gf,selected:n.formats,onChange:e=>l({formats:e}),multiple:!0}),U(WL,{label:`Airing Status`,options:Kf,selected:n.status?[n.status]:[],onChange:e=>l({status:e[0]??null})})]}),br===`stub`?U(WL,{label:`Category`,options:Jf,selected:n.category?[n.category]:[],onChange:e=>l({category:e[0]??null})}):void 0]}),G(`div`,{className:`chips`,children:[te.map(e=>G(`button`,{type:`button`,className:`chip`,"aria-label":`Remove ${e.label}`,onClick:()=>l(e.clear),children:[e.label,U(k_,{size:14})]},e.key)),te.length>1&&U(`button`,{type:`button`,className:`chip-clear`,onClick:()=>l({category:null,status:null,season:null,year:null,formats:[],genres:[],tags:[]}),children:`Clear filters`})]}),o?U(`div`,{className:`status`,children:`This picture could not be read.`}):r?i?`error`in i?U(`div`,{className:`status`,children:i.error}):i.matches.length?U(`div`,{className:P.className,children:i.matches.map(e=>U(aL,{match:e,item:P.item},e.anilist))}):U(`div`,{className:`status`,children:`No results found.`}):ee:E.length?U(`div`,{className:P.className,children:E.map(P.item)}):a?S?U(`div`,{className:`status`,children:`No results found.`}):ee:U(`div`,{className:`status`,children:yp(n)?`Add a title or another filter.`:`Search by title, or pick a filter.`})]})},QL=L`
4368
4368
  max-width: 72rem;
4369
4369
  margin: 0 auto;
4370
4370
  padding: calc(var(--stub-header-height) + 3rem) 3rem 6rem;
@@ -4403,7 +4403,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4403
4403
  color: #ff8a3d;
4404
4404
  }
4405
4405
  }
4406
- `,QL=({children:e})=>U(`div`,{css:ZL,children:e}),$L=()=>G(QL,{children:[U(`h1`,{children:`Legal & Terms`}),U(`div`,{className:`updated`,children:`Last updated 24 October 2026`}),U(`p`,{children:`stub is an independent, non-commercial personal project, provided “as is” without warranties of any kind.`}),U(`h2`,{children:`No hosted content`}),U(`p`,{children:`stub hosts, stores, and distributes no media of its own. Titles, descriptions, artwork, ratings, and playback streams are retrieved on demand from third-party services (including AniList, MyAnimeList, Crunchyroll, JustWatch, and Netflix). So that titles still show when those services are unreachable, stub’s files also carry titles, artwork addresses, and descriptions compiled from the anime-offline-database, AniDB, and Kitsu. All of it remains the property of its respective owners. You access those services with your own accounts and are responsible for complying with their terms.`}),G(`p`,{children:[`Contains information from`,` `,U(`a`,{href:`https://github.com/cedya77/anime-offline-database`,target:`_blank`,rel:`noreferrer noopener`,children:`cedya77/anime-offline-database`}),`, continuing`,` `,U(`a`,{href:`https://github.com/manami-project/anime-offline-database`,target:`_blank`,rel:`noreferrer noopener`,children:`manami-project/anime-offline-database`}),`, made available under the`,` `,U(`a`,{href:`https://opendatacommons.org/licenses/odbl/1-0/`,target:`_blank`,rel:`noreferrer noopener`,children:`ODbL`}),`.`]}),U(`h2`,{children:`Personal use`}),U(`p`,{children:`stub is a technical showcase of in-browser media aggregation, intended for personal, non-commercial use. It is not a content provider.`}),U(`h2`,{children:`Privacy`}),G(`p`,{children:[`stub keeps no accounts and stores no personal data. See the`,` `,U(Mf,{href:zf(Q.PRIVACY),children:`Privacy page`}),` for what is and isn’t handled when you use it.`]}),U(`h2`,{children:`Rights holders`}),G(`p`,{children:[`Apart from the compiled titles, artwork addresses, and descriptions above, stub stores no content itself; anything you see lives on the third-party service it came from. If you are a rights holder with a concern, you can reach the maintainer through the project repository at`,` `,U(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]}),U(`h2`,{children:`Liability`}),U(`p`,{children:`stub is provided without warranty of any kind. The maintainer is not liable for any damages arising from its use, or for the availability, accuracy, or legality of any third-party service it connects to.`})]}),eR=`This browser, in its storage for stub at this address`,tR=`This tab, in its storage for stub`,nR=[{id:`added-sources`,title:`Added sources`,what:`The source packages you added from npm, installed for stub through FKN. Signed in to FKN, the list is your account's, so every stub site you sign in on gets it. Sources added while signed out join the list of the next FKN account signed in on this browser.`,where:`${eR}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you remove them. The account's copy is deleted with your FKN account, and this browser's copy of it when you sign out`,keys:{store:`local`,names:[$a,eo]}},{id:`settings`,title:`Settings`,what:`Your choices in Settings and around stub: sources turned off, hidden icons, the country you picked, autoplay, the search layout, the trackers you chose not to save to and the play order. Signed in to FKN, they are your account's, so every stub site and device you sign in on gets them. What you set while signed out joins the next FKN account signed in on this browser, unless that account already set it.`,where:`${eR}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you change them. The account's copy is deleted with your FKN account, and this browser's copy of it when you sign out`,keys:{store:`local`,names:[...ml,ae]}},{id:`connected-sites`,title:`Connected tracking sites`,what:`Which of AniList, MyAnimeList and Crunchyroll you signed in to through stub on this device, so stub reaches only those.`,where:eR,lasts:`Until you sign out of them, or clear this site's data in your browser`,keys:{store:`local`,names:[Se]}},{id:`site-status`,title:`Site sign-in states`,what:`Whether you were signed in to Crunchyroll, Prime Video, AniList and MyAnimeList when stub last learned it, and when. Never your name there.`,where:eR,lasts:`Until stub learns it again, or you clear this site's data in your browser`,keys:{store:`local`,names:[se]}},{id:`party-name`,title:`Party name`,what:`The name you gave yourself in a watch party.`,where:tR,lasts:`Until you close the tab`,keys:{store:`session`,names:[$n]}},{id:`party-invite`,title:`Party you are in`,what:`The watch party this tab is in, so a reload rejoins it.`,where:tR,lasts:`Until you leave the party or close the tab`,keys:{store:`session`,names:[Qn]}},{id:`update-reloads`,title:`Update reloads`,what:`When this tab last reloaded by itself onto a new version of stub, so it does so at most twice in five minutes.`,where:tR,lasts:`Until you close the tab`,keys:{store:`session`,names:[Mr]}},{id:`stub-list`,title:`Stub's list`,what:`What you track with stub's own tracker: status, progress, score and dates, with each title's name and cover. Signed in to FKN, stub uses your account's list instead, encrypted in this browser before it is stored.`,where:`The browser's private files for stub at this address, on this device only, and your FKN account's storage once you use its list`,lasts:`As long as the list: a removed entry stays in it, with its title and last values, as a record that it was removed`},{id:`site-sign-ins`,title:`Site sign-ins`,what:`Your Crunchyroll, Prime Video, AniList and MyAnimeList sessions, which stub plays and tracks with.`,where:`Without the FKN extension, FKN keeps them for every fkn.app app. With it, your browser does.`,lasts:`Until you sign out, or the site ends the session`},{id:`fkn-account`,title:`FKN account`,what:`Which FKN account you are signed in with.`,where:`FKN, not stub`,lasts:`Until you disconnect`},{id:`player`,title:`Player volume`,what:`The volume you last left a player at, and whether it was muted, so the next episode or theme starts the same. Speed and captions are not kept.`,where:eR,lasts:`Until you clear this site's data in your browser`,keys:{store:`local`,names:[vt]}},{id:`positions`,title:`Where you stopped`,what:`The point you stopped at in each episode you have not finished, with the source it played on, its length and when you stopped, for your 200 most recent, and the source and time of the 200 you finished last. Signed in to FKN, they are your account's, so every stub site and device you sign in on resumes there. Those kept while signed out join the next FKN account signed in on this browser.`,where:`${eR}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until 200 newer ones replace them. The account's copy is deleted with your FKN account, and this browser's copy of it when you sign out`,keys:{store:`local`,names:[Kc,qc]}},{id:`fetched`,title:`Titles, artwork and streams`,what:`What stub fetched to show you.`,where:`Memory, in this tab`,lasts:`Until you refresh or close the tab`}],rR=L`
4406
+ `,$L=({children:e})=>U(`div`,{css:QL,children:e}),eR=()=>G($L,{children:[U(`h1`,{children:`Legal & Terms`}),U(`div`,{className:`updated`,children:`Last updated 24 October 2026`}),U(`p`,{children:`stub is an independent, non-commercial personal project, provided “as is” without warranties of any kind.`}),U(`h2`,{children:`No hosted content`}),U(`p`,{children:`stub hosts, stores, and distributes no media of its own. Titles, descriptions, artwork, ratings, and playback streams are retrieved on demand from third-party services (including AniList, MyAnimeList, Crunchyroll, JustWatch, and Netflix). So that titles still show when those services are unreachable, stub’s files also carry titles, artwork addresses, and descriptions compiled from the anime-offline-database, AniDB, and Kitsu. All of it remains the property of its respective owners. You access those services with your own accounts and are responsible for complying with their terms.`}),G(`p`,{children:[`Contains information from`,` `,U(`a`,{href:`https://github.com/cedya77/anime-offline-database`,target:`_blank`,rel:`noreferrer noopener`,children:`cedya77/anime-offline-database`}),`, continuing`,` `,U(`a`,{href:`https://github.com/manami-project/anime-offline-database`,target:`_blank`,rel:`noreferrer noopener`,children:`manami-project/anime-offline-database`}),`, made available under the`,` `,U(`a`,{href:`https://opendatacommons.org/licenses/odbl/1-0/`,target:`_blank`,rel:`noreferrer noopener`,children:`ODbL`}),`.`]}),U(`h2`,{children:`Personal use`}),U(`p`,{children:`stub is a technical showcase of in-browser media aggregation, intended for personal, non-commercial use. It is not a content provider.`}),U(`h2`,{children:`Privacy`}),G(`p`,{children:[`stub keeps no accounts and stores no personal data. See the`,` `,U(Mf,{href:zf(Q.PRIVACY),children:`Privacy page`}),` for what is and isn’t handled when you use it.`]}),U(`h2`,{children:`Rights holders`}),G(`p`,{children:[`Apart from the compiled titles, artwork addresses, and descriptions above, stub stores no content itself; anything you see lives on the third-party service it came from. If you are a rights holder with a concern, you can reach the maintainer through the project repository at`,` `,U(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]}),U(`h2`,{children:`Liability`}),U(`p`,{children:`stub is provided without warranty of any kind. The maintainer is not liable for any damages arising from its use, or for the availability, accuracy, or legality of any third-party service it connects to.`})]}),tR=`This browser, in its storage for stub at this address`,nR=`This tab, in its storage for stub`,rR=[{id:`added-sources`,title:`Added sources`,what:`The source packages you added from npm, installed for stub through FKN. Signed in to FKN, the list is your account's, so every stub site you sign in on gets it. Sources added while signed out join the list of the next FKN account signed in on this browser.`,where:`${tR}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you remove them. The account's copy is deleted with your FKN account, and this browser's copy of it when you sign out`,keys:{store:`local`,names:[$a,eo]}},{id:`settings`,title:`Settings`,what:`Your choices in Settings and around stub: sources turned off, hidden icons, the country you picked, autoplay, the search layout, the trackers you chose not to save to and the play order. Signed in to FKN, they are your account's, so every stub site and device you sign in on gets them. What you set while signed out joins the next FKN account signed in on this browser, unless that account already set it.`,where:`${tR}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you change them. The account's copy is deleted with your FKN account, and this browser's copy of it when you sign out`,keys:{store:`local`,names:[...ml,ae]}},{id:`connected-sites`,title:`Connected tracking sites`,what:`Which of AniList, MyAnimeList and Crunchyroll you signed in to through stub on this device, so stub reaches only those.`,where:tR,lasts:`Until you sign out of them, or clear this site's data in your browser`,keys:{store:`local`,names:[Se]}},{id:`site-status`,title:`Site sign-in states`,what:`Whether you were signed in to Crunchyroll, Prime Video, AniList and MyAnimeList when stub last learned it, and when. Never your name there.`,where:tR,lasts:`Until stub learns it again, or you clear this site's data in your browser`,keys:{store:`local`,names:[se]}},{id:`party-name`,title:`Party name`,what:`The name you gave yourself in a watch party.`,where:nR,lasts:`Until you close the tab`,keys:{store:`session`,names:[$n]}},{id:`party-invite`,title:`Party you are in`,what:`The watch party this tab is in, so a reload rejoins it.`,where:nR,lasts:`Until you leave the party or close the tab`,keys:{store:`session`,names:[Qn]}},{id:`update-reloads`,title:`Update reloads`,what:`When this tab last reloaded by itself onto a new version of stub, so it does so at most twice in five minutes.`,where:nR,lasts:`Until you close the tab`,keys:{store:`session`,names:[Mr]}},{id:`stub-list`,title:`Stub's list`,what:`What you track with stub's own tracker: status, progress, score and dates, with each title's name and cover. Signed in to FKN, stub uses your account's list instead, encrypted in this browser before it is stored.`,where:`The browser's private files for stub at this address, on this device only, and your FKN account's storage once you use its list`,lasts:`As long as the list: a removed entry stays in it, with its title and last values, as a record that it was removed`},{id:`site-sign-ins`,title:`Site sign-ins`,what:`Your Crunchyroll, Prime Video, AniList and MyAnimeList sessions, which stub plays and tracks with.`,where:`Without the FKN extension, FKN keeps them for every fkn.app app. With it, your browser does.`,lasts:`Until you sign out, or the site ends the session`},{id:`fkn-account`,title:`FKN account`,what:`Which FKN account you are signed in with.`,where:`FKN, not stub`,lasts:`Until you disconnect`},{id:`player`,title:`Player volume`,what:`The volume you last left a player at, and whether it was muted, so the next episode or theme starts the same. Speed and captions are not kept.`,where:tR,lasts:`Until you clear this site's data in your browser`,keys:{store:`local`,names:[vt]}},{id:`positions`,title:`Where you stopped`,what:`The point you stopped at in each episode you have not finished, with the source it played on, its length and when you stopped, for your 200 most recent, and the source and time of the 200 you finished last. Signed in to FKN, they are your account's, so every stub site and device you sign in on resumes there. Those kept while signed out join the next FKN account signed in on this browser.`,where:`${tR}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until 200 newer ones replace them. The account's copy is deleted with your FKN account, and this browser's copy of it when you sign out`,keys:{store:`local`,names:[Kc,qc]}},{id:`fetched`,title:`Titles, artwork and streams`,what:`What stub fetched to show you.`,where:`Memory, in this tab`,lasts:`Until you refresh or close the tab`}],iR=L`
4407
4407
  display: flex;
4408
4408
  flex-direction: column;
4409
4409
  gap: 1rem;
@@ -4418,7 +4418,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4418
4418
 
4419
4419
  strong { color: #fff; }
4420
4420
  .facts { color: rgba(255, 255, 255, 0.55); }
4421
- `,iR=e=>e.endsWith(`.`)?e:`${e}.`,aR=()=>G(QL,{children:[U(`h1`,{children:`Privacy`}),U(`div`,{className:`updated`,children:`Last updated 13 October 2026`}),U(`p`,{children:`stub is an independent, non-commercial personal project. In short: it has no accounts and no server of its own, runs no analytics, and keeps your settings and your watch list in your browser, or in your own FKN account when you choose to.`}),U(`h2`,{children:`What stub keeps`}),G(`p`,{children:[`stub sets no advertising or tracking cookies and runs no analytics or telemetry. This is everything it keeps, where, and for how long. You sign out of a site in`,` `,U(Mf,{to:`/settings#accounts`,children:`Settings, under Accounts`}),`, and remove a source you added in`,` `,U(Mf,{to:`/settings#sources`,children:`Settings, under Sources`}),`. Clearing this site's data in your browser removes everything stub keeps in this browser.`]}),U(`ul`,{css:rR,children:nR.map(e=>G(`li`,{children:[G(`strong`,{children:[e.title,`.`]}),` `,e.what,` `,G(`span`,{className:`facts`,children:[`Where: `,iR(e.where),` How long: `,iR(e.lasts)]})]},e.id))}),U(`p`,{children:`About stub's list: signed out, it is saved in your browser's storage for stub, on this device only. Signed in to an FKN account, stub uses that account's list instead: your changes are saved on the device and in the account's storage, encrypted in your browser before they leave the device, so every device signed in to the same account shows them. A list you kept before signing in is added to the account only if you choose to. When you sign out, the account's list is removed from the device. Removing an entry keeps a record that it was removed, with the entry's title and last values, so that every device using the list removes it too. There is no way to clear these records yet.`}),U(`h2`,{children:`Sign-ins to other sites`}),G(`p`,{children:[`stub plays Crunchyroll and Prime Video and tracks your AniList and MyAnimeList lists with your own accounts on those sites. Without the FKN browser extension, you sign in on each site's own page, in an FKN window, and the cookies that sign-in sets are kept by FKN, in a cookie jar every fkn.app app shares, and not by stub. Signing out in `,U(Mf,{to:`/settings#accounts`,children:`Settings, under Accounts`}),`, removes that site's cookies from FKN. The site itself is not told, so its session stays valid there until it expires, held by nobody.`]}),U(`p`,{children:`With the extension, stub uses your browser's own sessions for these sites and for Netflix. Those stay in your browser, and you sign in and out of them on the sites themselves.`}),U(`h2`,{children:`Network requests & third parties`}),G(`p`,{children:[`To fetch titles, artwork, and streams, stub sends requests through the FKN platform proxy, which then reaches third-party services such as AniList, MyAnimeList, Crunchyroll, Prime Video and JustWatch. The proxy requires no account. It uses your IP address to rate-limit requests, and it keeps a copy of each answer for a while, under a key made from the whole request (its address, headers and body), so only an identical request is answered from that copy. How the FKN platform handles that data is described in the`,` `,U(`a`,{href:`https://fkn.app/privacy`,target:`_blank`,rel:`noreferrer noopener`,children:`FKN platform privacy policy`}),`. Each third-party service receives the requests made to it and applies its own privacy policy, especially when you sign in to one (for example Crunchyroll) to watch.`]}),U(`p`,{children:`Netflix's catalogue is an exception: stub asks www.netflix.com from your browser, not through the proxy, because its answer depends on your country, so Netflix sees your IP address.`}),U(`p`,{children:`A search by picture asks api.trace.moe from your browser too, with a short color code of the picture, never the picture itself: trace.moe sees the code and your IP address, and FKN stores neither.`}),G(`p`,{children:[`JustWatch is asked for the streaming links of your country: the one you picked in`,` `,U(Mf,{to:`/settings#accounts`,children:`Settings`}),`, or else the one your device's time zone is in. Only the country is sent, never the time zone.`]}),U(`h2`,{children:`The optional browser extension`}),U(`p`,{children:`If you install the FKN browser extension, it works with your own already-logged-in sessions locally on your device so you can play content you have access to. Those credentials stay in your browser; stub never receives them.`}),U(`h2`,{children:`Your control`}),U(`p`,{children:`Disconnecting from FKN, in the account menu at the top right, takes your account's list off the device. Your party name and the party you are in go when you close the tab. If you use the browser extension, you can review and revoke its access at any time from the extension itself.`}),U(`h2`,{children:`Contact`}),G(`p`,{children:[`Questions about privacy can be raised through the project repository at`,` `,U(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]})]});K();var oR=({label:e,name:t=e,confirmLabel:n,busyLabel:r,question:i,onConfirm:a,home:o})=>{let[s,c]=W(!1),[l,u]=W(!1),d=q(null),f=q(null),p=q(null),m=q(!1),h=q(!0),g=pt(),_=()=>{let e=document.activeElement;return!e||e===document.body||!!p.current?.contains(e)};return V(()=>()=>{h.current=!1,p.current&&_()&&o?.current?.focus()},[]),et(()=>{s?f.current?.focus():m.current&&d.current?.focus(),m.current=!1},[s]),s?G(`div`,{ref:p,className:`confirm`,role:`group`,"aria-label":t,children:[U(`p`,{id:g,children:i}),G(`div`,{className:`actions`,children:[U(`button`,{type:`button`,className:`danger`,"aria-describedby":g,disabled:l,onClick:()=>{u(!0),Promise.resolve().then(a).catch(()=>{}).finally(()=>{if(!h.current)return;let e=_();u(!1),c(!1),e&&(o?.current?o.current.focus():m.current=!0)})},children:l?r:n}),U(`button`,{ref:f,type:`button`,className:`secondary`,"aria-describedby":g,disabled:l,onClick:()=>{m.current=!0,c(!1)},children:`Cancel`})]})]}):U(`button`,{ref:d,type:`button`,className:`secondary`,"aria-label":t===e?void 0:t,onClick:()=>c(!0),children:e})};K();var sR=new Intl.DisplayNames([`en`],{type:`region`}),cR=e=>sR.of(e)??e,lR=[...be].sort((e,t)=>cR(e).localeCompare(cR(t))),uR=()=>{let[e,t]=W(ue);return V(()=>(t(ue()),he(()=>t(ue()))),[]),e},dR=()=>(uR(),ie()),fR=()=>{let e=uR(),t=pt();return G(`div`,{className:`row`,"data-setting":`country`,children:[U(`div`,{className:`head`,children:U(`h3`,{id:t,children:`Country`})}),G(`select`,{"aria-labelledby":t,value:e??``,onChange:e=>ve(e.currentTarget.value||void 0),children:[G(`option`,{value:``,children:[`Automatic (`,cR(ye()),`)`]}),lR.map(e=>U(`option`,{value:e,children:cR(e)},e))]})]})};K();var pR=e=>e instanceof Error?e.message:String(e),mR=(e,t)=>{switch(t){case`authed`:return{text:`Signed in to ${e}.`};case`closed`:return{text:`The sign-in window closed.`};case`blocked`:return{text:`The browser blocked the sign-in window. Allow pop-ups for this page and try again.`,error:!0};case`unsupported`:return{text:`Connected to ${e}.`}}},hR={"signed-in":`Signed in`,"signed-out":`Signed out`},gR=(e,t)=>{let[,n]=W(0);return V(()=>e.watch(t,()=>n(e=>e+1)),[e,t]),e.read(t)},_R=(e,t,n)=>{V(()=>{if(!t||!n)return;let r=()=>{document.visibilityState!==`hidden`&&e.refresh(`crunchyroll`,t)};return r(),document.addEventListener(`visibilitychange`,r),()=>document.removeEventListener(`visibilitychange`,r)},[e,t,n])},vR=({id:e,title:t,state:n,on:r,heading:i,children:a})=>G(`div`,{className:`row account`,"data-account":e,children:[G(`div`,{className:`head`,children:[U(`h3`,{ref:i,tabIndex:-1,children:t}),n?U(`span`,{className:`state${r?` on`:``}`,children:n}):void 0]}),a]}),yR=({note:e})=>U(`p`,{className:`note${e?.error?` error`:``}`,role:`status`,children:e?.text}),bR=()=>{let e=q(!0);return V(()=>()=>{e.current=!1},[]),e},xR=[{site:`crunchyroll`,origin:`cr`,name:`Crunchyroll`,hostFor:()=>`crunchyroll.com`,signsInOnCloud:()=>!0,checked:!0},{site:`prime`,origin:`amazon`,name:`Prime Video`,hostFor:g,signsInOnCloud:m,checked:!1}].filter(e=>wr(e.origin)),SR=({site:e,name:t,hostFor:n,signsInOnCloud:r,checked:i,account:a,backend:o,status:s})=>{let c=n(dR()),[l,u]=W(!1),[d,f]=W(),p=bR(),m=q(null),h=gR(s,e);_R(s,o,i&&o===`cloud`&&h!==void 0);let g=()=>{let e=a.signIn();u(!0),f(void 0),e.then(e=>{p.current&&f(mR(t,e))}).catch(e=>{p.current&&f({text:pR(e),error:!0})}).finally(()=>{p.current&&u(!1)})},_=()=>a.signOut().then(()=>{p.current&&f({text:`Signed out.`})},e=>{p.current&&f({text:`Could not sign out of ${t}: ${pR(e)}. Try again.`,error:!0})}),v=o===`cloud`&&r(c),y=h?.state??(v?`signed-out`:void 0);return G(vR,{id:e,title:t,state:y&&hR[y],on:y===`signed-in`,heading:m,children:[v?U(`div`,{className:`actions`,children:y===`signed-in`?U(oR,{label:`Sign out`,name:`Sign out of ${t}`,home:m,confirmLabel:`Yes, sign out`,busyLabel:`Signing out...`,question:`Sign out of ${t} in every fkn.app app?`,onConfirm:_}):U(`button`,{type:`button`,disabled:l,onClick:g,children:l?`Signing in...`:`Sign in`})}):o?U(`div`,{className:`actions`,children:G(`a`,{className:`link`,href:`https://www.${c}`,target:`_blank`,rel:`noreferrer`,children:[`Open `,c]})}):U(`p`,{children:`Loading...`}),U(yR,{note:d})]})},CR=[{site:`anilist`,name:`AniList`,host:`anilist.co`},{site:`mal`,name:`MyAnimeList`,host:`myanimelist.net`}].filter(e=>wr(e.site)),wR=({site:e,name:t,host:n,backend:r,sites:i,status:a})=>{let[o,s]=W(()=>i.isConnected(e)),[c,l]=W(!1),[u,d]=W(),f=bR(),p=q(null),m=gR(a,e),h=o&&m?.state!==`signed-out`;V(()=>(s(i.isConnected(e)),i.watch(e,()=>{f.current&&s(i.isConnected(e))})),[i,e]);let g=()=>{f.current&&s(i.isConnected(e))},_=()=>{let n=i.signIn(e);l(!0),d(void 0),n.then(e=>{f.current&&d(mR(t,e))}).catch(e=>{f.current&&d({text:pR(e),error:!0})}).finally(()=>{f.current&&l(!1),g()})},v=n=>i.signOut(e,n).then(()=>{f.current&&d({text:n===`cloud`?`Signed out.`:`Disconnected.`}),g()},e=>{f.current&&d({text:`Could not finish signing out of ${t}: ${pR(e)}. Sign in and out again to retry.`,error:!0}),g()});return G(vR,{id:e,title:t,state:o?m&&hR[m.state]:`Not connected`,on:h,heading:p,children:[r?U(`div`,{className:`actions`,children:h?U(oR,{label:r===`cloud`?`Sign out`:`Disconnect`,name:r===`cloud`?`Sign out of ${t}`:`Disconnect ${t}`,home:p,confirmLabel:r===`cloud`?`Yes, sign out`:`Yes, disconnect`,busyLabel:r===`cloud`?`Signing out...`:`Disconnecting...`,question:r===`cloud`?`Sign out of ${t} in every fkn.app app?`:`Disconnect ${t} on this device?`,onConfirm:()=>v(r)}):r===`extension`&&o?G(`a`,{className:`link`,href:`https://${n}`,target:`_blank`,rel:`noreferrer`,children:[`Open `,n]}):U(`button`,{type:`button`,disabled:c,onClick:_,children:c?`Signing in...`:r===`cloud`?`Sign in`:`Connect`})}):void 0,U(yR,{note:u})]})},TR=({backend:e})=>U(vR,{id:`netflix`,title:`Netflix`,children:e===`extension`?U(`div`,{className:`actions`,children:U(`a`,{className:`link`,href:`https://www.netflix.com`,target:`_blank`,rel:`noreferrer`,children:`Open netflix.com`})}):U(`p`,{children:`Needs the FKN browser extension.`})}),ER=({backend:e,sites:t,status:n,...r})=>G(`div`,{className:`rows`,children:[U(fR,{}),xR.map(t=>U(SR,{...t,account:r[t.site],backend:e,status:n},t.site)),CR.map(r=>U(wR,{...r,backend:e,sites:t,status:n},r.site)),U(TR,{backend:e})]}),DR=[{origin:`mal`,name:`MyAnimeList`,url:`https://myanimelist.net`},{origin:`anilist`,name:`AniList`,url:`https://anilist.co`},{origin:`anizip`,name:`AniZip`,url:`https://api.ani.zip/`},{origin:`cr`,name:`Crunchyroll`,url:`https://www.crunchyroll.com`},{origin:`nf`,name:`Netflix`,url:`https://www.netflix.com`},{origin:`jw`,name:`JustWatch`,url:`https://www.justwatch.com`},{origin:`appletv`,name:`Apple TV+`,url:`https://tv.apple.com`},{origin:`paramount`,name:`Paramount+`,url:`https://www.paramountplus.com`},{origin:`disney`,name:`Disney+`,url:`https://www.disneyplus.com`},{origin:`amazon`,name:`Prime Video`,url:`https://www.primevideo.com`},{origin:`hulu`,name:`Hulu`,url:`https://www.hulu.com`},{origin:`peacock`,name:`Peacock`,url:`https://www.peacocktv.com`},{origin:`hbo`,name:`Max`,url:`https://www.max.com`},{origin:`fubo`,name:`Fubo`,url:`https://www.fubo.tv`},{origin:`hidive`,name:`HIDIVE`,url:`https://www.hidive.com`},{origin:`tubi`,name:`Tubi`,url:`https://tubitv.com`},{origin:`roku`,name:`The Roku Channel`,url:`https://therokuchannel.roku.com`},{origin:`pluto`,name:`Pluto TV`,url:`https://pluto.tv`},{origin:`plex`,name:`Plex`,url:`https://watch.plex.tv`},{origin:`hoopla`,name:`Hoopla`,url:`https://www.hoopladigital.com`},{origin:`starz`,name:`Starz`,url:`https://www.starz.com`},{origin:`amcplus`,name:`AMC+`,url:`https://www.amcplus.com`},{origin:`philo`,name:`Philo`,url:`https://www.philo.com`},{origin:`tmdb`,name:`TMDB`,url:`https://www.themoviedb.org`},{origin:`tvmaze`,name:`TVmaze`,url:`https://www.tvmaze.com`},{origin:`kitsu`,name:`Kitsu`,url:`https://kitsu.io`},{origin:`livechart`,name:`LiveChart`,url:`https://www.livechart.me`},{origin:`omdb`,name:`IMDb`,url:`https://www.imdb.com`},{origin:`trakt`,name:`Trakt`,url:`https://trakt.tv`},{origin:`simkl`,name:`Simkl`,url:`https://simkl.com`},{origin:`tvdb`,name:`TheTVDB`,url:`https://www.thetvdb.com`},{origin:`offline`,name:`Offline database`,url:`https://github.com/manami-project/anime-offline-database`},{origin:`animethemes`,name:`AnimeThemes`,url:`https://animethemes.moe`},{origin:`ann`,name:`Anime News Network`,url:`https://www.animenewsnetwork.com`},{origin:`watchmode`,name:`Watchmode`,url:`https://www.watchmode.com`}],OR=new Set([`anizip`,`jw`,`kitsu`,`livechart`,`offline`,`simkl`,`trakt`,`tvmaze`,`watchmode`]),kR=DR.filter(e=>!OR.has(e.origin)).map(e=>e.origin===`omdb`?{...e,origin:`imdb`}:e);K();var AR=()=>{let[e,t]=W(Ms);return V(()=>{let e=()=>t(Ms());return e(),js(e)},[]),e};K();var jR=`
4421
+ `,aR=e=>e.endsWith(`.`)?e:`${e}.`,oR=()=>G($L,{children:[U(`h1`,{children:`Privacy`}),U(`div`,{className:`updated`,children:`Last updated 13 October 2026`}),U(`p`,{children:`stub is an independent, non-commercial personal project. In short: it has no accounts and no server of its own, runs no analytics, and keeps your settings and your watch list in your browser, or in your own FKN account when you choose to.`}),U(`h2`,{children:`What stub keeps`}),G(`p`,{children:[`stub sets no advertising or tracking cookies and runs no analytics or telemetry. This is everything it keeps, where, and for how long. You sign out of a site in`,` `,U(Mf,{to:`/settings#accounts`,children:`Settings, under Accounts`}),`, and remove a source you added in`,` `,U(Mf,{to:`/settings#sources`,children:`Settings, under Sources`}),`. Clearing this site's data in your browser removes everything stub keeps in this browser.`]}),U(`ul`,{css:iR,children:rR.map(e=>G(`li`,{children:[G(`strong`,{children:[e.title,`.`]}),` `,e.what,` `,G(`span`,{className:`facts`,children:[`Where: `,aR(e.where),` How long: `,aR(e.lasts)]})]},e.id))}),U(`p`,{children:`About stub's list: signed out, it is saved in your browser's storage for stub, on this device only. Signed in to an FKN account, stub uses that account's list instead: your changes are saved on the device and in the account's storage, encrypted in your browser before they leave the device, so every device signed in to the same account shows them. A list you kept before signing in is added to the account only if you choose to. When you sign out, the account's list is removed from the device. Removing an entry keeps a record that it was removed, with the entry's title and last values, so that every device using the list removes it too. There is no way to clear these records yet.`}),U(`h2`,{children:`Sign-ins to other sites`}),G(`p`,{children:[`stub plays Crunchyroll and Prime Video and tracks your AniList and MyAnimeList lists with your own accounts on those sites. Without the FKN browser extension, you sign in on each site's own page, in an FKN window, and the cookies that sign-in sets are kept by FKN, in a cookie jar every fkn.app app shares, and not by stub. Signing out in `,U(Mf,{to:`/settings#accounts`,children:`Settings, under Accounts`}),`, removes that site's cookies from FKN. The site itself is not told, so its session stays valid there until it expires, held by nobody.`]}),U(`p`,{children:`With the extension, stub uses your browser's own sessions for these sites and for Netflix. Those stay in your browser, and you sign in and out of them on the sites themselves.`}),U(`h2`,{children:`Network requests & third parties`}),G(`p`,{children:[`To fetch titles, artwork, and streams, stub sends requests through the FKN platform proxy, which then reaches third-party services such as AniList, MyAnimeList, Crunchyroll, Prime Video and JustWatch. The proxy requires no account. It uses your IP address to rate-limit requests, and it keeps a copy of each answer for a while, under a key made from the whole request (its address, headers and body), so only an identical request is answered from that copy. How the FKN platform handles that data is described in the`,` `,U(`a`,{href:`https://fkn.app/privacy`,target:`_blank`,rel:`noreferrer noopener`,children:`FKN platform privacy policy`}),`. Each third-party service receives the requests made to it and applies its own privacy policy, especially when you sign in to one (for example Crunchyroll) to watch.`]}),U(`p`,{children:`Netflix's catalogue is an exception: stub asks www.netflix.com from your browser, not through the proxy, because its answer depends on your country, so Netflix sees your IP address.`}),U(`p`,{children:`A search by picture asks api.trace.moe from your browser too, with a short color code of the picture, never the picture itself: trace.moe sees the code and your IP address, and FKN stores neither.`}),G(`p`,{children:[`JustWatch is asked for the streaming links of your country: the one you picked in`,` `,U(Mf,{to:`/settings#accounts`,children:`Settings`}),`, or else the one your device's time zone is in. Only the country is sent, never the time zone.`]}),U(`h2`,{children:`The optional browser extension`}),U(`p`,{children:`If you install the FKN browser extension, it works with your own already-logged-in sessions locally on your device so you can play content you have access to. Those credentials stay in your browser; stub never receives them.`}),U(`h2`,{children:`Your control`}),U(`p`,{children:`Disconnecting from FKN, in the account menu at the top right, takes your account's list off the device. Your party name and the party you are in go when you close the tab. If you use the browser extension, you can review and revoke its access at any time from the extension itself.`}),U(`h2`,{children:`Contact`}),G(`p`,{children:[`Questions about privacy can be raised through the project repository at`,` `,U(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]})]});K();var sR=({label:e,name:t=e,confirmLabel:n,busyLabel:r,question:i,onConfirm:a,home:o})=>{let[s,c]=W(!1),[l,u]=W(!1),d=q(null),f=q(null),p=q(null),m=q(!1),h=q(!0),g=pt(),_=()=>{let e=document.activeElement;return!e||e===document.body||!!p.current?.contains(e)};return V(()=>()=>{h.current=!1,p.current&&_()&&o?.current?.focus()},[]),et(()=>{s?f.current?.focus():m.current&&d.current?.focus(),m.current=!1},[s]),s?G(`div`,{ref:p,className:`confirm`,role:`group`,"aria-label":t,children:[U(`p`,{id:g,children:i}),G(`div`,{className:`actions`,children:[U(`button`,{type:`button`,className:`danger`,"aria-describedby":g,disabled:l,onClick:()=>{u(!0),Promise.resolve().then(a).catch(()=>{}).finally(()=>{if(!h.current)return;let e=_();u(!1),c(!1),e&&(o?.current?o.current.focus():m.current=!0)})},children:l?r:n}),U(`button`,{ref:f,type:`button`,className:`secondary`,"aria-describedby":g,disabled:l,onClick:()=>{m.current=!0,c(!1)},children:`Cancel`})]})]}):U(`button`,{ref:d,type:`button`,className:`secondary`,"aria-label":t===e?void 0:t,onClick:()=>c(!0),children:e})};K();var cR=new Intl.DisplayNames([`en`],{type:`region`}),lR=e=>cR.of(e)??e,uR=[...be].sort((e,t)=>lR(e).localeCompare(lR(t))),dR=()=>{let[e,t]=W(ue);return V(()=>(t(ue()),he(()=>t(ue()))),[]),e},fR=()=>(dR(),ie()),pR=()=>{let e=dR(),t=pt();return G(`div`,{className:`row`,"data-setting":`country`,children:[U(`div`,{className:`head`,children:U(`h3`,{id:t,children:`Country`})}),G(`select`,{"aria-labelledby":t,value:e??``,onChange:e=>ve(e.currentTarget.value||void 0),children:[G(`option`,{value:``,children:[`Automatic (`,lR(ye()),`)`]}),uR.map(e=>U(`option`,{value:e,children:lR(e)},e))]})]})};K();var mR=e=>e instanceof Error?e.message:String(e),hR=(e,t)=>{switch(t){case`authed`:return{text:`Signed in to ${e}.`};case`closed`:return{text:`The sign-in window closed.`};case`blocked`:return{text:`The browser blocked the sign-in window. Allow pop-ups for this page and try again.`,error:!0};case`unsupported`:return{text:`Connected to ${e}.`}}},gR={"signed-in":`Signed in`,"signed-out":`Signed out`},_R=(e,t)=>{let[,n]=W(0);return V(()=>e.watch(t,()=>n(e=>e+1)),[e,t]),e.read(t)},vR=(e,t,n)=>{V(()=>{if(!t||!n)return;let r=()=>{document.visibilityState!==`hidden`&&e.refresh(`crunchyroll`,t)};return r(),document.addEventListener(`visibilitychange`,r),()=>document.removeEventListener(`visibilitychange`,r)},[e,t,n])},yR=({id:e,title:t,state:n,on:r,heading:i,children:a})=>G(`div`,{className:`row account`,"data-account":e,children:[G(`div`,{className:`head`,children:[U(`h3`,{ref:i,tabIndex:-1,children:t}),n?U(`span`,{className:`state${r?` on`:``}`,children:n}):void 0]}),a]}),bR=({note:e})=>U(`p`,{className:`note${e?.error?` error`:``}`,role:`status`,children:e?.text}),xR=()=>{let e=q(!0);return V(()=>()=>{e.current=!1},[]),e},SR=[{site:`crunchyroll`,origin:`cr`,name:`Crunchyroll`,hostFor:()=>`crunchyroll.com`,signsInOnCloud:()=>!0,checked:!0},{site:`prime`,origin:`amazon`,name:`Prime Video`,hostFor:g,signsInOnCloud:m,checked:!1}].filter(e=>wr(e.origin)),CR=({site:e,name:t,hostFor:n,signsInOnCloud:r,checked:i,account:a,backend:o,status:s})=>{let c=n(fR()),[l,u]=W(!1),[d,f]=W(),p=xR(),m=q(null),h=_R(s,e);vR(s,o,i&&o===`cloud`&&h!==void 0);let g=()=>{let e=a.signIn();u(!0),f(void 0),e.then(e=>{p.current&&f(hR(t,e))}).catch(e=>{p.current&&f({text:mR(e),error:!0})}).finally(()=>{p.current&&u(!1)})},_=()=>a.signOut().then(()=>{p.current&&f({text:`Signed out.`})},e=>{p.current&&f({text:`Could not sign out of ${t}: ${mR(e)}. Try again.`,error:!0})}),v=o===`cloud`&&r(c),y=h?.state??(v?`signed-out`:void 0);return G(yR,{id:e,title:t,state:y&&gR[y],on:y===`signed-in`,heading:m,children:[v?U(`div`,{className:`actions`,children:y===`signed-in`?U(sR,{label:`Sign out`,name:`Sign out of ${t}`,home:m,confirmLabel:`Yes, sign out`,busyLabel:`Signing out...`,question:`Sign out of ${t} in every fkn.app app?`,onConfirm:_}):U(`button`,{type:`button`,disabled:l,onClick:g,children:l?`Signing in...`:`Sign in`})}):o?U(`div`,{className:`actions`,children:G(`a`,{className:`link`,href:`https://www.${c}`,target:`_blank`,rel:`noreferrer`,children:[`Open `,c]})}):U(`p`,{children:`Loading...`}),U(bR,{note:d})]})},wR=[{site:`anilist`,name:`AniList`,host:`anilist.co`},{site:`mal`,name:`MyAnimeList`,host:`myanimelist.net`}].filter(e=>wr(e.site)),TR=({site:e,name:t,host:n,backend:r,sites:i,status:a})=>{let[o,s]=W(()=>i.isConnected(e)),[c,l]=W(!1),[u,d]=W(),f=xR(),p=q(null),m=_R(a,e),h=o&&m?.state!==`signed-out`;V(()=>(s(i.isConnected(e)),i.watch(e,()=>{f.current&&s(i.isConnected(e))})),[i,e]);let g=()=>{f.current&&s(i.isConnected(e))},_=()=>{let n=i.signIn(e);l(!0),d(void 0),n.then(e=>{f.current&&d(hR(t,e))}).catch(e=>{f.current&&d({text:mR(e),error:!0})}).finally(()=>{f.current&&l(!1),g()})},v=n=>i.signOut(e,n).then(()=>{f.current&&d({text:n===`cloud`?`Signed out.`:`Disconnected.`}),g()},e=>{f.current&&d({text:`Could not finish signing out of ${t}: ${mR(e)}. Sign in and out again to retry.`,error:!0}),g()});return G(yR,{id:e,title:t,state:o?m&&gR[m.state]:`Not connected`,on:h,heading:p,children:[r?U(`div`,{className:`actions`,children:h?U(sR,{label:r===`cloud`?`Sign out`:`Disconnect`,name:r===`cloud`?`Sign out of ${t}`:`Disconnect ${t}`,home:p,confirmLabel:r===`cloud`?`Yes, sign out`:`Yes, disconnect`,busyLabel:r===`cloud`?`Signing out...`:`Disconnecting...`,question:r===`cloud`?`Sign out of ${t} in every fkn.app app?`:`Disconnect ${t} on this device?`,onConfirm:()=>v(r)}):r===`extension`&&o?G(`a`,{className:`link`,href:`https://${n}`,target:`_blank`,rel:`noreferrer`,children:[`Open `,n]}):U(`button`,{type:`button`,disabled:c,onClick:_,children:c?`Signing in...`:r===`cloud`?`Sign in`:`Connect`})}):void 0,U(bR,{note:u})]})},ER=({backend:e})=>U(yR,{id:`netflix`,title:`Netflix`,children:e===`extension`?U(`div`,{className:`actions`,children:U(`a`,{className:`link`,href:`https://www.netflix.com`,target:`_blank`,rel:`noreferrer`,children:`Open netflix.com`})}):U(`p`,{children:`Needs the FKN browser extension.`})}),DR=({backend:e,sites:t,status:n,...r})=>G(`div`,{className:`rows`,children:[U(pR,{}),SR.map(t=>U(CR,{...t,account:r[t.site],backend:e,status:n},t.site)),wR.map(r=>U(TR,{...r,backend:e,sites:t,status:n},r.site)),U(ER,{backend:e})]}),OR=[{origin:`mal`,name:`MyAnimeList`,url:`https://myanimelist.net`},{origin:`anilist`,name:`AniList`,url:`https://anilist.co`},{origin:`anizip`,name:`AniZip`,url:`https://api.ani.zip/`},{origin:`cr`,name:`Crunchyroll`,url:`https://www.crunchyroll.com`},{origin:`nf`,name:`Netflix`,url:`https://www.netflix.com`},{origin:`jw`,name:`JustWatch`,url:`https://www.justwatch.com`},{origin:`appletv`,name:`Apple TV+`,url:`https://tv.apple.com`},{origin:`paramount`,name:`Paramount+`,url:`https://www.paramountplus.com`},{origin:`disney`,name:`Disney+`,url:`https://www.disneyplus.com`},{origin:`amazon`,name:`Prime Video`,url:`https://www.primevideo.com`},{origin:`hulu`,name:`Hulu`,url:`https://www.hulu.com`},{origin:`peacock`,name:`Peacock`,url:`https://www.peacocktv.com`},{origin:`hbo`,name:`Max`,url:`https://www.max.com`},{origin:`fubo`,name:`Fubo`,url:`https://www.fubo.tv`},{origin:`hidive`,name:`HIDIVE`,url:`https://www.hidive.com`},{origin:`tubi`,name:`Tubi`,url:`https://tubitv.com`},{origin:`roku`,name:`The Roku Channel`,url:`https://therokuchannel.roku.com`},{origin:`pluto`,name:`Pluto TV`,url:`https://pluto.tv`},{origin:`plex`,name:`Plex`,url:`https://watch.plex.tv`},{origin:`hoopla`,name:`Hoopla`,url:`https://www.hoopladigital.com`},{origin:`starz`,name:`Starz`,url:`https://www.starz.com`},{origin:`amcplus`,name:`AMC+`,url:`https://www.amcplus.com`},{origin:`philo`,name:`Philo`,url:`https://www.philo.com`},{origin:`tmdb`,name:`TMDB`,url:`https://www.themoviedb.org`},{origin:`tvmaze`,name:`TVmaze`,url:`https://www.tvmaze.com`},{origin:`kitsu`,name:`Kitsu`,url:`https://kitsu.io`},{origin:`livechart`,name:`LiveChart`,url:`https://www.livechart.me`},{origin:`omdb`,name:`IMDb`,url:`https://www.imdb.com`},{origin:`trakt`,name:`Trakt`,url:`https://trakt.tv`},{origin:`simkl`,name:`Simkl`,url:`https://simkl.com`},{origin:`tvdb`,name:`TheTVDB`,url:`https://www.thetvdb.com`},{origin:`offline`,name:`Offline database`,url:`https://github.com/manami-project/anime-offline-database`},{origin:`animethemes`,name:`AnimeThemes`,url:`https://animethemes.moe`},{origin:`ann`,name:`Anime News Network`,url:`https://www.animenewsnetwork.com`},{origin:`watchmode`,name:`Watchmode`,url:`https://www.watchmode.com`}],kR=new Set([`anizip`,`jw`,`kitsu`,`livechart`,`offline`,`simkl`,`trakt`,`tvmaze`,`watchmode`]),AR=OR.filter(e=>!kR.has(e.origin)).map(e=>e.origin===`omdb`?{...e,origin:`imdb`}:e);K();var jR=()=>{let[e,t]=W(Ms);return V(()=>{let e=()=>t(Ms());return e(),js(e)},[]),e};K();var MR=`
4422
4422
  max-width: 52rem;
4423
4423
  border: 1px solid rgba(255, 255, 255, 0.1);
4424
4424
  border-radius: 0.8rem;
@@ -4426,9 +4426,9 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4426
4426
  font-size: 1.5rem;
4427
4427
  font-weight: 600;
4428
4428
  color: #fff;
4429
- `,MR=L`
4429
+ `,NR=L`
4430
4430
  label.autoplay {
4431
- ${jR}
4431
+ ${MR}
4432
4432
  display: flex;
4433
4433
  align-items: center;
4434
4434
  justify-content: space-between;
@@ -4460,7 +4460,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4460
4460
  }
4461
4461
 
4462
4462
  ol.play-order li {
4463
- ${jR}
4463
+ ${MR}
4464
4464
  display: flex;
4465
4465
  align-items: center;
4466
4466
  gap: 0.8rem;
@@ -4493,7 +4493,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4493
4493
  }
4494
4494
 
4495
4495
  ol.play-order button[aria-disabled='true'] { opacity: 0.35; cursor: default; }
4496
- `,NR=new Map(DR.filter(e=>rc.includes(e.origin)).map(e=>[e.origin,e.name])),PR=()=>{let[e,t]=W(ic),[n,r]=W(Nt);V(()=>oc(()=>t(ic())),[]),V(()=>Ft(()=>r(Nt())),[]);let i=new Map([...NR,...AR().flatMap(e=>e.state===`connected`?e.sources?.map(e=>[e.origin,e.name])??[]:[])]),a=sc(e,[...i.keys()]),o=a.filter(e=>i.has(e)&&!n.includes(e)),s=q(void 0);et(()=>{s.current?.focus(),s.current=void 0});let c=(e,t,n)=>{let r=t<0?n===0:n===o.length-1;return U(`button`,{type:`button`,className:`secondary`,"aria-label":`Move ${i.get(e)} ${t<0?`up`:`down`}`,"aria-disabled":r?!0:void 0,onClick:n=>{r||(s.current=n.currentTarget,ac(cc(a,e,t,o)))},children:U(t<0?e_:$g,{})})};return U(`ol`,{className:`play-order`,children:o.map((e,t)=>G(`li`,{"data-play-order":e,children:[U(`span`,{className:`name`,children:i.get(e)}),c(e,-1,t),c(e,1,t)]},e))})},FR=()=>{let[e,t]=W(hc);return V(()=>_c(()=>t(hc())),[]),G(`div`,{css:MR,children:[G(`label`,{className:`autoplay`,children:[`Autoplay next episode`,U(`input`,{type:`checkbox`,role:`switch`,css:vv,checked:e,onChange:e=>{let n=e.target.checked;gc(n),t(n)}})]}),U(`h3`,{className:`part`,children:`Play order`}),U(PR,{})]})},IR=[{id:`accounts`,title:`Accounts`},{id:`sources`,title:`Sources`},{id:`playback`,title:`Playback`}],LR=e=>IR.find(t=>`#${t.id}`===e)?.id??`accounts`;K();var RR=L`
4496
+ `,PR=new Map(OR.filter(e=>rc.includes(e.origin)).map(e=>[e.origin,e.name])),FR=()=>{let[e,t]=W(ic),[n,r]=W(Nt);V(()=>oc(()=>t(ic())),[]),V(()=>Ft(()=>r(Nt())),[]);let i=new Map([...PR,...jR().flatMap(e=>e.state===`connected`?e.sources?.map(e=>[e.origin,e.name])??[]:[])]),a=sc(e,[...i.keys()]),o=a.filter(e=>i.has(e)&&!n.includes(e)),s=q(void 0);et(()=>{s.current?.focus(),s.current=void 0});let c=(e,t,n)=>{let r=t<0?n===0:n===o.length-1;return U(`button`,{type:`button`,className:`secondary`,"aria-label":`Move ${i.get(e)} ${t<0?`up`:`down`}`,"aria-disabled":r?!0:void 0,onClick:n=>{r||(s.current=n.currentTarget,ac(cc(a,e,t,o)))},children:U(t<0?e_:$g,{})})};return U(`ol`,{className:`play-order`,children:o.map((e,t)=>G(`li`,{"data-play-order":e,children:[U(`span`,{className:`name`,children:i.get(e)}),c(e,-1,t),c(e,1,t)]},e))})},IR=()=>{let[e,t]=W(hc);return V(()=>_c(()=>t(hc())),[]),G(`div`,{css:NR,children:[G(`label`,{className:`autoplay`,children:[`Autoplay next episode`,U(`input`,{type:`checkbox`,role:`switch`,css:vv,checked:e,onChange:e=>{let n=e.target.checked;gc(n),t(n)}})]}),U(`h3`,{className:`part`,children:`Play order`}),U(FR,{})]})},LR=[{id:`accounts`,title:`Accounts`},{id:`sources`,title:`Sources`},{id:`playback`,title:`Playback`}],RR=e=>LR.find(t=>`#${t.id}`===e)?.id??`accounts`;K();var zR=L`
4497
4497
  h3.part {
4498
4498
  font-size: 1.3rem;
4499
4499
  font-weight: 700;
@@ -4691,7 +4691,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4691
4691
  .group button:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.8); outline-offset: 0; }
4692
4692
 
4693
4693
  .by-address .note { font-size: 1.35rem; overflow-wrap: anywhere; }
4694
- `,zR={connected:`Connected`,connecting:`Connecting`,error:`Error`},BR=({plugin:e,onRemove:t})=>{let n=e.sources??[],r=n.length?n.map(e=>e.name).join(`, `):e.uri.replace(/^npm:/,``);return G(`li`,{className:`row plugin`,"data-plugin":e.uri,children:[G(`div`,{className:`info`,children:[U(`span`,{className:`name`,children:r}),n.length?G(`span`,{className:`meta`,children:[U(`span`,{className:`uri`,children:e.uri}),n.length>1?` · ${n.length} sources`:``,e.rejected?.length?` · ${e.rejected.length} unavailable`:``]}):void 0]}),G(`span`,{className:`pill`,"data-state":e.state,children:[U(`span`,{className:`dot`,"aria-hidden":`true`}),zR[e.state]]}),U(`button`,{type:`button`,className:`secondary small`,"aria-label":`Remove ${r}`,onClick:t,children:`Remove`}),e.state===`error`?U(`p`,{className:`failure`,children:`Could not connect to this source.`}):void 0]})},VR=e=>{let{host:t,pathname:n}=new URL(e);return t.replace(/^www\./,``)+n.replace(/\/$/,``)},HR=DR.filter(e=>wr(e.origin)),UR=()=>{let[e,t]=W(()=>new Set(Nt()));V(()=>Ft(()=>t(new Set(Nt()))),[]);let n=HR.filter(t=>e.has(t.origin)).length;return G(z,{children:[G(`div`,{className:`part-head`,children:[U(`h3`,{className:`part`,children:`Built in`}),U(`span`,{className:`count`,children:n?`${HR.length-n} of ${HR.length} on`:`All ${HR.length} on`}),U(`button`,{type:`button`,className:`link-button`,"aria-disabled":!n||void 0,onClick:()=>{n&&en(HR.map(e=>e.origin))},children:`Turn all on`})]}),U(`ul`,{className:`built-in`,children:HR.map(t=>{let n=!e.has(t.origin);return U(`li`,{"data-source":t.origin,children:G(`label`,{className:n?void 0:`off`,children:[G(`span`,{className:`source`,children:[U(`span`,{className:`source-name`,children:t.name}),U(`span`,{className:`host`,children:VR(t.url)})]}),U(`input`,{type:`checkbox`,role:`switch`,css:vv,"aria-label":t.name,checked:n,onChange:e=>Zt(t.origin,e.target.checked)})]})},t.origin)})})]})},WR=()=>{let e=tc();return G(z,{children:[U(`h3`,{className:`part`,children:`Icons`}),U(`ul`,{className:`built-in`,children:kR.map(t=>{let n=!e.has(t.origin);return U(`li`,{"data-icon":t.origin,children:G(`label`,{className:n?void 0:`off`,children:[U(`span`,{className:`source`,children:U(`span`,{className:`source-name`,children:t.name})}),U(`input`,{type:`checkbox`,role:`switch`,css:vv,"aria-label":`${t.name} icon`,checked:n,onChange:e=>$s(t.origin,e.target.checked)})]})},t.origin)})})]})},GR=()=>{let[e,t]=W(Ms),[n,r]=W(``),[i,a]=W(!1),[o,s]=W(``),c=pt(),l=()=>t(Ms());return V(()=>(l(),js(l)),[]),G(`div`,{css:RR,children:[U(UR,{}),U(WR,{}),U(`h3`,{className:`part`,children:`Added`}),e.length?U(`ul`,{className:`rows`,children:e.map(e=>U(BR,{plugin:e,onRemove:()=>{Ys(e.uri).then(l)}},e.uri))}):U(`p`,{className:`row empty`,children:`No sources added yet.`}),G(`div`,{className:`add`,children:[U(`div`,{className:`browse`,children:U(`button`,{type:`button`,onClick:()=>{Xs().finally(l)},children:`Browse sources`})}),G(`form`,{className:`by-address`,onSubmit:e=>{e.preventDefault();let t=n.trim();t&&!i&&(a(!0),s(``),qs(t).then(e=>{e&&r(``)}).catch(e=>{console.warn(`Source '${t}' could not be added:`,e),s(`Could not add this source. Check the address.`)}).finally(()=>{a(!1),l()}))},children:[U(`label`,{for:`${c}-address`,children:`Or add one by its address`}),G(`div`,{className:`group${o?` invalid`:``}`,children:[U(`input`,{id:`${c}-address`,type:`text`,autoComplete:`off`,spellcheck:!1,placeholder:`npm:@scope/package`,"aria-invalid":o?!0:void 0,"aria-describedby":`${c}-error`,value:n,onInput:e=>r(e.target.value)}),U(`button`,{type:`submit`,disabled:i,children:i?`Adding...`:`Add`})]}),U(`p`,{className:`note error`,id:`${c}-error`,role:`alert`,children:o})]})]})]})},KR=L`
4694
+ `,BR={connected:`Connected`,connecting:`Connecting`,error:`Error`},VR=({plugin:e,onRemove:t})=>{let n=e.sources??[],r=n.length?n.map(e=>e.name).join(`, `):e.uri.replace(/^npm:/,``);return G(`li`,{className:`row plugin`,"data-plugin":e.uri,children:[G(`div`,{className:`info`,children:[U(`span`,{className:`name`,children:r}),n.length?G(`span`,{className:`meta`,children:[U(`span`,{className:`uri`,children:e.uri}),n.length>1?` · ${n.length} sources`:``,e.rejected?.length?` · ${e.rejected.length} unavailable`:``]}):void 0]}),G(`span`,{className:`pill`,"data-state":e.state,children:[U(`span`,{className:`dot`,"aria-hidden":`true`}),BR[e.state]]}),U(`button`,{type:`button`,className:`secondary small`,"aria-label":`Remove ${r}`,onClick:t,children:`Remove`}),e.state===`error`?U(`p`,{className:`failure`,children:`Could not connect to this source.`}):void 0]})},HR=e=>{let{host:t,pathname:n}=new URL(e);return t.replace(/^www\./,``)+n.replace(/\/$/,``)},UR=OR.filter(e=>wr(e.origin)),WR=()=>{let[e,t]=W(()=>new Set(Nt()));V(()=>Ft(()=>t(new Set(Nt()))),[]);let n=UR.filter(t=>e.has(t.origin)).length;return G(z,{children:[G(`div`,{className:`part-head`,children:[U(`h3`,{className:`part`,children:`Built in`}),U(`span`,{className:`count`,children:n?`${UR.length-n} of ${UR.length} on`:`All ${UR.length} on`}),U(`button`,{type:`button`,className:`link-button`,"aria-disabled":!n||void 0,onClick:()=>{n&&en(UR.map(e=>e.origin))},children:`Turn all on`})]}),U(`ul`,{className:`built-in`,children:UR.map(t=>{let n=!e.has(t.origin);return U(`li`,{"data-source":t.origin,children:G(`label`,{className:n?void 0:`off`,children:[G(`span`,{className:`source`,children:[U(`span`,{className:`source-name`,children:t.name}),U(`span`,{className:`host`,children:HR(t.url)})]}),U(`input`,{type:`checkbox`,role:`switch`,css:vv,"aria-label":t.name,checked:n,onChange:e=>Zt(t.origin,e.target.checked)})]})},t.origin)})})]})},GR=()=>{let e=tc();return G(z,{children:[U(`h3`,{className:`part`,children:`Icons`}),U(`ul`,{className:`built-in`,children:AR.map(t=>{let n=!e.has(t.origin);return U(`li`,{"data-icon":t.origin,children:G(`label`,{className:n?void 0:`off`,children:[U(`span`,{className:`source`,children:U(`span`,{className:`source-name`,children:t.name})}),U(`input`,{type:`checkbox`,role:`switch`,css:vv,"aria-label":`${t.name} icon`,checked:n,onChange:e=>$s(t.origin,e.target.checked)})]})},t.origin)})})]})},KR=()=>{let[e,t]=W(Ms),[n,r]=W(``),[i,a]=W(!1),[o,s]=W(``),c=pt(),l=()=>t(Ms());return V(()=>(l(),js(l)),[]),G(`div`,{css:zR,children:[U(WR,{}),U(GR,{}),U(`h3`,{className:`part`,children:`Added`}),e.length?U(`ul`,{className:`rows`,children:e.map(e=>U(VR,{plugin:e,onRemove:()=>{Ys(e.uri).then(l)}},e.uri))}):U(`p`,{className:`row empty`,children:`No sources added yet.`}),G(`div`,{className:`add`,children:[U(`div`,{className:`browse`,children:U(`button`,{type:`button`,onClick:()=>{Xs().finally(l)},children:`Browse sources`})}),G(`form`,{className:`by-address`,onSubmit:e=>{e.preventDefault();let t=n.trim();t&&!i&&(a(!0),s(``),qs(t).then(e=>{e&&r(``)}).catch(e=>{console.warn(`Source '${t}' could not be added:`,e),s(`Could not add this source. Check the address.`)}).finally(()=>{a(!1),l()}))},children:[U(`label`,{for:`${c}-address`,children:`Or add one by its address`}),G(`div`,{className:`group${o?` invalid`:``}`,children:[U(`input`,{id:`${c}-address`,type:`text`,autoComplete:`off`,spellcheck:!1,placeholder:`npm:@scope/package`,"aria-invalid":o?!0:void 0,"aria-describedby":`${c}-error`,value:n,onInput:e=>r(e.target.value)}),U(`button`,{type:`submit`,disabled:i,children:i?`Adding...`:`Add`})]}),U(`p`,{className:`note error`,id:`${c}-error`,role:`alert`,children:o})]})]})]})},qR=L`
4695
4695
  min-width: 0;
4696
4696
 
4697
4697
  & > h2 {
@@ -4828,7 +4828,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4828
4828
  }
4829
4829
 
4830
4830
  .confirm p { color: rgba(255, 255, 255, 0.9); }
4831
- `,qR={url:`${de}/auth/v1/token`,authorization:`Basic ${btoa(`${P}:`)}`,deviceType:`stub on FKN`},JR=async({url:e,authorization:t,deviceType:n},r=fetch,i)=>{let a=globalThis.location?.origin===new URL(e).origin?globalThis.document?.cookie??``:``,o=/(?:^|;\s*)device_id=([^;]+)/.exec(a)?.[1]??crypto.randomUUID(),s=await r(`${e}?_=${crypto.randomUUID()}`,{method:`POST`,credentials:`include`,headers:{authorization:t,"content-type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`etp_rt_cookie`,device_id:o,device_type:n}).toString()}),c=await s.json().catch(()=>null);return!s.ok||!i?{status:s.status,body:s.ok?null:c}:{status:s.status,body:null,read:await i(c)}},YR=e=>(e?.context??[]).some(e=>e.field===`etp_rt`&&e.code===`auth.obtain_access_token.missing_required_field`),XR=({status:e,body:t})=>{if(e===200)return`signed-in`;if(e===400&&YR(t))return`signed-out`;throw Error(`Crunchyroll answered ${e}`)},ZR=`Check whether you are signed in to crunchyroll.com`,QR=async(e,{attach:t,mount:n,fetch:r,settle:i=()=>new Promise(e=>setTimeout(e,2e3))})=>{if(e===`extension`)return XR(await JR(qR,r));let{iframe:a,remove:o}=n();try{let e=await(await t({iframe:a,blank:{url:N},cookies:`persistent`,permissions:[{category:`evaluation`,reason:ZR}]})).evaluate(JR,qR);return e.status===200&&await i(),XR(e)}finally{o()}},$R={signIn:jt,signOut:Et},ez={signIn:()=>Ce({url:x(g(ie())),domains:v,isSignedIn:y}).then(le(ce,`prime`)),signOut:()=>Dt(v).then(()=>ce.record(`prime`,`signed-out`))},tz={isConnected:$t,watch:Ot,signIn:e=>Mt[e](),signOut:Qt},nz={read:ce.read,watch:ce.watch,refresh:ge(ce,(e,t)=>QR(t,{attach:A,mount:()=>At(`Sign-in check`),fetch:re}))};K();var rz=L`
4831
+ `,JR={url:`${de}/auth/v1/token`,authorization:`Basic ${btoa(`${P}:`)}`,deviceType:`stub on FKN`},YR=async({url:e,authorization:t,deviceType:n},r=fetch,i)=>{let a=globalThis.location?.origin===new URL(e).origin?globalThis.document?.cookie??``:``,o=/(?:^|;\s*)device_id=([^;]+)/.exec(a)?.[1]??crypto.randomUUID(),s=await r(`${e}?_=${crypto.randomUUID()}`,{method:`POST`,credentials:`include`,headers:{authorization:t,"content-type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`etp_rt_cookie`,device_id:o,device_type:n}).toString()}),c=await s.json().catch(()=>null);return!s.ok||!i?{status:s.status,body:s.ok?null:c}:{status:s.status,body:null,read:await i(c)}},XR=e=>(e?.context??[]).some(e=>e.field===`etp_rt`&&e.code===`auth.obtain_access_token.missing_required_field`),ZR=({status:e,body:t})=>{if(e===200)return`signed-in`;if(e===400&&XR(t))return`signed-out`;throw Error(`Crunchyroll answered ${e}`)},QR=`Check whether you are signed in to crunchyroll.com`,$R=async(e,{attach:t,mount:n,fetch:r,settle:i=()=>new Promise(e=>setTimeout(e,2e3))})=>{if(e===`extension`)return ZR(await YR(JR,r));let{iframe:a,remove:o}=n();try{let e=await(await t({iframe:a,blank:{url:N},cookies:`persistent`,permissions:[{category:`evaluation`,reason:QR}]})).evaluate(YR,JR);return e.status===200&&await i(),ZR(e)}finally{o()}},ez={signIn:jt,signOut:Et},tz={signIn:()=>Ce({url:x(g(ie())),domains:v,isSignedIn:y}).then(le(ce,`prime`)),signOut:()=>Dt(v).then(()=>ce.record(`prime`,`signed-out`))},nz={isConnected:$t,watch:Ot,signIn:e=>Mt[e](),signOut:Qt},rz={read:ce.read,watch:ce.watch,refresh:ge(ce,(e,t)=>$R(t,{attach:A,mount:()=>At(`Sign-in check`),fetch:re}))};K();var iz=L`
4832
4832
  display: grid;
4833
4833
  grid-template-columns: 17rem minmax(0, 1fr);
4834
4834
  column-gap: 4rem;
@@ -4889,7 +4889,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4889
4889
 
4890
4890
  .index a[aria-current='true'] { background: #fff; color: #000; border-color: #fff; }
4891
4891
  }
4892
- `,iz=()=>location.hash,az=()=>{let[e,t]=W(),n=LR(tf(iz)),r=IR.find(e=>e.id===n);return V(()=>{let e=!1;return ee().then(n=>{e||t(n)}),()=>{e=!0}},[]),G(`div`,{css:rz,children:[U(`h1`,{children:`Settings`}),U(`nav`,{className:`index`,"aria-label":`Settings categories`,children:IR.map(e=>U(`a`,{href:`#${e.id}`,"aria-current":r===e?`true`:void 0,onClick:N_,children:e.title},e.id))}),G(`section`,{css:KR,"data-section":r.id,"aria-labelledby":`settings-section-title`,children:[U(`h2`,{id:`settings-section-title`,children:r.title}),r.id===`accounts`?U(ER,{backend:e,crunchyroll:$R,prime:ez,sites:tz,status:nz}):r.id===`sources`?U(GR,{}):U(FR,{})]})]})},oz=e=>typeof e!=`number`||e===1/0?void 0:e>0?e:0,sz=e=>typeof e==`number`&&Number.isFinite(e),cz=e=>{if(!e||typeof e!=`object`)return;let{time:t,readyState:n,ranges:r}=e;if(!(!sz(t)||t<0||!sz(n)||!Number.isInteger(n)||n<0||n>4))return Array.isArray(r)&&r.every(e=>Array.isArray(e)&&e.length===2&&sz(e[0])&&sz(e[1])&&e[0]<=e[1])?{time:t,readyState:n,ranges:r}:void 0},lz=1e3,uz=e=>{let{onPlayback:t,applyPlayback:n,buffer:r}=e;if(!t||!n)return;let i=new Set,a=!1,o=!1,s,c=e=>{if(a||!Dn(e))return;o=e.ended===!0,s=oz(e.duration);let{paused:t,time:n,rate:r,at:c}=e;for(let e of i)e({paused:t,time:n,rate:r,at:c})},l=()=>{t(c).catch(()=>{})};return l(),{apply:e=>{n(e).catch(()=>{})},onReport:e=>(i.add(e),l(),()=>{i.delete(e)}),ended:()=>o,duration:()=>s,...r?{buffer:()=>Promise.race([r().then(cz,()=>void 0),new Promise(e=>setTimeout(e,lz))])}:{},dispose:()=>{a=!0,i.clear()}}};K();var dz=L`
4892
+ `,az=()=>location.hash,oz=()=>{let[e,t]=W(),n=RR(tf(az)),r=LR.find(e=>e.id===n);return V(()=>{let e=!1;return ee().then(n=>{e||t(n)}),()=>{e=!0}},[]),G(`div`,{css:iz,children:[U(`h1`,{children:`Settings`}),U(`nav`,{className:`index`,"aria-label":`Settings categories`,children:LR.map(e=>U(`a`,{href:`#${e.id}`,"aria-current":r===e?`true`:void 0,onClick:N_,children:e.title},e.id))}),G(`section`,{css:qR,"data-section":r.id,"aria-labelledby":`settings-section-title`,children:[U(`h2`,{id:`settings-section-title`,children:r.title}),r.id===`accounts`?U(DR,{backend:e,crunchyroll:ez,prime:tz,sites:nz,status:rz}):r.id===`sources`?U(KR,{}):U(IR,{})]})]})},sz=e=>typeof e!=`number`||e===1/0?void 0:e>0?e:0,cz=e=>typeof e==`number`&&Number.isFinite(e),lz=e=>{if(!e||typeof e!=`object`)return;let{time:t,readyState:n,ranges:r}=e;if(!(!cz(t)||t<0||!cz(n)||!Number.isInteger(n)||n<0||n>4))return Array.isArray(r)&&r.every(e=>Array.isArray(e)&&e.length===2&&cz(e[0])&&cz(e[1])&&e[0]<=e[1])?{time:t,readyState:n,ranges:r}:void 0},uz=1e3,dz=e=>{let{onPlayback:t,applyPlayback:n,buffer:r}=e;if(!t||!n)return;let i=new Set,a=!1,o=!1,s,c=e=>{if(a||!Dn(e))return;o=e.ended===!0,s=sz(e.duration);let{paused:t,time:n,rate:r,at:c}=e;for(let e of i)e({paused:t,time:n,rate:r,at:c})},l=()=>{t(c).catch(()=>{})};return l(),{apply:e=>{n(e).catch(()=>{})},onReport:e=>(i.add(e),l(),()=>{i.delete(e)}),ended:()=>o,duration:()=>s,...r?{buffer:()=>Promise.race([r().then(lz,()=>void 0),new Promise(e=>setTimeout(e,uz))])}:{},dispose:()=>{a=!0,i.clear()}}};K();var fz=L`
4893
4893
  position: relative;
4894
4894
  width: 100%;
4895
4895
  flex: 1;
@@ -4915,9 +4915,9 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4915
4915
  color: rgba(255, 255, 255, 0.55);
4916
4916
  font-size: 1.4rem;
4917
4917
  }
4918
- `,fz=({pluginUri:e,release:t,onUnplayable:n,onPlayback:i})=>{let a=q(null),[o,s]=W(!1),c=q({onUnplayable:n,onPlayback:i});return c.current={onUnplayable:n,onPlayback:i},V(()=>{let n=a.current;if(!n)return;let i=!1,o,l;return s(!1),(async()=>{try{let a=await E.mount(e,{iframe:n,protocol:Qa});if(i){a.unmount();return}o=a;let{origin:s}=r(t.uri),u=a.remote,d=u.sources?.find(e=>e.origin===s)??u,f=await d.play?.({uri:t.uri,url:t.url});if(i)return;if(!f){a.unmount(),o=void 0,c.current.onUnplayable();return}l=uz(d),l&&c.current.onPlayback?.(l)}catch(t){if(i)return;console.warn(`Source '${e}' could not start playback:`,t),s(!0)}})(),()=>{i=!0,l&&(l.dispose(),c.current.onPlayback?.(void 0)),o?.unmount()}},[e,t.uri,t.url]),G(`div`,{css:dz,children:[U(`iframe`,{ref:a,sandbox:`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox`,allow:`fullscreen; autoplay; encrypted-media; cross-origin-isolated`}),o?U(`div`,{className:`failed`,children:`This source could not start playback.`}):null]})},pz=(e,t,n)=>{let r=t===`party`?e:t;if(!(r===void 0||n.busy||r===n.selected)&&(r===null||n.ids.includes(r)))return r},mz=(e,t,n,r,i)=>!n||r.selected===n.selected||r.selected===i?e:r.selected===t?`party`:r.selected;K();var hz=()=>location.pathname+location.search,gz=()=>navigator.userActivation?.isActive??!0,_z=({link:e,tracks:t})=>{let n=Q_(),r=n.status===`active`?n.role:void 0,i=J.following(),a=q(void 0),o=q(void 0),s=q(0),c=q(void 0),u=q(0),d=q(void 0),f=q(new Map),p=q(void 0),m=q(void 0),h=q(new Map),g=()=>m.current?.busy??!1,_=(t,n)=>{if(!e||!J.following()||g())return;let r=Date.now(),i=o.current&&Fn(o.current,o.current.at,r),a=i&&Mn(i,t,r,n);e.ended?.()&&a?.seek===void 0||((!a||a.seek!==void 0||a.play||a.pause)&&(u.current=r+In),a?.seek!==void 0&&(d.current=a.seek),e.apply(t,n))},v=()=>{let e=a.current;e&&_(Fn(e.state,e.receivedAt,Date.now()),e.measured)},y=(e,t)=>{let n=J.hostClock(),r=n?{...t,at:Xn(t.at,n.offset)}:t;for(let t of e){let e=f.current.get(t)??{sentAt:0};if(f.current.set(t,e),e.next={t:`ask`,c:t,path:hz(),s:r},e.timer)continue;let n=()=>{e.timer=void 0,e.sentAt=Date.now(),J.send(e.next)},i=e.sentAt+250-Date.now();i<=0?n():e.timer=setTimeout(n,i)}s.current=Date.now()+Ln,clearTimeout(c.current),c.current=setTimeout(v,Ln)};V(()=>{if(a.current=void 0,o.current=void 0,p.current=void 0,d.current=void 0,!e||!r)return;let t=e.onReport(t=>{let n=o.current;if(o.current=t,r===`host`){if(g())return;p.current=t,J.setPlayback(t),J.send({t:`playback`,s:t});return}let i=a.current;if(!i||e.ended?.()||!J.following()||g())return;let c=Date.now(),l=c<s.current,f=Fn(i.state,i.receivedAt,c),m=d.current!==void 0&&Math.abs(t.time-d.current)<=.5;m&&(d.current=void 0);let h=n&&gz()&&(l||c>=u.current)?Rn(n,t,l?n:f).filter(e=>J.may(e)&&!(m&&e===`seek`)):[];h.length?y(h,t):l||_(f,i.measured)});return()=>{t(),clearTimeout(c.current);for(let e of f.current.values())clearTimeout(e.timer);f.current.clear(),s.current=0,r===`host`&&J.setPlayback(void 0)}},[r,e]),V(()=>{i&&v()},[i]),V(()=>{if(r!==`guest`)return;let t,n=!0,i=async()=>{let r=hz(),i=J.hostPath();if(i===void 0)return;if(i!==r){J.setStatus({s:`away`});return}let s=await e?.buffer?.();if(!n)return;let c=Date.now(),l=o.current&&Fn(o.current,o.current.at,c),u=s?.time??l?.time,d=l&&!l.paused&&(s?.readyState??3)>=3,f=u===void 0?{}:{time:u,rate:d?l.rate:0};if(!J.following()){J.setStatus({s:`away`,path:r,...f});return}let p=a.current;t=p?Un(t,s,Fn(p.state,p.receivedAt,c).time,e?.duration?.()):`loading`,J.setStatus({s:t,path:r,...f})};i();let s=setInterval(()=>{i()},Bn);return()=>{n=!1,clearInterval(s)}},[r,e]),V(()=>()=>{r===`guest`&&J.setStatus({s:`away`})},[r]);let b=()=>{let e=m.current;if(t&&e&&r)for(let n of l){let r=e[n],i=r&&pz(J.partyTrack(n),J.mine(n),{...r,busy:e.busy});i===void 0&&!e.busy&&h.current.delete(n),i!==void 0&&h.current.get(n)!==i&&(h.current.set(n,i),t.select(n,i))}},x=()=>{if(r===`guest`){v();return}let t=p.current,n=o.current;if(!e||!t||!n)return;let i=Date.now(),a=Fn(t,t.at,i),s=Fn(n,n.at,i);Math.abs(a.time-s.time)>.5?e.apply({...s,time:a.time},!0):(p.current=n,J.setPlayback(n),J.send({t:`playback`,s:n}))};return V(()=>{if(m.current=void 0,h.current.clear(),!t||!r)return;let e=t.onTracks(e=>{let t=m.current;m.current=e;for(let n of l){let r=e[n];if(!r)continue;let i=mz(J.mine(n),J.partyTrack(n),t?.[n],r,h.current.get(n));i!==J.mine(n)&&J.setMine(n,i)}J.setPlayerTracks(e),t?.busy&&!e.busy&&x(),b()});return()=>{e(),m.current=void 0,J.setPlayerTracks(void 0)}},[r,t,e]),V(b),$_(t=>{if(r===`host`){if(t.t!==`ask`||!(`s`in t)||t.path!==hz()||!e||!o.current)return;let n=zn(o.current,t,Date.now());if(!n)return;g()&&(p.current=n),e.apply(n,!0);return}if(r!==`guest`)return;let n=t.t===`playback`||t.t===`state`?t.s:void 0;if(!n||J.hostPath()!==hz())return;let i=J.hostClock(),c=i?{...n,at:Yn(n.at,i.offset)}:n;a.current={state:c,receivedAt:Date.now(),measured:!!i},Date.now()>=s.current&&_(c,!!i)}),null},vz=[`play`,`pause`,`seeked`,`ratechange`,`ended`],yz=e=>({paused:e.paused,time:e.currentTime,rate:e.playbackRate??1,at:Date.now()}),bz=(e,t=()=>{})=>{let n=new Set,r=()=>{let t=yz(e);for(let e of n)e(t)};for(let t of vz)e.addEventListener(t,r);let i=setInterval(()=>{e.paused||r()},kn);return{apply:(t,n)=>{let r=Mn(yz(e),t,Date.now(),n);r.seek!==void 0&&(e.currentTime=r.seek),r.rate!==void 0&&(e.playbackRate=r.rate),r.pause&&e.pause(),r.play&&(e.autoplay?e.autoplay():e.play()).catch(()=>{})},onReport:e=>(n.add(e),queueMicrotask(r),()=>{n.delete(e)}),ended:()=>e.ended??!1,duration:()=>e.duration??0,buffer:async()=>{let{buffered:t}=e,n=[];for(let e=0;t&&e<t.length;e++)n.push([t.start(e),t.end(e)]);return{time:e.currentTime,readyState:e.readyState??0,ranges:n}},dispose:()=>{for(let t of vz)e.removeEventListener(t,r);clearInterval(i),n.clear(),t()}}},xz=e=>{let t=tn(e,{origin:location.origin});return bz(t,()=>t.destroy())},Sz=(e,t)=>t?`${e==null?``:`E${e} - `}${t}`:e==null?void 0:`Episode ${e}`;K();var Cz=(e,t)=>!!(e.url&&t.builtIn(e.origin,e.url))||!!(t.selfPlaying&&(e.embedUrl||t.selfPlaying(e.origin))),wz=(e,t)=>{let n=e=>{let n=t.order.indexOf(e);return n<0?t.order.length:n},r;for(let i of e)Cz(i,t)&&(!r||n(i.origin)<n(r.origin))&&(r=i);if(!r)return;let i=t.order.slice(0,n(r.origin)).every(e=>!t.possible(e)||t.settled(e));return{uri:r.uri,now:i}},Tz=(e,{mediaUri:t,episodeUri:n,sourceUri:r,guest:i,cannotPlay:a,search:o},s)=>{let c=q(void 0);V(()=>{r&&r!==c.current&&(c.current=void 0)},[r]);let l=(!r||a&&r===c.current)&&!i&&e?.now?e.uri:void 0;V(()=>{if(!l)return;c.current=l;let e=zf(Q.WATCH,{mediaUri:t,episodeUri:n,sourceUri:l});s(o?`${e}?${o}`:e,{replace:!0})},[l,t,n])},Ez=(e,t)=>{if(ib(e))return;let{handles:n,seasons:r,relations:i,type:a}=e,o=r?.findIndex(e=>n.some(t=>t.node.uri===e.uri))??-1;if(r&&o>=0){let e=r[o+t];return e&&d(e.uri)}let s=t>0?`SEQUEL`:`PREQUEL`,c=i?.filter(e=>e.relation===s&&dS(e.format))??[];return(c.find(e=>e.format===a)??c[0])?.node.uri},Dz=([e,t,n],r,i=new Date)=>{let a=[e,t,n].filter(e=>e!==void 0),o=a.flatMap(({uri:e,episodes:t})=>t.map(t=>({episode:t,mediaUri:e}))),s=a.flatMap(e=>yb(e,i)),c=r<0?-1:r+(e?.episodes.length??0);return{previous:c>0?o[c-1]:void 0,next:c>=0&&!s[c+1]?o[c+1]:void 0}},Oz=(e,t,n)=>t?wz(e.filter(e=>e.origin===t),n)?.uri:void 0;K();var kz=5e3,Az=We`
4918
+ `,pz=({pluginUri:e,release:t,onUnplayable:n,onPlayback:i})=>{let a=q(null),[o,s]=W(!1),c=q({onUnplayable:n,onPlayback:i});return c.current={onUnplayable:n,onPlayback:i},V(()=>{let n=a.current;if(!n)return;let i=!1,o,l;return s(!1),(async()=>{try{let a=await E.mount(e,{iframe:n,protocol:Qa});if(i){a.unmount();return}o=a;let{origin:s}=r(t.uri),u=a.remote,d=u.sources?.find(e=>e.origin===s)??u,f=await d.play?.({uri:t.uri,url:t.url});if(i)return;if(!f){a.unmount(),o=void 0,c.current.onUnplayable();return}l=dz(d),l&&c.current.onPlayback?.(l)}catch(t){if(i)return;console.warn(`Source '${e}' could not start playback:`,t),s(!0)}})(),()=>{i=!0,l&&(l.dispose(),c.current.onPlayback?.(void 0)),o?.unmount()}},[e,t.uri,t.url]),G(`div`,{css:fz,children:[U(`iframe`,{ref:a,sandbox:`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox`,allow:`fullscreen; autoplay; encrypted-media; cross-origin-isolated`}),o?U(`div`,{className:`failed`,children:`This source could not start playback.`}):null]})},mz=(e,t,n)=>{let r=t===`party`?e:t;if(!(r===void 0||n.busy||r===n.selected)&&(r===null||n.ids.includes(r)))return r},hz=(e,t,n,r,i)=>!n||r.selected===n.selected||r.selected===i?e:r.selected===t?`party`:r.selected;K();var gz=()=>location.pathname+location.search,_z=()=>navigator.userActivation?.isActive??!0,vz=({link:e,tracks:t})=>{let n=Q_(),r=n.status===`active`?n.role:void 0,i=J.following(),a=q(void 0),o=q(void 0),s=q(0),c=q(void 0),u=q(0),d=q(void 0),f=q(new Map),p=q(void 0),m=q(void 0),h=q(new Map),g=()=>m.current?.busy??!1,_=(t,n)=>{if(!e||!J.following()||g())return;let r=Date.now(),i=o.current&&Fn(o.current,o.current.at,r),a=i&&Mn(i,t,r,n);e.ended?.()&&a?.seek===void 0||((!a||a.seek!==void 0||a.play||a.pause)&&(u.current=r+In),a?.seek!==void 0&&(d.current=a.seek),e.apply(t,n))},v=()=>{let e=a.current;e&&_(Fn(e.state,e.receivedAt,Date.now()),e.measured)},y=(e,t)=>{let n=J.hostClock(),r=n?{...t,at:Xn(t.at,n.offset)}:t;for(let t of e){let e=f.current.get(t)??{sentAt:0};if(f.current.set(t,e),e.next={t:`ask`,c:t,path:gz(),s:r},e.timer)continue;let n=()=>{e.timer=void 0,e.sentAt=Date.now(),J.send(e.next)},i=e.sentAt+250-Date.now();i<=0?n():e.timer=setTimeout(n,i)}s.current=Date.now()+Ln,clearTimeout(c.current),c.current=setTimeout(v,Ln)};V(()=>{if(a.current=void 0,o.current=void 0,p.current=void 0,d.current=void 0,!e||!r)return;let t=e.onReport(t=>{let n=o.current;if(o.current=t,r===`host`){if(g())return;p.current=t,J.setPlayback(t),J.send({t:`playback`,s:t});return}let i=a.current;if(!i||e.ended?.()||!J.following()||g())return;let c=Date.now(),l=c<s.current,f=Fn(i.state,i.receivedAt,c),m=d.current!==void 0&&Math.abs(t.time-d.current)<=.5;m&&(d.current=void 0);let h=n&&_z()&&(l||c>=u.current)?Rn(n,t,l?n:f).filter(e=>J.may(e)&&!(m&&e===`seek`)):[];h.length?y(h,t):l||_(f,i.measured)});return()=>{t(),clearTimeout(c.current);for(let e of f.current.values())clearTimeout(e.timer);f.current.clear(),s.current=0,r===`host`&&J.setPlayback(void 0)}},[r,e]),V(()=>{i&&v()},[i]),V(()=>{if(r!==`guest`)return;let t,n=!0,i=async()=>{let r=gz(),i=J.hostPath();if(i===void 0)return;if(i!==r){J.setStatus({s:`away`});return}let s=await e?.buffer?.();if(!n)return;let c=Date.now(),l=o.current&&Fn(o.current,o.current.at,c),u=s?.time??l?.time,d=l&&!l.paused&&(s?.readyState??3)>=3,f=u===void 0?{}:{time:u,rate:d?l.rate:0};if(!J.following()){J.setStatus({s:`away`,path:r,...f});return}let p=a.current;t=p?Un(t,s,Fn(p.state,p.receivedAt,c).time,e?.duration?.()):`loading`,J.setStatus({s:t,path:r,...f})};i();let s=setInterval(()=>{i()},Bn);return()=>{n=!1,clearInterval(s)}},[r,e]),V(()=>()=>{r===`guest`&&J.setStatus({s:`away`})},[r]);let b=()=>{let e=m.current;if(t&&e&&r)for(let n of l){let r=e[n],i=r&&mz(J.partyTrack(n),J.mine(n),{...r,busy:e.busy});i===void 0&&!e.busy&&h.current.delete(n),i!==void 0&&h.current.get(n)!==i&&(h.current.set(n,i),t.select(n,i))}},x=()=>{if(r===`guest`){v();return}let t=p.current,n=o.current;if(!e||!t||!n)return;let i=Date.now(),a=Fn(t,t.at,i),s=Fn(n,n.at,i);Math.abs(a.time-s.time)>.5?e.apply({...s,time:a.time},!0):(p.current=n,J.setPlayback(n),J.send({t:`playback`,s:n}))};return V(()=>{if(m.current=void 0,h.current.clear(),!t||!r)return;let e=t.onTracks(e=>{let t=m.current;m.current=e;for(let n of l){let r=e[n];if(!r)continue;let i=hz(J.mine(n),J.partyTrack(n),t?.[n],r,h.current.get(n));i!==J.mine(n)&&J.setMine(n,i)}J.setPlayerTracks(e),t?.busy&&!e.busy&&x(),b()});return()=>{e(),m.current=void 0,J.setPlayerTracks(void 0)}},[r,t,e]),V(b),$_(t=>{if(r===`host`){if(t.t!==`ask`||!(`s`in t)||t.path!==gz()||!e||!o.current)return;let n=zn(o.current,t,Date.now());if(!n)return;g()&&(p.current=n),e.apply(n,!0);return}if(r!==`guest`)return;let n=t.t===`playback`||t.t===`state`?t.s:void 0;if(!n||J.hostPath()!==gz())return;let i=J.hostClock(),c=i?{...n,at:Yn(n.at,i.offset)}:n;a.current={state:c,receivedAt:Date.now(),measured:!!i},Date.now()>=s.current&&_(c,!!i)}),null},yz=[`play`,`pause`,`seeked`,`ratechange`,`ended`],bz=e=>({paused:e.paused,time:e.currentTime,rate:e.playbackRate??1,at:Date.now()}),xz=(e,t=()=>{})=>{let n=new Set,r=()=>{let t=bz(e);for(let e of n)e(t)};for(let t of yz)e.addEventListener(t,r);let i=setInterval(()=>{e.paused||r()},kn);return{apply:(t,n)=>{let r=Mn(bz(e),t,Date.now(),n);r.seek!==void 0&&(e.currentTime=r.seek),r.rate!==void 0&&(e.playbackRate=r.rate),r.pause&&e.pause(),r.play&&(e.autoplay?e.autoplay():e.play()).catch(()=>{})},onReport:e=>(n.add(e),queueMicrotask(r),()=>{n.delete(e)}),ended:()=>e.ended??!1,duration:()=>e.duration??0,buffer:async()=>{let{buffered:t}=e,n=[];for(let e=0;t&&e<t.length;e++)n.push([t.start(e),t.end(e)]);return{time:e.currentTime,readyState:e.readyState??0,ranges:n}},dispose:()=>{for(let t of yz)e.removeEventListener(t,r);clearInterval(i),n.clear(),t()}}},Sz=e=>{let t=tn(e,{origin:location.origin});return xz(t,()=>t.destroy())},Cz=(e,t)=>t?`${e==null?``:`E${e} - `}${t}`:e==null?void 0:`Episode ${e}`;K();var wz=(e,t)=>!!(e.url&&t.builtIn(e.origin,e.url))||!!(t.selfPlaying&&(e.embedUrl||t.selfPlaying(e.origin))),Tz=(e,t)=>{let n=e=>{let n=t.order.indexOf(e);return n<0?t.order.length:n},r;for(let i of e)wz(i,t)&&(!r||n(i.origin)<n(r.origin))&&(r=i);if(!r)return;let i=t.order.slice(0,n(r.origin)).every(e=>!t.possible(e)||t.settled(e));return{uri:r.uri,now:i}},Ez=(e,{mediaUri:t,episodeUri:n,sourceUri:r,guest:i,cannotPlay:a,search:o},s)=>{let c=q(void 0);V(()=>{r&&r!==c.current&&(c.current=void 0)},[r]);let l=(!r||a&&r===c.current)&&!i&&e?.now?e.uri:void 0;V(()=>{if(!l)return;c.current=l;let e=zf(Q.WATCH,{mediaUri:t,episodeUri:n,sourceUri:l});s(o?`${e}?${o}`:e,{replace:!0})},[l,t,n])},Dz=(e,t)=>{if(ab(e))return;let{handles:n,seasons:r,relations:i,type:a}=e,o=r?.findIndex(e=>n.some(t=>t.node.uri===e.uri))??-1;if(r&&o>=0){let e=r[o+t];return e&&d(e.uri)}let s=t>0?`SEQUEL`:`PREQUEL`,c=i?.filter(e=>e.relation===s&&fS(e.format))??[];return(c.find(e=>e.format===a)??c[0])?.node.uri},Oz=([e,t,n],r,i=new Date)=>{let a=[e,t,n].filter(e=>e!==void 0),o=a.flatMap(({uri:e,episodes:t})=>t.map(t=>({episode:t,mediaUri:e}))),s=a.flatMap(e=>bb(e,i)),c=r<0?-1:r+(e?.episodes.length??0);return{previous:c>0?o[c-1]:void 0,next:c>=0&&!s[c+1]?o[c+1]:void 0}},kz=(e,t,n)=>t?Tz(e.filter(e=>e.origin===t),n)?.uri:void 0;K();var Az=5e3,jz=We`
4919
4919
  to { background-size: 100% 100%; }
4920
- `,jz=L`
4920
+ `,Mz=L`
4921
4921
  position: absolute;
4922
4922
  right: 2.4rem;
4923
4923
  bottom: 8rem;
@@ -4945,9 +4945,9 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4945
4945
  }
4946
4946
 
4947
4947
  .up-next.counting {
4948
- animation: ${Az} ${kz}ms linear forwards;
4948
+ animation: ${jz} ${Az}ms linear forwards;
4949
4949
  }
4950
- `,Mz=({link:e,next:t})=>{let[,n]=wf(),[r,i]=W(),a=t?.href;return V(()=>{if(i(void 0),!e||!a)return;let t=!1;return e.onReport(({paused:n})=>{e.ended?.()?t&&(t=!1,document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),i(hc()?`counting`:`offered`)):(t||=!n,i(void 0))})},[e,!!a]),V(()=>{if(r!==`counting`||!a)return;let e=setTimeout(()=>n(a),kz);return()=>clearTimeout(e)},[r,a]),!r||!a?null:G(`div`,{css:jz,children:[U(`button`,{type:`button`,className:`up-next ${r}`,title:t?.title,onClick:()=>n(a),children:`Next episode`}),r===`counting`?U(`button`,{type:`button`,className:`up-next-cancel`,onClick:()=>i(void 0),children:`Cancel`}):void 0]})};K();var Nz=e=>(e??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node),Pz={nf:e=>`https://www.netflix.com/watch/${e}`},Fz=Iv(`
4950
+ `,Nz=({link:e,next:t})=>{let[,n]=wf(),[r,i]=W(),a=t?.href;return V(()=>{if(i(void 0),!e||!a)return;let t=!1;return e.onReport(({paused:n})=>{e.ended?.()?t&&(t=!1,document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),i(hc()?`counting`:`offered`)):(t||=!n,i(void 0))})},[e,!!a]),V(()=>{if(r!==`counting`||!a)return;let e=setTimeout(()=>n(a),Az);return()=>clearTimeout(e)},[r,a]),!r||!a?null:G(`div`,{css:Mz,children:[U(`button`,{type:`button`,className:`up-next ${r}`,title:t?.title,onClick:()=>n(a),children:`Next episode`}),r===`counting`?U(`button`,{type:`button`,className:`up-next-cancel`,onClick:()=>i(void 0),children:`Cancel`}):void 0]})};K();var Pz=e=>(e??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node),Fz={nf:e=>`https://www.netflix.com/watch/${e}`},Iz=Iv(`
4951
4951
  subscription GetWatchMedia($input: MediaInput!) {
4952
4952
  media(input: $input) {
4953
4953
  _id
@@ -5034,7 +5034,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5034
5034
  }
5035
5035
  }
5036
5036
  }
5037
- `),Iz=Iv(`
5037
+ `),Lz=Iv(`
5038
5038
  subscription GetWatchOrigins($input: OriginPageInput!) {
5039
5039
  originPage(input: $input) {
5040
5040
  nodes {
@@ -5047,7 +5047,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5047
5047
  }
5048
5048
  }
5049
5049
  }
5050
- `),Lz=e=>{let[t]=Za({query:Fz,variables:{input:{uri:e??``}},pause:!e});return By(t,e)},Rz=L`
5050
+ `),Rz=e=>{let[t]=Za({query:Iz,variables:{input:{uri:e??``}},pause:!e});return Vy(t,e)},zz=L`
5051
5051
  display: flex;
5052
5052
  flex-direction: column;
5053
5053
  height: 100vh;
@@ -5167,13 +5167,13 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5167
5167
  }
5168
5168
  }
5169
5169
  }
5170
- `,zz=()=>{let e=Sf(),t={...e,mediaUri:o(e.mediaUri),episodeUri:T(e.episodeUri),sourceUri:T(e.sourceUri)},[,n]=wf(),i=q(null),[c,l]=W(),[p,m]=W(void 0),[h]=Za({query:Fz,variables:{input:{uri:t.mediaUri}},pause:!t.mediaUri}),g=h.data?.media,_=H(()=>g?.episodes?.find(e=>e.uri&&t.episodeUri?a(d(e.uri),d(t.episodeUri)):!1),[g?.episodes,t.episodeUri]),v=t.sourceUri,y=c?.sourceUri===v?c?.link:void 0,x=H(()=>{let e=Nz(_?.handles);if(!v||_?.handles?.some(e=>e.node.uri===v))return e;let{origin:t,id:n}=r(v),i=Pz[t]?.(n);return i?[...e,{uri:v,origin:t,url:i}]:e},[_?.handles,v]),w=H(()=>_?.uri?s(_.uri)?.handleUrisValues:void 0,[_?.uri]),E=H(()=>w&&[...new Set([...w,...x].map(e=>e.origin))],[w,x]),[{data:O}]=Za({query:Iz,variables:{input:{ids:E,filters:[_o.IsNotApiOnly]}},pause:!E}),k=g?.titles?.at(0)?.title,A=_?.titles?.at(0)?.title,j=_?.episodeNumber,M=Sz(j,A),[N,P]=W();V(()=>{let e=!1;return ee().then(t=>{e||P(t)}),()=>{e=!0}},[]);let te=H(()=>v?f(v):{},[v]),F=H(()=>{if(!v)return;let e=x.find(e=>e.uri===v);if(!e)return;if(e.embedUrl)return e.embedUrl;let{origin:n}=r(v);if(!e.url||!jb(n,e.url,N)||N!==`extension`&&kb.has(n))return;let i=new URLSearchParams({mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:v,url:e.url,...te});return`${new URL(`../embed.html`,import.meta.url).href}?${i}`},[v,x,t.mediaUri,t.episodeUri,te,N]),I=AR(),re=I.flatMap(e=>e.state===`connected`?e.sources?.map(e=>e.origin)??[]:[]),ie=re.join(`,`),[ae,oe]=W({}),[se,ce]=W(),[le,ue]=W();V(()=>{let e=!1,t=ie?ie.split(`,`):[],n=async e=>Object.fromEntries((await Promise.all(t.map(async t=>[t,(await e(t))?.pluginUri]))).filter(e=>!!e[1]));return Promise.all([n(Jt),n(It)]).then(([t,n])=>{e||(oe(t),ce(n),ue(ie))}).catch(()=>{e||ue(ie)}),()=>{e=!0}},[ie]);let de=H(()=>{if(!v)return;let{origin:e}=r(v),t=se?.[e];if(!t)return;let n=x.find(e=>e.uri===v);if(n)return{pluginUri:t,release:{uri:v,url:n.url??void 0}}},[v,se,x]),[fe,pe]=W();V(()=>{pe(void 0)},[v]);let me=!!(de&&fe!==v);V(()=>{let e=i.current;if(me||!F||!e)return;let t=xz(e),n=C(e);return l({link:t,sourceUri:v}),m(n),()=>{t.dispose(),n.dispose(),l(void 0),m(void 0)}},[me,F]),V(()=>{let e=i.current;if(!me&&F&&e&&M)return b(e,M)},[me,F,M]),V(()=>{let e=i.current;if(!me&&F&&e&&v)return u(e,v)},[me,F,v]);let[he,ge]=W([]);V(()=>{let e=i.current;if(!me&&F&&e&&v)return S(e,()=>ge(e=>[...e,v]))},[me,F,v]);let _e=H(()=>(O?.originPage?.nodes??[]).map(e=>{let n=x.filter(t=>t.origin===e.id),i=!!se?.[e.id],a=t=>!!(t?.embedUrl||i||jb(e.id,t?.url,N)),o=e=>zf(Q.WATCH,{mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:e}),s=n.map(e=>({uri:e.uri,label:e.shortDescriptions?.at(0)?.shortDescription??e.titles?.at(0)?.title??r(e.uri).id,href:a(e)?o(e.uri):e.url??void 0,external:!a(e),active:v===e.uri})),c=n.at(0);return{id:e.id,name:e.name??e.id,icon:e.icon,color:e.color,href:c?s.at(0)?.href:void 0,external:!c||!a(c),active:s.some(e=>e.active),releases:s.length>1?s:void 0,picker:ae[e.id]?{pluginUri:ae[e.id]}:void 0}}).filter(e=>e.href||e.releases),[O,x,t.mediaUri,t.episodeUri,v,ae,se,N]),ve=x.find(e=>e.uri===v),ye=N===`cloud`&&!F&&ve?.url&&jb(ve.origin,ve.url,`extension`)?DR.find(e=>e.origin===ve.origin)?.name:void 0;V(()=>{ye&&v&&!D()&&ge(e=>[...e,v])},[ye,v]);let be=q(new Map);for(let e of be.current.keys())re.includes(e)||be.current.delete(e);for(let e of re)be.current.has(e)||be.current.set(e,g);let xe=!!g?.settled&&le===ie,Se=I.some(e=>e.state===`connecting`),Ce=Q_(),we=N===`extension`||D(),Te={builtIn:(e,t)=>jb(e,t,`extension`),selfPlaying:se&&(e=>!!se[e]),order:sc(ic(),re),possible:e=>Ob.has(e)?(we||!kb.has(e))&&!Nt().includes(e):Se||re.includes(e),settled:e=>xe&&(Ob.has(e)||be.current.has(e)&&be.current.get(e)!==g)},Ee=Ce.status===`joining`||Ce.status===`active`&&Ce.role===`guest`,De=!!(v&&he.includes(v)),R=Tf();Tz(wz(x.filter(e=>!he.includes(e.uri)),Te),{...t,guest:Ee,cannotPlay:De,search:R},n),$I(y,v,x.map(e=>e.uri),Ee,QI(R));let Oe=g?.episodes??[],ke=_?Oe.indexOf(_):-1,Ae=Lz(g&&ke===0?Ez(g,-1):void 0),je=Lz(g&&ke>=0&&ke===Oe.length-1?Ez(g,1):void 0),Me=Db(),{previous:Ne,next:Pe}=Dz([Ae,g?{...g,uri:t.mediaUri}:void 0,je],ke,new Date(Me)),Fe=v?r(v).origin:void 0,Ie=e=>e?.episode.uri?{href:zf(Q.WATCH,{mediaUri:e.mediaUri,episodeUri:e.episode.uri,sourceUri:Oz(Nz(e.episode.handles),Fe,Te)}),title:Sz(e.episode.episodeNumber,e.episode.titles?.at(0)?.title)}:void 0,Le=Ie(Ne),Re=Ie(Pe),ze=!Ee&&Pe&&wz(Nz(Pe.episode.handles),Te)?Re:void 0;return U(`div`,{css:Rz,children:G(`div`,{className:`watch-container`,children:[me&&de||F?G(`div`,{className:`player-container`,children:[me&&de?U(fz,{pluginUri:de.pluginUri,release:de.release,onUnplayable:()=>pe(v),onPlayback:e=>l(e&&{link:e,sourceUri:de.release.uri})},de.release.uri):U(`iframe`,{ref:i,src:F,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`,css:L`
5170
+ `,Bz=()=>{let e=Sf(),t={...e,mediaUri:o(e.mediaUri),episodeUri:T(e.episodeUri),sourceUri:T(e.sourceUri)},[,n]=wf(),i=q(null),[c,l]=W(),[p,m]=W(void 0),[h]=Za({query:Iz,variables:{input:{uri:t.mediaUri}},pause:!t.mediaUri}),g=h.data?.media,_=H(()=>g?.episodes?.find(e=>e.uri&&t.episodeUri?a(d(e.uri),d(t.episodeUri)):!1),[g?.episodes,t.episodeUri]),v=t.sourceUri,y=c?.sourceUri===v?c?.link:void 0,x=H(()=>{let e=Pz(_?.handles);if(!v||_?.handles?.some(e=>e.node.uri===v))return e;let{origin:t,id:n}=r(v),i=Fz[t]?.(n);return i?[...e,{uri:v,origin:t,url:i}]:e},[_?.handles,v]),w=H(()=>_?.uri?s(_.uri)?.handleUrisValues:void 0,[_?.uri]),E=H(()=>w&&[...new Set([...w,...x].map(e=>e.origin))],[w,x]),[{data:O}]=Za({query:Lz,variables:{input:{ids:E,filters:[_o.IsNotApiOnly]}},pause:!E}),k=g?.titles?.at(0)?.title,A=_?.titles?.at(0)?.title,j=_?.episodeNumber,M=Cz(j,A),[N,P]=W();V(()=>{let e=!1;return ee().then(t=>{e||P(t)}),()=>{e=!0}},[]);let te=H(()=>v?f(v):{},[v]),F=H(()=>{if(!v)return;let e=x.find(e=>e.uri===v);if(!e)return;if(e.embedUrl)return e.embedUrl;let{origin:n}=r(v);if(!e.url||!Mb(n,e.url,N)||N!==`extension`&&Ab.has(n))return;let i=new URLSearchParams({mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:v,url:e.url,...te});return`${new URL(`../embed.html`,import.meta.url).href}?${i}`},[v,x,t.mediaUri,t.episodeUri,te,N]),I=jR(),re=I.flatMap(e=>e.state===`connected`?e.sources?.map(e=>e.origin)??[]:[]),ie=re.join(`,`),[ae,oe]=W({}),[se,ce]=W(),[le,ue]=W();V(()=>{let e=!1,t=ie?ie.split(`,`):[],n=async e=>Object.fromEntries((await Promise.all(t.map(async t=>[t,(await e(t))?.pluginUri]))).filter(e=>!!e[1]));return Promise.all([n(Jt),n(It)]).then(([t,n])=>{e||(oe(t),ce(n),ue(ie))}).catch(()=>{e||ue(ie)}),()=>{e=!0}},[ie]);let de=H(()=>{if(!v)return;let{origin:e}=r(v),t=se?.[e];if(!t)return;let n=x.find(e=>e.uri===v);if(n)return{pluginUri:t,release:{uri:v,url:n.url??void 0}}},[v,se,x]),[fe,pe]=W();V(()=>{pe(void 0)},[v]);let me=!!(de&&fe!==v);V(()=>{let e=i.current;if(me||!F||!e)return;let t=Sz(e),n=C(e);return l({link:t,sourceUri:v}),m(n),()=>{t.dispose(),n.dispose(),l(void 0),m(void 0)}},[me,F]),V(()=>{let e=i.current;if(!me&&F&&e&&M)return b(e,M)},[me,F,M]),V(()=>{let e=i.current;if(!me&&F&&e&&v)return u(e,v)},[me,F,v]);let[he,ge]=W([]);V(()=>{let e=i.current;if(!me&&F&&e&&v)return S(e,()=>ge(e=>[...e,v]))},[me,F,v]);let _e=H(()=>(O?.originPage?.nodes??[]).map(e=>{let n=x.filter(t=>t.origin===e.id),i=!!se?.[e.id],a=t=>!!(t?.embedUrl||i||Mb(e.id,t?.url,N)),o=e=>zf(Q.WATCH,{mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:e}),s=n.map(e=>({uri:e.uri,label:e.shortDescriptions?.at(0)?.shortDescription??e.titles?.at(0)?.title??r(e.uri).id,href:a(e)?o(e.uri):e.url??void 0,external:!a(e),active:v===e.uri})),c=n.at(0);return{id:e.id,name:e.name??e.id,icon:e.icon,color:e.color,href:c?s.at(0)?.href:void 0,external:!c||!a(c),active:s.some(e=>e.active),releases:s.length>1?s:void 0,picker:ae[e.id]?{pluginUri:ae[e.id]}:void 0}}).filter(e=>e.href||e.releases),[O,x,t.mediaUri,t.episodeUri,v,ae,se,N]),ve=x.find(e=>e.uri===v),ye=N===`cloud`&&!F&&ve?.url&&Mb(ve.origin,ve.url,`extension`)?OR.find(e=>e.origin===ve.origin)?.name:void 0;V(()=>{ye&&v&&!D()&&ge(e=>[...e,v])},[ye,v]);let be=q(new Map);for(let e of be.current.keys())re.includes(e)||be.current.delete(e);for(let e of re)be.current.has(e)||be.current.set(e,g);let xe=!!g?.settled&&le===ie,Se=I.some(e=>e.state===`connecting`),Ce=Q_(),we=N===`extension`||D(),Te={builtIn:(e,t)=>Mb(e,t,`extension`),selfPlaying:se&&(e=>!!se[e]),order:sc(ic(),re),possible:e=>kb.has(e)?(we||!Ab.has(e))&&!Nt().includes(e):Se||re.includes(e),settled:e=>xe&&(kb.has(e)||be.current.has(e)&&be.current.get(e)!==g)},Ee=Ce.status===`joining`||Ce.status===`active`&&Ce.role===`guest`,De=!!(v&&he.includes(v)),R=Tf();Ez(Tz(x.filter(e=>!he.includes(e.uri)),Te),{...t,guest:Ee,cannotPlay:De,search:R},n),eL(y,v,x.map(e=>e.uri),Ee,$I(R));let Oe=g?.episodes??[],ke=_?Oe.indexOf(_):-1,Ae=Rz(g&&ke===0?Dz(g,-1):void 0),je=Rz(g&&ke>=0&&ke===Oe.length-1?Dz(g,1):void 0),Me=Ob(),{previous:Ne,next:Pe}=Oz([Ae,g?{...g,uri:t.mediaUri}:void 0,je],ke,new Date(Me)),Fe=v?r(v).origin:void 0,Ie=e=>e?.episode.uri?{href:zf(Q.WATCH,{mediaUri:e.mediaUri,episodeUri:e.episode.uri,sourceUri:kz(Pz(e.episode.handles),Fe,Te)}),title:Cz(e.episode.episodeNumber,e.episode.titles?.at(0)?.title)}:void 0,Le=Ie(Ne),Re=Ie(Pe),ze=!Ee&&Pe&&Tz(Pz(Pe.episode.handles),Te)?Re:void 0;return U(`div`,{css:zz,children:G(`div`,{className:`watch-container`,children:[me&&de||F?G(`div`,{className:`player-container`,children:[me&&de?U(pz,{pluginUri:de.pluginUri,release:de.release,onUnplayable:()=>pe(v),onPlayback:e=>l(e&&{link:e,sourceUri:de.release.uri})},de.release.uri):U(`iframe`,{ref:i,src:F,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`,css:L`
5171
5171
  width: 100%;
5172
5172
  border: none;
5173
5173
  background: #000;
5174
5174
  flex: 1;
5175
5175
  min-height: 0;
5176
- `},F),U(Mz,{link:y,next:ze})]}):ye?U(`div`,{className:`player-container fix`,children:G(`button`,{type:`button`,onClick:()=>{ne().then(e=>{e&&P(`extension`)})},children:[`Install the FKN extension to play `,ye]})}):void 0,U(_z,{link:y,tracks:p}),G(`div`,{className:`watch-info`,children:[G(`div`,{className:`episode-row`,children:[G(`div`,{className:`episode-info`,children:[U(`div`,{className:`episode-title`,children:M??(_||g?.settled?t.episodeUri:U(ty,{className:`pending`}))}),k?U(`div`,{className:`media-title`,children:k}):void 0]}),Le||Re?G(`nav`,{className:`episode-nav`,children:[Le?G(Mf,{href:Le.href,title:Le.title,children:[U(rt,{}),`Previous episode`]}):void 0,Re?G(Mf,{href:Re.href,title:Re.title,children:[`Next episode`,U(at,{})]}):void 0]}):void 0,U(`div`,{className:`tracking`,children:U(sI,{work:t.mediaUri,address:t.mediaUri,uri:By(h,t.mediaUri)?.uri,title:k,cover:g?.covers?.at(0)?.url,episodeCount:g?.episodeCount,movie:g?ib(g):!1,notice:!1,link:y,episode:j})})]}),U(Fy,{sources:_e,onPickRelease:e=>n(zf(Q.WATCH,{mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:e}))})]})]})})};K();var Bz=L`
5176
+ `},F),U(Nz,{link:y,next:ze})]}):ye?U(`div`,{className:`player-container fix`,children:G(`button`,{type:`button`,onClick:()=>{ne().then(e=>{e&&P(`extension`)})},children:[`Install the FKN extension to play `,ye]})}):void 0,U(vz,{link:y,tracks:p}),G(`div`,{className:`watch-info`,children:[G(`div`,{className:`episode-row`,children:[G(`div`,{className:`episode-info`,children:[U(`div`,{className:`episode-title`,children:M??(_||g?.settled?t.episodeUri:U(ty,{className:`pending`}))}),k?U(`div`,{className:`media-title`,children:k}):void 0]}),Le||Re?G(`nav`,{className:`episode-nav`,children:[Le?G(Mf,{href:Le.href,title:Le.title,children:[U(rt,{}),`Previous episode`]}):void 0,Re?G(Mf,{href:Re.href,title:Re.title,children:[`Next episode`,U(at,{})]}):void 0]}):void 0,U(`div`,{className:`tracking`,children:U(cI,{work:t.mediaUri,address:t.mediaUri,uri:Vy(h,t.mediaUri)?.uri,title:k,cover:g?.covers?.at(0)?.url,episodeCount:g?.episodeCount,movie:g?ab(g):!1,notice:!1,link:y,episode:j})})]}),U(Iy,{sources:_e,onPickRelease:e=>n(zf(Q.WATCH,{mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:e}))})]})]})})};K();var Vz=L`
5177
5177
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
5178
5178
  min-height: 100vh;
5179
5179
  max-width: 72rem;
@@ -5287,10 +5287,10 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5287
5287
  }
5288
5288
 
5289
5289
  .field input:focus { border-color: rgba(255, 255, 255, 0.4); }
5290
- `,Vz={"not-found":`That party has ended.`,"bad-key":`The invite link is not valid.`,invalid:`The invite link is broken.`,full:`The party is full.`,blocked:`You cannot join this party.`,unavailable:`Parties are not available right now. Is FKN connected?`},Hz=()=>{let e=Q_(),[t]=W(()=>dr(location.hash,location.origin)),[n]=W(()=>location.hash.length>1&&!dr(location.hash,location.origin)),[r,i]=W([]),[a,o]=W(()=>J.name()??``),[s,c]=W(!1),l=e.status===`active`;V(()=>{if(!t)return;let e=J.getState();(e.status!==`joining`&&e.status!==`active`||e.invite!==t)&&J.join(t)},[t]);let u=l?e.members:0;V(()=>{if(!l){i([]);return}let e=!1;return J.roster().then(t=>{e||i(t)}),()=>{e=!0}},[l,u]),$_(e=>{e.t===`name`&&J.roster().then(i)}),V(()=>{if(!s)return;let e=setTimeout(()=>c(!1),1500);return()=>clearTimeout(e)},[s]);let d=l?ur(location.origin,e.invite):void 0,f=async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0)}catch{}};return G(`div`,{css:Bz,children:[U(`div`,{className:`heading`,children:`Watch together`}),G(`div`,{className:`status`,children:[n?U(z,{children:`This invite link is broken. Ask the host for a new one.`}):!t&&!l&&e.status!==`joining`?e.status===`failed`?G(z,{children:[`Could not join. `,Vz[e.code]??`Something went wrong.`]}):e.status===`ended`?U(z,{children:`The party ended.`}):U(z,{children:`You are not in a party. Start one from the header.`}):!t&&e.status===`joining`?U(z,{children:`Joining the party…`}):t&&!l?e.status===`joining`?U(z,{children:`Joining the party…`}):e.status===`failed`?G(z,{children:[`Could not join. `,Vz[e.code]??`Something went wrong.`]}):e.status===`ended`?U(z,{children:`The party ended.`}):U(z,{children:`This invite link is broken. Ask the host for a new one.`}):l&&e.role===`guest`&&t?U(z,{children:`You are in. Waiting for the host…`}):l&&e.role===`guest`?G(z,{children:[`You are following the host. `,U(Mf,{to:zf(Q.HOME),children:`Go home`})]}):U(z,{children:`You are hosting.`}),!t&&!l&&e.status!==`joining`&&(e.status===`failed`||e.status===`ended`)?G(z,{children:[` `,U(`button`,{type:`button`,className:`action`,onClick:()=>J.dismiss(),children:`OK`})]}):null]}),l&&G(z,{children:[G(`div`,{className:`section`,children:[U(`div`,{className:`label`,children:`Your name`}),G(`form`,{className:`field`,onSubmit:e=>{e.preventDefault(),J.setName(fn(a))},children:[U(`input`,{value:a,maxLength:32,placeholder:`What the party should call you`,"aria-label":`Your name`,onInput:e=>o(e.currentTarget.value)}),G(`button`,{type:`submit`,className:`action`,children:[U(Ye,{size:14}),` Save`]})]})]}),G(`div`,{className:`section`,children:[U(`div`,{className:`label`,children:`Invite link`}),G(`div`,{className:`field`,children:[U(`input`,{readOnly:!0,value:d,"aria-label":`Invite link`,onFocus:e=>e.currentTarget.select()}),G(`button`,{type:`button`,className:`action`,onClick:()=>{f()},children:[U(s?Ye:dt,{size:14}),` Copy`]})]})]}),G(`div`,{className:`section`,children:[G(`div`,{className:`label`,children:[`In the party (`,r.length,`)`]}),r.map(t=>G(`div`,{className:`row`,"data-member":t.id,children:[t.name?U(`span`,{className:`name`,children:t.name}):null,U(`span`,{className:`id`,title:t.id,children:t.id}),t.host&&U(`span`,{className:`badge`,children:`host`}),t.self&&U(`span`,{className:`badge you`,children:`you`}),e.role===`host`&&!t.self&&G(z,{children:[G(`button`,{type:`button`,className:`action danger`,onClick:()=>{J.kick(t.id)},children:[U(E_,{size:14}),` Kick`]}),G(`button`,{type:`button`,className:`action danger`,onClick:()=>{J.ban(t.id)},children:[U(Qg,{size:14}),` Ban`]})]})]},t.id))]}),U(`div`,{className:`section`,children:G(`button`,{type:`button`,className:`action`,onClick:()=>{J.leave()},children:[U(p_,{size:14}),` `,e.role===`host`?`End party`:`Leave party`]})})]})]})},Uz=e=>e.owned?`owned`:`placeholder`,Wz=e=>{let t=[],n=new Set;for(let r of e.members??[])r.uri&&!n.has(r.uri)&&(n.add(r.uri),t.push({uri:r.uri,kind:Uz(r),origin:r.origin,scope:r.scope,title:r.title,episodeCount:r.episodeCount,startDate:r.startDate,member:r}));let r=[...(e.links??[]).flatMap(e=>[e.fromUri,e.toUri]),...(e.claims??[]).flatMap(e=>[e.fromUri,e.toUri])];for(let e of r)e&&!n.has(e)&&(n.add(e),t.push({uri:e,kind:`named`,origin:null,scope:null,title:null,episodeCount:null,startDate:null,member:null}));return t},Gz=e=>{let t=Wz(e),n=yS({nodes:t.map(e=>({uri:e.uri,titles:[{title:e.title??e.uri}],startDate:e.startDate})),edges:(e.links??[]).map(e=>({from:e.fromUri,to:e.toUri,relation:e.kind}))},`graph`),r=new Map(n.nodes.map(e=>[e.uri,e]));return{nodes:t.map(e=>({...e,column:r.get(e.uri)?.column??0,row:r.get(e.uri)?.row??0})),columns:n.columns,rows:n.rows}},Kz=(e,t)=>[e,t].sort().join(` `),qz=e=>{let t=new Map;for(let n of e){let e=Kz(n.fromUri,n.toUri),r=t.get(e)??[];r.push(n.key),t.set(e,r)}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,{lane:r,lanes:e.length}));return n},Jz=e=>{let t=new Map;for(let n of e.links??[])t.set(n.key,{kind:`link`,row:n});for(let n of e.claims??[])t.set(n.key,{kind:`claim`,row:n});for(let n of e.episodeLinks??[])t.set(n.key,{kind:`episode-link`,row:n});for(let n of e.episodeClaims??[])t.set(n.key,{kind:`episode-claim`,row:n});for(let n of e.episodeSources??[])t.set(n.key,{kind:`episode-source`,row:n});return t},Yz=/^[0-9a-f]{64}$/,Xz=(e,t)=>(t??[]).map(t=>{let n=e.get(t)??null;return{key:t,ref:n,gap:n?null:Yz.test(t)?`missing`:`not-an-edge-key`}}),Zz=(e,t)=>(e.answers??[]).find(e=>e.seq===t)??null,Qz=e=>e===null?null:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e),$z=e=>{if(e==null||e===``)return{kind:`absent`};let t;try{t=JSON.parse(e)}catch{return{kind:`raw`,raw:e}}return t===null?{kind:`fields`,fields:[{field:`value`,value:null}]}:typeof t==`object`&&!Array.isArray(t)?{kind:`fields`,fields:Object.entries(t).map(([e,t])=>({field:e,value:Qz(t)}))}:{kind:`fields`,fields:[{field:Array.isArray(t)?`values`:`value`,value:Qz(t)}]}},eB=e=>e===`not-enabled`?`The graph engine is switched off for this page, so there is nothing to read. Reloading with ?graph=1 turns it on, and this page then asks the sources about the uri itself. The only way a page gets here now is ?store=legacy, which pins it to the old store; dropping that flag puts the whole app back on the graph, which is the default.`:e===`graph-empty`?`The engine is on and the graph is empty. A graph is built inside one tab and never outlives it, so a link opened cold always starts here: what fills it is a page asking the sources, which is what this page does with the uri it was given.`:e===`no-row`?`No media row exists for that uri, so there is nothing to cluster. Either no source has answered for it in this tab yet, or the uri is not one any source recognises.`:e===`no-cluster`?`A media row exists for that uri, but no cluster holds it yet: either a pass has not run since it arrived, or it is a placeholder no pass will ever cluster on its own.`:`That uri reached no cluster, and the bundle carries no reason for it.`,tB=e=>e===`active`,nB=async(e,t,n={},r={})=>{let i=r.settleMs??2e4,a=await e(`http://d/graphql`,{method:`POST`,headers:{"content-type":`application/json`,accept:`application/json, text/event-stream`},body:JSON.stringify({query:t,variables:n})});if(!(a.headers.get(`content-type`)??``).includes(`event-stream`)){let e=await a.json();return r.onPayload?.(e,1),{payloads:1,last:e}}let o=a.body.getReader(),s=new TextDecoder,c=Date.now()+i,l=``,u=0,d,f=!1;for(;!f&&Date.now()<c;){let e=await Promise.race([o.read(),new Promise(e=>setTimeout(()=>e({done:!0,value:void 0}),Math.max(0,c-Date.now())))]);if(e.done)break;l+=s.decode(e.value,{stream:!0});let t=l.split(`
5290
+ `,Hz={"not-found":`That party has ended.`,"bad-key":`The invite link is not valid.`,invalid:`The invite link is broken.`,full:`The party is full.`,blocked:`You cannot join this party.`,unavailable:`Parties are not available right now. Is FKN connected?`},Uz=()=>{let e=Q_(),[t]=W(()=>dr(location.hash,location.origin)),[n]=W(()=>location.hash.length>1&&!dr(location.hash,location.origin)),[r,i]=W([]),[a,o]=W(()=>J.name()??``),[s,c]=W(!1),l=e.status===`active`;V(()=>{if(!t)return;let e=J.getState();(e.status!==`joining`&&e.status!==`active`||e.invite!==t)&&J.join(t)},[t]);let u=l?e.members:0;V(()=>{if(!l){i([]);return}let e=!1;return J.roster().then(t=>{e||i(t)}),()=>{e=!0}},[l,u]),$_(e=>{e.t===`name`&&J.roster().then(i)}),V(()=>{if(!s)return;let e=setTimeout(()=>c(!1),1500);return()=>clearTimeout(e)},[s]);let d=l?ur(location.origin,e.invite):void 0,f=async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0)}catch{}};return G(`div`,{css:Vz,children:[U(`div`,{className:`heading`,children:`Watch together`}),G(`div`,{className:`status`,children:[n?U(z,{children:`This invite link is broken. Ask the host for a new one.`}):!t&&!l&&e.status!==`joining`?e.status===`failed`?G(z,{children:[`Could not join. `,Hz[e.code]??`Something went wrong.`]}):e.status===`ended`?U(z,{children:`The party ended.`}):U(z,{children:`You are not in a party. Start one from the header.`}):!t&&e.status===`joining`?U(z,{children:`Joining the party…`}):t&&!l?e.status===`joining`?U(z,{children:`Joining the party…`}):e.status===`failed`?G(z,{children:[`Could not join. `,Hz[e.code]??`Something went wrong.`]}):e.status===`ended`?U(z,{children:`The party ended.`}):U(z,{children:`This invite link is broken. Ask the host for a new one.`}):l&&e.role===`guest`&&t?U(z,{children:`You are in. Waiting for the host…`}):l&&e.role===`guest`?G(z,{children:[`You are following the host. `,U(Mf,{to:zf(Q.HOME),children:`Go home`})]}):U(z,{children:`You are hosting.`}),!t&&!l&&e.status!==`joining`&&(e.status===`failed`||e.status===`ended`)?G(z,{children:[` `,U(`button`,{type:`button`,className:`action`,onClick:()=>J.dismiss(),children:`OK`})]}):null]}),l&&G(z,{children:[G(`div`,{className:`section`,children:[U(`div`,{className:`label`,children:`Your name`}),G(`form`,{className:`field`,onSubmit:e=>{e.preventDefault(),J.setName(fn(a))},children:[U(`input`,{value:a,maxLength:32,placeholder:`What the party should call you`,"aria-label":`Your name`,onInput:e=>o(e.currentTarget.value)}),G(`button`,{type:`submit`,className:`action`,children:[U(Ye,{size:14}),` Save`]})]})]}),G(`div`,{className:`section`,children:[U(`div`,{className:`label`,children:`Invite link`}),G(`div`,{className:`field`,children:[U(`input`,{readOnly:!0,value:d,"aria-label":`Invite link`,onFocus:e=>e.currentTarget.select()}),G(`button`,{type:`button`,className:`action`,onClick:()=>{f()},children:[U(s?Ye:dt,{size:14}),` Copy`]})]})]}),G(`div`,{className:`section`,children:[G(`div`,{className:`label`,children:[`In the party (`,r.length,`)`]}),r.map(t=>G(`div`,{className:`row`,"data-member":t.id,children:[t.name?U(`span`,{className:`name`,children:t.name}):null,U(`span`,{className:`id`,title:t.id,children:t.id}),t.host&&U(`span`,{className:`badge`,children:`host`}),t.self&&U(`span`,{className:`badge you`,children:`you`}),e.role===`host`&&!t.self&&G(z,{children:[G(`button`,{type:`button`,className:`action danger`,onClick:()=>{J.kick(t.id)},children:[U(E_,{size:14}),` Kick`]}),G(`button`,{type:`button`,className:`action danger`,onClick:()=>{J.ban(t.id)},children:[U(Qg,{size:14}),` Ban`]})]})]},t.id))]}),U(`div`,{className:`section`,children:G(`button`,{type:`button`,className:`action`,onClick:()=>{J.leave()},children:[U(p_,{size:14}),` `,e.role===`host`?`End party`:`Leave party`]})})]})]})},Wz=e=>e.owned?`owned`:`placeholder`,Gz=e=>{let t=[],n=new Set;for(let r of e.members??[])r.uri&&!n.has(r.uri)&&(n.add(r.uri),t.push({uri:r.uri,kind:Wz(r),origin:r.origin,scope:r.scope,title:r.title,episodeCount:r.episodeCount,startDate:r.startDate,member:r}));let r=[...(e.links??[]).flatMap(e=>[e.fromUri,e.toUri]),...(e.claims??[]).flatMap(e=>[e.fromUri,e.toUri])];for(let e of r)e&&!n.has(e)&&(n.add(e),t.push({uri:e,kind:`named`,origin:null,scope:null,title:null,episodeCount:null,startDate:null,member:null}));return t},Kz=e=>{let t=Gz(e),n=bS({nodes:t.map(e=>({uri:e.uri,titles:[{title:e.title??e.uri}],startDate:e.startDate})),edges:(e.links??[]).map(e=>({from:e.fromUri,to:e.toUri,relation:e.kind}))},`graph`),r=new Map(n.nodes.map(e=>[e.uri,e]));return{nodes:t.map(e=>({...e,column:r.get(e.uri)?.column??0,row:r.get(e.uri)?.row??0})),columns:n.columns,rows:n.rows}},qz=(e,t)=>[e,t].sort().join(` `),Jz=e=>{let t=new Map;for(let n of e){let e=qz(n.fromUri,n.toUri),r=t.get(e)??[];r.push(n.key),t.set(e,r)}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,{lane:r,lanes:e.length}));return n},Yz=e=>{let t=new Map;for(let n of e.links??[])t.set(n.key,{kind:`link`,row:n});for(let n of e.claims??[])t.set(n.key,{kind:`claim`,row:n});for(let n of e.episodeLinks??[])t.set(n.key,{kind:`episode-link`,row:n});for(let n of e.episodeClaims??[])t.set(n.key,{kind:`episode-claim`,row:n});for(let n of e.episodeSources??[])t.set(n.key,{kind:`episode-source`,row:n});return t},Xz=/^[0-9a-f]{64}$/,Zz=(e,t)=>(t??[]).map(t=>{let n=e.get(t)??null;return{key:t,ref:n,gap:n?null:Xz.test(t)?`missing`:`not-an-edge-key`}}),Qz=(e,t)=>(e.answers??[]).find(e=>e.seq===t)??null,$z=e=>e===null?null:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e),eB=e=>{if(e==null||e===``)return{kind:`absent`};let t;try{t=JSON.parse(e)}catch{return{kind:`raw`,raw:e}}return t===null?{kind:`fields`,fields:[{field:`value`,value:null}]}:typeof t==`object`&&!Array.isArray(t)?{kind:`fields`,fields:Object.entries(t).map(([e,t])=>({field:e,value:$z(t)}))}:{kind:`fields`,fields:[{field:Array.isArray(t)?`values`:`value`,value:$z(t)}]}},tB=e=>e===`not-enabled`?`The graph engine is switched off for this page, so there is nothing to read. Reloading with ?graph=1 turns it on, and this page then asks the sources about the uri itself. The only way a page gets here now is ?store=legacy, which pins it to the old store; dropping that flag puts the whole app back on the graph, which is the default.`:e===`graph-empty`?`The engine is on and the graph is empty. A graph is built inside one tab and never outlives it, so a link opened cold always starts here: what fills it is a page asking the sources, which is what this page does with the uri it was given.`:e===`no-row`?`No media row exists for that uri, so there is nothing to cluster. Either no source has answered for it in this tab yet, or the uri is not one any source recognises.`:e===`no-cluster`?`A media row exists for that uri, but no cluster holds it yet: either a pass has not run since it arrived, or it is a placeholder no pass will ever cluster on its own.`:`That uri reached no cluster, and the bundle carries no reason for it.`,nB=e=>e===`active`,rB=async(e,t,n={},r={})=>{let i=r.settleMs??2e4,a=await e(`http://d/graphql`,{method:`POST`,headers:{"content-type":`application/json`,accept:`application/json, text/event-stream`},body:JSON.stringify({query:t,variables:n})});if(!(a.headers.get(`content-type`)??``).includes(`event-stream`)){let e=await a.json();return r.onPayload?.(e,1),{payloads:1,last:e}}let o=a.body.getReader(),s=new TextDecoder,c=Date.now()+i,l=``,u=0,d,f=!1;for(;!f&&Date.now()<c;){let e=await Promise.race([o.read(),new Promise(e=>setTimeout(()=>e({done:!0,value:void 0}),Math.max(0,c-Date.now())))]);if(e.done)break;l+=s.decode(e.value,{stream:!0});let t=l.split(`
5291
5291
 
5292
5292
  `);l=t.pop()??``;for(let e of t){let t=e.split(`
5293
- `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trim()).join(``);if(t){try{d=JSON.parse(t),u+=1}catch{continue}if(r.onPayload?.(d,u),r.done?.(d,u)){f=!0;break}}}}return o.cancel().catch(()=>{}),{payloads:u,last:d}},rB=`
5293
+ `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trim()).join(``);if(t){try{d=JSON.parse(t),u+=1}catch{continue}if(r.onPayload?.(d,u),r.done?.(d,u)){f=!0;break}}}}return o.cancel().catch(()=>{}),{payloads:u,last:d}},iB=`
5294
5294
  subscription TraceWarm($input: MediaInput!) {
5295
5295
  media(input: $input) {
5296
5296
  _id
@@ -5324,12 +5324,12 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5324
5324
  }
5325
5325
  }
5326
5326
  }
5327
- `,iB=(e,t)=>{let n=e?.data?.media;return{payloads:t,uri:typeof n?.uri==`string`?n.uri:null,handles:Array.isArray(n?.handles)?n.handles.length:0,episodes:Array.isArray(n?.episodes)?n.episodes.length:0}},aB=async(e,{onProgress:t,settleMs:n=25e3}={})=>{let r={payloads:0,uri:null,handles:0,episodes:0};if(!e)return r;try{let i=await st(()=>import(`./worker-KoBi1osA.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url);if(typeof i.handleRequest!=`function`)return r;await nB(i.handleRequest,rB,{input:{uri:e}},{settleMs:n,onPayload:(e,n)=>{r=iB(e,n),t?.(r)}})}catch(e){console.error(Error(`graph trace: the warm could not ask the sources`,{cause:e}))}return r},oB=L`
5327
+ `,aB=(e,t)=>{let n=e?.data?.media;return{payloads:t,uri:typeof n?.uri==`string`?n.uri:null,handles:Array.isArray(n?.handles)?n.handles.length:0,episodes:Array.isArray(n?.episodes)?n.episodes.length:0}},oB=async(e,{onProgress:t,settleMs:n=25e3}={})=>{let r={payloads:0,uri:null,handles:0,episodes:0};if(!e)return r;try{let i=await st(()=>import(`./worker-Bqm03xpO.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url);if(typeof i.handleRequest!=`function`)return r;await rB(i.handleRequest,iB,{input:{uri:e}},{settleMs:n,onPayload:(e,n)=>{r=aB(e,n),t?.(r)}})}catch(e){console.error(Error(`graph trace: the warm could not ask the sources`,{cause:e}))}return r},sB=L`
5328
5328
  &.nothing {
5329
5329
  color: rgb(250, 204, 21);
5330
5330
  font-style: italic;
5331
5331
  }
5332
- `,sB=({value:e})=>e===null?U(`span`,{css:oB,className:`nothing`,children:`null`}):e===void 0?U(`span`,{css:oB,className:`nothing`,children:`absent`}):e===``?U(`span`,{css:oB,className:`nothing`,children:`empty`}):U(`span`,{css:oB,children:String(e)}),cB=L`
5332
+ `,cB=({value:e})=>e===null?U(`span`,{css:sB,className:`nothing`,children:`null`}):e===void 0?U(`span`,{css:sB,className:`nothing`,children:`absent`}):e===``?U(`span`,{css:sB,className:`nothing`,children:`empty`}):U(`span`,{css:sB,children:String(e)}),lB=L`
5333
5333
  .fields {
5334
5334
  width: 100%;
5335
5335
  border-collapse: collapse;
@@ -5362,7 +5362,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5362
5362
  white-space: pre-wrap;
5363
5363
  overflow-wrap: anywhere;
5364
5364
  }
5365
- `,lB=({blob:e,label:t})=>G(`div`,{css:cB,className:`blob`,"data-blob":t,children:[e.kind===`absent`&&U(`div`,{className:`absent`,children:U(sB,{value:null})}),e.kind===`raw`&&G(z,{children:[U(`div`,{className:`note`,children:`not JSON, shown as it is stored`}),U(`pre`,{className:`raw`,children:e.raw})]}),e.kind===`fields`&&U(`table`,{className:`fields`,children:U(`tbody`,{children:e.fields.map(e=>G(`tr`,{"data-field":e.field,children:[U(`th`,{scope:`row`,children:e.field}),U(`td`,{children:U(sB,{value:e.value})})]},e.field))})})]}),uB=88,dB=20,fB=36,pB=266,mB=76,hB=e=>[e.member?`${e.kind} ${e.member.via===`member`?`member`:`claimed`}`:`named by an edge`,e.origin??`no origin`,e.scope??`no scope`].join(` · `),gB=(e,t)=>{let n=e.find(e=>e.key===t);return new Set(n?[n.fromUri,n.toUri]:[])},_B=(e,t)=>{let n=Gz(e),r=e.links??[],i=qz(r),a=gB(r,t),o=new Set(n.nodes.map(e=>e.uri));return{nodes:n.nodes.map(e=>({id:e.uri,type:`trace`,position:{x:fB+e.column*pB,y:fB+e.row*mB},width:178,height:56,draggable:!1,selectable:!1,data:{uri:e.uri,kind:e.kind,title:e.title,meta:hB(e),lit:a.has(e.uri)}})),edges:r.filter(e=>o.has(e.fromUri)&&o.has(e.toUri)).map(e=>{let n=i.get(e.key)??{lane:0,lanes:1};return{id:e.key,type:`trace`,source:e.fromUri,target:e.toUri,selected:e.key===t,data:{spread:(n.lane-(n.lanes-1)/2)*26,active:tB(e.status),status:e.status,label:e.kind,tooltip:`${e.kind} ${e.status} by ${e.by}: ${e.reason}`}}}),width:Math.max(1,n.columns)*pB-uB+72,height:Math.max(1,n.rows)*mB-dB+72}};K();var vB=L`
5365
+ `,uB=({blob:e,label:t})=>G(`div`,{css:lB,className:`blob`,"data-blob":t,children:[e.kind===`absent`&&U(`div`,{className:`absent`,children:U(cB,{value:null})}),e.kind===`raw`&&G(z,{children:[U(`div`,{className:`note`,children:`not JSON, shown as it is stored`}),U(`pre`,{className:`raw`,children:e.raw})]}),e.kind===`fields`&&U(`table`,{className:`fields`,children:U(`tbody`,{children:e.fields.map(e=>G(`tr`,{"data-field":e.field,children:[U(`th`,{scope:`row`,children:e.field}),U(`td`,{children:U(cB,{value:e.value})})]},e.field))})})]}),dB=88,fB=20,pB=36,mB=266,hB=76,gB=e=>[e.member?`${e.kind} ${e.member.via===`member`?`member`:`claimed`}`:`named by an edge`,e.origin??`no origin`,e.scope??`no scope`].join(` · `),_B=(e,t)=>{let n=e.find(e=>e.key===t);return new Set(n?[n.fromUri,n.toUri]:[])},vB=(e,t)=>{let n=Kz(e),r=e.links??[],i=Jz(r),a=_B(r,t),o=new Set(n.nodes.map(e=>e.uri));return{nodes:n.nodes.map(e=>({id:e.uri,type:`trace`,position:{x:pB+e.column*mB,y:pB+e.row*hB},width:178,height:56,draggable:!1,selectable:!1,data:{uri:e.uri,kind:e.kind,title:e.title,meta:gB(e),lit:a.has(e.uri)}})),edges:r.filter(e=>o.has(e.fromUri)&&o.has(e.toUri)).map(e=>{let n=i.get(e.key)??{lane:0,lanes:1};return{id:e.key,type:`trace`,source:e.fromUri,target:e.toUri,selected:e.key===t,data:{spread:(n.lane-(n.lanes-1)/2)*26,active:nB(e.status),status:e.status,label:e.kind,tooltip:`${e.kind} ${e.status} by ${e.by}: ${e.reason}`}}}),width:Math.max(1,n.columns)*mB-dB+72,height:Math.max(1,n.rows)*hB-fB+72}};K();var yB=L`
5366
5366
  position: relative;
5367
5367
  height: 46rem;
5368
5368
  border: 1px solid rgba(255, 255, 255, 0.12);
@@ -5434,7 +5434,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5434
5434
  .edge-label.active { fill: rgb(134, 239, 172); }
5435
5435
  .edge-label.refused { fill: rgb(252, 165, 165); }
5436
5436
  .cross { stroke: rgb(248, 113, 113); stroke-width: 1.5; }
5437
- `,yB=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e,bB=({data:e})=>G(`div`,{className:`trace-node ${e.kind}${e.lit?` lit`:``}`,"data-node":e.uri,"data-kind":e.kind,title:`${e.uri} (${e.kind})`,children:[U(GM,{type:`target`,position:$.Left}),U(`div`,{className:`uri`,children:yB(e.uri,26)}),U(`div`,{children:e.title===null?`no title`:yB(e.title,28)}),U(`div`,{className:`meta`,children:yB(e.meta,34)}),U(GM,{type:`source`,position:$.Right})]}),xB=({data:e,selected:t,sourceX:n,sourceY:r,targetX:i,targetY:a})=>{let o=e?.spread??0,s=e?.active?`active`:`refused`,c=i>=n,l=Math.max(20,Math.abs(i-n)/2)*(c?1:-1),u=`M ${n} ${r} C ${n+l} ${r+o}, ${i-l} ${a+o}, ${i} ${a}`,d=(n+i)/2,f=(r+a)/2+o*.75;return G(z,{children:[U(`path`,{className:`edge ${s}${t?` selected`:``}`,d:u}),U(`path`,{className:`edge-hit`,d:u,children:U(`title`,{children:e?.tooltip})}),s===`refused`?G(`g`,{className:`cross-mark`,children:[U(`path`,{className:`cross`,d:`M ${d-5} ${f-5} L ${d+5} ${f+5}`}),U(`path`,{className:`cross`,d:`M ${d+5} ${f-5} L ${d-5} ${f+5}`})]}):null,U(`text`,{className:`edge-label ${s}`,x:d,y:f-9,textAnchor:`middle`,children:yB(e?.label??``,22)})]})},SB={trace:bB},CB={trace:xB},wB=({bundle:e,selected:t,onSelect:n})=>{let{nodes:r,edges:i}=H(()=>_B(e,t),[e,t]),a=B((e,t)=>n(t.id),[n]);return G(`div`,{css:vB,"data-trace-graph":!0,children:[G(`div`,{className:`legend`,children:[G(`div`,{children:[U(`b`,{children:`solid`}),` owned: its origin described it`]}),G(`div`,{children:[U(`b`,{children:`dashed yellow`}),` placeholder: no origin has`]}),G(`div`,{children:[U(`b`,{children:`dotted`}),` named by an edge only`]}),G(`div`,{children:[U(`b`,{children:`green line`}),` active link`]}),G(`div`,{children:[U(`b`,{children:`red dashed, crossed`}),` refused link`]})]}),U(wP,{nodes:r,edges:i,nodeTypes:SB,edgeTypes:CB,onEdgeClick:a,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,fitView:!0,minZoom:.05,maxZoom:20,"aria-label":`Every uri this cluster names, and every link between them`,children:U(jP,{variant:DP.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.12)`})})]})};K();var TB=L`
5437
+ `,bB=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e,xB=({data:e})=>G(`div`,{className:`trace-node ${e.kind}${e.lit?` lit`:``}`,"data-node":e.uri,"data-kind":e.kind,title:`${e.uri} (${e.kind})`,children:[U(KM,{type:`target`,position:$.Left}),U(`div`,{className:`uri`,children:bB(e.uri,26)}),U(`div`,{children:e.title===null?`no title`:bB(e.title,28)}),U(`div`,{className:`meta`,children:bB(e.meta,34)}),U(KM,{type:`source`,position:$.Right})]}),SB=({data:e,selected:t,sourceX:n,sourceY:r,targetX:i,targetY:a})=>{let o=e?.spread??0,s=e?.active?`active`:`refused`,c=i>=n,l=Math.max(20,Math.abs(i-n)/2)*(c?1:-1),u=`M ${n} ${r} C ${n+l} ${r+o}, ${i-l} ${a+o}, ${i} ${a}`,d=(n+i)/2,f=(r+a)/2+o*.75;return G(z,{children:[U(`path`,{className:`edge ${s}${t?` selected`:``}`,d:u}),U(`path`,{className:`edge-hit`,d:u,children:U(`title`,{children:e?.tooltip})}),s===`refused`?G(`g`,{className:`cross-mark`,children:[U(`path`,{className:`cross`,d:`M ${d-5} ${f-5} L ${d+5} ${f+5}`}),U(`path`,{className:`cross`,d:`M ${d+5} ${f-5} L ${d-5} ${f+5}`})]}):null,U(`text`,{className:`edge-label ${s}`,x:d,y:f-9,textAnchor:`middle`,children:bB(e?.label??``,22)})]})},CB={trace:xB},wB={trace:SB},TB=({bundle:e,selected:t,onSelect:n})=>{let{nodes:r,edges:i}=H(()=>vB(e,t),[e,t]),a=B((e,t)=>n(t.id),[n]);return G(`div`,{css:yB,"data-trace-graph":!0,children:[G(`div`,{className:`legend`,children:[G(`div`,{children:[U(`b`,{children:`solid`}),` owned: its origin described it`]}),G(`div`,{children:[U(`b`,{children:`dashed yellow`}),` placeholder: no origin has`]}),G(`div`,{children:[U(`b`,{children:`dotted`}),` named by an edge only`]}),G(`div`,{children:[U(`b`,{children:`green line`}),` active link`]}),G(`div`,{children:[U(`b`,{children:`red dashed, crossed`}),` refused link`]})]}),U(TP,{nodes:r,edges:i,nodeTypes:CB,edgeTypes:wB,onEdgeClick:a,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,fitView:!0,minZoom:.05,maxZoom:20,"aria-label":`Every uri this cluster names, and every link between them`,children:U(MP,{variant:OP.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.12)`})})]})};K();var EB=L`
5438
5438
  border: 1px solid rgba(255, 255, 255, 0.12);
5439
5439
  border-radius: 0.5rem;
5440
5440
  padding: 1rem 1.2rem;
@@ -5534,7 +5534,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5534
5534
  }
5535
5535
 
5536
5536
  .empty { color: rgba(255, 255, 255, 0.5); }
5537
- `,EB=e=>e.kind===`link`?`link ${e.row.kind} ${e.row.status} by ${e.row.by}`:e.kind===`episode-link`?`episode link ${e.row.kind} ${e.row.status} by ${e.row.by}`:e.kind===`claim`?`claim ${e.row.kind} from ${e.row.claimer}`:e.kind===`episode-source`?`episode list from ${e.row.claimer}`:`episode claim ${e.row.kind} from ${e.row.claimer}`,DB=e=>e===`not-an-edge-key`?`not an edge key`:`not in this bundle`,OB=e=>{if(e==null)return``;if(typeof e==`string`)return e;if(e instanceof Uint8Array)return new TextDecoder().decode(e);if(e instanceof ArrayBuffer)return new TextDecoder().decode(new Uint8Array(e));if(typeof e==`object`&&typeof e.raw==`string`)return e.raw;try{return JSON.stringify(e,null,2)}catch{return String(e)}},kB=({rows:e})=>U(`table`,{className:`facts`,children:U(`tbody`,{children:e.map(([e,t])=>G(`tr`,{"data-fact":e,children:[U(`th`,{scope:`row`,children:e}),U(`td`,{children:U(sB,{value:t})})]},e))})}),AB=({bundle:e,seq:t,answer:n,onLoad:r})=>{let i=Zz(e,t);return G(z,{children:[G(`h4`,{children:[`answer `,t]}),i?U(kB,{rows:[[`uri`,i.uri],[`origin`,i.origin],[`operation`,i.operation],[`bytes`,i.bytes]]}):U(`p`,{className:`empty`,"data-no-answer-row":!0,children:`The bundle lists no answer with that sequence.`}),U(`button`,{type:`button`,className:`load`,onClick:()=>r(t),children:`Load answer bytes`}),n?.seq===t&&G(`div`,{className:`answer`,"data-answer":!0,children:[n.state===`loading`&&U(`p`,{className:`empty`,children:`loading…`}),n.state===`failed`&&U(`p`,{className:`failed`,children:n.text}),n.state===`done`&&(n.text===``?U(`p`,{className:`empty`,children:`nothing came back for that sequence.`}):U(`pre`,{children:n.text}))]})]})},jB=({bundle:e,index:t,trail:n,onFollow:r,onTrailTo:i,loadAnswerBytes:a})=>{let[o,s]=W(void 0),c=n[n.length-1],l=c===void 0?void 0:t.get(c),u=Xz(t,l&&(l.kind===`link`||l.kind===`episode-link`)?l.row.supports:[]),d=e=>{s({seq:e,state:`loading`,text:``}),a(e).then(t=>s({seq:e,state:`done`,text:OB(t)})).catch(t=>s({seq:e,state:`failed`,text:t instanceof Error?t.message:String(t)}))};return G(`div`,{css:TB,"data-inspector":!0,children:[U(`h3`,{children:`Edge inspector`}),c===void 0?U(`p`,{className:`empty`,children:`Select a link in the graph, or any row in the tables below.`}):G(z,{children:[G(`div`,{className:`trail`,children:[n.slice(0,-1).map((e,n)=>U(`button`,{type:`button`,onClick:()=>i(n),children:t.get(e)?EB(t.get(e)):e},e)),U(`span`,{className:`here`,children:l?EB(l):c})]}),l===void 0?G(`p`,{className:`empty`,"data-unknown-row":!0,children:[`The bundle carries no row with the key `,U(`code`,{children:c}),`.`]}):G(z,{children:[(l.kind===`link`||l.kind===`episode-link`)&&G(z,{children:[U(kB,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`written by`,l.row.by],[`rule`,l.row.reason]]}),G(`p`,{children:[`status`,` `,U(`span`,{className:`status ${tB(l.row.status)?`active`:`refused`}`,children:l.row.status})]}),U(kB,{rows:l.kind===`link`?[[`confidence`,l.row.confidence],[`version`,l.row.version]]:[[`from number`,l.row.fromNumber],[`to number`,l.row.toNumber]]}),U(`h4`,{children:`evidence`}),U(lB,{blob:$z(l.row.evidence),label:`evidence`}),l.kind===`link`&&G(z,{children:[U(`h4`,{children:`gates`}),U(lB,{blob:$z(l.row.gates),label:`gates`})]})]}),(l.kind===`claim`||l.kind===`episode-claim`)&&G(z,{children:[U(kB,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`claimed by`,l.row.claimer],[`provenance`,l.row.provenance],[`answer seq`,l.row.answerSeq],...l.kind===`claim`?[[`target scope`,l.row.targetScope]]:[]]}),U(AB,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),l.kind===`episode-source`&&G(z,{children:[U(kB,{rows:[[`media`,l.row.fromUri],[`episode`,l.row.toUri],[`listed by`,l.row.claimer],[`answer seq`,l.row.answerSeq]]}),U(AB,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),U(`h4`,{children:`supports`}),l.kind===`claim`||l.kind===`episode-claim`||l.kind===`episode-source`?U(`p`,{className:`empty`,children:`This row is source truth: it is derived from nothing.`}):u.length===0?U(`p`,{className:`empty`,children:`This row names no supports.`}):U(`div`,{className:`supports`,children:u.map(e=>G(`div`,{className:`support`,"data-gap":e.gap??void 0,children:[e.ref?U(`button`,{type:`button`,onClick:()=>r(e.key),children:`Follow`}):U(`span`,{className:`unresolved`,children:DB(e.gap)}),U(`span`,{className:`what`,children:e.ref?EB(e.ref):`unresolved`}),U(`span`,{className:`key`,children:e.key})]},e.key))})]})]})]})},MB=L`
5537
+ `,DB=e=>e.kind===`link`?`link ${e.row.kind} ${e.row.status} by ${e.row.by}`:e.kind===`episode-link`?`episode link ${e.row.kind} ${e.row.status} by ${e.row.by}`:e.kind===`claim`?`claim ${e.row.kind} from ${e.row.claimer}`:e.kind===`episode-source`?`episode list from ${e.row.claimer}`:`episode claim ${e.row.kind} from ${e.row.claimer}`,OB=e=>e===`not-an-edge-key`?`not an edge key`:`not in this bundle`,kB=e=>{if(e==null)return``;if(typeof e==`string`)return e;if(e instanceof Uint8Array)return new TextDecoder().decode(e);if(e instanceof ArrayBuffer)return new TextDecoder().decode(new Uint8Array(e));if(typeof e==`object`&&typeof e.raw==`string`)return e.raw;try{return JSON.stringify(e,null,2)}catch{return String(e)}},AB=({rows:e})=>U(`table`,{className:`facts`,children:U(`tbody`,{children:e.map(([e,t])=>G(`tr`,{"data-fact":e,children:[U(`th`,{scope:`row`,children:e}),U(`td`,{children:U(cB,{value:t})})]},e))})}),jB=({bundle:e,seq:t,answer:n,onLoad:r})=>{let i=Qz(e,t);return G(z,{children:[G(`h4`,{children:[`answer `,t]}),i?U(AB,{rows:[[`uri`,i.uri],[`origin`,i.origin],[`operation`,i.operation],[`bytes`,i.bytes]]}):U(`p`,{className:`empty`,"data-no-answer-row":!0,children:`The bundle lists no answer with that sequence.`}),U(`button`,{type:`button`,className:`load`,onClick:()=>r(t),children:`Load answer bytes`}),n?.seq===t&&G(`div`,{className:`answer`,"data-answer":!0,children:[n.state===`loading`&&U(`p`,{className:`empty`,children:`loading…`}),n.state===`failed`&&U(`p`,{className:`failed`,children:n.text}),n.state===`done`&&(n.text===``?U(`p`,{className:`empty`,children:`nothing came back for that sequence.`}):U(`pre`,{children:n.text}))]})]})},MB=({bundle:e,index:t,trail:n,onFollow:r,onTrailTo:i,loadAnswerBytes:a})=>{let[o,s]=W(void 0),c=n[n.length-1],l=c===void 0?void 0:t.get(c),u=Zz(t,l&&(l.kind===`link`||l.kind===`episode-link`)?l.row.supports:[]),d=e=>{s({seq:e,state:`loading`,text:``}),a(e).then(t=>s({seq:e,state:`done`,text:kB(t)})).catch(t=>s({seq:e,state:`failed`,text:t instanceof Error?t.message:String(t)}))};return G(`div`,{css:EB,"data-inspector":!0,children:[U(`h3`,{children:`Edge inspector`}),c===void 0?U(`p`,{className:`empty`,children:`Select a link in the graph, or any row in the tables below.`}):G(z,{children:[G(`div`,{className:`trail`,children:[n.slice(0,-1).map((e,n)=>U(`button`,{type:`button`,onClick:()=>i(n),children:t.get(e)?DB(t.get(e)):e},e)),U(`span`,{className:`here`,children:l?DB(l):c})]}),l===void 0?G(`p`,{className:`empty`,"data-unknown-row":!0,children:[`The bundle carries no row with the key `,U(`code`,{children:c}),`.`]}):G(z,{children:[(l.kind===`link`||l.kind===`episode-link`)&&G(z,{children:[U(AB,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`written by`,l.row.by],[`rule`,l.row.reason]]}),G(`p`,{children:[`status`,` `,U(`span`,{className:`status ${nB(l.row.status)?`active`:`refused`}`,children:l.row.status})]}),U(AB,{rows:l.kind===`link`?[[`confidence`,l.row.confidence],[`version`,l.row.version]]:[[`from number`,l.row.fromNumber],[`to number`,l.row.toNumber]]}),U(`h4`,{children:`evidence`}),U(uB,{blob:eB(l.row.evidence),label:`evidence`}),l.kind===`link`&&G(z,{children:[U(`h4`,{children:`gates`}),U(uB,{blob:eB(l.row.gates),label:`gates`})]})]}),(l.kind===`claim`||l.kind===`episode-claim`)&&G(z,{children:[U(AB,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`claimed by`,l.row.claimer],[`provenance`,l.row.provenance],[`answer seq`,l.row.answerSeq],...l.kind===`claim`?[[`target scope`,l.row.targetScope]]:[]]}),U(jB,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),l.kind===`episode-source`&&G(z,{children:[U(AB,{rows:[[`media`,l.row.fromUri],[`episode`,l.row.toUri],[`listed by`,l.row.claimer],[`answer seq`,l.row.answerSeq]]}),U(jB,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),U(`h4`,{children:`supports`}),l.kind===`claim`||l.kind===`episode-claim`||l.kind===`episode-source`?U(`p`,{className:`empty`,children:`This row is source truth: it is derived from nothing.`}):u.length===0?U(`p`,{className:`empty`,children:`This row names no supports.`}):U(`div`,{className:`supports`,children:u.map(e=>G(`div`,{className:`support`,"data-gap":e.gap??void 0,children:[e.ref?U(`button`,{type:`button`,onClick:()=>r(e.key),children:`Follow`}):U(`span`,{className:`unresolved`,children:OB(e.gap)}),U(`span`,{className:`what`,children:e.ref?DB(e.ref):`unresolved`}),U(`span`,{className:`key`,children:e.key})]},e.key))})]})]})]})},NB=L`
5538
5538
  table {
5539
5539
  width: 100%;
5540
5540
  border-collapse: collapse;
@@ -5587,7 +5587,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5587
5587
  .status.active { color: rgb(74, 222, 128); }
5588
5588
  .status.refused { color: rgb(248, 113, 113); }
5589
5589
  .empty { color: rgba(255, 255, 255, 0.5); font-size: 1.2rem; }
5590
- `,NB=({fill:e,index:t,onSelect:n})=>{let r=Xz(t,e.supports);return r.length===0?U(`div`,{className:`proof`,children:U(`span`,{className:`missing`,"data-no-proof":!0,children:`${e.via} names no proving pair`})}):U(z,{children:r.map(e=>{let t=e.ref?.kind===`episode-link`?e.ref.row:void 0;return G(`div`,{className:`proof`,children:[U(`button`,{type:`button`,onClick:()=>n(e.key),children:`Inspect`}),t?U(`span`,{className:`pair`,children:`${t.fromUri} #${t.fromNumber??`null`} to ${t.toUri} #${t.toNumber??`null`}`}):U(`span`,{className:`pair`,children:e.ref?`${EB(e.ref)} ${e.key}`:U(`span`,{className:`missing`,children:`${e.key}: ${DB(e.gap)}`})}),t&&U(`span`,{className:`status ${tB(t.status)?`active`:`refused`}`,children:t.status})]},e.key)})})},PB=({bundle:e,index:t,selected:n,onSelect:r})=>G(`div`,{css:MB,"data-episodes":!0,children:[(e.episodes??[]).length===0?U(`p`,{className:`empty`,children:`This cluster holds no slots.`}):G(`table`,{"data-slots":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`slot`}),U(`th`,{children:`number`}),U(`th`,{children:`title`}),U(`th`,{children:`fills`})]})}),U(`tbody`,{children:e.episodes.map(e=>G(`tr`,{"data-slot":e.slotId,children:[U(`td`,{className:`slot`,children:e.slotId}),U(`td`,{children:U(sB,{value:e.number})}),U(`td`,{children:U(sB,{value:e.title})}),U(`td`,{children:e.fills.length===0?U(`span`,{className:`empty`,children:`nothing fills this slot`}):e.fills.map(e=>G(`div`,{"data-fill":e.episodeUri,children:[G(`div`,{className:`fill`,children:[U(`span`,{className:`uri`,children:e.episodeUri}),G(`span`,{children:[`#`,U(sB,{value:e.number})]}),U(`span`,{children:e.origin}),U(`span`,{className:`via`,children:e.via}),U(`span`,{className:`by`,children:e.by})]}),U(NB,{fill:e,index:t,onSelect:r})]},`${e.episodeUri}\u0000${e.via}`))})]},e.slotId))})]}),U(`h3`,{children:`Episode edges`}),(e.episodeLinks??[]).length===0?U(`p`,{className:`empty`,children:`No episode links, refused or otherwise.`}):G(`table`,{"data-episode-links":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`from`}),U(`th`,{children:`to`}),U(`th`,{children:`kind`}),U(`th`,{children:`status`}),U(`th`,{children:`by`}),U(`th`,{children:`rule`}),U(`th`,{})]})}),U(`tbody`,{children:e.episodeLinks.map(e=>G(`tr`,{"data-episode-link":e.key,"data-status":e.status,className:n===e.key?`selected`:void 0,children:[U(`td`,{className:`uri`,children:`${e.fromUri} #${e.fromNumber??`null`}`}),U(`td`,{className:`uri`,children:`${e.toUri} #${e.toNumber??`null`}`}),U(`td`,{children:e.kind}),U(`td`,{children:U(`span`,{className:`status ${tB(e.status)?`active`:`refused`}`,children:e.status})}),U(`td`,{children:e.by}),U(`td`,{children:e.reason}),U(`td`,{children:U(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]}),U(`h3`,{children:`Episode claims`}),(e.episodeClaims??[]).length===0?U(`p`,{className:`empty`,children:`no episode level claims`}):G(`table`,{"data-episode-claims":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`from`}),U(`th`,{children:`to`}),U(`th`,{children:`kind`}),U(`th`,{children:`claimer`}),U(`th`,{children:`provenance`}),U(`th`,{children:`answer`}),U(`th`,{})]})}),U(`tbody`,{children:e.episodeClaims.map(e=>G(`tr`,{"data-episode-claim":e.key,className:n===e.key?`selected`:void 0,children:[U(`td`,{className:`uri`,children:e.fromUri}),U(`td`,{className:`uri`,children:e.toUri}),U(`td`,{children:e.kind}),U(`td`,{children:e.claimer}),U(`td`,{children:e.provenance}),U(`td`,{children:e.answerSeq}),U(`td`,{children:U(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]})]});K();var FB=L`
5590
+ `,PB=({fill:e,index:t,onSelect:n})=>{let r=Zz(t,e.supports);return r.length===0?U(`div`,{className:`proof`,children:U(`span`,{className:`missing`,"data-no-proof":!0,children:`${e.via} names no proving pair`})}):U(z,{children:r.map(e=>{let t=e.ref?.kind===`episode-link`?e.ref.row:void 0;return G(`div`,{className:`proof`,children:[U(`button`,{type:`button`,onClick:()=>n(e.key),children:`Inspect`}),t?U(`span`,{className:`pair`,children:`${t.fromUri} #${t.fromNumber??`null`} to ${t.toUri} #${t.toNumber??`null`}`}):U(`span`,{className:`pair`,children:e.ref?`${DB(e.ref)} ${e.key}`:U(`span`,{className:`missing`,children:`${e.key}: ${OB(e.gap)}`})}),t&&U(`span`,{className:`status ${nB(t.status)?`active`:`refused`}`,children:t.status})]},e.key)})})},FB=({bundle:e,index:t,selected:n,onSelect:r})=>G(`div`,{css:NB,"data-episodes":!0,children:[(e.episodes??[]).length===0?U(`p`,{className:`empty`,children:`This cluster holds no slots.`}):G(`table`,{"data-slots":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`slot`}),U(`th`,{children:`number`}),U(`th`,{children:`title`}),U(`th`,{children:`fills`})]})}),U(`tbody`,{children:e.episodes.map(e=>G(`tr`,{"data-slot":e.slotId,children:[U(`td`,{className:`slot`,children:e.slotId}),U(`td`,{children:U(cB,{value:e.number})}),U(`td`,{children:U(cB,{value:e.title})}),U(`td`,{children:e.fills.length===0?U(`span`,{className:`empty`,children:`nothing fills this slot`}):e.fills.map(e=>G(`div`,{"data-fill":e.episodeUri,children:[G(`div`,{className:`fill`,children:[U(`span`,{className:`uri`,children:e.episodeUri}),G(`span`,{children:[`#`,U(cB,{value:e.number})]}),U(`span`,{children:e.origin}),U(`span`,{className:`via`,children:e.via}),U(`span`,{className:`by`,children:e.by})]}),U(PB,{fill:e,index:t,onSelect:r})]},`${e.episodeUri}\u0000${e.via}`))})]},e.slotId))})]}),U(`h3`,{children:`Episode edges`}),(e.episodeLinks??[]).length===0?U(`p`,{className:`empty`,children:`No episode links, refused or otherwise.`}):G(`table`,{"data-episode-links":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`from`}),U(`th`,{children:`to`}),U(`th`,{children:`kind`}),U(`th`,{children:`status`}),U(`th`,{children:`by`}),U(`th`,{children:`rule`}),U(`th`,{})]})}),U(`tbody`,{children:e.episodeLinks.map(e=>G(`tr`,{"data-episode-link":e.key,"data-status":e.status,className:n===e.key?`selected`:void 0,children:[U(`td`,{className:`uri`,children:`${e.fromUri} #${e.fromNumber??`null`}`}),U(`td`,{className:`uri`,children:`${e.toUri} #${e.toNumber??`null`}`}),U(`td`,{children:e.kind}),U(`td`,{children:U(`span`,{className:`status ${nB(e.status)?`active`:`refused`}`,children:e.status})}),U(`td`,{children:e.by}),U(`td`,{children:e.reason}),U(`td`,{children:U(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]}),U(`h3`,{children:`Episode claims`}),(e.episodeClaims??[]).length===0?U(`p`,{className:`empty`,children:`no episode level claims`}):G(`table`,{"data-episode-claims":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`from`}),U(`th`,{children:`to`}),U(`th`,{children:`kind`}),U(`th`,{children:`claimer`}),U(`th`,{children:`provenance`}),U(`th`,{children:`answer`}),U(`th`,{})]})}),U(`tbody`,{children:e.episodeClaims.map(e=>G(`tr`,{"data-episode-claim":e.key,className:n===e.key?`selected`:void 0,children:[U(`td`,{className:`uri`,children:e.fromUri}),U(`td`,{className:`uri`,children:e.toUri}),U(`td`,{children:e.kind}),U(`td`,{children:e.claimer}),U(`td`,{children:e.provenance}),U(`td`,{children:e.answerSeq}),U(`td`,{children:U(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]})]});K();var IB=L`
5591
5591
  max-width: 150rem;
5592
5592
  margin: calc(var(--stub-header-height) + 2rem) auto 6rem;
5593
5593
  padding: 0 1.5rem;
@@ -5697,7 +5697,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5697
5697
 
5698
5698
  .columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
5699
5699
  @media (max-width: 900px) { .columns { grid-template-columns: 1fr; } }
5700
- `,IB=1500,LB=({label:e,value:t})=>G(`div`,{children:[U(`span`,{className:`label`,children:e}),U(`code`,{children:U(sB,{value:t})})]}),RB=({reason:e})=>e===`null`?U(`code`,{className:`token`,"data-token-reason":!0,children:`"null"`}):U(sB,{value:e}),zB=({load:e=Zx,loadAnswerBytes:t=Qx,warm:n=aB})=>{let r=Tf(),[,i]=wf(),a=sS(r),[o,s]=W(a),[c,l]=W({kind:`idle`}),[u,d]=W(0),[f,p]=W({kind:`off`}),[m,h]=W([]),g=q(``),_=q(void 0);V(()=>{s(a),h([]),p({kind:`off`}),g.current=``,_.current!==void 0&&clearTimeout(_.current),_.current=void 0},[a]),V(()=>{if(!a){l({kind:`idle`});return}let t=!0;return l(e=>e.kind===`done`?e:{kind:`loading`}),e(a).then(e=>{t&&l({kind:`done`,bundle:e})}).catch(e=>{t&&l({kind:`failed`,error:e instanceof Error?e.message:String(e)})}),()=>{t=!1}},[a,u]);let v=c.kind===`done`?c.bundle:void 0,y=H(()=>v?Jz(v):new Map,[v]),b=m[m.length-1],x=!(!v||v.resolved||v.reason===`not-enabled`);return V(()=>{if(!a||!x||g.current===a)return;g.current=a;let e=a,t=()=>g.current===e,r=()=>{_.current===void 0&&(_.current=setTimeout(()=>{_.current=void 0,t()&&d(e=>e+1)},IB))};p({kind:`asking`,progress:{payloads:0,uri:null,handles:0,episodes:0}}),n(a,{onProgress:e=>{t()&&(p({kind:`asking`,progress:e}),r())}}).then(e=>{t()&&(p({kind:`done`,progress:e}),d(e=>e+1))}).catch(()=>{t()&&p({kind:`off`})})},[a,x]),V(()=>()=>{g.current=``,_.current!==void 0&&clearTimeout(_.current)},[]),G(`div`,{css:FB,"data-debug-trace":!0,children:[U(`h1`,{children:`Graph trace`}),U(`p`,{className:`intro`,children:`Everything the graph holds for one cluster: its members, every link between them including the refused ones, the episodes it resolved to, and the answer each edge came from. Nothing here is derived, and a value the graph does not carry shows as null. The graph is built inside this tab, so a uri nothing has asked about yet is asked about here first, which is what makes this url worth pasting into a bug report.`}),G(`form`,{className:`ask`,onSubmit:e=>{e.preventDefault();let t=o.trim();t&&(d(e=>e+1),i(eS({uri:t})))},children:[U(`input`,{type:`text`,autoComplete:`off`,spellcheck:!1,placeholder:`ag:(mal:39535,anilist:101280), or a member uri like mal:39535, or a cluster id like cl:...`,value:o,onInput:e=>s(e.target.value)}),U(`button`,{type:`submit`,children:`Trace`})]}),c.kind===`idle`&&U(`p`,{className:`empty`,children:`Give it a uri. It rides in the url, so this page can be linked into a bug report.`}),f.kind!==`off`&&U(`p`,{className:f.kind===`asking`?`warming`:`warming done`,"data-warming":f.kind,"data-answered":f.progress.payloads,children:f.kind===`asking`?`asking the sources about ${a}: ${f.progress.payloads} answer(s) so far, ${f.progress.handles} handle(s), ${f.progress.episodes} episode(s). Every source is asked, so a cold graph takes tens of seconds. The panel fills as they answer and stops waiting on its own.`:f.progress.payloads===0?`nothing answered about ${a}. Every source was asked and none returned a row, so the graph stayed empty: either no source recognises that uri, or every one of them refused it. Nothing is still loading.`:`the sources have stopped answering about ${a}: ${f.progress.payloads} answer(s), ${f.progress.handles} handle(s), ${f.progress.episodes} episode(s). What is below is what that produced.`}),c.kind===`loading`&&G(`p`,{className:`empty`,"data-loading":!0,children:[`tracing `,a,`…`]}),c.kind===`failed`&&U(`p`,{className:`failed`,"data-failed":!0,children:c.error}),v&&G(z,{children:[v.resolved?G(`div`,{className:`resolved`,"data-resolved":!0,children:[G(`div`,{className:`pairs`,children:[U(LB,{label:`asked`,value:v.asked}),U(LB,{label:`cluster`,value:v.resolved.clusterId}),U(LB,{label:`aggregate`,value:v.resolved.aggUri}),U(LB,{label:`scope`,value:v.resolved.scope}),U(LB,{label:`kind`,value:v.resolved.kind})]}),(v.resolved.otherClusters??[]).length>0&&G(`div`,{className:`split`,"data-other-clusters":!0,children:[`This address also reaches`,` `,v.resolved.otherClusters.length,` other cluster(s), whose members are not below:`,` `,v.resolved.otherClusters.map(e=>U(`a`,{href:eS({uri:e,search:r}),children:U(`code`,{children:e})},e))]})]}):G(`div`,{className:`unresolved`,"data-unresolved":!0,"data-reason":v.reason??`none`,children:[U(`div`,{className:`why`,children:eB(v.reason)}),v.reason===`not-enabled`&&G(`div`,{className:`advice`,children:[U(`a`,{"data-reload-graph":!0,href:nS(r),children:`Reload with ?graph=1`}),` or `,U(`a`,{"data-reload-store":!0,href:rS(r),children:`drop ?store=legacy`}),`, keeping this uri.`]}),G(`div`,{className:`pairs`,children:[U(LB,{label:`asked`,value:v.asked}),U(LB,{label:`reason`,value:v.reason??null})]})]}),G(`div`,{className:`pairs`,"data-run-length":!0,children:[U(LB,{label:`run length`,value:v.runLength?.value??null}),U(LB,{label:`from`,value:v.runLength?.from??null}),U(LB,{label:`tier`,value:v.runLength?.tier??null}),U(LB,{label:`witnesses`,value:v.runLength?.witnesses??null})]}),G(`div`,{className:`pairs`,"data-cost":!0,children:[U(LB,{label:`statements`,value:v.cost?.statements??null}),U(LB,{label:`ms to build`,value:v.cost?.ms??null})]}),U(`h3`,{children:`Graph counts`}),U(`div`,{className:`chips`,"data-counts":!0,children:Object.entries(v.counts??{}).length===0?U(`span`,{className:`empty`,children:`the bundle carries no counts`}):Object.entries(v.counts).map(([e,t])=>U(`span`,{className:`chip`,children:`${e} ${t}`},e))}),G(`div`,{className:`columns`,children:[G(`div`,{children:[U(`h3`,{children:`Anomalies`}),(v.anomalies??[]).length===0?U(`p`,{className:`empty`,children:`no rule complained`}):U(`table`,{"data-anomalies":!0,children:U(`tbody`,{children:v.anomalies.map((e,t)=>G(`tr`,{children:[U(`td`,{children:e.rule}),U(`td`,{children:e.detail})]},`${e.rule} ${e.detail} ${t}`))})})]}),G(`div`,{children:[U(`h3`,{children:`Asks`}),(v.asks??[]).length===0?U(`p`,{className:`empty`,children:`nothing was asked of any origin`}):G(`table`,{"data-asks":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`seq`}),U(`th`,{children:`origin`}),U(`th`,{children:`outcome`}),U(`th`,{children:`reason`})]})}),U(`tbody`,{children:v.asks.map((e,t)=>G(`tr`,{"data-ask":e.origin,children:[U(`td`,{children:U(sB,{value:e.seq??null})}),U(`td`,{children:e.origin}),U(`td`,{children:e.outcome}),U(`td`,{children:U(RB,{reason:e.reason})})]},`${e.origin} ${e.seq??t}`))})]})]})]}),U(`h2`,{children:`Media graph`}),U(wB,{bundle:v,selected:b,onSelect:e=>h([e])}),U(`h3`,{children:`Links`}),(v.links??[]).length===0?U(`p`,{className:`empty`,children:`no links, refused or otherwise`}):G(`table`,{"data-links":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`from`}),U(`th`,{children:`to`}),U(`th`,{children:`kind`}),U(`th`,{children:`status`}),U(`th`,{children:`by`}),U(`th`,{children:`rule`}),U(`th`,{children:`confidence`}),U(`th`,{})]})}),U(`tbody`,{children:v.links.map(e=>G(`tr`,{"data-link":e.key,"data-status":e.status,className:b===e.key?`selected`:void 0,children:[U(`td`,{className:`uri`,children:e.fromUri}),U(`td`,{className:`uri`,children:e.toUri}),U(`td`,{children:e.kind}),U(`td`,{children:U(`span`,{className:`status ${tB(e.status)?`active`:`refused`}`,children:e.status})}),U(`td`,{children:e.by}),U(`td`,{children:e.reason}),U(`td`,{children:U(sB,{value:e.confidence})}),U(`td`,{children:U(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),U(`h3`,{children:`Claims`}),(v.claims??[]).length===0?U(`p`,{className:`empty`,children:`no claims between the uris this bundle names`}):G(`table`,{"data-claims":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`from`}),U(`th`,{children:`to`}),U(`th`,{children:`kind`}),U(`th`,{children:`claimer`}),U(`th`,{children:`provenance`}),U(`th`,{children:`answer`}),U(`th`,{children:`target scope`}),U(`th`,{})]})}),U(`tbody`,{children:v.claims.map(e=>G(`tr`,{"data-claim":e.key,className:b===e.key?`selected`:void 0,children:[U(`td`,{className:`uri`,children:e.fromUri}),U(`td`,{className:`uri`,children:e.toUri}),U(`td`,{children:e.kind}),U(`td`,{children:e.claimer}),U(`td`,{children:e.provenance}),U(`td`,{children:e.answerSeq}),U(`td`,{children:U(sB,{value:e.targetScope})}),U(`td`,{children:U(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),U(`h3`,{children:`Attachments`}),(v.attachments??[]).length===0?U(`p`,{className:`empty`,children:`no run is attached to a container here`}):G(`table`,{"data-attachments":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`run`}),U(`th`,{children:`container`}),U(`th`,{children:`via`}),U(`th`,{children:`by`}),U(`th`,{children:`evidence`}),U(`th`,{children:`supports`})]})}),U(`tbody`,{children:v.attachments.map(e=>G(`tr`,{children:[U(`td`,{className:`uri`,children:e.runUri}),U(`td`,{className:`uri`,children:e.containerUri}),U(`td`,{children:e.via}),U(`td`,{children:e.by}),U(`td`,{className:`uri`,children:U(sB,{value:e.evidence})}),U(`td`,{children:(e.supports??[]).length===0?U(sB,{value:null}):e.supports.map(e=>U(`button`,{type:`button`,className:`inspect`,"data-attachment-support":e,onClick:()=>h([e]),children:e},e))})]},`${e.runUri} ${e.containerUri} ${e.via} ${e.by}`))})]}),U(`h2`,{children:`Episodes`}),U(PB,{bundle:v,index:y,selected:b,onSelect:e=>h([e])}),U(`h2`,{children:`Inspector`}),U(jB,{bundle:v,index:y,trail:m,onFollow:e=>h(t=>[...t,e]),onTrailTo:e=>h(t=>t.slice(0,e+1)),loadAnswerBytes:t})]})]})},BB=`[data-party-scroll]`,VB=()=>{let e=document.querySelectorAll(BB);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.scrollHeight-n.clientHeight>0)return n}},HB=(e,t)=>t>0?Math.min(1,Math.max(0,e/t)):0,UB=()=>{let e=VB();return e?Math.max(0,e.scrollHeight-e.clientHeight):Math.max(0,document.documentElement.scrollHeight-window.innerHeight)},WB=()=>{let e=VB();return e?HB(e.scrollTop,e.scrollHeight-e.clientHeight):HB(window.scrollY,document.documentElement.scrollHeight-window.innerHeight)},GB=()=>{try{return window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0}catch{return!1}},KB=(e,t,n)=>!e||GB()?`instant`:t<=n*2?`smooth`:`instant`,qB=(e,{smooth:t}={})=>{let n=VB();if(n){let r=n.scrollHeight-n.clientHeight,i=r>0?e*r:0;n.scrollTo({top:i,behavior:KB(t,Math.abs(i-n.scrollTop),n.clientHeight)});return}let r=document.documentElement.scrollHeight-window.innerHeight,i=r>0?e*r:0;window.scrollTo({top:i,behavior:KB(t,Math.abs(i-window.scrollY),window.innerHeight)})};K();var JB=2,YB=8e3,XB=[`wheel`,`touchstart`,`keydown`,`pointerdown`],ZB=60,QB=()=>{let e=Q_(),[t,n]=wf(),r=Tf(),i=r?`${t}?${r}`:t,a=e.status===`active`?e.role:void 0,o=t===lr,s=t===zf(Q.SEARCH);V(()=>{if(a!==`host`||o)return;let e=()=>{J.setLocation(i,WB()),J.send({t:`nav`,path:i})};if(!s)return e();let t=setTimeout(e,350);return()=>clearTimeout(t)},[a,i,o]),V(()=>{if(a!==`host`||o)return;let e=0,t,n=()=>{t=void 0,e=Date.now();let n=WB();J.setLocation(i,n),J.send({t:`scroll`,y:n})},r=()=>{if(t)return;let r=Math.max(0,1e3/JB-(Date.now()-e));t=setTimeout(n,r)};return document.addEventListener(`scroll`,r,{passive:!0,capture:!0}),()=>{document.removeEventListener(`scroll`,r,{capture:!0}),t&&clearTimeout(t)}},[a,i]);let c=q(void 0),l=q(0);V(()=>{if(c.current===void 0)return;let e=c.current;c.current=void 0;let t=0,n=-1,r=0,i=!1,a=l.current,o=Date.now()+YB,s=()=>{i=!0};for(let e of XB)document.addEventListener(e,s,{passive:!0});let u=()=>{cancelAnimationFrame(t);for(let e of XB)document.removeEventListener(e,s)};if(I_(),e===0)return qB(0),u;let d=()=>{let s=UB();s===n?r+=1:(r=0,n=s);let c=s>0&&r>=ZB;if(i||l.current!==a||c||Date.now()>o)return u();qB(e),t=requestAnimationFrame(d)};return t=requestAnimationFrame(d),u},[i]);let u=q(!1),d=e.status===`active`?e.invite:void 0;V(()=>{u.current=!1},[d]);let f=(e,t)=>{u.current=!0,e===i?(I_(),l.current+=1,qB(t,{smooth:!0})):(c.current=t,n(e))};return $_((e,{replayed:t})=>{if(a===`host`)e.t===`ask`&&e.c===`go`&&e.path!==i&&n(e.path);else if(a===`guest`)switch(e.t){case`nav`:u.current=!0,e.path!==i&&n(e.path);return;case`scroll`:J.hostPath()===i&&(I_(),l.current+=1,qB(e.y,{smooth:!0}));return;case`state`:(!u.current||t)&&f(e.path,e.y);return}}),null};K();var $B=4,eV=2500,tV=L`
5700
+ `,LB=1500,RB=({label:e,value:t})=>G(`div`,{children:[U(`span`,{className:`label`,children:e}),U(`code`,{children:U(cB,{value:t})})]}),zB=({reason:e})=>e===`null`?U(`code`,{className:`token`,"data-token-reason":!0,children:`"null"`}):U(cB,{value:e}),BB=({load:e=Qx,loadAnswerBytes:t=$x,warm:n=oB})=>{let r=Tf(),[,i]=wf(),a=cS(r),[o,s]=W(a),[c,l]=W({kind:`idle`}),[u,d]=W(0),[f,p]=W({kind:`off`}),[m,h]=W([]),g=q(``),_=q(void 0);V(()=>{s(a),h([]),p({kind:`off`}),g.current=``,_.current!==void 0&&clearTimeout(_.current),_.current=void 0},[a]),V(()=>{if(!a){l({kind:`idle`});return}let t=!0;return l(e=>e.kind===`done`?e:{kind:`loading`}),e(a).then(e=>{t&&l({kind:`done`,bundle:e})}).catch(e=>{t&&l({kind:`failed`,error:e instanceof Error?e.message:String(e)})}),()=>{t=!1}},[a,u]);let v=c.kind===`done`?c.bundle:void 0,y=H(()=>v?Yz(v):new Map,[v]),b=m[m.length-1],x=!(!v||v.resolved||v.reason===`not-enabled`);return V(()=>{if(!a||!x||g.current===a)return;g.current=a;let e=a,t=()=>g.current===e,r=()=>{_.current===void 0&&(_.current=setTimeout(()=>{_.current=void 0,t()&&d(e=>e+1)},LB))};p({kind:`asking`,progress:{payloads:0,uri:null,handles:0,episodes:0}}),n(a,{onProgress:e=>{t()&&(p({kind:`asking`,progress:e}),r())}}).then(e=>{t()&&(p({kind:`done`,progress:e}),d(e=>e+1))}).catch(()=>{t()&&p({kind:`off`})})},[a,x]),V(()=>()=>{g.current=``,_.current!==void 0&&clearTimeout(_.current)},[]),G(`div`,{css:IB,"data-debug-trace":!0,children:[U(`h1`,{children:`Graph trace`}),U(`p`,{className:`intro`,children:`Everything the graph holds for one cluster: its members, every link between them including the refused ones, the episodes it resolved to, and the answer each edge came from. Nothing here is derived, and a value the graph does not carry shows as null. The graph is built inside this tab, so a uri nothing has asked about yet is asked about here first, which is what makes this url worth pasting into a bug report.`}),G(`form`,{className:`ask`,onSubmit:e=>{e.preventDefault();let t=o.trim();t&&(d(e=>e+1),i(tS({uri:t})))},children:[U(`input`,{type:`text`,autoComplete:`off`,spellcheck:!1,placeholder:`ag:(mal:39535,anilist:101280), or a member uri like mal:39535, or a cluster id like cl:...`,value:o,onInput:e=>s(e.target.value)}),U(`button`,{type:`submit`,children:`Trace`})]}),c.kind===`idle`&&U(`p`,{className:`empty`,children:`Give it a uri. It rides in the url, so this page can be linked into a bug report.`}),f.kind!==`off`&&U(`p`,{className:f.kind===`asking`?`warming`:`warming done`,"data-warming":f.kind,"data-answered":f.progress.payloads,children:f.kind===`asking`?`asking the sources about ${a}: ${f.progress.payloads} answer(s) so far, ${f.progress.handles} handle(s), ${f.progress.episodes} episode(s). Every source is asked, so a cold graph takes tens of seconds. The panel fills as they answer and stops waiting on its own.`:f.progress.payloads===0?`nothing answered about ${a}. Every source was asked and none returned a row, so the graph stayed empty: either no source recognises that uri, or every one of them refused it. Nothing is still loading.`:`the sources have stopped answering about ${a}: ${f.progress.payloads} answer(s), ${f.progress.handles} handle(s), ${f.progress.episodes} episode(s). What is below is what that produced.`}),c.kind===`loading`&&G(`p`,{className:`empty`,"data-loading":!0,children:[`tracing `,a,`…`]}),c.kind===`failed`&&U(`p`,{className:`failed`,"data-failed":!0,children:c.error}),v&&G(z,{children:[v.resolved?G(`div`,{className:`resolved`,"data-resolved":!0,children:[G(`div`,{className:`pairs`,children:[U(RB,{label:`asked`,value:v.asked}),U(RB,{label:`cluster`,value:v.resolved.clusterId}),U(RB,{label:`aggregate`,value:v.resolved.aggUri}),U(RB,{label:`scope`,value:v.resolved.scope}),U(RB,{label:`kind`,value:v.resolved.kind})]}),(v.resolved.otherClusters??[]).length>0&&G(`div`,{className:`split`,"data-other-clusters":!0,children:[`This address also reaches`,` `,v.resolved.otherClusters.length,` other cluster(s), whose members are not below:`,` `,v.resolved.otherClusters.map(e=>U(`a`,{href:tS({uri:e,search:r}),children:U(`code`,{children:e})},e))]})]}):G(`div`,{className:`unresolved`,"data-unresolved":!0,"data-reason":v.reason??`none`,children:[U(`div`,{className:`why`,children:tB(v.reason)}),v.reason===`not-enabled`&&G(`div`,{className:`advice`,children:[U(`a`,{"data-reload-graph":!0,href:rS(r),children:`Reload with ?graph=1`}),` or `,U(`a`,{"data-reload-store":!0,href:iS(r),children:`drop ?store=legacy`}),`, keeping this uri.`]}),G(`div`,{className:`pairs`,children:[U(RB,{label:`asked`,value:v.asked}),U(RB,{label:`reason`,value:v.reason??null})]})]}),G(`div`,{className:`pairs`,"data-run-length":!0,children:[U(RB,{label:`run length`,value:v.runLength?.value??null}),U(RB,{label:`from`,value:v.runLength?.from??null}),U(RB,{label:`tier`,value:v.runLength?.tier??null}),U(RB,{label:`witnesses`,value:v.runLength?.witnesses??null})]}),G(`div`,{className:`pairs`,"data-cost":!0,children:[U(RB,{label:`statements`,value:v.cost?.statements??null}),U(RB,{label:`ms to build`,value:v.cost?.ms??null})]}),U(`h3`,{children:`Graph counts`}),U(`div`,{className:`chips`,"data-counts":!0,children:Object.entries(v.counts??{}).length===0?U(`span`,{className:`empty`,children:`the bundle carries no counts`}):Object.entries(v.counts).map(([e,t])=>U(`span`,{className:`chip`,children:`${e} ${t}`},e))}),G(`div`,{className:`columns`,children:[G(`div`,{children:[U(`h3`,{children:`Anomalies`}),(v.anomalies??[]).length===0?U(`p`,{className:`empty`,children:`no rule complained`}):U(`table`,{"data-anomalies":!0,children:U(`tbody`,{children:v.anomalies.map((e,t)=>G(`tr`,{children:[U(`td`,{children:e.rule}),U(`td`,{children:e.detail})]},`${e.rule} ${e.detail} ${t}`))})})]}),G(`div`,{children:[U(`h3`,{children:`Asks`}),(v.asks??[]).length===0?U(`p`,{className:`empty`,children:`nothing was asked of any origin`}):G(`table`,{"data-asks":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`seq`}),U(`th`,{children:`origin`}),U(`th`,{children:`outcome`}),U(`th`,{children:`reason`})]})}),U(`tbody`,{children:v.asks.map((e,t)=>G(`tr`,{"data-ask":e.origin,children:[U(`td`,{children:U(cB,{value:e.seq??null})}),U(`td`,{children:e.origin}),U(`td`,{children:e.outcome}),U(`td`,{children:U(zB,{reason:e.reason})})]},`${e.origin} ${e.seq??t}`))})]})]})]}),U(`h2`,{children:`Media graph`}),U(TB,{bundle:v,selected:b,onSelect:e=>h([e])}),U(`h3`,{children:`Links`}),(v.links??[]).length===0?U(`p`,{className:`empty`,children:`no links, refused or otherwise`}):G(`table`,{"data-links":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`from`}),U(`th`,{children:`to`}),U(`th`,{children:`kind`}),U(`th`,{children:`status`}),U(`th`,{children:`by`}),U(`th`,{children:`rule`}),U(`th`,{children:`confidence`}),U(`th`,{})]})}),U(`tbody`,{children:v.links.map(e=>G(`tr`,{"data-link":e.key,"data-status":e.status,className:b===e.key?`selected`:void 0,children:[U(`td`,{className:`uri`,children:e.fromUri}),U(`td`,{className:`uri`,children:e.toUri}),U(`td`,{children:e.kind}),U(`td`,{children:U(`span`,{className:`status ${nB(e.status)?`active`:`refused`}`,children:e.status})}),U(`td`,{children:e.by}),U(`td`,{children:e.reason}),U(`td`,{children:U(cB,{value:e.confidence})}),U(`td`,{children:U(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),U(`h3`,{children:`Claims`}),(v.claims??[]).length===0?U(`p`,{className:`empty`,children:`no claims between the uris this bundle names`}):G(`table`,{"data-claims":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`from`}),U(`th`,{children:`to`}),U(`th`,{children:`kind`}),U(`th`,{children:`claimer`}),U(`th`,{children:`provenance`}),U(`th`,{children:`answer`}),U(`th`,{children:`target scope`}),U(`th`,{})]})}),U(`tbody`,{children:v.claims.map(e=>G(`tr`,{"data-claim":e.key,className:b===e.key?`selected`:void 0,children:[U(`td`,{className:`uri`,children:e.fromUri}),U(`td`,{className:`uri`,children:e.toUri}),U(`td`,{children:e.kind}),U(`td`,{children:e.claimer}),U(`td`,{children:e.provenance}),U(`td`,{children:e.answerSeq}),U(`td`,{children:U(cB,{value:e.targetScope})}),U(`td`,{children:U(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),U(`h3`,{children:`Attachments`}),(v.attachments??[]).length===0?U(`p`,{className:`empty`,children:`no run is attached to a container here`}):G(`table`,{"data-attachments":!0,children:[U(`thead`,{children:G(`tr`,{children:[U(`th`,{children:`run`}),U(`th`,{children:`container`}),U(`th`,{children:`via`}),U(`th`,{children:`by`}),U(`th`,{children:`evidence`}),U(`th`,{children:`supports`})]})}),U(`tbody`,{children:v.attachments.map(e=>G(`tr`,{children:[U(`td`,{className:`uri`,children:e.runUri}),U(`td`,{className:`uri`,children:e.containerUri}),U(`td`,{children:e.via}),U(`td`,{children:e.by}),U(`td`,{className:`uri`,children:U(cB,{value:e.evidence})}),U(`td`,{children:(e.supports??[]).length===0?U(cB,{value:null}):e.supports.map(e=>U(`button`,{type:`button`,className:`inspect`,"data-attachment-support":e,onClick:()=>h([e]),children:e},e))})]},`${e.runUri} ${e.containerUri} ${e.via} ${e.by}`))})]}),U(`h2`,{children:`Episodes`}),U(FB,{bundle:v,index:y,selected:b,onSelect:e=>h([e])}),U(`h2`,{children:`Inspector`}),U(MB,{bundle:v,index:y,trail:m,onFollow:e=>h(t=>[...t,e]),onTrailTo:e=>h(t=>t.slice(0,e+1)),loadAnswerBytes:t})]})]})},VB=`[data-party-scroll]`,HB=()=>{let e=document.querySelectorAll(VB);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.scrollHeight-n.clientHeight>0)return n}},UB=(e,t)=>t>0?Math.min(1,Math.max(0,e/t)):0,WB=()=>{let e=HB();return e?Math.max(0,e.scrollHeight-e.clientHeight):Math.max(0,document.documentElement.scrollHeight-window.innerHeight)},GB=()=>{let e=HB();return e?UB(e.scrollTop,e.scrollHeight-e.clientHeight):UB(window.scrollY,document.documentElement.scrollHeight-window.innerHeight)},KB=()=>{try{return window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0}catch{return!1}},qB=(e,t,n)=>!e||KB()?`instant`:t<=n*2?`smooth`:`instant`,JB=(e,{smooth:t}={})=>{let n=HB();if(n){let r=n.scrollHeight-n.clientHeight,i=r>0?e*r:0;n.scrollTo({top:i,behavior:qB(t,Math.abs(i-n.scrollTop),n.clientHeight)});return}let r=document.documentElement.scrollHeight-window.innerHeight,i=r>0?e*r:0;window.scrollTo({top:i,behavior:qB(t,Math.abs(i-window.scrollY),window.innerHeight)})};K();var YB=2,XB=8e3,ZB=[`wheel`,`touchstart`,`keydown`,`pointerdown`],QB=60,$B=()=>{let e=Q_(),[t,n]=wf(),r=Tf(),i=r?`${t}?${r}`:t,a=e.status===`active`?e.role:void 0,o=t===lr,s=t===zf(Q.SEARCH);V(()=>{if(a!==`host`||o)return;let e=()=>{J.setLocation(i,GB()),J.send({t:`nav`,path:i})};if(!s)return e();let t=setTimeout(e,350);return()=>clearTimeout(t)},[a,i,o]),V(()=>{if(a!==`host`||o)return;let e=0,t,n=()=>{t=void 0,e=Date.now();let n=GB();J.setLocation(i,n),J.send({t:`scroll`,y:n})},r=()=>{if(t)return;let r=Math.max(0,1e3/YB-(Date.now()-e));t=setTimeout(n,r)};return document.addEventListener(`scroll`,r,{passive:!0,capture:!0}),()=>{document.removeEventListener(`scroll`,r,{capture:!0}),t&&clearTimeout(t)}},[a,i]);let c=q(void 0),l=q(0);V(()=>{if(c.current===void 0)return;let e=c.current;c.current=void 0;let t=0,n=-1,r=0,i=!1,a=l.current,o=Date.now()+XB,s=()=>{i=!0};for(let e of ZB)document.addEventListener(e,s,{passive:!0});let u=()=>{cancelAnimationFrame(t);for(let e of ZB)document.removeEventListener(e,s)};if(I_(),e===0)return JB(0),u;let d=()=>{let s=WB();s===n?r+=1:(r=0,n=s);let c=s>0&&r>=QB;if(i||l.current!==a||c||Date.now()>o)return u();JB(e),t=requestAnimationFrame(d)};return t=requestAnimationFrame(d),u},[i]);let u=q(!1),d=e.status===`active`?e.invite:void 0;V(()=>{u.current=!1},[d]);let f=(e,t)=>{u.current=!0,e===i?(I_(),l.current+=1,JB(t,{smooth:!0})):(c.current=t,n(e))};return $_((e,{replayed:t})=>{if(a===`host`)e.t===`ask`&&e.c===`go`&&e.path!==i&&n(e.path);else if(a===`guest`)switch(e.t){case`nav`:u.current=!0,e.path!==i&&n(e.path);return;case`scroll`:J.hostPath()===i&&(I_(),l.current+=1,JB(e.y,{smooth:!0}));return;case`state`:(!u.current||t)&&f(e.path,e.y);return}}),null};K();var eV=4,tV=2500,nV=L`
5701
5701
  position: fixed;
5702
5702
  left: 0;
5703
5703
  top: 0;
@@ -5724,7 +5724,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5724
5724
  font-weight: 600;
5725
5725
  white-space: nowrap;
5726
5726
  }
5727
- `,nV=()=>{let e=Q_(),t=e.status===`active`?e.role:void 0,[n]=wf(),r=Tf(),i=r?`${n}?${r}`:n;V(()=>{if(t!==`host`)return;let e=0,n,r,i=()=>{n=void 0,r&&!J.playing()&&(e=Date.now(),J.send({t:`cursor`,x:r.x,y:r.y}))},a=t=>{r={x:Math.min(1,Math.max(0,t.clientX/window.innerWidth)),y:Math.min(1,Math.max(0,t.clientY/window.innerHeight))},!n&&(n=setTimeout(i,Math.max(0,1e3/$B-(Date.now()-e))))};return window.addEventListener(`pointermove`,a,{passive:!0}),()=>{window.removeEventListener(`pointermove`,a),n&&clearTimeout(n)}},[t]);let[a,o]=W(void 0),[s,c]=W(()=>Date.now()),l=q(!1);if($_(e=>{if(t===`guest`){if(e.t===`playback`||e.t===`state`&&e.s){let t=(e.t,e.s);l.current=!t.paused,l.current&&o(void 0)}else e.t!==`cursor`||l.current||J.hostPath()===i&&o({x:e.x,y:e.y,at:Date.now()})}}),V(()=>{if(!a)return;let e=setInterval(()=>c(Date.now()),500);return()=>clearInterval(e)},[a]),t!==`guest`||!a||s-a.at>eV)return null;let u=e.status===`active`?J.nameOf(e.owner):void 0;return G(`div`,{css:tV,style:{"--x":`${a.x*100}vw`,"--y":`${a.y*100}vh`},"aria-hidden":`true`,children:[U(`svg`,{width:`18`,height:`22`,viewBox:`0 0 18 22`,fill:`none`,children:U(`path`,{d:`M2 2 L2 17 L6.5 13 L9.5 20 L12 19 L9 12.5 L15 12 Z`,fill:`#4ade80`,stroke:`#06120a`,strokeWidth:`1.2`,strokeLinejoin:`round`})}),U(`span`,{className:`tag`,children:u??`host`})]})};K();var rV=()=>({pathname:location.pathname,search:location.search}),iV=[[`pushState`,`push`],[`replaceState`,`replace`],[`popstate`,`pop`]],aV=()=>{let e=q(rV());return V(()=>{let t=iV.map(([t,n])=>{let r=()=>{let t={from:e.current,to:rV(),kind:n,asked:z_()};e.current=t.to,M_(t)&&F_()};return addEventListener(t,r),()=>removeEventListener(t,r)});return()=>{I_();for(let e of t)e()}},[]),null};K();var oV=()=>{let{query:e}=Sf();return U(Ff,{to:dp({query:up(e)}),replace:!0})},sV=()=>(V(()=>{globalThis.close()},[]),U(`div`,{children:`Logging in...`})),cV=L`
5727
+ `,rV=()=>{let e=Q_(),t=e.status===`active`?e.role:void 0,[n]=wf(),r=Tf(),i=r?`${n}?${r}`:n;V(()=>{if(t!==`host`)return;let e=0,n,r,i=()=>{n=void 0,r&&!J.playing()&&(e=Date.now(),J.send({t:`cursor`,x:r.x,y:r.y}))},a=t=>{r={x:Math.min(1,Math.max(0,t.clientX/window.innerWidth)),y:Math.min(1,Math.max(0,t.clientY/window.innerHeight))},!n&&(n=setTimeout(i,Math.max(0,1e3/eV-(Date.now()-e))))};return window.addEventListener(`pointermove`,a,{passive:!0}),()=>{window.removeEventListener(`pointermove`,a),n&&clearTimeout(n)}},[t]);let[a,o]=W(void 0),[s,c]=W(()=>Date.now()),l=q(!1);if($_(e=>{if(t===`guest`){if(e.t===`playback`||e.t===`state`&&e.s){let t=(e.t,e.s);l.current=!t.paused,l.current&&o(void 0)}else e.t!==`cursor`||l.current||J.hostPath()===i&&o({x:e.x,y:e.y,at:Date.now()})}}),V(()=>{if(!a)return;let e=setInterval(()=>c(Date.now()),500);return()=>clearInterval(e)},[a]),t!==`guest`||!a||s-a.at>tV)return null;let u=e.status===`active`?J.nameOf(e.owner):void 0;return G(`div`,{css:nV,style:{"--x":`${a.x*100}vw`,"--y":`${a.y*100}vh`},"aria-hidden":`true`,children:[U(`svg`,{width:`18`,height:`22`,viewBox:`0 0 18 22`,fill:`none`,children:U(`path`,{d:`M2 2 L2 17 L6.5 13 L9.5 20 L12 19 L9 12.5 L15 12 Z`,fill:`#4ade80`,stroke:`#06120a`,strokeWidth:`1.2`,strokeLinejoin:`round`})}),U(`span`,{className:`tag`,children:u??`host`})]})};K();var iV=()=>({pathname:location.pathname,search:location.search}),aV=[[`pushState`,`push`],[`replaceState`,`replace`],[`popstate`,`pop`]],oV=()=>{let e=q(iV());return V(()=>{let t=aV.map(([t,n])=>{let r=()=>{let t={from:e.current,to:iV(),kind:n,asked:z_()};e.current=t.to,M_(t)&&F_()};return addEventListener(t,r),()=>removeEventListener(t,r)});return()=>{I_();for(let e of t)e()}},[]),null};K();var sV=()=>{let{query:e}=Sf();return U(Ff,{to:dp({query:up(e)}),replace:!0})},cV=()=>(V(()=>{globalThis.close()},[]),U(`div`,{children:`Logging in...`})),lV=L`
5728
5728
  display: flex;
5729
5729
  flex-direction: column;
5730
5730
  min-height: 100vh;
@@ -5732,9 +5732,9 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5732
5732
  & > .content {
5733
5733
  flex: 1;
5734
5734
  }
5735
- `,lV=L`
5735
+ `,uV=L`
5736
5736
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
5737
- `,uV=()=>U(Of,{hrefs:Wp,children:G(`div`,{css:cV,children:[U(Av,{}),U(`div`,{className:`content`,children:G(Pf,{children:[U(jf,{path:Rf(Q.HOME),component:kI}),U(jf,{path:Rf(Q.MEDIA),component:kI}),U(jf,{path:Rf(Q.TITLE),component:YI}),U(jf,{path:Rf(Q.SEARCH),component:XL}),U(jf,{path:Rf(Q.SEARCH_LEGACY),component:oV}),U(jf,{path:Rf(Q.LEGAL),component:$L}),U(jf,{path:Rf(Q.PRIVACY),component:aR}),U(jf,{path:Rf(Q.SETTINGS),component:az}),U(jf,{path:Rf(Q.WATCH),component:zz}),U(jf,{path:Rf(Q.PARTY),component:Hz}),U(jf,{path:Rf(Q.DEBUG_TRACE),children:U(zB,{})}),U(jf,{path:Rf(Q.LOGIN_CALLBACK),component:sV}),U(jf,{component:()=>U(`div`,{css:lV,children:`404 No page found`})})]})}),U(Mv,{}),U(Pv,{}),U(QB,{}),U(nV,{}),U(nv,{}),U(aV,{})]})});ft(),K();var dV=L`
5737
+ `,dV=()=>U(Of,{hrefs:Wp,children:G(`div`,{css:lV,children:[U(Av,{}),U(`div`,{className:`content`,children:G(Pf,{children:[U(jf,{path:Rf(Q.HOME),component:AI}),U(jf,{path:Rf(Q.MEDIA),component:AI}),U(jf,{path:Rf(Q.TITLE),component:XI}),U(jf,{path:Rf(Q.SEARCH),component:ZL}),U(jf,{path:Rf(Q.SEARCH_LEGACY),component:sV}),U(jf,{path:Rf(Q.LEGAL),component:eR}),U(jf,{path:Rf(Q.PRIVACY),component:oR}),U(jf,{path:Rf(Q.SETTINGS),component:oz}),U(jf,{path:Rf(Q.WATCH),component:Bz}),U(jf,{path:Rf(Q.PARTY),component:Uz}),U(jf,{path:Rf(Q.DEBUG_TRACE),children:U(BB,{})}),U(jf,{path:Rf(Q.LOGIN_CALLBACK),component:cV}),U(jf,{component:()=>U(`div`,{css:uV,children:`404 No page found`})})]})}),U(Mv,{}),U(Pv,{}),U($B,{}),U(rV,{}),U(nv,{}),U(oV,{})]})});ft(),K();var fV=L`
5738
5738
  display: flex;
5739
5739
  align-items: center;
5740
5740
  justify-content: center;
@@ -5783,7 +5783,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5783
5783
  background: rgba(255, 255, 255, 0.08);
5784
5784
  }
5785
5785
  }
5786
- `,fV=(e,t)=>`route: ${t}\nmessage: ${e.message}\nstack: ${e.stack??`(no stack)`}`,pV=({error:e,route:t})=>{let[n,r]=W(!1);return U(`div`,{css:dV,children:G(`div`,{className:`panel`,children:[U(`h2`,{children:`This page failed to render`}),U(`p`,{className:`message`,children:e.message||`No message was given.`}),G(`div`,{className:`actions`,children:[U(`button`,{type:`button`,onClick:()=>globalThis.location?.reload(),children:`Reload`}),U(`button`,{type:`button`,onClick:()=>{let n=navigator.clipboard?.writeText(fV(e,t));n&&n.then(()=>r(!0)).catch(e=>console.error(Error(`the failure details could not be copied`,{cause:e})))},children:n?`Copied`:`Copy details`})]})]})})},mV=class extends it{state={error:null,route:this.props.route};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}static getDerivedStateFromProps(e,t){return e.route===t.route?null:{error:null,route:e.route}}componentDidCatch(e){console.error(Error(`the ${this.props.route} route failed to render`,{cause:e}))}render(){return this.state.error?U(pV,{error:this.state.error,route:this.props.route}):this.props.children}},hV=({children:e})=>{let[t]=wf();return U(mV,{route:t,children:e})};Tt(location.href)&&(window.__stubExportStore=e=>qt(e??{excludeOrigins:[]}));var gV=async(e,t={},n={})=>nB(Pt,e,t,{settleMs:n.settleMs});Vt(location.href)&&(window.__stubExportAnswers=()=>Yt(),window.__stubExportAsks=()=>Wt(),window.__stubGraphCounts=()=>zt()),Bt(location.href)&&(window.__stubGraphQL=(e,t,n)=>gV(e,t,n));var _V=`stub.apikeys`;ft(),((e=()=>localStorage)=>{try{e().removeItem(_V)}catch{}})(),bl({check:Kt,focused:Ut}),El(Gs);var vV=L`
5786
+ `,pV=(e,t)=>`route: ${t}\nmessage: ${e.message}\nstack: ${e.stack??`(no stack)`}`,mV=({error:e,route:t})=>{let[n,r]=W(!1);return U(`div`,{css:fV,children:G(`div`,{className:`panel`,children:[U(`h2`,{children:`This page failed to render`}),U(`p`,{className:`message`,children:e.message||`No message was given.`}),G(`div`,{className:`actions`,children:[U(`button`,{type:`button`,onClick:()=>globalThis.location?.reload(),children:`Reload`}),U(`button`,{type:`button`,onClick:()=>{let n=navigator.clipboard?.writeText(pV(e,t));n&&n.then(()=>r(!0)).catch(e=>console.error(Error(`the failure details could not be copied`,{cause:e})))},children:n?`Copied`:`Copy details`})]})]})})},hV=class extends it{state={error:null,route:this.props.route};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}static getDerivedStateFromProps(e,t){return e.route===t.route?null:{error:null,route:e.route}}componentDidCatch(e){console.error(Error(`the ${this.props.route} route failed to render`,{cause:e}))}render(){return this.state.error?U(mV,{error:this.state.error,route:this.props.route}):this.props.children}},gV=({children:e})=>{let[t]=wf();return U(hV,{route:t,children:e})};Tt(location.href)&&(window.__stubExportStore=e=>qt(e??{excludeOrigins:[]}));var _V=async(e,t={},n={})=>rB(Pt,e,t,{settleMs:n.settleMs});Vt(location.href)&&(window.__stubExportAnswers=()=>Yt(),window.__stubExportAsks=()=>Wt(),window.__stubGraphCounts=()=>zt()),Bt(location.href)&&(window.__stubGraphQL=(e,t,n)=>_V(e,t,n));var vV=`stub.apikeys`;ft(),((e=()=>localStorage)=>{try{e().removeItem(vV)}catch{}})(),bl({check:Kt,focused:Ut}),El(Gs);var yV=L`
5787
5787
  @import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&family=Fira+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,500;1,600;1,700;1,800;1,900&family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
5788
5788
 
5789
5789
  :root {
@@ -5843,4 +5843,4 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
5843
5843
  .hidden {
5844
5844
  display: none !important;
5845
5845
  }
5846
- `;J.resume();var yV=document.createElement(`div`);yV.id=`stub-root`,$e(G(Ha,{value:Vd,children:[U(wt,{styles:vV}),U(hV,{children:U(uV,{})})]}),document.body.appendChild(yV));
5846
+ `;J.resume();var bV=document.createElement(`div`);bV.id=`stub-root`,$e(G(Ha,{value:Vd,children:[U(wt,{styles:yV}),U(gV,{children:U(dV,{})})]}),document.body.appendChild(bV));