@banou/stub 0.0.45 → 0.0.46

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.
@@ -19,7 +19,7 @@ import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J a
19
19
  `)){var r=n.match(Rn);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?An(i,l,a,c):On(e,l,a),r=!1,yield i,r=!0;i||(yield i=On(e,{},a))}catch(t){if(!r)throw t;yield jn(e,a&&(a.status<200||a.status>=300)&&a.statusText?Error(a.statusText):t,a)}}function Hn(e,t,n){var r;return typeof AbortController<`u`&&(n.signal=(r=new AbortController).signal),Rt((()=>{r&&r.abort()}))(Nt((e=>!!e))(qt(Vn(e,t,n))))}function Un(e){var t=t=>e(t);return t.toPromise=()=>rn(Ut(1)(Nt((e=>!e.stale&&!e.hasNext))(t))),t.then=(e,n)=>t.toPromise().then(e,n),t.subscribe=e=>tn(e)(t),t}function Wn(e,t,n){return{...t,kind:e,context:t.context?{...t.context,...n}:n||t.context}}var Gn=()=>{},Kn=({forward:e,dispatchDebug:t})=>t=>Lt([Ft((e=>{var n=Mn(e),r=Nn(e,n),i=In(e,n);return Wt(Nt((t=>t.kind===`teardown`&&t.key===e.key))(t))(Hn(e,r,i))}))(Nt((e=>e.kind!==`teardown`&&(e.kind!==`subscription`||!!e.context.fetchSubscriptions)))(t)),e(Nt((e=>e.kind===`teardown`||e.kind===`subscription`&&!e.context.fetchSubscriptions))(t))]),qn=e=>({client:t,forward:n,dispatchDebug:r})=>e.reduceRight(((e,n)=>n({client:t,forward(t){return Vt(e(Vt(t)))},dispatchDebug(e){}})),n),Jn=({onOperation:e,onResult:t,onError:n})=>({forward:r})=>i=>Ft((e=>{n&&e.error&&n(e.error,e.operation);var r=t&&t(e)||e;return`then`in r?en(r):Xt(r)}))(r(Ft((t=>{var n=e&&e(t)||t;return`then`in n?en(n):Xt(n)}))(i))),Yn=({dispatchDebug:e})=>e=>Nt((e=>!1))(e),Xn=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=Qt();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=Wt(Nt((t=>t.kind===`teardown`&&t.key===e.key))(c.source))(Nt((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`?Ht((t=>{var n=Xt(t);return t.stale||t.hasNext?n:Lt([n,Pt((()=>(t.stale=!0,t)))(Ut(1)(Nt((t=>t.key===e.key))(c.source)))])}))(t):Gt((e=>!!e.hasNext),!0)(t),t=e.kind===`mutation`?Bt((()=>{l(e)}))(t):Rt((()=>{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(Wn(`teardown`,e,e.context))}))(zt((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)),Vt(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||={},Wn(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`?Un(f(e)):Un(Kt((()=>{var t=i.get(e.key);t||i.set(e.key,t=f(e)),t=Bt((()=>{d(e)}))(t);var n=r.get(e.key);return e.kind===`query`&&n&&(n.stale||n.hasNext)?Ht(Xt)(Lt([t,Nt((t=>t===r.get(e.key)))(Xt(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 tn((e=>{r=e}))(m.query(e,t,n)).unsubscribe(),r},query:(e,t,n)=>m.executeQuery(En(e,t),n),subscription:(e,t,n)=>m.executeSubscription(En(e,t),n),mutation:(e,t,n)=>m.executeMutation(En(e,t),n)}),h=Gn,g=Vt(qn(t.exchanges)({client:m,dispatchDebug:h,forward:Yn({dispatchDebug:h})})(c.source));return nn(g),m};le();var Zn=A({}),Qn=Zn.Provider;Zn.Consumer,Zn.displayName=`UrqlContext`;var $n=()=>R(Zn),er={fetching:!1,stale:!1,hasNext:!1,error:void 0,data:void 0,extensions:void 0,operation:void 0},tr=(e,t)=>e===t||!(!e||!t||e.key!==t.key),nr=(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`?!tr(e[r],t[r]):e[r]!==t[r])return!0;return!1})(e,n)?n:e},rr=(e,t)=>{for(var n=0,r=t.length;n<r;n++)if(e[n]!==t[n])return!0;return!1};function ir(e,t){e(t)}function ar(e){var t=w(!0),n=$n(),[r,i]=V(er),a=U(((r,a)=>(ir(i,{...er,fetching:!0}),rn(Ut(1)(Nt((e=>!e.hasNext))(zt((e=>{t.current&&ir(i,{fetching:!1,stale:e.stale,data:e.data,error:e.error,extensions:e.extensions,operation:e.operation,hasNext:e.hasNext})}))(n.executeMutation(En(e,r),a||{}))))))),[n,e,i]);return N((()=>(t.current=!0,()=>{t.current=!1})),[]),[r,a]}function or(e,t){var n=w(void 0);return D((()=>{var r=En(e,t);return n.current!==void 0&&n.current.key===r.key?n.current:(n.current=r,r)}),[e,t])}function sr(e,t){var n=$n(),r=or(e.query,e.variables),i=w(t);i.current=t;var a=D((()=>e.pause?null:n.executeSubscription(r,e.context)),[n,r,e.pause,e.context]),o=[n,r,e.context,e.pause],[s,c]=V((()=>[a,{...er,fetching:!!a},o])),l=s[1];a!==s[0]&&rr(s[2],o)&&c([a,l=nr(s[1],{fetching:!!a}),o]),N((()=>{var e=e=>{ir(c,(t=>{var n=nr(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 tn(e)(Rt((()=>{e({fetching:!!a})}))(s[0])).unsubscribe;e({fetching:!1})}),[s[0]]);var u=U((t=>{var i=n.executeSubscription(r,{...e.context,...t});ir(c,(e=>[i,e[1],o]))}),[n,r,e.context,e.pause]);return[l,u]}H();var cr=()=>`https://fkn.app/connect-button`,lr=`stub-source@1`,ur=`stub-enabled-plugins`,dr=()=>{try{return globalThis.localStorage}catch{return}},fr=(e=dr())=>{try{let t=JSON.parse(e?.getItem(`stub-enabled-plugins`)??`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}},pr=(e,t=dr())=>{try{t?.setItem(ur,JSON.stringify(e))}catch{}},mr=3e3,hr=new Map,gr=new Set,_r=()=>gr.forEach(e=>{try{e()}catch{}}),vr=e=>(gr.add(e),()=>{gr.delete(e)}),yr=()=>fr().map(e=>hr.get(e)??{uri:e,state:`connecting`}),br=()=>fr(),xr=(e,t)=>{hr.set(e,{uri:e,...t}),_r()},Sr=45e3,Cr=(e,t)=>Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(Error(t)),Sr))]),wr=new Set,Tr=new Map,Er=3e4,Dr=(e,t)=>{if(!fr().includes(e)||wr.has(e)||Tr.has(e))return;hr.get(e)?.state!==`error`&&xr(e,{state:`connecting`});let n=Math.min(mr*t,Er),r=setTimeout(()=>{Tr.delete(e),Or(e,t+1).catch(()=>{})},n);Tr.set(e,r)},Or=async(e,t=1)=>{if(!wr.has(e)){wr.add(e),xr(e,{state:`connecting`});try{let{port:t,closed:n}=await Cr(ye.connect(e,{protocol:lr,raw:!0}),`connecting to '${e}' timed out`);n.then(()=>{wr.delete(e),Le(e),Dr(e,1)});let r=await Cr(Promise.race([He(t,e),n.then(()=>({error:`the package closed before the source registered`}))]),`'${e}' connected but never registered its source`);if(`error`in r)throw Error(r.error);xr(e,{state:`connected`,sources:r.ok.sources,rejected:r.ok.rejected})}catch(n){wr.delete(e);let r=n instanceof Error?n.message:String(n);throw console.warn(`Plugin '${e}' failed to connect:`,n),xr(e,{state:`error`,error:r}),Dr(e,t+1),n}}},kr=e=>{let t=Tr.get(e);t!==void 0&&(clearTimeout(t),Tr.delete(e))},Ar=async(e,t)=>{let n=await ye.install(e,t);return n?(pr([...new Set([...fr(),n.uri])]),await Or(n.uri),n.uri):null},jr=async e=>{pr(fr().filter(t=>t!==e)),kr(e),wr.delete(e),hr.delete(e),Le(e),_r(),await ye.uninstall(e).catch(()=>{})},Mr=()=>Promise.all(fr().map(jr)).then(()=>{}),Nr=async()=>{let e=await ye.pick({type:`plugin`,id:`stub`},{multiple:!0,title:`Add stub sources`});for(let t of e)await Ar(t.uri).catch(()=>{})};for(let e of fr())Or(e).catch(()=>{});function Pr(e){var t=e.forward;return function(e){return an(e,t)}}var Fr=function(){return typeof navigator>`u`||navigator==null||navigator.product,Pr}(),Ir=(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},Lr=new Set,Rr=new WeakMap,zr=(e,t)=>{if(e===null||Lr.has(e))return`null`;if(typeof e!=`object`)return JSON.stringify(e)||``;if(e.toJSON)return zr(e.toJSON(),t);if(Array.isArray(e)){for(var n=`[`,r=0,i=e.length;r<i;r++)n.length>1&&(n+=`,`),n+=zr(e[r],t)||`null`;return n+=`]`}if(!t&&(Hr!==Vr&&e instanceof Hr||Ur!==Vr&&e instanceof Ur))return`null`;var a=Object.keys(e).sort();if(!a.length&&e.constructor&&Object.getPrototypeOf(e).constructor!==Object.prototype.constructor){var o=Rr.get(e)||Math.random().toString(36).slice(2);return Rr.set(e,o),zr({__key:o},t)}Lr.add(e);for(var s=`{`,c=0,l=a.length;c<l;c++){var u=zr(e[a[c]],t);u&&(s.length>1&&(s+=`,`),s+=zr(a[c],t)+`:`+u)}return Lr.delete(e),s+=`}`},Br=(e,t)=>(Lr.clear(),zr(e,t||!1)),Vr=class{},Hr=typeof File<`u`?File:Vr,Ur=typeof Blob<`u`?Blob:Vr,Wr=/("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g,Gr=/(?:#[^\n\r]+)?(?:[\r\n]+|$)/g,Kr=(e,t)=>t%2==0?e.replace(Gr,`
20
20
  `):e,qr=e=>e.split(Wr).map(Kr).join(``).trim(),Jr=new Map,Yr=new Map,Xr=e=>{var t;return typeof e==`string`?t=qr(e):e.loc&&Yr.get(e.__key)===e?t=e.loc.source.body:(t=Jr.get(e)||qr(Tt(e)),Jr.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},Zr=e=>{var t;if(e.documentId)t=Ir(e.documentId);else if(t=Ir(Xr(e)),e.definitions){var n=ei(e);n&&(t=Ir(`\n# ${n}`,t))}return t},Qr=e=>{var t,n;return typeof e==`string`?(t=Zr(e),n=Yr.get(t)||vt(e,{noLocation:!0})):(t=e.__key||Zr(e),n=Yr.get(t)||e),n.loc||Xr(n),n.__key=t,Yr.set(t,n),n},$r=(e,t,n)=>{var r=t||{},i=Qr(e),a=Br(r,!0),o=i.__key;return a!==`{}`&&(o=Ir(a,o)),{key:o,query:i,variables:r,extensions:n}},ei=e=>{for(var t=0,n=e.definitions.length;t<n;t++){var r=e.definitions[t];if(r.kind===$e.OPERATION_DEFINITION)return r.name?r.name.value:void 0}},ti=e=>{if(`definitions`in e){for(var t=[],n=0,r=e.definitions.length;n<r;n++){var i=ti(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===$e.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===$e.FIELD&&h.name.value===`__typename`&&!h.alias;var g=ti(h);d.push(g)}return f||d.push({kind:$e.FIELD,name:{kind:$e.NAME,value:`__typename`},_generated:!0}),{...e,selectionSet:{...e.selectionSet,selections:d}}}}return e},ni=new Map,ri=e=>{var t=Qr(e),n=ni.get(t.__key);return n||(ni.set(t.__key,n=ti(t)),Object.defineProperty(n,"__key",{value:t.__key,enumerable:!1})),n};function ii(e,t,n){return{...t,kind:e,context:t.context?{...t.context,...n}:n||t.context}}var ai=`
21
21
  https://bit.ly/2XbVrpR#`;function oi(e,t,n){if(!e){var r=t||`Minfied Error #`+n+`
22
- `,i=Error(r+ai+n);throw i.name=`Graphcache Error`,i}}var si={},ci=e=>e._directives||si,li=e=>e.name.value,ui=e=>e.typeCondition.name.value,di=e=>e.alias?e.alias.value:e.name.value,fi=[],pi=e=>e.selectionSet?e.selectionSet.selections:fi,mi=e=>e.typeCondition?e.typeCondition.name.value:null,hi=(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=Et(a.value,t);o!=null&&(n||={},n[li(a)]=o)}return n},gi=(e,t)=>{if(t&&e.variableDefinitions){for(var n={},r=0,i=e.variableDefinitions.length;r<i;r++){var a=li(e.variableDefinitions[r].variable);n[a]=t[a]}return n}},_i=(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=li(a.variable);n[o]=t[o]===void 0&&a.defaultValue?Et(a.defaultValue,t):t[o]}for(var s in t)s in n||(n[s]=t[s]);return n};function vi(e){for(var t=0;t<e.definitions.length;t++)if(e.definitions[t].kind===$e.OPERATION_DEFINITION)return e.definitions[t];oi(!1,``,1)}var yi=e=>{for(var t={},n=0;n<e.definitions.length;n++){var r=e.definitions[n];r.kind===$e.FRAGMENT_DEFINITION&&(t[li(r)]=r)}return t},bi=(e,t)=>{var n=ci(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]&&li(i.arguments[0])===`if`){var a=Et(i.arguments[0].value,t);return r===`include`?!!a:!a}}return!0},xi=(e,t)=>{var{defer:n}=ci(e);if(n){for(var r of n.arguments||[])if(li(r)===`if`)return!!Et(r.value,t);return!0}return!1},Si=e=>{var{optional:t,required:n}=ci(e);if(n)return!1;if(t)return!0},Ci=`__`,wi=(e,t,n,r)=>{var i=Di(e,t,n,r);return!!i&&i.type.kind!==`NON_NULL`},Ti=(e,t,n,r)=>{var i=Di(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`},Ei=(e,t,n)=>{if(!n)return!1;var r=mi(t);return!r||n===r?!0:e.types.has(r)&&e.types.get(r).kind===`OBJECT`?r===n:((function(e,t){oi(e.types.has(t)&&(e.types.get(t).kind===`INTERFACE`||e.types.get(t).kind===`UNION`),``,5)})(e,r),Oi(e,n),e.isSubType(r,n))},Di=(e,t,n,r)=>{if(n.indexOf(Ci)!==0&&t.indexOf(Ci)!==0)return Oi(e,t),e.types.get(t).fields()[n]};function Oi(e,t){oi(e.types.has(t)&&e.types.get(t).kind===`OBJECT`,``,3)}var ki=(e,t)=>t?`${e}(${Br(t)})`:e,Ai=(e,t)=>`${e}.${t}`,ji=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}},Mi=e=>{var t=e.indexOf(`.`);return{entityKey:e.slice(0,t).replace(/%2e/g,`.`),fieldKey:e.slice(t+1)}},Ni=null,Pi=null,J=null,Fi=null,Ii=null,Li=null,Ri=!1,zi=!1;function Bi(e,t){var n;if(e){if(Ni.has(e))return e;n=Pi.get(e)}return n??=t?[]:{},e&&Pi.set(e,n),Ni.add(n),n}var Vi=e=>!!e&&Ni.has(e),Hi=(e,t,n,r,i)=>{Ni=new WeakSet,Pi=new WeakMap,Ii=e,J=t,Li=new Set,zi=!!r,Ri=!!i,n?Ii===`read`?Fi=n:r||t.hydrating||t.optimisticOrder.length>1?(!r&&!t.commutativeKeys.has(n)?sa(t,n):r&&(t.optimisticOrder.indexOf(n)!==-1&&!t.commutativeKeys.has(n)&&t.optimisticOrder.splice(t.optimisticOrder.indexOf(n),1),t.commutativeKeys.delete(n)),Fi=n,ca(t,n)):(Fi=null,ua(t,n)):Fi=null},Ui=()=>{var e=J,t=Fi;if(zi=!1,Fi=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]);)da(e.optimisticOrder[n]);Ni=null,Pi=null,Ii=null,J=null,Li=null,!e.defer&&(e.storage||!e.optimisticOrder.length)&&(e.defer=!0,setTimeout((()=>{Hi(`read`,e,null),Qi(),pa(),Ui(),e.defer=!1})))},Wi=(e,t,n)=>{t&&!n&&e.deferredKeys.delete(t),Hi(`write`,e,t,n),Ui()},Gi=new Set,Ki=(e,t,n,r)=>{var i=Fi?e.optimistic.get(Fi):e.base,a=i.get(t);a===void 0&&i.set(t,a=Object.create(null)),r===void 0&&!Fi?delete a[n]:a[n]=r},qi=(e,t,n)=>{for(var r,i=!zi&&Ii===`read`&&Fi&&J.commutativeKeys.has(Fi),a=0,o=J.optimisticOrder.length;a<o;a++){var s=J.optimisticOrder[a],c=e.optimistic.get(s);if(i&&=s!==Fi,c&&(!i||!J.commutativeKeys.has(s))&&(!zi||Ii===`write`||J.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 Ji(e){return J.refCount.get(e)||0}var Yi=(e,t)=>{if(Array.isArray(e))for(var n=0,r=e.length;n<r;n++)Yi(e[n],t);else typeof e==`string`&&((e,t)=>{var n=Ji(e),r=n+t>0?n+t:0;J.refCount.set(e,r),r?!n&&r&&J.gc.delete(e):J.gc.add(e)})(e,t)},Xi=(e,t,n)=>{if(n!==void 0)for(var r in n)t.has(r)||(e.push(ji(r)),t.add(r))},Zi=(e,t,n,r)=>{Xi(e,t,r.base.get(n));for(var i=0,a=J.optimisticOrder.length;i<a;i++){var o=r.optimistic.get(J.optimisticOrder[i]);o!==void 0&&Xi(e,t,o.get(n))}},Qi=()=>{if(!J.optimisticOrder.length){for(var e of J.gc.keys())if(J.gc.delete(e),!(Ji(e)>0)){var t=J.records.base.get(e);J.refCount.delete(e),J.records.base.delete(e);var n=t&&t.__typename;if(n){var r=J.types.get(n);r&&r.delete(e)}var i=J.links.base.get(e);if(i)for(var a in J.links.base.delete(e),i)Yi(i[a],-1)}}},$i=(e,t)=>{e===J.queryRootKey?t!==void 0&&t!==`__typename`&&Li.add(Ai(e,t)):Li.add(e)},ea=(e,t)=>{!zi&&J.storage&&J.persist.add(((e,t)=>`${e.replace(/\./g,`%2e`)}.${t}`)(e,t))},ta=(e,t)=>(Ii===`read`&&$i(e,t),qi(J.records,e,t)),na=(e,t)=>(Ii===`read`&&$i(e,t),qi(J.links,e,t)),ra=(e,t)=>{var n=J.abstractToConcreteMap.get(e);if(n)n.add(t);else{var r=new Set;r.add(t),J.abstractToConcreteMap.set(e,r)}},ia=(e,t,n)=>{ma(qi(J.records,e,t),n)||($i(e,t),ea(e,t)),Ki(J.records,e,t,n)},aa=(e,t)=>ta(e,t)!==void 0||na(e,t)!==void 0,oa=(e,t,n)=>{var r=Fi?J.links.optimistic.get(Fi):J.links.base;if(!Fi){var i=r&&r.get(e);Yi(i&&i[t],-1),Yi(n,1)}ma(qi(J.links,e,t),n)||($i(e,t),ea(e,t)),Ki(J.links,e,t,n)},sa=(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)&&la(e,t),r=0;e.optimisticOrder.splice(r,0,t),e.commutativeKeys.add(t)},ca=(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))},la=(e,t)=>{e.dirtyKeys.has(t)&&(e.dirtyKeys.delete(t),e.records.optimistic.delete(t),e.links.optimistic.delete(t),e.deferredKeys.delete(t))},ua=(e,t)=>{var n=e.optimisticOrder.indexOf(t);n>-1&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),la(e,t)},da=e=>{var t=Li;Li=new Set,Ii=`write`;var n=J.links.optimistic.get(e);if(n)for(var r of n.entries()){var i=r[0],a=r[1];for(var o in a)oa(i,o,a[o])}var s=J.records.optimistic.get(e);if(s)for(var c of s.entries()){var l=c[0],u=c[1];for(var d in u)ia(l,d,u[d])}Li=t,ua(J,e)},fa=e=>{var{links:t,records:n}=J,r=[],i=new Set;return $i(e),Zi(r,i,e,t),Zi(r,i,e,n),r},pa=()=>{if(J.storage){zi=!0,Ii=`read`;var e={};for(var t of J.persist.keys()){var{entityKey:n,fieldKey:r}=Mi(t),i=void 0;e[t]=(i=na(n,r))===void 0?(i=ta(n,r))===void 0?void 0:Br(i):`:${Br(i)}`}zi=!1,J.storage.writeData(e),J.persist.clear()}};function ma(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 ha=null,ga=!1,_a=void 0,va=e=>e.__internal.path.length>0&&e.__internal.errorMap?e.__internal.errorMap[e.__internal.path.join(`.`)]:void 0,ya=(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:zi,__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},ba=(e,t,n,r,i,a)=>{ha=e,e.parent=t,e.parentTypeName=n,e.parentKey=r,e.parentFieldKey=i,e.fieldName=a,e.error=va(e)},xa=(e,t,n,r,i)=>{if(!t)return!1;var a=mi(e);return!a||t===a||!pi(e).some((e=>e.kind===$e.FIELD&&!aa(n,ki(li(e),hi(e,r)))))},Sa=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(bi(t,this.ctx.variables)){if(t.kind!==$e.FIELD){var n=t.kind===$e.INLINE_FRAGMENT?t:this.ctx.fragments[li(t)];if(n){var r=!n.typeCondition||(this.ctx.store.schema?Ei(this.ctx.store.schema,n,this.typename):this.ctx.store.possibleTypeMap?Ca(this.ctx.store.possibleTypeMap,n.typeCondition.name.value,this.typename):Ii===`read`&&wa(n.typeCondition.name.value,this.typename)||xa(n,this.typename,this.entityKey,this.ctx.variables,this.ctx.store.logger));if(r||Ii===`write`&&!this.ctx.store.schema){var i=Si(t);r&&n.typeCondition&&this.typename!==n.typeCondition.name.value&&ra(n.typeCondition.name.value,this.typename),this.stack.push(e={selectionSet:pi(n),index:0,defer:e.defer||xi(t,this.ctx.variables),optional:i===void 0?e.optional:i})}}}else if(Ii===`write`||!t._generated)return ga=e.defer,_a=e.optional,t}}this.stack.pop()}}},Ca=(e,t,n)=>{if(!n)return!1;if(t===n)return!0;var r=e.get(t);return r&&r.has(n)},wa=(e,t)=>{if(!t)return!1;if(e===t)return!0;if((e=>J.types.has(e))(e))return!1;var n=(e=>J.abstractToConcreteMap.get(e)||Gi)(e);return n.size&&n.has(t)},Ta=e=>e??null,Ea=(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]=Ea(e,t[r]);return n}return e.keyOfEntity(t)},Da=(e,t,n,r)=>{var i=ri(t.query),a=vi(i),o=e.rootFields[a.operation],s=pi(a),c=ya(e,_i(a,t.variables),yi(i),o,o,r),l=o===c.store.rootFields.query?ja(c,o,s,n||Bi()):Oa(c,o,s,n||Bi());return{dependencies:Li,partial:c.partial||!l,hasNext:c.hasNext,data:l||null}},Oa=(e,t,n,r)=>{if(typeof(e.store.rootNames[t]?t:r.__typename)!=`string`)return r;for(var i=new Sa(t,t,!1,void 0,n,e),a,o=Ri,s=Bi(r);a=i.next();){var c=di(a),l=r[c];e.__internal.path.push(c);var u=void 0;u=a.selectionSet&&l!==null?ka(e,pi(a),Ta(l)):l,o||=u!==l,u!==void 0&&(s[c]=u),e.__internal.path.pop()}return o?s:r},ka=(e,t,n)=>{if(Array.isArray(n)){for(var r=Array(n.length),i=Ri,a=0,o=n.length;a<o;a++)e.__internal.path.push(a),r[a]=ka(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?Oa(e,n.__typename,t,n):ja(e,s,t,n)||null};function Aa(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](hi(c,r.variables)),o}return o||a}var ja=(e,t,n,r,i)=>{var{store:a}=e,o=t===a.rootFields.query,s=i&&a.keyOfEntity(i)||t,c=o?t:ta(s,`__typename`)||i&&i.__typename;if(typeof c==`string`&&!(i&&c!==i.__typename)){for(var l=new Sa(c,s,!1,void 0,n,e),u=!1,d=!1,f=Ri,p,m=e.partial,h=Bi(r);(p=l.next())!==void 0;){var g=li(p),_=hi(p,e.variables),v=di(p),y=ci(p),b=Aa(y,c,g,e),x=ki(g,_),S=Ai(s,x),C=ta(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(Ii===`read`&&b){var E=h;if(p.selectionSet===void 0&&C!==void 0&&(E={...h,[v]:C,[g]:C}),ba(e,E,c,s,x,g),T=b(E,_||{},a,e),p.selectionSet&&(T=Ma(e,c,g,S,pi(p),h[v]===void 0?r[v]:h[v],T,Vi(r))),a.schema&&T===null&&!wi(a.schema,c,g,e.store.logger))return}else if(!p.selectionSet)T=C;else if(w!==void 0)T=Ma(e,c,g,S,pi(p),h[v]===void 0?r[v]:h[v],w,Vi(r));else{var D=na(s,x);D===void 0?typeof C==`object`&&C&&(T=C):T=Na(e,D,c,g,pi(p),h[v]===void 0?r[v]:h[v],Vi(r))}if(!ga&&T===void 0&&(y.optional||_a&&!y.required||va(e)||!y.required&&a.schema&&wi(a.schema,c,g,e.store.logger))?(e.partial=!0,T=null):T===null&&(y.required||!1===_a)?(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(ga)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}},Ma=(e,t,n,r,i,a,o,s)=>{if(Array.isArray(o)){for(var{store:c}=e,l=c.schema?Ti(c.schema,t,n,e.store.logger):!1,u=e.partial,d=Bi(a,!0),f=Ri||!Array.isArray(a)||o.length!==a.length,p=0,m=o.length;p<m;p++){e.__internal.path.push(p);var h=Ma(e,t,n,Ai(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(Pa(o)){var g=a||Bi(a);return typeof o==`string`?ja(e,o,i,g):ja(e,r,i,g,o)}},Na=(e,t,n,r,i,a,o)=>{if(Array.isArray(t)){for(var{store:s}=e,c=s.schema?Ti(s.schema,n,r,e.store.logger):!1,l=Bi(a,!0),u=e.partial,d=Ri||!Array.isArray(a)||t.length!==a.length,f=0,p=t.length;f<p;f++){e.__internal.path.push(f);var m=Na(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:ja(e,t,i,a||Bi(a))},Pa=e=>typeof e==`string`||typeof e==`object`&&typeof e.__typename==`string`,Fa=(e,t,n)=>{for(var r=t?[{fieldKey:ki(t,n)}]:fa(e),i=0,a=r.length;i<a;i++){var{fieldKey:o}=r[i];na(e,o)===void 0?ia(e,o,void 0):oa(e,o,void 0)}},Ia=(e,t)=>{for(var n of(e=>J.types.get(e)||Gi)(e))t.includes(n)||Fa(n)},La=(e,t,n,r)=>{var i=ri(t.query),a=vi(i),o={data:n||Bi(),dependencies:Li},s=e.rootFields[a.operation];return Ra(ya(e,_i(a,t.variables),yi(i),s,s,r),s,pi(a),o.data),o},Ra=(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=ta(t,`__typename`)),o)!a&&t&&(ia(t,`__typename`,o),((e,t)=>{var n=J.types.get(e);if(n)n.add(t);else{var r=new Set;r.add(t),J.types.set(e,r)}})(o,t));else return;for(var s=e.store.updates[o],c=new Sa(o,t||o,!1,void 0,n,e),l;l=c.next();){var u=li(l),d=hi(l,e.variables),f=ki(u,d),p=di(l),m=r[e.optimistic?u:p];if(!(u===`__typename`||m===void 0&&(ga||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&&(ba(e,r,o,t||o,f,u),m=Ta(h(d||{},e.store,e))),m!==void 0){if(l.selectionSet){if(t&&i===`query`){var g=Ai(t,f),_=za(e,pi(l),Ta(m),g,e.optimistic?na(t||o,f):void 0);oa(t||o,f,_)}else za(e,pi(l),Ta(m))}else t&&i===`query`&&ia(t||o,f,m!==null||!va(e)?m:void 0);var v=s&&s[u];if(v)ba(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=ta(S,`__typename`),w=Ji(S);C&&!w&&Ia(m[b].__typename,y)}}else if(m&&typeof m==`object`){var T=e.store.keyOfEntity(m);if(T){var E=ta(T,`__typename`),D=Ji(T);(!E||!D)&&m.__typename&&Ia(m.__typename,[T])}}}e.__internal.path.pop()}}}},za=(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?Ai(r,`${o}`):void 0,l=za(e,t,n[o],c,i?.[o]);a[o]=l,e.__internal.path.pop()}return a}if(n===null)return va(e)?void 0:null;var u=e.store.keyOfEntity(n)||(typeof i==`string`?i:null);n.__typename;var d=u||r;return Ra(e,d,t,n),d||null},Ba=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 ki(e,t)}keyOfEntity(e){if(ha&&e===ha.parent)return ha.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=ki(t,n),a=ta(r,i);if(a!==void 0)return a;var o=na(r,i);return o!==void 0&&(o=Ea(this,o)),o}}invalidate(e,t,n){var r=this.keyOfEntity(e);e&&typeof e==`string`&&!t&&!n&&!this.resolve(e,`__typename`)?Ia(e,[]):(oi(r,``,19),Fa(r,t,n))}inspectFields(e){var t=this.keyOfEntity(e);return t?fa(t):[]}updateQuery(e,t){var n=$r(e.query,e.variables),r=t(this.readQuery(n));r!==null&&La(this,n,r,void 0)}readQuery(e){var t=$r(e.query,e.variables);return Da(this,t,void 0,void 0).data}readFragment(e,t,n,r){return((e,t,n,r,i)=>{var a=yi(t),o;if(i){if(!(o=a[i]))return null}else if(!(o=a[Object.keys(a)[0]]))return null;var s=ui(o);typeof n!=`string`&&!n.__typename&&(n.__typename=s);var c=e.keyOfEntity(n);return c&&ja(ya(e,r||{},a,s,c,void 0),c,pi(o),Bi())||null})(this,ri(e),t,n,r)}writeFragment(e,t,n,r){((e,t,n,r,i)=>{var a=yi(t),o;if(i){if(!(o=a[i]))return null}else if(!(o=a[Object.keys(a)[0]]))return null;var s=ui(o),c={__typename:s,...n},l=e.keyOfEntity(c);l&&Ra(ya(e,r||{},a,s,l,void 0),l,pi(o),c)})(this,ri(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&&oa(a,ki(t,r),Ea(this,i))}},Va=(e,t)=>ii(e.kind,e,{...e.context,meta:{...e.context.meta,...t}}),Ha=(e,t)=>ii(e.kind,e,{...e.context,requestPolicy:t}),Ua=(e=>({forward:t,client:n,dispatchDebug:r})=>{var i=new Ba(e);e&&e.storage&&(i.data.hydrating=!0,e.storage.readData().then((t=>{((e,t,n)=>{for(var r in Hi(`write`,e,null),n){var i=n[r];if(i!==void 0){var{entityKey:a,fieldKey:o}=Mi(r);i[0]===`:`?na(a,o)===void 0&&oa(a,o,JSON.parse(i.slice(1))):ta(a,o)===void 0&&ia(a,o,JSON.parse(i))}}e.storage=t,e.hydrating=!1,Ui()})(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(Ha(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`)sa(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),Wi(i.data,e.key),e;else if(e.kind===`mutation`&&e.context.requestPolicy!==`network-only`){s.set(e.key,e),Hi(`write`,i.data,e.key,!0,!1);var{dependencies:n}=La(i,e,void 0,void 0);if(Ui(),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 ii(e.kind,{key:e.key,query:ri(e.query),variables:e.variables?gi(vi(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=>{Hi(`read`,i.data,void 0,!1,!1);var t=Da(i,e,c.get(e.key),void 0);Ui();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)&&sa(i.data,n.key,!0);var r,o=e.data;if(o){Hi(`write`,i.data,n.key,!1,!1);var l=La(i,n,o,e.error).dependencies;Ui(),h(t,l);var u=n.kind===`query`?c.get(n.key):null;Hi(`read`,i.data,n.key,!1,u!==o);var d=Da(i,n,u||o,e.error);Ui(),o=d.data,n.kind===`query`&&(h(t,r=d.dependencies),c.set(n.key,o))}else Wi(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=Vt(Pt(y)(Nt((e=>e.kind===`query`&&e.context.requestPolicy!==`network-only`))(e))),c=Nt((e=>e.kind!==`query`||e.context.requestPolicy===`network-only`))(e),d=Pt((e=>Va(e.operation,{cacheOutcome:`miss`})))(Nt((e=>e.outcome===`miss`&&e.operation.context.requestPolicy!==`cache-only`&&!m(e.dependencies)&&!f.has(e.operation.key)))(r)),p=Pt((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:Va(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(Ha(s.get(e.operation.key)||e.operation,`network-only`))),l}))(Nt((e=>e.outcome!==`miss`||e.operation.context.requestPolicy===`cache-only`))(r)),h=t(Pt(_)(Lt([c,d])));return Lt([Pt((e=>{var t=new Set,n=b(e,t);return g(e.operation,t,!1),n}))(Nt((e=>!a.has(e.operation.key)))(h)),Ft((e=>{if(o.push(e)<a.size)return $t;for(var t=0;t<o.length;t++)sa(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),Yt(n)}))(Nt((e=>a.has(e.operation.key)))(h)),p])}})({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":"scoreLabel","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":"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":"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":"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":"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":"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":"startDate","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"status","type":{"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":"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":"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":"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":"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":"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":"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":"keeps","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}},"args":[]},{"name":"keepsPageEpisodeCount","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"name","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"rewatchThroughCompleted","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":"writeNotice","type":{"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":"pending","type":{"kind":"NON_NULL","ofType":{"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:{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,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},resolvers:{}}),Wa=new Xn({url:`http://d/graphql`,exchanges:[Jn({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}`}))}}),Fr,Ua,Kn],fetchSubscriptions:!0,fetch:async(e,t)=>Ne(e,t)});function Ga(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 Ka=ce((e=>{var t=(le(),ee(s));function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),s=r[0].inst,l=r[1];return o(function(){s.value=n,s.getSnapshot=t,u(s)&&l({inst:s})},[e,n,t]),a(function(){return u(s)&&l({inst:s}),e(function(){u(s)&&l({inst:s})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(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;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),qa=ce(((e,t)=>{t.exports=Ka()}));le();var Ja=qa(),Ya=C,Xa=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?S:N,Za=Ya||Xa,Qa=e=>{let t=w([e,(...e)=>t[0](...e)]).current;return Za(()=>{t[0]=e}),t[1]},$a=`popstate`,eo=`pushState`,to=`replaceState`,no=[$a,eo,to,`hashchange`],ro=e=>{for(let t of no)addEventListener(t,e);return()=>{for(let t of no)removeEventListener(t,e)}},io=(e,t)=>(0,Ja.useSyncExternalStore)(ro,e,t),ao=()=>location.search,oo=({ssrSearch:e=``}={})=>io(ao,()=>e),so=()=>location.pathname,co=({ssrPath:e}={})=>io(so,e?()=>e:so),lo=(e,{replace:t=!1,state:n=null}={})=>history[t?to:eo](n,``,e),uo=(e={})=>[co(e),lo],fo=Symbol.for(`wouter_v3`);if(typeof history<`u`&&window[fo]===void 0){for(let e of[eo,to]){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,fo,{value:!0})}var po=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?`~`+t:t.slice(e.length)||`/`,mo=(e=``)=>e===`/`?``:e,ho=(e,t)=>e[0]===`~`?e.slice(1):mo(t)+e,go=(e=``,t)=>po(vo(mo(e)),vo(t)),_o=e=>e[0]===`?`?e.slice(1):e,vo=e=>{try{return decodeURI(e)}catch{return e}},yo=e=>vo(_o(e)),bo={hook:uo,searchHook:oo,parser:Ga,base:``,ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},xo=A(bo),So=()=>R(xo),Co={},wo=A(Co),To=()=>R(wo),Eo=e=>{let[t,n]=e.hook(e);return[go(e.base,t),Qa((t,r)=>n(ho(t,e.base),r))]},Do=()=>Eo(So()),Oo=()=>{let e=So();return yo(e.searchHook(e))},ko=(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]:[]]},Ao=e=>ko(So().parser,e,Do()[0]),jo=({children:e,...t})=>{let n=So(),r=t.hook?bo:n,i=r,[a,o]=t.ssrPath?.split(`?`)??[];o&&(t.ssrSearch=o,t.ssrPath=a),t.hrefs=t.hrefs??t.hook?.hrefs;let s=w({}),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 ie(xo.Provider,{value:i,children:e})},Mo=({children:e,component:t},n)=>t?ie(t,{params:n}):typeof e==`function`?e(n):e,No=e=>{let t=w(Co),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},Po=({path:e,nest:t,match:n,...r})=>{let i=So(),[a]=Eo(i),[o,s,c]=n??ko(i.parser,e,a,t),l=No({...To(),...s});if(!o)return null;let u=c?ie(jo,{base:c},Mo(r,l)):Mo(r,l);return ie(wo.Provider,{value:l,children:u})},Fo=b((e,t)=>{let n=So(),[r,i]=Eo(n),{to:a=``,href:o=a,onClick:s,asChild:c,children:l,className:f,replace:p,state:m,...h}=e,g=Qa(t=>{t.ctrlKey||t.metaKey||t.altKey||t.shiftKey||t.button!==0||(s?.(t),t.defaultPrevented||(t.preventDefault(),i(o,e)))}),_=n.hrefs(o[0]===`~`?o.slice(1):n.base+o,n);return c&&u(l)?d(l,{onClick:g,href:_}):ie(`a`,{...h,onClick:g,href:_,className:f?.call?f(r===o):f,children:l,ref:t})}),Io=e=>Array.isArray(e)?e.flatMap(e=>Io(e&&e.type===M?e.props.children:e)):[e],Lo=({children:e,location:t})=>{let n=So(),[r]=Eo(n);for(let i of Io(e)){let e=0;if(u(i)&&(e=ko(n.parser,i.props.path,t||r,i.props.nest))[0])return d(i,{match:e})}return null},Ro=e=>{let{to:t,href:n=t}=e,r=So(),[,i]=Eo(r),a=Qa(()=>i(t||n,e)),{ssrContext:o}=r;return Xa(()=>{a()},[]),o&&(o.redirectTo=t),null},Y=function(e){return e.HOME=`HOME`,e.MEDIA=`MEDIA`,e.MEDIA_EPISODE=`MEDIA_EPISODE`,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}({}),zo={HOME:()=>`/`,MEDIA:({uri:e})=>`/media/${e}`,MEDIA_EPISODE:({uri:e,mediaUri:t})=>`/media/${e}/${t}`,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`},Bo={HOME:`/`,MEDIA:`/media/:uri`,MEDIA_EPISODE:`/media/:uri/:mediaUri`,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`},Vo=e=>Bo[e],Ho=(e,t)=>zo[e](t),Uo=function(e){return e.Anime=`ANIME`,e.Movie=`MOVIE`,e.Series=`SERIES`,e}({}),Wo=function(e){return e.Html=`HTML`,e.Text=`TEXT`,e}({}),Go=function(e){return e.Fall=`FALL`,e.Spring=`SPRING`,e.Summer=`SUMMER`,e.Winter=`WINTER`,e}({}),Ko=function(e){return e.Popularity=`POPULARITY`,e.PopularityDesc=`POPULARITY_DESC`,e}({}),qo=function(e){return e.Cancelled=`CANCELLED`,e.Finished=`FINISHED`,e.Hiatus=`HIATUS`,e.NotYetReleased=`NOT_YET_RELEASED`,e.Releasing=`RELEASING`,e}({}),Jo=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}({}),Yo=function(e){return e.IsApiOnly=`IS_API_ONLY`,e.IsNotApiOnly=`IS_NOT_API_ONLY`,e}({}),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`}}]}}]}}]}}]},Zo={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`}}]}}]}}]}}]},Qo={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`}}]}}]},$o={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:`pending`}},{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:`account`}},{kind:`Field`,name:{kind:`Name`,value:`scoreScale`}},{kind:`Field`,name:{kind:`Name`,value:`writeNotice`}},{kind:`Field`,name:{kind:`Name`,value:`keepsPageEpisodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`keeps`}},{kind:`Field`,name:{kind:`Name`,value:`rewatchThroughCompleted`}}]}},{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:`scoreLabel`}},{kind:`Field`,name:{kind:`Name`,value:`startedAt`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`year`}},{kind:`Field`,name:{kind:`Name`,value:`month`}},{kind:`Field`,name:{kind:`Name`,value:`day`}}]}},{kind:`Field`,name:{kind:`Name`,value:`completedAt`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`year`}},{kind:`Field`,name:{kind:`Name`,value:`month`}},{kind:`Field`,name:{kind:`Name`,value:`day`}}]}},{kind:`Field`,name:{kind:`Name`,value:`rewatchCount`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`updatedAt`}}]}}]}}]}}]}}]},es={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:`scoreLabel`}},{kind:`Field`,name:{kind:`Name`,value:`startedAt`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`year`}},{kind:`Field`,name:{kind:`Name`,value:`month`}},{kind:`Field`,name:{kind:`Name`,value:`day`}}]}},{kind:`Field`,name:{kind:`Name`,value:`completedAt`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`year`}},{kind:`Field`,name:{kind:`Name`,value:`month`}},{kind:`Field`,name:{kind:`Name`,value:`day`}}]}},{kind:`Field`,name:{kind:`Name`,value:`rewatchCount`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`updatedAt`}}]}}]}}]}}]},ts={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`}}]}}]}}]},ns={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`}}]}}]}}]},rs={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`}}]}}]}}]},is={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`}}]}}]}}]}}]},as={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetMediaModal`},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`}}}}],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:`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:`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:`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`}}]}}]}}]}}]},os={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetMediaModalOrigins`},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`}}]}}]},ss={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetTheatherMedia`},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:`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:`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`}}]}}]}}]}}]},cs={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:`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`}}]}}]}}]}}]},ls={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:`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:`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:`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`}}]}}]}}]}}]},us={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`}}]}}]}}]}}]},ds={query:`q`,category:`category`,status:`status`,season:`season`,year:`year`,format:`format`,genre:`genre`,tag:`tag`},fs=[{value:Jo.Tv,label:`TV Show`},{value:Jo.Movie,label:`Movie`},{value:Jo.TvShort,label:`TV Short`},{value:Jo.Special,label:`Special`},{value:Jo.Ova,label:`OVA`},{value:Jo.Ona,label:`ONA`}],ps=[{value:qo.Releasing,label:`Airing`},{value:qo.Finished,label:`Finished`},{value:qo.NotYetReleased,label:`Not yet aired`},{value:qo.Cancelled,label:`Cancelled`},{value:qo.Hiatus,label:`Hiatus`}],ms=[{value:Go.Winter,label:`Winter`},{value:Go.Spring,label:`Spring`},{value:Go.Summer,label:`Summer`},{value:Go.Fall,label:`Fall`}],hs=[{value:Uo.Anime,label:`Anime`},{value:Uo.Series,label:`Series`},{value:Uo.Movie,label:`Movies`}],gs=[`Action`,`Adventure`,`Comedy`,`Drama`,`Ecchi`,`Fantasy`,`Horror`,`Mahou Shoujo`,`Mecha`,`Music`,`Mystery`,`Psychological`,`Romance`,`Sci-Fi`,`Slice of Life`,`Sports`,`Supernatural`,`Thriller`],_s=new Set(gs.map(e=>e.toLowerCase())),vs=e=>_s.has(e.trim().toLowerCase()),ys=(e,t)=>e.find(e=>e===t)??null,bs=(e,t)=>t.map(t=>ys(e,t)).filter(e=>e!==null),xs=e=>ms.map(e=>e.value).find(t=>t===e)??null,Ss=fs.map(e=>e.value),Cs=ps.map(e=>e.value),ws=ms.map(e=>e.value),Ts=hs.map(e=>e.value),Es=1917,Ds=(e=new Date)=>e.getFullYear()+5,Os=(e,t=new Date)=>{if(!e||!/^\d{4}$/.test(e))return null;let n=Number(e);return n>=1917&&n<=Ds(t)?n:null},ks=(e,t=new Date)=>{let n=new URLSearchParams(e);return{query:(n.get(ds.query)??``).trim(),category:ys(Ts,n.get(ds.category)),status:ys(Cs,n.get(ds.status)),season:ys(ws,n.get(ds.season)),year:Os(n.get(ds.year),t),formats:bs(Ss,n.getAll(ds.format)),genres:As(n.getAll(ds.genre)),tags:As(n.getAll(ds.tag))}},As=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},js=e=>{let t=new URLSearchParams,n=e.query?.trim();n&&t.set(ds.query,n),e.category&&t.set(ds.category,e.category),e.status&&t.set(ds.status,e.status),e.season&&t.set(ds.season,e.season),e.year&&t.set(ds.year,String(e.year));for(let n of e.formats??[])t.append(ds.format,n);for(let n of e.genres??[])t.append(ds.genre,n);for(let n of e.tags??[])t.append(ds.tag,n);return t.toString()},Ms=e=>{if(!e)return``;try{return decodeURIComponent(e)}catch{return e}},Ns=(e={})=>{let t=js(e);return t?`/search?${t}`:`/search`},Ps=e=>{if(e.query)return`Results for \u201C${e.query}\u201D`;let t=ms.find(t=>t.value===e.season)?.label;return t&&e.year?`${t} ${e.year}`:t?`${t} seasons`:e.year?String(e.year):Rs(e)?`Browsing`:`Search`},Fs=e=>fs.find(t=>t.value===e)?.label,Is=e=>ps.find(t=>t.value===e)?.label,Ls=(e,t)=>{let n=ms.find(t=>t.value===e)?.label;return n&&t?`${n} ${t}`:t?String(t):void 0},Rs=e=>!!(e.query||e.category||e.status||e.season||e.year||e.formats.length||e.genres.length||e.tags.length),zs=e=>!!(e.query||e.status||e.season||e.year||e.formats.length||e.genres.length||e.tags.length),Bs=`plugins`,Vs=`plugin`,Hs=(e,t)=>{try{return new URL(e,t)}catch{return}},Us=e=>{let t=new Set;return e.filter(e=>{let n=Ws(e);return!n||t.has(n)?!1:(t.add(n),!0)})},Ws=e=>e.trim().replace(/\/+$/,``).replace(/@\d[^@/]*$/,``),Gs=(e,t)=>{let n=Hs(e,t);return n?Us([...n.searchParams].filter(([e])=>e===`plugins`||e===Vs).map(([,e])=>e.trim())):[]},Ks=e=>encodeURIComponent(e).replace(/%3A/g,`:`).replace(/%2F/g,`/`).replace(/%40/g,`@`),qs=(e,t,n)=>{let r=Hs(e,n),i=Hs(n);return!r||!i||r.origin!==i.origin?e:(r.searchParams.delete(Bs),r.searchParams.delete(Vs),r.search=[r.searchParams.toString(),Us(t.map(e=>e.trim())).sort().map(e=>`${Bs}=${Ks(e)}`).join(`&`)].filter(Boolean).join(`&`),r.href)},Js=new Map,Ys=new Set,Xs=new Set,Zs=()=>Xs.forEach(e=>{try{e()}catch{}}),Qs=e=>(Xs.add(e),()=>{Xs.delete(e)}),$s=()=>[...Js.values()],ec=()=>[...Js.keys()],tc=e=>{let t=new Set(br().map(Ws)),n=!1;for(let r of e){let e=Ws(r);!e||t.has(e)||Ys.has(e)||Js.has(r)||(Js.set(r,{uri:r,state:`offered`}),n=!0)}n&&Zs()},nc=()=>{if(Js.size){for(let e of Js.keys())Ys.add(Ws(e));Js.clear(),Zs()}},rc=async()=>{let e=[...Js.keys()];if(e.length){for(let t of e)Js.set(t,{uri:t,state:`installing`});Zs();for(let t of e){try{await Ar(t,{noConfirm:!0})||Ys.add(Ws(t)),Js.delete(t)}catch(e){Js.set(t,{uri:t,state:`error`,error:e instanceof Error?e.message:String(e)})}Zs()}}},ic=e=>{Js.delete(e)&&(Ys.add(Ws(e)),Zs())},ac=()=>[...br(),...ec()],oc=()=>{let e=qs(location.href,ac(),location.href);e!==location.href&&history.replaceState(history.state,``,e)},sc=()=>tc(Gs(location.href)),cc=e=>{let t=qs(e,ac(),location.href);return t.startsWith(location.origin)?t.slice(location.origin.length):t},lc=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,qs(i,ac(),location.href))}},uc=Symbol.for(`stub_plugin_url`);uc in globalThis||(Object.defineProperty(globalThis,uc,{value:!0}),lc(`pushState`),lc(`replaceState`),addEventListener(`popstate`,()=>{sc(),oc()}),vr(oc),Qs(oc),sc(),oc());var dc=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),fc=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),pc=e=>{let t=fc(e);return t.charAt(0).toUpperCase()+t.slice(1)},mc=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),hc=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},gc={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`};le();var _c=b(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>ie(`svg`,{ref:c,...gc,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:mc(`lucide`,i),...!a&&!hc(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>ie(e,t)),...Array.isArray(a)?a:[a]]));le();var X=(e,t)=>{let n=b(({className:n,...r},i)=>ie(_c,{ref:i,iconNode:t,className:mc(`lucide-${dc(pc(e))}`,`lucide-${e}`,n),...r}));return n.displayName=pc(e),n},vc=X(`ban`,[[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),yc=X(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),bc=X(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),xc=X(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Sc=X(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Cc=X(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),wc=X(`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`}]]),Tc=X(`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`}]]),Ec=X(`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`}]]),Dc=X(`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`}]]),Oc=X(`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`}]]),kc=X(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ac=X(`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`}]]),jc=X(`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`}]]),Mc=X(`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`}]]),Nc=X(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Pc=X(`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`}]]),Fc=X(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Ic=X(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Lc=X(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Rc=X(`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`}]]),zc=X(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Bc=X(`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`}]]),Vc=X(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Hc=X(`sliders-horizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),Uc=X(`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`}]]),Wc=X(`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`}]]),Gc=X(`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`}]]),Kc=X(`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`}]]),qc=X(`volume-1`,[[`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`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}]]),Jc=X(`volume-2`,[[`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`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),Yc=X(`volume-x`,[[`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`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),Xc=X(`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`}]]),Zc=X(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Qc=e=>e===`/`||e===`/media`||e.startsWith(`/media/`),$c=({from:e,to:t,kind:n,asked:r=!1})=>r?!0:n===`pop`||Qc(e.pathname)&&Qc(t.pathname)?!1:n!==`replace`||e.pathname!==t.pathname,el=()=>{window.scrollTo({top:0,left:0,behavior:`instant`})},tl=0,nl=()=>{rl(),tl=requestAnimationFrame(()=>{tl=0,el()})},rl=()=>{cancelAnimationFrame(tl),tl=0},il=!1,al=()=>{il=!0},ol=()=>{let e=il;return il=!1,e},sl=[`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])`].join(`,`),cl=typeof Element>`u`,ll=cl?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ul=!cl&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},dl=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)},fl=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},pl=function(e,t,n){if(dl(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(sl));return t&&ll.call(e,sl)&&r.unshift(e),r=r.filter(n),r},ml=function e(t,n,r){for(var i=[],a=Array.from(t);a.length;){var o=a.shift();if(!dl(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{ll.call(o,sl)&&r.filter(o)&&(n||!t.includes(o))&&i.push(o);var l=o.shadowRoot||typeof r.getShadowRoot==`function`&&r.getShadowRoot(o),u=!dl(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},hl=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},gl=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||fl(e))&&!hl(e)?0:e.tabIndex},_l=function(e,t){var n=gl(e);return n<0&&t&&!hl(e)?0:n},vl=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},yl=function(e){return e.tagName===`INPUT`},bl=function(e){return yl(e)&&e.type===`hidden`},xl=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},Sl=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},Cl=function(e){if(!e.name)return!0;var t=e.form||ul(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=Sl(r,e.form);return!i||i===e},wl=function(e){return yl(e)&&e.type===`radio`},Tl=function(e){return wl(e)&&!Cl(e)},El=function(e){var t=e&&ul(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=ul(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},Dl=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},Ol=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(getComputedStyle(e).visibility===`hidden`)return!0;var i=ll.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(ll.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=ul(e);if(o&&!o.shadowRoot&&r(o)===!0)return Dl(e);e=e.assignedSlot?e.assignedSlot:!o&&s!==e.ownerDocument?s.host:o}e=a}if(El(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return Dl(e);return!1},kl=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 ll.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},Al=function(e,t){return!(t.disabled||dl(t)||bl(t)||Ol(t,e)||xl(t)||kl(t))},jl=function(e,t){return!(Tl(t)||gl(t)<0||!Al(e,t))},Ml=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},Nl=function e(t){var n=[],r=[];return t.forEach(function(t,i){var a=!!t.scopeParent,o=a?t.scopeParent:t,s=_l(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(vl).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(n)},Pl=function(e,t){return t||={},Nl(t.getShadowRoot?ml([e],t.includeContainer,{filter:jl.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ml}):pl(e,t.includeContainer,jl.bind(null,t)))},Fl=function(e,t){return t||={},t.getShadowRoot?ml([e],t.includeContainer,{filter:Al.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):pl(e,t.includeContainer,Al.bind(null,t))},Il=function(e,t){if(t||={},!e)throw Error(`No node provided`);return ll.call(e,sl)!==!1&&jl(t,e)};le();function Ll(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Rl(){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 zl(){return/apple/i.test(navigator.vendor)}function Bl(){let e=/android/i;return e.test(Ll())||e.test(Rl())}function Vl(){return Rl().includes(`jsdom/`)}var Hl=`data-floating-ui-focusable`,Ul=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`;function Wl(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 Gl(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&p(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Kl(e){return`composedPath`in e?e.composedPath()[0]:e.target}function ql(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 Jl(e){return e.matches(`html,body`)}function Yl(e){return e?.ownerDocument||document}function Xl(e){return t(e)&&e.matches(Ul)}function Zl(e){return e?e.getAttribute(`role`)===`combobox`&&Xl(e):!1}function Ql(e){return e?e.hasAttribute(Hl)?e:e.querySelector(`[`+Hl+`]`)||e:null}function $l(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...$l(e,t.id,n)])}function eu(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 tu(e){e.preventDefault(),e.stopPropagation()}function nu(e){return`nativeEvent`in e}function ru(e){return e.mozInputSource===0&&e.isTrusted?!0:Bl()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function iu(e){return Vl()?!1:!Bl()&&e.width===0&&e.height===0||Bl()&&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 au(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var ou=typeof document<`u`?S:function(){},su={...s};function cu(e){let t=w(e);return ou(()=>{t.current=e}),t}var lu=su.useInsertionEffect||(e=>e());function uu(e){let t=w(()=>{});return lu(()=>{t.current=e}),U(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}var du=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function fu(e,t){let n=Pl(e,du()),r=n.length;if(r===0)return;let i=Wl(Yl(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function pu(e){return fu(Yl(e).body,1)||e}function mu(e){return fu(Yl(e).body,-1)||e}function hu(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Gl(n,r)}function gu(e){Pl(e,du()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function _u(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}le();var vu=typeof document<`u`?S:function(){};function yu(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(!yu(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)&&!yu(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function bu(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xu(e,t){let n=bu(e);return Math.round(t*n)/n}function Su(e){let t=w(e);return vu(()=>{t.current=e}),t}function Cu(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]=V({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=V(r);yu(f,r)||p(r);let[m,h]=V(null),[g,_]=V(null),v=U(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=U(e=>{e!==T.current&&(T.current=e,_(e))},[]),b=a||m,S=o||g,C=w(null),T=w(null),E=w(u),O=c!=null,k=Su(c),A=Su(i),j=Su(l),M=U(()=>{if(!C.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};A.current&&(e.platform=A.current),_e(C.current,T.current,e).then(e=>{let t={...e,isPositioned:j.current!==!1};N.current&&!yu(E.current,t)&&(E.current=t,x(()=>{d(t)}))})},[f,t,n,A,j]);vu(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let N=w(!1);vu(()=>(N.current=!0,()=>{N.current=!1}),[]),vu(()=>{if(b&&(C.current=b),S&&(T.current=S),b&&S){if(k.current)return k.current(b,S,M);M()}},[b,S,M,k,O]);let P=D(()=>({reference:C,floating:T,setReference:v,setFloating:y}),[v,y]),F=D(()=>({reference:b,floating:S}),[b,S]),I=D(()=>{let e={position:n,left:0,top:0};if(!F.floating)return e;let t=xu(F.floating,u.x),r=xu(F.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...bu(F.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,F.floating,u.x,u.y]);return D(()=>({...u,update:M,refs:P,elements:F,floatingStyles:I}),[u,M,P,F,I])}var wu=(e,t)=>({...ge(e),options:[e,t]}),Tu=(e,t)=>({...v(e),options:[e,t]}),Eu=(e,t)=>({...O(e),options:[e,t]}),Du=(e,t)=>({...r(e),options:[e,t]});le(),me();var Ou=`data-floating-ui-focusable`,ku=`active`,Au=`selected`,ju=`ArrowLeft`,Mu=`ArrowRight`,Nu=`ArrowUp`,Pu=`ArrowDown`,Fu=[ju,Mu],Iu=[Nu,Pu];[...Fu,...Iu];var Lu={...s},Ru=!1,zu=0,Bu=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+zu++;function Vu(){let[e,t]=V(()=>Ru?Bu():void 0);return ou(()=>{e??t(Bu())},[]),N(()=>{Ru=!0},[]),e}var Hu=Lu.useId||Vu;function Uu(){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 Wu=A(null),Gu=A(null),Ku=()=>R(Wu)?.id||null,qu=()=>R(Gu);function Ju(e){return`data-floating-ui-`+e}function Yu(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}var Xu=Ju(`safe-polygon`);function Zu(e,t,n){if(n&&!au(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 Qu(e){return typeof e==`function`?e():e}function $u(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=qu(),m=Ku(),h=cu(l),g=cu(c),_=cu(n),v=cu(d),y=w(),b=w(-1),x=w(),S=w(-1),C=w(!0),T=w(!1),E=w(()=>{}),O=w(!1),k=uu(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});N(()=>{if(!s)return;function e(e){let{open:t}=e;t||(Yu(b),Yu(S),C.current=!0,O.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[s,a]),N(()=>{if(!s||!h.current||!n)return;function e(e){k()&&r(!1,e,`hover`)}let t=Yl(o.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[o.floating,n,r,s,h,k]);let A=U(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=Zu(g.current,`close`,y.current);i&&!x.current?(Yu(b),b.current=window.setTimeout(()=>r(!1,e,n),i)):t&&(Yu(b),r(!1,e,n))},[g,r]),j=uu(()=>{E.current(),x.current=void 0}),M=uu(()=>{if(T.current){let e=Yl(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(Xu),T.current=!1}}),P=uu(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);N(()=>{if(!s)return;function e(e){if(Yu(b),C.current=!1,u&&!au(y.current)||Qu(v.current)>0&&!Zu(g.current,`open`))return;let t=Zu(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(P()){M();return}E.current();let t=Yl(o.floating);if(Yu(S),O.current=!1,h.current&&i.current.floatingContext){n||Yu(b),x.current=h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){M(),j(),P()||A(e,!0,`safe-polygon`)}});let r=x.current;t.addEventListener(`mousemove`,r),E.current=()=>{t.removeEventListener(`mousemove`,r)};return}(y.current!==`touch`||!Gl(o.floating,e.relatedTarget))&&A(e)}function a(e){P()||i.current.floatingContext&&(h.current==null||h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){M(),j(),P()||A(e)}})(e))}function c(){Yu(b)}function l(e){P()||A(e,!1)}if(re(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,A,j,M,r,n,_,p,g,h,i,P,v]),ou(()=>{var e;if(s&&n&&(e=h.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&k()){T.current=!0;let e=o.floating;if(re(o.domReference)&&e){var t;let n=Yl(o.floating).body;n.setAttribute(Xu,``);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,k]),ou(()=>{n||(y.current=void 0,O.current=!1,j(),M())},[n,j,M]),N(()=>()=>{j(),Yu(b),Yu(S),M()},[s,o.domReference,j,M]);let F=D(()=>{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||au(y.current))&&(n||Qu(v.current)===0||O.current&&e.movementX**2+e.movementY**2<2||(Yu(S),y.current===`touch`?i():(O.current=!0,S.current=window.setTimeout(i,Qu(v.current)))))}}},[u,r,n,_,v]);return D(()=>s?{reference:F}:{},[s,F])}var ed=0;function td(e,t){t===void 0&&(t={});let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(ed);let a=()=>e?.focus({preventScroll:n});i?a():ed=requestAnimationFrame(a)}function nd(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&p(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function rd(e){return`composedPath`in e?e.composedPath()[0]:e.target}function id(e){return e?.ownerDocument||document}var ad={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function od(e){return e===`inert`?ad.inert:e===`aria-hidden`?ad[`aria-hidden`]:ad.none}var sd=new WeakSet,cd={},ld=0,ud=()=>typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype,dd=e=>e&&(e.host||dd(e.parentNode)),fd=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=dd(t);return e.contains(n)?n:null}).filter(e=>e!=null);function pd(e,t,n,r){let i=`data-floating-ui-inert`,o=r?`inert`:n?`aria-hidden`:null,s=fd(t,e),c=new Set,l=new Set(s),u=[];cd[i]||(cd[i]=new WeakMap);let d=cd[i];s.forEach(f),p(t),c.clear();function f(e){e&&!c.has(e)&&(c.add(e),e.parentNode&&f(e.parentNode))}function p(e){e&&!l.has(e)&&[].forEach.call(e.children,e=>{if(a(e)!==`script`){if(c.has(e))p(e);else{let t=o?e.getAttribute(o):null,n=t!==null&&t!==`false`,r=od(o),a=(r.get(e)||0)+1,s=(d.get(e)||0)+1;r.set(e,a),d.set(e,s),u.push(e),a===1&&n&&sd.add(e),s===1&&e.setAttribute(i,``),!n&&o&&e.setAttribute(o,o===`inert`?``:`true`)}}})}return ld++,()=>{u.forEach(e=>{let t=od(o),n=(t.get(e)||0)-1,r=(d.get(e)||0)-1;t.set(e,n),d.set(e,r),n||(!sd.has(e)&&o&&e.removeAttribute(o),sd.delete(e)),r||e.removeAttribute(i)}),ld--,ld||(ad.inert=new WeakMap,ad[`aria-hidden`]=new WeakMap,ad.none=new WeakMap,sd=new WeakSet,cd={})}}function md(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);let r=id(e[0]).body;return pd(e.concat(Array.from(r.querySelectorAll(`[aria-live],[role="status"],output`))),r,t,n)}var hd={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},gd=b(function(e,t){let[n,r]=V();ou(()=>{zl()&&r(`button`)},[]);let i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Ju(`focus-guard`)]:``,style:hd};return W(`span`,{...e,...i})}),_d=A(null),vd=Ju(`portal`);function yd(e){e===void 0&&(e={});let{id:t,root:n}=e,r=Hu(),i=xd(),[a,o]=V(null),s=w(null);return ou(()=>()=>{a?.remove(),queueMicrotask(()=>{s.current=null})},[a]),ou(()=>{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(vd,``),e.appendChild(n),s.current=n,o(n)},[t,r]),ou(()=>{if(n===null||!r||s.current)return;let e=n||i?.portalNode;e&&!f(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(vd,``),e=a||e,e.appendChild(c),s.current=c,o(c)},[t,n,r,i]),a}function bd(e){let{children:t,id:n,root:r,preserveTabOrder:i=!0}=e,a=yd({id:n,root:r}),[o,s]=V(null),l=w(null),u=w(null),d=w(null),f=w(null),p=o?.modal,m=o?.open,h=!!o&&!o.modal&&o.open&&i&&!!(r||a);return N(()=>{if(!a||!i||p)return;function e(e){a&&hu(e)&&(e.type===`focusin`?_u:gu)(a)}return a.addEventListener(`focusin`,e,!0),a.addEventListener(`focusout`,e,!0),()=>{a.removeEventListener(`focusin`,e,!0),a.removeEventListener(`focusout`,e,!0)}},[a,i,p]),N(()=>{a&&(m||_u(a))},[m,a]),W(_d.Provider,{value:D(()=>({preserveTabOrder:i,beforeOutsideRef:l,afterOutsideRef:u,beforeInsideRef:d,afterInsideRef:f,portalNode:a,setFocusManagerState:s}),[i,a]),children:[h&&a&&W(gd,{"data-type":`outside`,ref:l,onFocus:e=>{if(hu(e,a)){var t;(t=d.current)==null||t.focus()}else mu(o?o.domReference:null)?.focus()}}),h&&a&&W(`span`,{"aria-owns":a.id,style:hd}),a&&c(t,a),h&&a&&W(gd,{"data-type":`outside`,ref:u,onFocus:e=>{if(hu(e,a)){var t;(t=f.current)==null||t.focus()}else pu(o?o.domReference:null)?.focus(),o!=null&&o.closeOnFocusOut&&o?.onOpenChange(!1,e.nativeEvent,`focus-out`)}})]})}var xd=()=>R(_d);function Sd(e){return D(()=>t=>{e.forEach(e=>{e&&(e.current=t)})},e)}var Cd=20,wd=[];function Td(){wd=wd.filter(e=>e.isConnected)}function Ed(e){Td(),e&&a(e)!==`body`&&(wd.push(e),wd.length>Cd&&(wd=wd.slice(-20)))}function Dd(){return Td(),wd[wd.length-1]}function Od(e){let t=du();return Il(e,t)?e:Pl(e,t)[0]||e}function kd(e,t){var n;if(!t.current.includes(`floating`)&&!((n=e.getAttribute(`role`))!=null&&n.includes(`dialog`)))return;let r=du(),i=Fl(e,r).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Il(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 Ad=b(function(e,t){return W(`button`,{...e,type:`button`,ref:t,tabIndex:-1,style:hd})});function jd(e){let{context:n,children:r,disabled:i=!1,order:a=[`content`],guards:o=!0,initialFocus:s=0,returnFocus:c=!0,restoreFocus:l=!1,modal:u=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:f=!0,outsideElementsInert:p=!1,getInsideElements:m=()=>[]}=e,{open:h,onOpenChange:g,events:_,dataRef:v,elements:{domReference:y,floating:b}}=n,x=uu(()=>v.current.floatingContext?.nodeId),S=uu(m),C=typeof s==`number`&&s<0,T=Zl(y)&&C,E=ud(),D=!E||o,O=!D||E&&p,k=cu(a),A=cu(s),j=cu(c),P=qu(),F=xd(),I=w(null),ee=w(null),L=w(!1),te=w(!1),R=w(-1),ne=w(-1),re=F!=null,z=Ql(b),ie=uu(function(e){return e===void 0&&(e=z),e?Pl(e,du()):[]}),B=uu(e=>{let t=ie(e);return k.current.map(e=>y&&e===`reference`?y:z&&e===`floating`?z:t).filter(Boolean).flat()});N(()=>{if(i||!u)return;function e(e){if(e.key===`Tab`){Gl(z,Wl(Yl(z)))&&ie().length===0&&!T&&tu(e);let t=B(),n=Kl(e);k.current[0]===`reference`&&n===y&&(tu(e),e.shiftKey?td(t[t.length-1]):td(t[1])),k.current[1]===`floating`&&n===z&&e.shiftKey&&(tu(e),td(t[0]))}}let t=Yl(z);return t.addEventListener(`keydown`,e),()=>{t.removeEventListener(`keydown`,e)}},[i,y,z,u,k,T,ie,B]),N(()=>{if(i||!b)return;function e(e){let t=Kl(e),n=ie().indexOf(t);n!==-1&&(R.current=n)}return b.addEventListener(`focusin`,e),()=>{b.removeEventListener(`focusin`,e)}},[i,b,ie]),N(()=>{if(i||!f)return;function e(){te.current=!0,setTimeout(()=>{te.current=!1})}function n(e){let n=e.relatedTarget,r=e.currentTarget,i=Kl(e);queueMicrotask(()=>{let a=x(),o=!(Gl(y,n)||Gl(b,n)||Gl(n,b)||Gl(F?.portalNode,n)||n!=null&&n.hasAttribute(Ju(`focus-guard`))||P&&($l(P.nodesRef.current,a).find(e=>Gl(e.context?.elements.floating,n)||Gl(e.context?.elements.domReference,n))||eu(P.nodesRef.current,a).find(e=>[e.context?.elements.floating,Ql(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===y&&z&&kd(z,k),l&&r!==y&&!(i!=null&&i.isConnected)&&Wl(Yl(z))===Yl(z).body){t(z)&&z.focus();let e=R.current,n=ie(),r=n[e]||n[n.length-1]||z;t(r)&&r.focus()}if(v.current.insideReactTree){v.current.insideReactTree=!1;return}(T||!u)&&n&&o&&!te.current&&n!==Dd()&&(L.current=!0,g(!1,e,`focus-out`))})}let r=!(P||!F);function a(){Yu(ne),v.current.insideReactTree=!0,ne.current=window.setTimeout(()=>{v.current.insideReactTree=!1})}if(b&&t(y))return y.addEventListener(`focusout`,n),y.addEventListener(`pointerdown`,e),b.addEventListener(`focusout`,n),r&&b.addEventListener(`focusout`,a,!0),()=>{y.removeEventListener(`focusout`,n),y.removeEventListener(`pointerdown`,e),b.removeEventListener(`focusout`,n),r&&b.removeEventListener(`focusout`,a,!0)}},[i,y,b,z,u,P,F,g,f,l,ie,T,x,k,v]);let ae=w(null),V=w(null),oe=Sd([ae,F?.beforeInsideRef]),se=Sd([V,F?.afterInsideRef]);N(()=>{var e,t;if(i||!b)return;let n=Array.from((F==null||(e=F.portalNode)==null?void 0:e.querySelectorAll(`[`+Ju(`portal`)+`]`))||[]),r=(t=(P?eu(P.nodesRef.current,x()):[]).find(e=>Zl(e.context?.elements.domReference||null)))==null||(t=t.context)==null?void 0:t.elements.domReference,a=[b,r,...n,...S(),I.current,ee.current,ae.current,V.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,k.current.includes(`reference`)||T?y:null].filter(e=>e!=null),o=u||T?md(a,!O,O):md(a);return()=>{o()}},[i,y,b,u,k,F,T,D,O,P,x,S]),ou(()=>{if(i||!t(z))return;let e=Wl(Yl(z));queueMicrotask(()=>{let t=B(z),n=A.current,r=(typeof n==`number`?t[n]:n.current)||z,i=Gl(z,e);!C&&!i&&h&&td(r,{preventScroll:r===z})})},[i,h,z,C,B,A]),ou(()=>{if(i||!z)return;let e=Yl(z);Ed(Wl(e));function n(e){let{reason:t,event:n,nested:r}=e;if([`hover`,`safe-polygon`].includes(t)&&n.type===`mouseleave`&&(L.current=!0),t===`outside-press`){if(r)L.current=!1;else if(ru(n)||iu(n))L.current=!1;else{let e=!1;document.createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?L.current=!1:L.current=!0}}}_.on(`openchange`,n);let r=e.createElement(`span`);r.setAttribute(`tabindex`,`-1`),r.setAttribute(`aria-hidden`,`true`),Object.assign(r.style,hd),re&&y&&y.insertAdjacentElement(`afterend`,r);function a(){if(typeof j.current==`boolean`){let e=y||Dd();return e&&e.isConnected?e:r}return j.current.current||r}return()=>{_.off(`openchange`,n);let i=Wl(e),o=Gl(b,i)||P&&$l(P.nodesRef.current,x(),!1).some(e=>Gl(e.context?.elements.floating,i)),s=a();queueMicrotask(()=>{let n=Od(s);j.current&&!L.current&&t(n)&&(n===i||i===e.body||o)&&n.focus({preventScroll:!0}),r.remove()})}},[i,b,z,j,v,_,P,re,y,x]),N(()=>(queueMicrotask(()=>{L.current=!1}),()=>{queueMicrotask(Td)}),[i]),ou(()=>{if(!i&&F)return F.setFocusManagerState({modal:u,closeOnFocusOut:f,open:h,onOpenChange:g,domReference:y}),()=>{F.setFocusManagerState(null)}},[i,F,u,h,g,f,y]),ou(()=>{i||z&&kd(z,k)},[i,z,k]);function ce(e){return i||!d||!u?null:W(Ad,{ref:e===`start`?I:ee,onClick:e=>g(!1,e.nativeEvent),children:typeof d==`string`?d:`Dismiss`})}let le=!i&&D&&(!u||!T)&&(re||u);return W(M,{children:[le&&W(gd,{"data-type":`inside`,ref:oe,onFocus:e=>{if(u){let e=B();td(a[0]===`reference`?e[0]:e[e.length-1])}else if(F!=null&&F.preserveTabOrder&&F.portalNode){if(L.current=!1,hu(e,F.portalNode))pu(y)?.focus();else{var t;(t=F.beforeOutsideRef.current)==null||t.focus()}}}}),!T&&ce(`start`),r,ce(`end`),le&&W(gd,{"data-type":`inside`,ref:se,onFocus:e=>{if(u)td(B()[0]);else if(F!=null&&F.preserveTabOrder&&F.portalNode){if(f&&(L.current=!0),hu(e,F.portalNode))mu(y)?.focus();else{var t;(t=F.afterOutsideRef.current)==null||t.focus()}}}})]})}var Md=0,Nd=`--floating-ui-scrollbar-width`;function Pd(){let e=Ll(),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(Nd,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(Nd),t&&(Object.assign(n,{position:``,top:``,left:``,right:``}),window.scrollTo(a,o))}}var Fd=()=>{},Id=b(function(e,t){let{lockScroll:n=!1,...r}=e;return ou(()=>{if(n)return Md++,Md===1&&(Fd=Pd()),()=>{Md--,Md===0&&Fd()}},[n]),W(`div`,{ref:t,...r,style:{position:`fixed`,overflow:`auto`,top:0,right:0,bottom:0,left:0,...r.style}})});function Ld(e){return t(e.target)&&e.target.tagName===`BUTTON`}function Rd(e){return t(e.target)&&e.target.tagName===`A`}function zd(e){return Xl(e)}function Bd(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=w(),p=w(!1),m=D(()=>({onPointerDown(e){f.current=e.pointerType},onMouseDown(e){let t=f.current;e.button===0&&s!==`click`&&(au(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;if(s===`mousedown`&&f.current){f.current=void 0;return}au(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||Ld(e))&&(e.key===` `&&!zd(a)&&(e.preventDefault(),p.current=!0),!Rd(e)&&e.key===`Enter`&&r(!(n&&c),e.nativeEvent,`click`))},onKeyUp(e){e.defaultPrevented||!u||Ld(e)||zd(a)||e.key===` `&&p.current&&(p.current=!1,r(!(n&&c),e.nativeEvent,`click`))}}),[i,a,s,l,u,r,n,d,c]);return D(()=>o?{reference:m}:{},[o,m])}var Vd={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},Hd={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},Ud=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function Wd(e,n){n===void 0&&(n={});let{open:r,onOpenChange:a,elements:o,dataRef:s}=e,{enabled:c=!0,escapeKey:l=!0,outsidePress:u=!0,outsidePressEvent:d=`pointerdown`,referencePress:f=!1,referencePressEvent:p=`pointerdown`,ancestorScroll:g=!1,bubbles:_,capture:v}=n,b=qu(),x=uu(typeof u==`function`?u:()=>!1),S=typeof u==`function`?x:u,C=w(!1),{escapeKey:T,outsidePress:E}=Ud(_),{escapeKey:O,outsidePress:k}=Ud(v),A=w(!1),j=uu(e=>{if(!r||!c||!l||e.key!==`Escape`||A.current)return;let t=s.current.floatingContext?.nodeId,n=b?$l(b.nodesRef.current,t):[];if(!T&&(e.stopPropagation(),n.length>0)){let e=!0;if(n.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}a(!1,nu(e)?e.nativeEvent:e,`escape-key`)}),M=uu(e=>{var t;let n=()=>{var t;j(e),(t=Kl(e))==null||t.removeEventListener(`keydown`,n)};(t=Kl(e))==null||t.addEventListener(`keydown`,n)}),P=uu(e=>{let n=s.current.insideReactTree;s.current.insideReactTree=!1;let r=C.current;if(C.current=!1,d===`click`&&r||n||typeof S==`function`&&!S(e))return;let i=Kl(e),c=`[`+Ju(`inert`)+`]`,l=Yl(o.floating).querySelectorAll(c),u=re(i)?i:null;for(;u&&!ne(u);){let e=m(u);if(ne(e)||!re(e))break;u=e}if(l.length&&re(i)&&!Jl(i)&&!Gl(i,o.floating)&&Array.from(l).every(e=>!Gl(u,e)))return;if(t(i)&&ee){let t=ne(i),n=y(i),r=/auto|scroll/,a=t||r.test(n.overflowX),o=t||r.test(n.overflowY),s=a&&i.clientWidth>0&&i.scrollWidth>i.clientWidth,c=o&&i.clientHeight>0&&i.scrollHeight>i.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=i.offsetWidth-i.clientWidth:e.offsetX>i.clientWidth),d=s&&e.offsetY>i.clientHeight;if(u||d)return}let f=s.current.floatingContext?.nodeId,p=b&&$l(b.nodesRef.current,f).some(t=>ql(e,t.context?.elements.floating));if(ql(e,o.floating)||ql(e,o.domReference)||p)return;let h=b?$l(b.nodesRef.current,f):[];if(h.length>0){let e=!0;if(h.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}a(!1,e,`outside-press`)}),F=uu(e=>{var t;let n=()=>{var t;P(e),(t=Kl(e))==null||t.removeEventListener(d,n)};(t=Kl(e))==null||t.addEventListener(d,n)});N(()=>{if(!r||!c)return;s.current.__escapeKeyBubbles=T,s.current.__outsidePressBubbles=E;let e=-1;function t(e){a(!1,e,`ancestor-scroll`)}function n(){window.clearTimeout(e),A.current=!0}function u(){e=window.setTimeout(()=>{A.current=!1},h()?5:0)}let f=Yl(o.floating);l&&(f.addEventListener(`keydown`,O?M:j,O),f.addEventListener(`compositionstart`,n),f.addEventListener(`compositionend`,u)),S&&f.addEventListener(d,k?F:P,k);let p=[];return g&&(re(o.domReference)&&(p=i(o.domReference)),re(o.floating)&&(p=p.concat(i(o.floating))),!re(o.reference)&&o.reference&&o.reference.contextElement&&(p=p.concat(i(o.reference.contextElement)))),p=p.filter(e=>e!==f.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{l&&(f.removeEventListener(`keydown`,O?M:j,O),f.removeEventListener(`compositionstart`,n),f.removeEventListener(`compositionend`,u)),S&&f.removeEventListener(d,k?F:P,k),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[s,o,l,S,d,r,a,g,c,T,E,j,O,M,P,k,F]),N(()=>{s.current.insideReactTree=!1},[s,S,d]);let I=D(()=>({onKeyDown:j,...f&&{[Vd[p]]:e=>{a(!1,e.nativeEvent,`reference-press`)},...p!==`click`&&{onClick(e){a(!1,e.nativeEvent,`reference-press`)}}}}),[j,a,f,p]),ee=D(()=>({onKeyDown:j,onMouseDown(){C.current=!0},onMouseUp(){C.current=!0},[Hd[d]]:()=>{s.current.insideReactTree=!0}}),[j,d,s]);return D(()=>c?{reference:I,floating:ee}:{},[c,I,ee])}function Gd(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=Hu(),a=w({}),[o]=V(()=>Uu()),s=Ku()!=null,[c,l]=V(r.reference),u=uu((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=D(()=>({setPositionReference:l}),[]),f=D(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return D(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function Kd(e){e===void 0&&(e={});let{nodeId:t}=e,n=Gd({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[a,o]=V(null),[s,c]=V(null),l=i?.domReference||a,u=w(null),d=qu();ou(()=>{l&&(u.current=l)},[l]);let f=Cu({...e,elements:{...i,...s&&{reference:s}}}),p=U(e=>{let t=re(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;c(t),f.refs.setReference(t)},[f.refs]),m=U(e=>{(re(e)||e===null)&&(u.current=e,o(e)),(re(f.refs.reference.current)||f.refs.reference.current===null||e!==null&&!re(e))&&f.refs.setReference(e)},[f.refs]),h=D(()=>({...f.refs,setReference:m,setPositionReference:p,domReference:u}),[f.refs,m,p]),g=D(()=>({...f.elements,domReference:l}),[f.elements,l]),_=D(()=>({...f,...r,refs:h,elements:g,nodeId:t}),[f,h,g,t,r]);return ou(()=>{r.dataRef.current.floatingContext=_;let e=d?.nodesRef.current.find(e=>e.id===t);e&&(e.context=_)}),D(()=>({...f,context:_,refs:h,elements:g}),[f,h,g,_])}function qd(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[ku]:t,[Au]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[Ou]:``},...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&&[ku,Au].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 Jd(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=U(t=>qd(t,e,`reference`),t),a=U(t=>qd(t,e,`floating`),n),o=U(t=>qd(t,e,`item`),r);return D(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}var Yd=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Xd(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=Hu(),c=r.domReference?.id||s,l=D(()=>Ql(r.floating)?.id||i,[r.floating,i]),u=Yd.get(o)??o,d=Ku()!=null,f=D(()=>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=D(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=U(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 D(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}var Zd=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?`-`:``)+e.toLowerCase());function Qd(e,t){return typeof e==`function`?e(t):e}function $d(e,t){let[n,r]=V(e);return e&&!n&&r(!0),N(()=>{if(!e&&n){let e=setTimeout(()=>r(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}function ef(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]=V(`unmounted`),c=$d(n,a);return!c&&o===`close`&&s(`unmounted`),ou(()=>{if(r){if(n){s(`initial`);let e=requestAnimationFrame(()=>{x(()=>{s(`open`)})});return()=>{cancelAnimationFrame(e)}}s(`close`)}},[n,r]),{isMounted:c,status:o}}function tf(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=D(()=>({side:c,placement:s}),[c,s]),u=typeof o==`number`,d=(u?o:o.open)||0,f=(u?o:o.close)||0,[p,m]=V(()=>({...Qd(a,l),...Qd(n,l)})),{isMounted:h,status:g}=ef(e,{duration:o}),_=cu(n),v=cu(r),y=cu(i),b=cu(a);return ou(()=>{let e=Qd(_.current,l),t=Qd(y.current,l),n=Qd(b.current,l),r=Qd(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(Zd).join(`,`),transitionDuration:d+`ms`,...n,...r}),g===`close`){let r=t||e;m({transitionProperty:Object.keys(r).map(Zd).join(`,`),transitionDuration:f+`ms`,...n,...r})}},[f,y,_,v,b,d,g,l]),{isMounted:h,styles:p}}function nf(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...nf(e,t.id,n)])}function rf(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 af(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function of(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(){Yu(i),u()}if(Yu(i),!c.domReference||!c.floating||s==null||n==null||o==null)return;let{clientX:m,clientY:h}=e,g=[m,h],_=rd(e),v=e.type===`mouseleave`,y=nd(c.floating,_),b=nd(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=af(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&&re(e.relatedTarget)&&nd(c.floating,e.relatedTarget)||f&&nf(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(!rf([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()}rf([m,h],P([n,o]))?!a&&r&&(i.current=window.setTimeout(p,40)):p()}}};return u.__options={blockPointerEvents:n},u}le();var sf=({className:e,style:t}={})=>ie(`iframe`,{src:cr(),title:`Connect your FKN account`,className:e,style:{border:`none`,width:150,height:40,background:`transparent`,colorScheme:`normal`,...t}}),cf=8e3,lf=async(e,t=cf)=>{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)}},uf=()=>Promise.race([ve.info(),new Promise(e=>setTimeout(()=>e(null),4e3))]),df=()=>{let[e,t]=V(null),[n,r]=V(!1),i=U(()=>uf().then(e=>{t(e),r(!0)}).catch(()=>r(!0)),[]);return N(()=>{let e=!1,t=ve.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:U(async()=>{let e=await lf(()=>ve.logout());return await i(),e},[i])}},ff={categoryBar:1,hoverCard:150,sourcePopup:300,filterMenu:500,mediaModal:1e3,header:1100,headerPopup:1150,franchiseDialog:1200,pluginPrompt:2e3,partyCursor:3e3};H();var pf=`https://fkn.app/account`,mf=150,hf=40,gf=l`
22
+ `,i=Error(r+ai+n);throw i.name=`Graphcache Error`,i}}var si={},ci=e=>e._directives||si,li=e=>e.name.value,ui=e=>e.typeCondition.name.value,di=e=>e.alias?e.alias.value:e.name.value,fi=[],pi=e=>e.selectionSet?e.selectionSet.selections:fi,mi=e=>e.typeCondition?e.typeCondition.name.value:null,hi=(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=Et(a.value,t);o!=null&&(n||={},n[li(a)]=o)}return n},gi=(e,t)=>{if(t&&e.variableDefinitions){for(var n={},r=0,i=e.variableDefinitions.length;r<i;r++){var a=li(e.variableDefinitions[r].variable);n[a]=t[a]}return n}},_i=(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=li(a.variable);n[o]=t[o]===void 0&&a.defaultValue?Et(a.defaultValue,t):t[o]}for(var s in t)s in n||(n[s]=t[s]);return n};function vi(e){for(var t=0;t<e.definitions.length;t++)if(e.definitions[t].kind===$e.OPERATION_DEFINITION)return e.definitions[t];oi(!1,``,1)}var yi=e=>{for(var t={},n=0;n<e.definitions.length;n++){var r=e.definitions[n];r.kind===$e.FRAGMENT_DEFINITION&&(t[li(r)]=r)}return t},bi=(e,t)=>{var n=ci(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]&&li(i.arguments[0])===`if`){var a=Et(i.arguments[0].value,t);return r===`include`?!!a:!a}}return!0},xi=(e,t)=>{var{defer:n}=ci(e);if(n){for(var r of n.arguments||[])if(li(r)===`if`)return!!Et(r.value,t);return!0}return!1},Si=e=>{var{optional:t,required:n}=ci(e);if(n)return!1;if(t)return!0},Ci=`__`,wi=(e,t,n,r)=>{var i=Di(e,t,n,r);return!!i&&i.type.kind!==`NON_NULL`},Ti=(e,t,n,r)=>{var i=Di(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`},Ei=(e,t,n)=>{if(!n)return!1;var r=mi(t);return!r||n===r?!0:e.types.has(r)&&e.types.get(r).kind===`OBJECT`?r===n:((function(e,t){oi(e.types.has(t)&&(e.types.get(t).kind===`INTERFACE`||e.types.get(t).kind===`UNION`),``,5)})(e,r),Oi(e,n),e.isSubType(r,n))},Di=(e,t,n,r)=>{if(n.indexOf(Ci)!==0&&t.indexOf(Ci)!==0)return Oi(e,t),e.types.get(t).fields()[n]};function Oi(e,t){oi(e.types.has(t)&&e.types.get(t).kind===`OBJECT`,``,3)}var ki=(e,t)=>t?`${e}(${Br(t)})`:e,Ai=(e,t)=>`${e}.${t}`,ji=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}},Mi=e=>{var t=e.indexOf(`.`);return{entityKey:e.slice(0,t).replace(/%2e/g,`.`),fieldKey:e.slice(t+1)}},Ni=null,Pi=null,J=null,Fi=null,Ii=null,Li=null,Ri=!1,zi=!1;function Bi(e,t){var n;if(e){if(Ni.has(e))return e;n=Pi.get(e)}return n??=t?[]:{},e&&Pi.set(e,n),Ni.add(n),n}var Vi=e=>!!e&&Ni.has(e),Hi=(e,t,n,r,i)=>{Ni=new WeakSet,Pi=new WeakMap,Ii=e,J=t,Li=new Set,zi=!!r,Ri=!!i,n?Ii===`read`?Fi=n:r||t.hydrating||t.optimisticOrder.length>1?(!r&&!t.commutativeKeys.has(n)?sa(t,n):r&&(t.optimisticOrder.indexOf(n)!==-1&&!t.commutativeKeys.has(n)&&t.optimisticOrder.splice(t.optimisticOrder.indexOf(n),1),t.commutativeKeys.delete(n)),Fi=n,ca(t,n)):(Fi=null,ua(t,n)):Fi=null},Ui=()=>{var e=J,t=Fi;if(zi=!1,Fi=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]);)da(e.optimisticOrder[n]);Ni=null,Pi=null,Ii=null,J=null,Li=null,!e.defer&&(e.storage||!e.optimisticOrder.length)&&(e.defer=!0,setTimeout((()=>{Hi(`read`,e,null),Qi(),pa(),Ui(),e.defer=!1})))},Wi=(e,t,n)=>{t&&!n&&e.deferredKeys.delete(t),Hi(`write`,e,t,n),Ui()},Gi=new Set,Ki=(e,t,n,r)=>{var i=Fi?e.optimistic.get(Fi):e.base,a=i.get(t);a===void 0&&i.set(t,a=Object.create(null)),r===void 0&&!Fi?delete a[n]:a[n]=r},qi=(e,t,n)=>{for(var r,i=!zi&&Ii===`read`&&Fi&&J.commutativeKeys.has(Fi),a=0,o=J.optimisticOrder.length;a<o;a++){var s=J.optimisticOrder[a],c=e.optimistic.get(s);if(i&&=s!==Fi,c&&(!i||!J.commutativeKeys.has(s))&&(!zi||Ii===`write`||J.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 Ji(e){return J.refCount.get(e)||0}var Yi=(e,t)=>{if(Array.isArray(e))for(var n=0,r=e.length;n<r;n++)Yi(e[n],t);else typeof e==`string`&&((e,t)=>{var n=Ji(e),r=n+t>0?n+t:0;J.refCount.set(e,r),r?!n&&r&&J.gc.delete(e):J.gc.add(e)})(e,t)},Xi=(e,t,n)=>{if(n!==void 0)for(var r in n)t.has(r)||(e.push(ji(r)),t.add(r))},Zi=(e,t,n,r)=>{Xi(e,t,r.base.get(n));for(var i=0,a=J.optimisticOrder.length;i<a;i++){var o=r.optimistic.get(J.optimisticOrder[i]);o!==void 0&&Xi(e,t,o.get(n))}},Qi=()=>{if(!J.optimisticOrder.length){for(var e of J.gc.keys())if(J.gc.delete(e),!(Ji(e)>0)){var t=J.records.base.get(e);J.refCount.delete(e),J.records.base.delete(e);var n=t&&t.__typename;if(n){var r=J.types.get(n);r&&r.delete(e)}var i=J.links.base.get(e);if(i)for(var a in J.links.base.delete(e),i)Yi(i[a],-1)}}},$i=(e,t)=>{e===J.queryRootKey?t!==void 0&&t!==`__typename`&&Li.add(Ai(e,t)):Li.add(e)},ea=(e,t)=>{!zi&&J.storage&&J.persist.add(((e,t)=>`${e.replace(/\./g,`%2e`)}.${t}`)(e,t))},ta=(e,t)=>(Ii===`read`&&$i(e,t),qi(J.records,e,t)),na=(e,t)=>(Ii===`read`&&$i(e,t),qi(J.links,e,t)),ra=(e,t)=>{var n=J.abstractToConcreteMap.get(e);if(n)n.add(t);else{var r=new Set;r.add(t),J.abstractToConcreteMap.set(e,r)}},ia=(e,t,n)=>{ma(qi(J.records,e,t),n)||($i(e,t),ea(e,t)),Ki(J.records,e,t,n)},aa=(e,t)=>ta(e,t)!==void 0||na(e,t)!==void 0,oa=(e,t,n)=>{var r=Fi?J.links.optimistic.get(Fi):J.links.base;if(!Fi){var i=r&&r.get(e);Yi(i&&i[t],-1),Yi(n,1)}ma(qi(J.links,e,t),n)||($i(e,t),ea(e,t)),Ki(J.links,e,t,n)},sa=(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)&&la(e,t),r=0;e.optimisticOrder.splice(r,0,t),e.commutativeKeys.add(t)},ca=(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))},la=(e,t)=>{e.dirtyKeys.has(t)&&(e.dirtyKeys.delete(t),e.records.optimistic.delete(t),e.links.optimistic.delete(t),e.deferredKeys.delete(t))},ua=(e,t)=>{var n=e.optimisticOrder.indexOf(t);n>-1&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),la(e,t)},da=e=>{var t=Li;Li=new Set,Ii=`write`;var n=J.links.optimistic.get(e);if(n)for(var r of n.entries()){var i=r[0],a=r[1];for(var o in a)oa(i,o,a[o])}var s=J.records.optimistic.get(e);if(s)for(var c of s.entries()){var l=c[0],u=c[1];for(var d in u)ia(l,d,u[d])}Li=t,ua(J,e)},fa=e=>{var{links:t,records:n}=J,r=[],i=new Set;return $i(e),Zi(r,i,e,t),Zi(r,i,e,n),r},pa=()=>{if(J.storage){zi=!0,Ii=`read`;var e={};for(var t of J.persist.keys()){var{entityKey:n,fieldKey:r}=Mi(t),i=void 0;e[t]=(i=na(n,r))===void 0?(i=ta(n,r))===void 0?void 0:Br(i):`:${Br(i)}`}zi=!1,J.storage.writeData(e),J.persist.clear()}};function ma(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 ha=null,ga=!1,_a=void 0,va=e=>e.__internal.path.length>0&&e.__internal.errorMap?e.__internal.errorMap[e.__internal.path.join(`.`)]:void 0,ya=(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:zi,__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},ba=(e,t,n,r,i,a)=>{ha=e,e.parent=t,e.parentTypeName=n,e.parentKey=r,e.parentFieldKey=i,e.fieldName=a,e.error=va(e)},xa=(e,t,n,r,i)=>{if(!t)return!1;var a=mi(e);return!a||t===a||!pi(e).some((e=>e.kind===$e.FIELD&&!aa(n,ki(li(e),hi(e,r)))))},Sa=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(bi(t,this.ctx.variables)){if(t.kind!==$e.FIELD){var n=t.kind===$e.INLINE_FRAGMENT?t:this.ctx.fragments[li(t)];if(n){var r=!n.typeCondition||(this.ctx.store.schema?Ei(this.ctx.store.schema,n,this.typename):this.ctx.store.possibleTypeMap?Ca(this.ctx.store.possibleTypeMap,n.typeCondition.name.value,this.typename):Ii===`read`&&wa(n.typeCondition.name.value,this.typename)||xa(n,this.typename,this.entityKey,this.ctx.variables,this.ctx.store.logger));if(r||Ii===`write`&&!this.ctx.store.schema){var i=Si(t);r&&n.typeCondition&&this.typename!==n.typeCondition.name.value&&ra(n.typeCondition.name.value,this.typename),this.stack.push(e={selectionSet:pi(n),index:0,defer:e.defer||xi(t,this.ctx.variables),optional:i===void 0?e.optional:i})}}}else if(Ii===`write`||!t._generated)return ga=e.defer,_a=e.optional,t}}this.stack.pop()}}},Ca=(e,t,n)=>{if(!n)return!1;if(t===n)return!0;var r=e.get(t);return r&&r.has(n)},wa=(e,t)=>{if(!t)return!1;if(e===t)return!0;if((e=>J.types.has(e))(e))return!1;var n=(e=>J.abstractToConcreteMap.get(e)||Gi)(e);return n.size&&n.has(t)},Ta=e=>e??null,Ea=(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]=Ea(e,t[r]);return n}return e.keyOfEntity(t)},Da=(e,t,n,r)=>{var i=ri(t.query),a=vi(i),o=e.rootFields[a.operation],s=pi(a),c=ya(e,_i(a,t.variables),yi(i),o,o,r),l=o===c.store.rootFields.query?ja(c,o,s,n||Bi()):Oa(c,o,s,n||Bi());return{dependencies:Li,partial:c.partial||!l,hasNext:c.hasNext,data:l||null}},Oa=(e,t,n,r)=>{if(typeof(e.store.rootNames[t]?t:r.__typename)!=`string`)return r;for(var i=new Sa(t,t,!1,void 0,n,e),a,o=Ri,s=Bi(r);a=i.next();){var c=di(a),l=r[c];e.__internal.path.push(c);var u=void 0;u=a.selectionSet&&l!==null?ka(e,pi(a),Ta(l)):l,o||=u!==l,u!==void 0&&(s[c]=u),e.__internal.path.pop()}return o?s:r},ka=(e,t,n)=>{if(Array.isArray(n)){for(var r=Array(n.length),i=Ri,a=0,o=n.length;a<o;a++)e.__internal.path.push(a),r[a]=ka(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?Oa(e,n.__typename,t,n):ja(e,s,t,n)||null};function Aa(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](hi(c,r.variables)),o}return o||a}var ja=(e,t,n,r,i)=>{var{store:a}=e,o=t===a.rootFields.query,s=i&&a.keyOfEntity(i)||t,c=o?t:ta(s,`__typename`)||i&&i.__typename;if(typeof c==`string`&&!(i&&c!==i.__typename)){for(var l=new Sa(c,s,!1,void 0,n,e),u=!1,d=!1,f=Ri,p,m=e.partial,h=Bi(r);(p=l.next())!==void 0;){var g=li(p),_=hi(p,e.variables),v=di(p),y=ci(p),b=Aa(y,c,g,e),x=ki(g,_),S=Ai(s,x),C=ta(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(Ii===`read`&&b){var E=h;if(p.selectionSet===void 0&&C!==void 0&&(E={...h,[v]:C,[g]:C}),ba(e,E,c,s,x,g),T=b(E,_||{},a,e),p.selectionSet&&(T=Ma(e,c,g,S,pi(p),h[v]===void 0?r[v]:h[v],T,Vi(r))),a.schema&&T===null&&!wi(a.schema,c,g,e.store.logger))return}else if(!p.selectionSet)T=C;else if(w!==void 0)T=Ma(e,c,g,S,pi(p),h[v]===void 0?r[v]:h[v],w,Vi(r));else{var D=na(s,x);D===void 0?typeof C==`object`&&C&&(T=C):T=Na(e,D,c,g,pi(p),h[v]===void 0?r[v]:h[v],Vi(r))}if(!ga&&T===void 0&&(y.optional||_a&&!y.required||va(e)||!y.required&&a.schema&&wi(a.schema,c,g,e.store.logger))?(e.partial=!0,T=null):T===null&&(y.required||!1===_a)?(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(ga)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}},Ma=(e,t,n,r,i,a,o,s)=>{if(Array.isArray(o)){for(var{store:c}=e,l=c.schema?Ti(c.schema,t,n,e.store.logger):!1,u=e.partial,d=Bi(a,!0),f=Ri||!Array.isArray(a)||o.length!==a.length,p=0,m=o.length;p<m;p++){e.__internal.path.push(p);var h=Ma(e,t,n,Ai(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(Pa(o)){var g=a||Bi(a);return typeof o==`string`?ja(e,o,i,g):ja(e,r,i,g,o)}},Na=(e,t,n,r,i,a,o)=>{if(Array.isArray(t)){for(var{store:s}=e,c=s.schema?Ti(s.schema,n,r,e.store.logger):!1,l=Bi(a,!0),u=e.partial,d=Ri||!Array.isArray(a)||t.length!==a.length,f=0,p=t.length;f<p;f++){e.__internal.path.push(f);var m=Na(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:ja(e,t,i,a||Bi(a))},Pa=e=>typeof e==`string`||typeof e==`object`&&typeof e.__typename==`string`,Fa=(e,t,n)=>{for(var r=t?[{fieldKey:ki(t,n)}]:fa(e),i=0,a=r.length;i<a;i++){var{fieldKey:o}=r[i];na(e,o)===void 0?ia(e,o,void 0):oa(e,o,void 0)}},Ia=(e,t)=>{for(var n of(e=>J.types.get(e)||Gi)(e))t.includes(n)||Fa(n)},La=(e,t,n,r)=>{var i=ri(t.query),a=vi(i),o={data:n||Bi(),dependencies:Li},s=e.rootFields[a.operation];return Ra(ya(e,_i(a,t.variables),yi(i),s,s,r),s,pi(a),o.data),o},Ra=(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=ta(t,`__typename`)),o)!a&&t&&(ia(t,`__typename`,o),((e,t)=>{var n=J.types.get(e);if(n)n.add(t);else{var r=new Set;r.add(t),J.types.set(e,r)}})(o,t));else return;for(var s=e.store.updates[o],c=new Sa(o,t||o,!1,void 0,n,e),l;l=c.next();){var u=li(l),d=hi(l,e.variables),f=ki(u,d),p=di(l),m=r[e.optimistic?u:p];if(!(u===`__typename`||m===void 0&&(ga||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&&(ba(e,r,o,t||o,f,u),m=Ta(h(d||{},e.store,e))),m!==void 0){if(l.selectionSet){if(t&&i===`query`){var g=Ai(t,f),_=za(e,pi(l),Ta(m),g,e.optimistic?na(t||o,f):void 0);oa(t||o,f,_)}else za(e,pi(l),Ta(m))}else t&&i===`query`&&ia(t||o,f,m!==null||!va(e)?m:void 0);var v=s&&s[u];if(v)ba(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=ta(S,`__typename`),w=Ji(S);C&&!w&&Ia(m[b].__typename,y)}}else if(m&&typeof m==`object`){var T=e.store.keyOfEntity(m);if(T){var E=ta(T,`__typename`),D=Ji(T);(!E||!D)&&m.__typename&&Ia(m.__typename,[T])}}}e.__internal.path.pop()}}}},za=(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?Ai(r,`${o}`):void 0,l=za(e,t,n[o],c,i?.[o]);a[o]=l,e.__internal.path.pop()}return a}if(n===null)return va(e)?void 0:null;var u=e.store.keyOfEntity(n)||(typeof i==`string`?i:null);n.__typename;var d=u||r;return Ra(e,d,t,n),d||null},Ba=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 ki(e,t)}keyOfEntity(e){if(ha&&e===ha.parent)return ha.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=ki(t,n),a=ta(r,i);if(a!==void 0)return a;var o=na(r,i);return o!==void 0&&(o=Ea(this,o)),o}}invalidate(e,t,n){var r=this.keyOfEntity(e);e&&typeof e==`string`&&!t&&!n&&!this.resolve(e,`__typename`)?Ia(e,[]):(oi(r,``,19),Fa(r,t,n))}inspectFields(e){var t=this.keyOfEntity(e);return t?fa(t):[]}updateQuery(e,t){var n=$r(e.query,e.variables),r=t(this.readQuery(n));r!==null&&La(this,n,r,void 0)}readQuery(e){var t=$r(e.query,e.variables);return Da(this,t,void 0,void 0).data}readFragment(e,t,n,r){return((e,t,n,r,i)=>{var a=yi(t),o;if(i){if(!(o=a[i]))return null}else if(!(o=a[Object.keys(a)[0]]))return null;var s=ui(o);typeof n!=`string`&&!n.__typename&&(n.__typename=s);var c=e.keyOfEntity(n);return c&&ja(ya(e,r||{},a,s,c,void 0),c,pi(o),Bi())||null})(this,ri(e),t,n,r)}writeFragment(e,t,n,r){((e,t,n,r,i)=>{var a=yi(t),o;if(i){if(!(o=a[i]))return null}else if(!(o=a[Object.keys(a)[0]]))return null;var s=ui(o),c={__typename:s,...n},l=e.keyOfEntity(c);l&&Ra(ya(e,r||{},a,s,l,void 0),l,pi(o),c)})(this,ri(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&&oa(a,ki(t,r),Ea(this,i))}},Va=(e,t)=>ii(e.kind,e,{...e.context,meta:{...e.context.meta,...t}}),Ha=(e,t)=>ii(e.kind,e,{...e.context,requestPolicy:t}),Ua=(e=>({forward:t,client:n,dispatchDebug:r})=>{var i=new Ba(e);e&&e.storage&&(i.data.hydrating=!0,e.storage.readData().then((t=>{((e,t,n)=>{for(var r in Hi(`write`,e,null),n){var i=n[r];if(i!==void 0){var{entityKey:a,fieldKey:o}=Mi(r);i[0]===`:`?na(a,o)===void 0&&oa(a,o,JSON.parse(i.slice(1))):ta(a,o)===void 0&&ia(a,o,JSON.parse(i))}}e.storage=t,e.hydrating=!1,Ui()})(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(Ha(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`)sa(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),Wi(i.data,e.key),e;else if(e.kind===`mutation`&&e.context.requestPolicy!==`network-only`){s.set(e.key,e),Hi(`write`,i.data,e.key,!0,!1);var{dependencies:n}=La(i,e,void 0,void 0);if(Ui(),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 ii(e.kind,{key:e.key,query:ri(e.query),variables:e.variables?gi(vi(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=>{Hi(`read`,i.data,void 0,!1,!1);var t=Da(i,e,c.get(e.key),void 0);Ui();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)&&sa(i.data,n.key,!0);var r,o=e.data;if(o){Hi(`write`,i.data,n.key,!1,!1);var l=La(i,n,o,e.error).dependencies;Ui(),h(t,l);var u=n.kind===`query`?c.get(n.key):null;Hi(`read`,i.data,n.key,!1,u!==o);var d=Da(i,n,u||o,e.error);Ui(),o=d.data,n.kind===`query`&&(h(t,r=d.dependencies),c.set(n.key,o))}else Wi(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=Vt(Pt(y)(Nt((e=>e.kind===`query`&&e.context.requestPolicy!==`network-only`))(e))),c=Nt((e=>e.kind!==`query`||e.context.requestPolicy===`network-only`))(e),d=Pt((e=>Va(e.operation,{cacheOutcome:`miss`})))(Nt((e=>e.outcome===`miss`&&e.operation.context.requestPolicy!==`cache-only`&&!m(e.dependencies)&&!f.has(e.operation.key)))(r)),p=Pt((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:Va(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(Ha(s.get(e.operation.key)||e.operation,`network-only`))),l}))(Nt((e=>e.outcome!==`miss`||e.operation.context.requestPolicy===`cache-only`))(r)),h=t(Pt(_)(Lt([c,d])));return Lt([Pt((e=>{var t=new Set,n=b(e,t);return g(e.operation,t,!1),n}))(Nt((e=>!a.has(e.operation.key)))(h)),Ft((e=>{if(o.push(e)<a.size)return $t;for(var t=0;t<o.length;t++)sa(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),Yt(n)}))(Nt((e=>a.has(e.operation.key)))(h)),p])}})({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":"scoreLabel","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":"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":"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":"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":"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":"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":"startDate","type":{"kind":"SCALAR","name":"Any"},"args":[]},{"name":"status","type":{"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":"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":"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":"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":"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":"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":"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":"keeps","type":{"kind":"NON_NULL","ofType":{"kind":"LIST","ofType":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}}}},"args":[]},{"name":"keepsPageEpisodeCount","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"name","type":{"kind":"NON_NULL","ofType":{"kind":"SCALAR","name":"Any"}},"args":[]},{"name":"rewatchThroughCompleted","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":"writeNotice","type":{"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":"pending","type":{"kind":"NON_NULL","ofType":{"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:{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,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},resolvers:{}}),Wa=new Xn({url:`http://d/graphql`,exchanges:[Jn({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}`}))}}),Fr,Ua,Kn],fetchSubscriptions:!0,fetch:async(e,t)=>Ne(e,t)});function Ga(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 Ka=ce((e=>{var t=(le(),ee(s));function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),s=r[0].inst,l=r[1];return o(function(){s.value=n,s.getSnapshot=t,u(s)&&l({inst:s})},[e,n,t]),a(function(){return u(s)&&l({inst:s}),e(function(){u(s)&&l({inst:s})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(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;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),qa=ce(((e,t)=>{t.exports=Ka()}));le();var Ja=qa(),Ya=C,Xa=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?S:N,Za=Ya||Xa,Qa=e=>{let t=w([e,(...e)=>t[0](...e)]).current;return Za(()=>{t[0]=e}),t[1]},$a=`popstate`,eo=`pushState`,to=`replaceState`,no=[$a,eo,to,`hashchange`],ro=e=>{for(let t of no)addEventListener(t,e);return()=>{for(let t of no)removeEventListener(t,e)}},io=(e,t)=>(0,Ja.useSyncExternalStore)(ro,e,t),ao=()=>location.search,oo=({ssrSearch:e=``}={})=>io(ao,()=>e),so=()=>location.pathname,co=({ssrPath:e}={})=>io(so,e?()=>e:so),lo=(e,{replace:t=!1,state:n=null}={})=>history[t?to:eo](n,``,e),uo=(e={})=>[co(e),lo],fo=Symbol.for(`wouter_v3`);if(typeof history<`u`&&window[fo]===void 0){for(let e of[eo,to]){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,fo,{value:!0})}var po=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?`~`+t:t.slice(e.length)||`/`,mo=(e=``)=>e===`/`?``:e,ho=(e,t)=>e[0]===`~`?e.slice(1):mo(t)+e,go=(e=``,t)=>po(vo(mo(e)),vo(t)),_o=e=>e[0]===`?`?e.slice(1):e,vo=e=>{try{return decodeURI(e)}catch{return e}},yo=e=>vo(_o(e)),bo={hook:uo,searchHook:oo,parser:Ga,base:``,ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},xo=A(bo),So=()=>R(xo),Co={},wo=A(Co),To=()=>R(wo),Eo=e=>{let[t,n]=e.hook(e);return[go(e.base,t),Qa((t,r)=>n(ho(t,e.base),r))]},Do=()=>Eo(So()),Oo=()=>{let e=So();return yo(e.searchHook(e))},ko=(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]:[]]},Ao=e=>ko(So().parser,e,Do()[0]),jo=({children:e,...t})=>{let n=So(),r=t.hook?bo:n,i=r,[a,o]=t.ssrPath?.split(`?`)??[];o&&(t.ssrSearch=o,t.ssrPath=a),t.hrefs=t.hrefs??t.hook?.hrefs;let s=w({}),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 ie(xo.Provider,{value:i,children:e})},Mo=({children:e,component:t},n)=>t?ie(t,{params:n}):typeof e==`function`?e(n):e,No=e=>{let t=w(Co),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},Po=({path:e,nest:t,match:n,...r})=>{let i=So(),[a]=Eo(i),[o,s,c]=n??ko(i.parser,e,a,t),l=No({...To(),...s});if(!o)return null;let u=c?ie(jo,{base:c},Mo(r,l)):Mo(r,l);return ie(wo.Provider,{value:l,children:u})},Fo=b((e,t)=>{let n=So(),[r,i]=Eo(n),{to:a=``,href:o=a,onClick:s,asChild:c,children:l,className:f,replace:p,state:m,...h}=e,g=Qa(t=>{t.ctrlKey||t.metaKey||t.altKey||t.shiftKey||t.button!==0||(s?.(t),t.defaultPrevented||(t.preventDefault(),i(o,e)))}),_=n.hrefs(o[0]===`~`?o.slice(1):n.base+o,n);return c&&u(l)?d(l,{onClick:g,href:_}):ie(`a`,{...h,onClick:g,href:_,className:f?.call?f(r===o):f,children:l,ref:t})}),Io=e=>Array.isArray(e)?e.flatMap(e=>Io(e&&e.type===M?e.props.children:e)):[e],Lo=({children:e,location:t})=>{let n=So(),[r]=Eo(n);for(let i of Io(e)){let e=0;if(u(i)&&(e=ko(n.parser,i.props.path,t||r,i.props.nest))[0])return d(i,{match:e})}return null},Ro=e=>{let{to:t,href:n=t}=e,r=So(),[,i]=Eo(r),a=Qa(()=>i(t||n,e)),{ssrContext:o}=r;return Xa(()=>{a()},[]),o&&(o.redirectTo=t),null},Y=function(e){return e.HOME=`HOME`,e.MEDIA=`MEDIA`,e.MEDIA_EPISODE=`MEDIA_EPISODE`,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}({}),zo={HOME:()=>`/`,MEDIA:({uri:e})=>`/media/${e}`,MEDIA_EPISODE:({uri:e,mediaUri:t})=>`/media/${e}/${t}`,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`},Bo={HOME:`/`,MEDIA:`/media/:uri`,MEDIA_EPISODE:`/media/:uri/:mediaUri`,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`},Vo=e=>Bo[e],Ho=(e,t)=>zo[e](t),Uo=function(e){return e.Anime=`ANIME`,e.Movie=`MOVIE`,e.Series=`SERIES`,e}({}),Wo=function(e){return e.Html=`HTML`,e.Text=`TEXT`,e}({}),Go=function(e){return e.Fall=`FALL`,e.Spring=`SPRING`,e.Summer=`SUMMER`,e.Winter=`WINTER`,e}({}),Ko=function(e){return e.Popularity=`POPULARITY`,e.PopularityDesc=`POPULARITY_DESC`,e}({}),qo=function(e){return e.Cancelled=`CANCELLED`,e.Finished=`FINISHED`,e.Hiatus=`HIATUS`,e.NotYetReleased=`NOT_YET_RELEASED`,e.Releasing=`RELEASING`,e}({}),Jo=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}({}),Yo=function(e){return e.IsApiOnly=`IS_API_ONLY`,e.IsNotApiOnly=`IS_NOT_API_ONLY`,e}({}),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`}}]}}]}}]}}]},Zo={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`}}]}}]}}]}}]},Qo={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`}}]}}]},$o={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:`pending`}},{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:`account`}},{kind:`Field`,name:{kind:`Name`,value:`scoreScale`}},{kind:`Field`,name:{kind:`Name`,value:`writeNotice`}},{kind:`Field`,name:{kind:`Name`,value:`keepsPageEpisodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`keeps`}},{kind:`Field`,name:{kind:`Name`,value:`rewatchThroughCompleted`}}]}},{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:`scoreLabel`}},{kind:`Field`,name:{kind:`Name`,value:`startedAt`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`year`}},{kind:`Field`,name:{kind:`Name`,value:`month`}},{kind:`Field`,name:{kind:`Name`,value:`day`}}]}},{kind:`Field`,name:{kind:`Name`,value:`completedAt`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`year`}},{kind:`Field`,name:{kind:`Name`,value:`month`}},{kind:`Field`,name:{kind:`Name`,value:`day`}}]}},{kind:`Field`,name:{kind:`Name`,value:`rewatchCount`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`updatedAt`}}]}}]}}]}}]}}]},es={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:`scoreLabel`}},{kind:`Field`,name:{kind:`Name`,value:`startedAt`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`year`}},{kind:`Field`,name:{kind:`Name`,value:`month`}},{kind:`Field`,name:{kind:`Name`,value:`day`}}]}},{kind:`Field`,name:{kind:`Name`,value:`completedAt`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`year`}},{kind:`Field`,name:{kind:`Name`,value:`month`}},{kind:`Field`,name:{kind:`Name`,value:`day`}}]}},{kind:`Field`,name:{kind:`Name`,value:`rewatchCount`}},{kind:`Field`,name:{kind:`Name`,value:`episodeCount`}},{kind:`Field`,name:{kind:`Name`,value:`updatedAt`}}]}}]}}]}}]},ts={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`}}]}}]}}]},ns={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`}}]}}]}}]},rs={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`}}]}}]}}]},is={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`}}]}}]}}]}}]},as={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetMediaModal`},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`}}}}],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:`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:`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:`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`}}]}}]}}]}}]},os={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`subscription`,name:{kind:`Name`,value:`GetMediaModalOrigins`},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`}}]}}]},ss={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:`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`}}]}}]}}]}}]},cs={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:`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:`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:`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`}}]}}]}}]}}]},ls={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`}}]}}]}}]}}]},us={query:`q`,category:`category`,status:`status`,season:`season`,year:`year`,format:`format`,genre:`genre`,tag:`tag`},ds=[{value:Jo.Tv,label:`TV Show`},{value:Jo.Movie,label:`Movie`},{value:Jo.TvShort,label:`TV Short`},{value:Jo.Special,label:`Special`},{value:Jo.Ova,label:`OVA`},{value:Jo.Ona,label:`ONA`}],fs=[{value:qo.Releasing,label:`Airing`},{value:qo.Finished,label:`Finished`},{value:qo.NotYetReleased,label:`Not yet aired`},{value:qo.Cancelled,label:`Cancelled`},{value:qo.Hiatus,label:`Hiatus`}],ps=[{value:Go.Winter,label:`Winter`},{value:Go.Spring,label:`Spring`},{value:Go.Summer,label:`Summer`},{value:Go.Fall,label:`Fall`}],ms=[{value:Uo.Anime,label:`Anime`},{value:Uo.Series,label:`Series`},{value:Uo.Movie,label:`Movies`}],hs=[`Action`,`Adventure`,`Comedy`,`Drama`,`Ecchi`,`Fantasy`,`Horror`,`Mahou Shoujo`,`Mecha`,`Music`,`Mystery`,`Psychological`,`Romance`,`Sci-Fi`,`Slice of Life`,`Sports`,`Supernatural`,`Thriller`],gs=new Set(hs.map(e=>e.toLowerCase())),_s=e=>gs.has(e.trim().toLowerCase()),vs=(e,t)=>e.find(e=>e===t)??null,ys=(e,t)=>t.map(t=>vs(e,t)).filter(e=>e!==null),bs=e=>ps.map(e=>e.value).find(t=>t===e)??null,xs=ds.map(e=>e.value),Ss=fs.map(e=>e.value),Cs=ps.map(e=>e.value),ws=ms.map(e=>e.value),Ts=1917,Es=(e=new Date)=>e.getFullYear()+5,Ds=(e,t=new Date)=>{if(!e||!/^\d{4}$/.test(e))return null;let n=Number(e);return n>=1917&&n<=Es(t)?n:null},Os=(e,t=new Date)=>{let n=new URLSearchParams(e);return{query:(n.get(us.query)??``).trim(),category:vs(ws,n.get(us.category)),status:vs(Ss,n.get(us.status)),season:vs(Cs,n.get(us.season)),year:Ds(n.get(us.year),t),formats:ys(xs,n.getAll(us.format)),genres:ks(n.getAll(us.genre)),tags:ks(n.getAll(us.tag))}},ks=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},As=e=>{let t=new URLSearchParams,n=e.query?.trim();n&&t.set(us.query,n),e.category&&t.set(us.category,e.category),e.status&&t.set(us.status,e.status),e.season&&t.set(us.season,e.season),e.year&&t.set(us.year,String(e.year));for(let n of e.formats??[])t.append(us.format,n);for(let n of e.genres??[])t.append(us.genre,n);for(let n of e.tags??[])t.append(us.tag,n);return t.toString()},js=e=>{if(!e)return``;try{return decodeURIComponent(e)}catch{return e}},Ms=(e={})=>{let t=As(e);return t?`/search?${t}`:`/search`},Ns=e=>{if(e.query)return`Results for \u201C${e.query}\u201D`;let t=ps.find(t=>t.value===e.season)?.label;return t&&e.year?`${t} ${e.year}`:t?`${t} seasons`:e.year?String(e.year):Ls(e)?`Browsing`:`Search`},Ps=e=>ds.find(t=>t.value===e)?.label,Fs=e=>fs.find(t=>t.value===e)?.label,Is=(e,t)=>{let n=ps.find(t=>t.value===e)?.label;return n&&t?`${n} ${t}`:t?String(t):void 0},Ls=e=>!!(e.query||e.category||e.status||e.season||e.year||e.formats.length||e.genres.length||e.tags.length),Rs=e=>!!(e.query||e.status||e.season||e.year||e.formats.length||e.genres.length||e.tags.length),zs=`plugins`,Bs=`plugin`,Vs=(e,t)=>{try{return new URL(e,t)}catch{return}},Hs=e=>{let t=new Set;return e.filter(e=>{let n=Us(e);return!n||t.has(n)?!1:(t.add(n),!0)})},Us=e=>e.trim().replace(/\/+$/,``).replace(/@\d[^@/]*$/,``),Ws=(e,t)=>{let n=Vs(e,t);return n?Hs([...n.searchParams].filter(([e])=>e===`plugins`||e===Bs).map(([,e])=>e.trim())):[]},Gs=e=>encodeURIComponent(e).replace(/%3A/g,`:`).replace(/%2F/g,`/`).replace(/%40/g,`@`),Ks=(e,t,n)=>{let r=Vs(e,n),i=Vs(n);return!r||!i||r.origin!==i.origin?e:(r.searchParams.delete(zs),r.searchParams.delete(Bs),r.search=[r.searchParams.toString(),Hs(t.map(e=>e.trim())).sort().map(e=>`${zs}=${Gs(e)}`).join(`&`)].filter(Boolean).join(`&`),r.href)},qs=new Map,Js=new Set,Ys=new Set,Xs=()=>Ys.forEach(e=>{try{e()}catch{}}),Zs=e=>(Ys.add(e),()=>{Ys.delete(e)}),Qs=()=>[...qs.values()],$s=()=>[...qs.keys()],ec=e=>{let t=new Set(br().map(Us)),n=!1;for(let r of e){let e=Us(r);!e||t.has(e)||Js.has(e)||qs.has(r)||(qs.set(r,{uri:r,state:`offered`}),n=!0)}n&&Xs()},tc=()=>{if(qs.size){for(let e of qs.keys())Js.add(Us(e));qs.clear(),Xs()}},nc=async()=>{let e=[...qs.keys()];if(e.length){for(let t of e)qs.set(t,{uri:t,state:`installing`});Xs();for(let t of e){try{await Ar(t,{noConfirm:!0})||Js.add(Us(t)),qs.delete(t)}catch(e){qs.set(t,{uri:t,state:`error`,error:e instanceof Error?e.message:String(e)})}Xs()}}},rc=e=>{qs.delete(e)&&(Js.add(Us(e)),Xs())},ic=()=>[...br(),...$s()],ac=()=>{let e=Ks(location.href,ic(),location.href);e!==location.href&&history.replaceState(history.state,``,e)},oc=()=>ec(Ws(location.href)),sc=e=>{let t=Ks(e,ic(),location.href);return t.startsWith(location.origin)?t.slice(location.origin.length):t},cc=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,Ks(i,ic(),location.href))}},lc=Symbol.for(`stub_plugin_url`);lc in globalThis||(Object.defineProperty(globalThis,lc,{value:!0}),cc(`pushState`),cc(`replaceState`),addEventListener(`popstate`,()=>{oc(),ac()}),vr(ac),Zs(ac),oc(),ac());var uc=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),dc=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),fc=e=>{let t=dc(e);return t.charAt(0).toUpperCase()+t.slice(1)},pc=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),mc=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},hc={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`};le();var gc=b(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>ie(`svg`,{ref:c,...hc,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:pc(`lucide`,i),...!a&&!mc(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>ie(e,t)),...Array.isArray(a)?a:[a]]));le();var X=(e,t)=>{let n=b(({className:n,...r},i)=>ie(gc,{ref:i,iconNode:t,className:pc(`lucide-${uc(fc(e))}`,`lucide-${e}`,n),...r}));return n.displayName=fc(e),n},_c=X(`ban`,[[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),vc=X(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),yc=X(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),bc=X(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),xc=X(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Sc=X(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Cc=X(`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`}]]),wc=X(`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`}]]),Tc=X(`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`}]]),Ec=X(`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`}]]),Dc=X(`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`}]]),Oc=X(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),kc=X(`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`}]]),Ac=X(`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`}]]),jc=X(`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`}]]),Mc=X(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Nc=X(`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`}]]),Pc=X(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Fc=X(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Ic=X(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Lc=X(`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`}]]),Rc=X(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),zc=X(`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`}]]),Bc=X(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Vc=X(`sliders-horizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),Hc=X(`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`}]]),Uc=X(`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`}]]),Wc=X(`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`}]]),Gc=X(`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`}]]),Kc=X(`volume-1`,[[`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`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}]]),qc=X(`volume-2`,[[`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`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),Jc=X(`volume-x`,[[`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`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),Yc=X(`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`}]]),Xc=X(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Zc=e=>e===`/`||e===`/media`||e.startsWith(`/media/`),Qc=({from:e,to:t,kind:n,asked:r=!1})=>r?!0:n===`pop`||Zc(e.pathname)&&Zc(t.pathname)?!1:n!==`replace`||e.pathname!==t.pathname,$c=()=>{window.scrollTo({top:0,left:0,behavior:`instant`})},el=0,tl=()=>{nl(),el=requestAnimationFrame(()=>{el=0,$c()})},nl=()=>{cancelAnimationFrame(el),el=0},rl=!1,il=()=>{rl=!0},al=()=>{let e=rl;return rl=!1,e},ol=[`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])`].join(`,`),sl=typeof Element>`u`,cl=sl?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ll=!sl&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},ul=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)},dl=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},fl=function(e,t,n){if(ul(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ol));return t&&cl.call(e,ol)&&r.unshift(e),r=r.filter(n),r},pl=function e(t,n,r){for(var i=[],a=Array.from(t);a.length;){var o=a.shift();if(!ul(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{cl.call(o,ol)&&r.filter(o)&&(n||!t.includes(o))&&i.push(o);var l=o.shadowRoot||typeof r.getShadowRoot==`function`&&r.getShadowRoot(o),u=!ul(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},ml=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},hl=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||dl(e))&&!ml(e)?0:e.tabIndex},gl=function(e,t){var n=hl(e);return n<0&&t&&!ml(e)?0:n},_l=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},vl=function(e){return e.tagName===`INPUT`},yl=function(e){return vl(e)&&e.type===`hidden`},bl=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},xl=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},Sl=function(e){if(!e.name)return!0;var t=e.form||ll(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=xl(r,e.form);return!i||i===e},Cl=function(e){return vl(e)&&e.type===`radio`},wl=function(e){return Cl(e)&&!Sl(e)},Tl=function(e){var t=e&&ll(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=ll(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},El=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},Dl=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(getComputedStyle(e).visibility===`hidden`)return!0;var i=cl.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(cl.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=ll(e);if(o&&!o.shadowRoot&&r(o)===!0)return El(e);e=e.assignedSlot?e.assignedSlot:!o&&s!==e.ownerDocument?s.host:o}e=a}if(Tl(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return El(e);return!1},Ol=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 cl.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},kl=function(e,t){return!(t.disabled||ul(t)||yl(t)||Dl(t,e)||bl(t)||Ol(t))},Al=function(e,t){return!(wl(t)||hl(t)<0||!kl(e,t))},jl=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},Ml=function e(t){var n=[],r=[];return t.forEach(function(t,i){var a=!!t.scopeParent,o=a?t.scopeParent:t,s=gl(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(_l).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(n)},Nl=function(e,t){return t||={},Ml(t.getShadowRoot?pl([e],t.includeContainer,{filter:Al.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:jl}):fl(e,t.includeContainer,Al.bind(null,t)))},Pl=function(e,t){return t||={},t.getShadowRoot?pl([e],t.includeContainer,{filter:kl.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):fl(e,t.includeContainer,kl.bind(null,t))},Fl=function(e,t){if(t||={},!e)throw Error(`No node provided`);return cl.call(e,ol)!==!1&&Al(t,e)};le();function Il(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Ll(){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 Rl(){return/apple/i.test(navigator.vendor)}function zl(){let e=/android/i;return e.test(Il())||e.test(Ll())}function Bl(){return Ll().includes(`jsdom/`)}var Vl=`data-floating-ui-focusable`,Hl=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`;function Ul(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 Wl(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&p(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Gl(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Kl(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 ql(e){return e.matches(`html,body`)}function Jl(e){return e?.ownerDocument||document}function Yl(e){return t(e)&&e.matches(Hl)}function Xl(e){return e?e.getAttribute(`role`)===`combobox`&&Yl(e):!1}function Zl(e){return e?e.hasAttribute(Vl)?e:e.querySelector(`[`+Vl+`]`)||e:null}function Ql(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Ql(e,t.id,n)])}function $l(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 eu(e){e.preventDefault(),e.stopPropagation()}function tu(e){return`nativeEvent`in e}function nu(e){return e.mozInputSource===0&&e.isTrusted?!0:zl()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function ru(e){return Bl()?!1:!zl()&&e.width===0&&e.height===0||zl()&&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 iu(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var au=typeof document<`u`?S:function(){},ou={...s};function su(e){let t=w(e);return au(()=>{t.current=e}),t}var cu=ou.useInsertionEffect||(e=>e());function lu(e){let t=w(()=>{});return cu(()=>{t.current=e}),U(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}var uu=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function du(e,t){let n=Nl(e,uu()),r=n.length;if(r===0)return;let i=Ul(Jl(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function fu(e){return du(Jl(e).body,1)||e}function pu(e){return du(Jl(e).body,-1)||e}function mu(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Wl(n,r)}function hu(e){Nl(e,uu()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function gu(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}le();var _u=typeof document<`u`?S:function(){};function vu(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(!vu(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)&&!vu(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function yu(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function bu(e,t){let n=yu(e);return Math.round(t*n)/n}function xu(e){let t=w(e);return _u(()=>{t.current=e}),t}function Su(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]=V({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=V(r);vu(f,r)||p(r);let[m,h]=V(null),[g,_]=V(null),v=U(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=U(e=>{e!==T.current&&(T.current=e,_(e))},[]),b=a||m,S=o||g,C=w(null),T=w(null),E=w(u),O=c!=null,k=xu(c),A=xu(i),j=xu(l),M=U(()=>{if(!C.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};A.current&&(e.platform=A.current),_e(C.current,T.current,e).then(e=>{let t={...e,isPositioned:j.current!==!1};N.current&&!vu(E.current,t)&&(E.current=t,x(()=>{d(t)}))})},[f,t,n,A,j]);_u(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let N=w(!1);_u(()=>(N.current=!0,()=>{N.current=!1}),[]),_u(()=>{if(b&&(C.current=b),S&&(T.current=S),b&&S){if(k.current)return k.current(b,S,M);M()}},[b,S,M,k,O]);let P=D(()=>({reference:C,floating:T,setReference:v,setFloating:y}),[v,y]),F=D(()=>({reference:b,floating:S}),[b,S]),I=D(()=>{let e={position:n,left:0,top:0};if(!F.floating)return e;let t=bu(F.floating,u.x),r=bu(F.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...yu(F.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,F.floating,u.x,u.y]);return D(()=>({...u,update:M,refs:P,elements:F,floatingStyles:I}),[u,M,P,F,I])}var Cu=(e,t)=>({...ge(e),options:[e,t]}),wu=(e,t)=>({...v(e),options:[e,t]}),Tu=(e,t)=>({...O(e),options:[e,t]}),Eu=(e,t)=>({...r(e),options:[e,t]});le(),me();var Du=`data-floating-ui-focusable`,Ou=`active`,ku=`selected`,Au=`ArrowLeft`,ju=`ArrowRight`,Mu=`ArrowUp`,Nu=`ArrowDown`,Pu=[Au,ju],Fu=[Mu,Nu];[...Pu,...Fu];var Iu={...s},Lu=!1,Ru=0,zu=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+Ru++;function Bu(){let[e,t]=V(()=>Lu?zu():void 0);return au(()=>{e??t(zu())},[]),N(()=>{Lu=!0},[]),e}var Vu=Iu.useId||Bu;function Hu(){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 Uu=A(null),Wu=A(null),Gu=()=>R(Uu)?.id||null,Ku=()=>R(Wu);function qu(e){return`data-floating-ui-`+e}function Ju(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}var Yu=qu(`safe-polygon`);function Xu(e,t,n){if(n&&!iu(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 Zu(e){return typeof e==`function`?e():e}function Qu(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=Ku(),m=Gu(),h=su(l),g=su(c),_=su(n),v=su(d),y=w(),b=w(-1),x=w(),S=w(-1),C=w(!0),T=w(!1),E=w(()=>{}),O=w(!1),k=lu(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});N(()=>{if(!s)return;function e(e){let{open:t}=e;t||(Ju(b),Ju(S),C.current=!0,O.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[s,a]),N(()=>{if(!s||!h.current||!n)return;function e(e){k()&&r(!1,e,`hover`)}let t=Jl(o.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[o.floating,n,r,s,h,k]);let A=U(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=Xu(g.current,`close`,y.current);i&&!x.current?(Ju(b),b.current=window.setTimeout(()=>r(!1,e,n),i)):t&&(Ju(b),r(!1,e,n))},[g,r]),j=lu(()=>{E.current(),x.current=void 0}),M=lu(()=>{if(T.current){let e=Jl(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(Yu),T.current=!1}}),P=lu(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);N(()=>{if(!s)return;function e(e){if(Ju(b),C.current=!1,u&&!iu(y.current)||Zu(v.current)>0&&!Xu(g.current,`open`))return;let t=Xu(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(P()){M();return}E.current();let t=Jl(o.floating);if(Ju(S),O.current=!1,h.current&&i.current.floatingContext){n||Ju(b),x.current=h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){M(),j(),P()||A(e,!0,`safe-polygon`)}});let r=x.current;t.addEventListener(`mousemove`,r),E.current=()=>{t.removeEventListener(`mousemove`,r)};return}(y.current!==`touch`||!Wl(o.floating,e.relatedTarget))&&A(e)}function a(e){P()||i.current.floatingContext&&(h.current==null||h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){M(),j(),P()||A(e)}})(e))}function c(){Ju(b)}function l(e){P()||A(e,!1)}if(re(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,A,j,M,r,n,_,p,g,h,i,P,v]),au(()=>{var e;if(s&&n&&(e=h.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&k()){T.current=!0;let e=o.floating;if(re(o.domReference)&&e){var t;let n=Jl(o.floating).body;n.setAttribute(Yu,``);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,k]),au(()=>{n||(y.current=void 0,O.current=!1,j(),M())},[n,j,M]),N(()=>()=>{j(),Ju(b),Ju(S),M()},[s,o.domReference,j,M]);let F=D(()=>{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||iu(y.current))&&(n||Zu(v.current)===0||O.current&&e.movementX**2+e.movementY**2<2||(Ju(S),y.current===`touch`?i():(O.current=!0,S.current=window.setTimeout(i,Zu(v.current)))))}}},[u,r,n,_,v]);return D(()=>s?{reference:F}:{},[s,F])}var $u=0;function ed(e,t){t===void 0&&(t={});let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame($u);let a=()=>e?.focus({preventScroll:n});i?a():$u=requestAnimationFrame(a)}function td(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&p(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function nd(e){return`composedPath`in e?e.composedPath()[0]:e.target}function rd(e){return e?.ownerDocument||document}var id={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function ad(e){return e===`inert`?id.inert:e===`aria-hidden`?id[`aria-hidden`]:id.none}var od=new WeakSet,sd={},cd=0,ld=()=>typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype,ud=e=>e&&(e.host||ud(e.parentNode)),dd=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=ud(t);return e.contains(n)?n:null}).filter(e=>e!=null);function fd(e,t,n,r){let i=`data-floating-ui-inert`,o=r?`inert`:n?`aria-hidden`:null,s=dd(t,e),c=new Set,l=new Set(s),u=[];sd[i]||(sd[i]=new WeakMap);let d=sd[i];s.forEach(f),p(t),c.clear();function f(e){e&&!c.has(e)&&(c.add(e),e.parentNode&&f(e.parentNode))}function p(e){e&&!l.has(e)&&[].forEach.call(e.children,e=>{if(a(e)!==`script`){if(c.has(e))p(e);else{let t=o?e.getAttribute(o):null,n=t!==null&&t!==`false`,r=ad(o),a=(r.get(e)||0)+1,s=(d.get(e)||0)+1;r.set(e,a),d.set(e,s),u.push(e),a===1&&n&&od.add(e),s===1&&e.setAttribute(i,``),!n&&o&&e.setAttribute(o,o===`inert`?``:`true`)}}})}return cd++,()=>{u.forEach(e=>{let t=ad(o),n=(t.get(e)||0)-1,r=(d.get(e)||0)-1;t.set(e,n),d.set(e,r),n||(!od.has(e)&&o&&e.removeAttribute(o),od.delete(e)),r||e.removeAttribute(i)}),cd--,cd||(id.inert=new WeakMap,id[`aria-hidden`]=new WeakMap,id.none=new WeakMap,od=new WeakSet,sd={})}}function pd(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);let r=rd(e[0]).body;return fd(e.concat(Array.from(r.querySelectorAll(`[aria-live],[role="status"],output`))),r,t,n)}var md={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},hd=b(function(e,t){let[n,r]=V();au(()=>{Rl()&&r(`button`)},[]);let i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[qu(`focus-guard`)]:``,style:md};return W(`span`,{...e,...i})}),gd=A(null),_d=qu(`portal`);function vd(e){e===void 0&&(e={});let{id:t,root:n}=e,r=Vu(),i=bd(),[a,o]=V(null),s=w(null);return au(()=>()=>{a?.remove(),queueMicrotask(()=>{s.current=null})},[a]),au(()=>{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(_d,``),e.appendChild(n),s.current=n,o(n)},[t,r]),au(()=>{if(n===null||!r||s.current)return;let e=n||i?.portalNode;e&&!f(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(_d,``),e=a||e,e.appendChild(c),s.current=c,o(c)},[t,n,r,i]),a}function yd(e){let{children:t,id:n,root:r,preserveTabOrder:i=!0}=e,a=vd({id:n,root:r}),[o,s]=V(null),l=w(null),u=w(null),d=w(null),f=w(null),p=o?.modal,m=o?.open,h=!!o&&!o.modal&&o.open&&i&&!!(r||a);return N(()=>{if(!a||!i||p)return;function e(e){a&&mu(e)&&(e.type===`focusin`?gu:hu)(a)}return a.addEventListener(`focusin`,e,!0),a.addEventListener(`focusout`,e,!0),()=>{a.removeEventListener(`focusin`,e,!0),a.removeEventListener(`focusout`,e,!0)}},[a,i,p]),N(()=>{a&&(m||gu(a))},[m,a]),W(gd.Provider,{value:D(()=>({preserveTabOrder:i,beforeOutsideRef:l,afterOutsideRef:u,beforeInsideRef:d,afterInsideRef:f,portalNode:a,setFocusManagerState:s}),[i,a]),children:[h&&a&&W(hd,{"data-type":`outside`,ref:l,onFocus:e=>{if(mu(e,a)){var t;(t=d.current)==null||t.focus()}else pu(o?o.domReference:null)?.focus()}}),h&&a&&W(`span`,{"aria-owns":a.id,style:md}),a&&c(t,a),h&&a&&W(hd,{"data-type":`outside`,ref:u,onFocus:e=>{if(mu(e,a)){var t;(t=f.current)==null||t.focus()}else fu(o?o.domReference:null)?.focus(),o!=null&&o.closeOnFocusOut&&o?.onOpenChange(!1,e.nativeEvent,`focus-out`)}})]})}var bd=()=>R(gd);function xd(e){return D(()=>t=>{e.forEach(e=>{e&&(e.current=t)})},e)}var Sd=20,Cd=[];function wd(){Cd=Cd.filter(e=>e.isConnected)}function Td(e){wd(),e&&a(e)!==`body`&&(Cd.push(e),Cd.length>Sd&&(Cd=Cd.slice(-20)))}function Ed(){return wd(),Cd[Cd.length-1]}function Dd(e){let t=uu();return Fl(e,t)?e:Nl(e,t)[0]||e}function Od(e,t){var n;if(!t.current.includes(`floating`)&&!((n=e.getAttribute(`role`))!=null&&n.includes(`dialog`)))return;let r=uu(),i=Pl(e,r).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Fl(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 kd=b(function(e,t){return W(`button`,{...e,type:`button`,ref:t,tabIndex:-1,style:md})});function Ad(e){let{context:n,children:r,disabled:i=!1,order:a=[`content`],guards:o=!0,initialFocus:s=0,returnFocus:c=!0,restoreFocus:l=!1,modal:u=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:f=!0,outsideElementsInert:p=!1,getInsideElements:m=()=>[]}=e,{open:h,onOpenChange:g,events:_,dataRef:v,elements:{domReference:y,floating:b}}=n,x=lu(()=>v.current.floatingContext?.nodeId),S=lu(m),C=typeof s==`number`&&s<0,T=Xl(y)&&C,E=ld(),D=!E||o,O=!D||E&&p,k=su(a),A=su(s),j=su(c),P=Ku(),F=bd(),I=w(null),ee=w(null),L=w(!1),te=w(!1),R=w(-1),ne=w(-1),re=F!=null,z=Zl(b),ie=lu(function(e){return e===void 0&&(e=z),e?Nl(e,uu()):[]}),B=lu(e=>{let t=ie(e);return k.current.map(e=>y&&e===`reference`?y:z&&e===`floating`?z:t).filter(Boolean).flat()});N(()=>{if(i||!u)return;function e(e){if(e.key===`Tab`){Wl(z,Ul(Jl(z)))&&ie().length===0&&!T&&eu(e);let t=B(),n=Gl(e);k.current[0]===`reference`&&n===y&&(eu(e),e.shiftKey?ed(t[t.length-1]):ed(t[1])),k.current[1]===`floating`&&n===z&&e.shiftKey&&(eu(e),ed(t[0]))}}let t=Jl(z);return t.addEventListener(`keydown`,e),()=>{t.removeEventListener(`keydown`,e)}},[i,y,z,u,k,T,ie,B]),N(()=>{if(i||!b)return;function e(e){let t=Gl(e),n=ie().indexOf(t);n!==-1&&(R.current=n)}return b.addEventListener(`focusin`,e),()=>{b.removeEventListener(`focusin`,e)}},[i,b,ie]),N(()=>{if(i||!f)return;function e(){te.current=!0,setTimeout(()=>{te.current=!1})}function n(e){let n=e.relatedTarget,r=e.currentTarget,i=Gl(e);queueMicrotask(()=>{let a=x(),o=!(Wl(y,n)||Wl(b,n)||Wl(n,b)||Wl(F?.portalNode,n)||n!=null&&n.hasAttribute(qu(`focus-guard`))||P&&(Ql(P.nodesRef.current,a).find(e=>Wl(e.context?.elements.floating,n)||Wl(e.context?.elements.domReference,n))||$l(P.nodesRef.current,a).find(e=>[e.context?.elements.floating,Zl(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===y&&z&&Od(z,k),l&&r!==y&&!(i!=null&&i.isConnected)&&Ul(Jl(z))===Jl(z).body){t(z)&&z.focus();let e=R.current,n=ie(),r=n[e]||n[n.length-1]||z;t(r)&&r.focus()}if(v.current.insideReactTree){v.current.insideReactTree=!1;return}(T||!u)&&n&&o&&!te.current&&n!==Ed()&&(L.current=!0,g(!1,e,`focus-out`))})}let r=!(P||!F);function a(){Ju(ne),v.current.insideReactTree=!0,ne.current=window.setTimeout(()=>{v.current.insideReactTree=!1})}if(b&&t(y))return y.addEventListener(`focusout`,n),y.addEventListener(`pointerdown`,e),b.addEventListener(`focusout`,n),r&&b.addEventListener(`focusout`,a,!0),()=>{y.removeEventListener(`focusout`,n),y.removeEventListener(`pointerdown`,e),b.removeEventListener(`focusout`,n),r&&b.removeEventListener(`focusout`,a,!0)}},[i,y,b,z,u,P,F,g,f,l,ie,T,x,k,v]);let ae=w(null),V=w(null),oe=xd([ae,F?.beforeInsideRef]),se=xd([V,F?.afterInsideRef]);N(()=>{var e,t;if(i||!b)return;let n=Array.from((F==null||(e=F.portalNode)==null?void 0:e.querySelectorAll(`[`+qu(`portal`)+`]`))||[]),r=(t=(P?$l(P.nodesRef.current,x()):[]).find(e=>Xl(e.context?.elements.domReference||null)))==null||(t=t.context)==null?void 0:t.elements.domReference,a=[b,r,...n,...S(),I.current,ee.current,ae.current,V.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,k.current.includes(`reference`)||T?y:null].filter(e=>e!=null),o=u||T?pd(a,!O,O):pd(a);return()=>{o()}},[i,y,b,u,k,F,T,D,O,P,x,S]),au(()=>{if(i||!t(z))return;let e=Ul(Jl(z));queueMicrotask(()=>{let t=B(z),n=A.current,r=(typeof n==`number`?t[n]:n.current)||z,i=Wl(z,e);!C&&!i&&h&&ed(r,{preventScroll:r===z})})},[i,h,z,C,B,A]),au(()=>{if(i||!z)return;let e=Jl(z);Td(Ul(e));function n(e){let{reason:t,event:n,nested:r}=e;if([`hover`,`safe-polygon`].includes(t)&&n.type===`mouseleave`&&(L.current=!0),t===`outside-press`){if(r)L.current=!1;else if(nu(n)||ru(n))L.current=!1;else{let e=!1;document.createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?L.current=!1:L.current=!0}}}_.on(`openchange`,n);let r=e.createElement(`span`);r.setAttribute(`tabindex`,`-1`),r.setAttribute(`aria-hidden`,`true`),Object.assign(r.style,md),re&&y&&y.insertAdjacentElement(`afterend`,r);function a(){if(typeof j.current==`boolean`){let e=y||Ed();return e&&e.isConnected?e:r}return j.current.current||r}return()=>{_.off(`openchange`,n);let i=Ul(e),o=Wl(b,i)||P&&Ql(P.nodesRef.current,x(),!1).some(e=>Wl(e.context?.elements.floating,i)),s=a();queueMicrotask(()=>{let n=Dd(s);j.current&&!L.current&&t(n)&&(n===i||i===e.body||o)&&n.focus({preventScroll:!0}),r.remove()})}},[i,b,z,j,v,_,P,re,y,x]),N(()=>(queueMicrotask(()=>{L.current=!1}),()=>{queueMicrotask(wd)}),[i]),au(()=>{if(!i&&F)return F.setFocusManagerState({modal:u,closeOnFocusOut:f,open:h,onOpenChange:g,domReference:y}),()=>{F.setFocusManagerState(null)}},[i,F,u,h,g,f,y]),au(()=>{i||z&&Od(z,k)},[i,z,k]);function ce(e){return i||!d||!u?null:W(kd,{ref:e===`start`?I:ee,onClick:e=>g(!1,e.nativeEvent),children:typeof d==`string`?d:`Dismiss`})}let le=!i&&D&&(!u||!T)&&(re||u);return W(M,{children:[le&&W(hd,{"data-type":`inside`,ref:oe,onFocus:e=>{if(u){let e=B();ed(a[0]===`reference`?e[0]:e[e.length-1])}else if(F!=null&&F.preserveTabOrder&&F.portalNode){if(L.current=!1,mu(e,F.portalNode))fu(y)?.focus();else{var t;(t=F.beforeOutsideRef.current)==null||t.focus()}}}}),!T&&ce(`start`),r,ce(`end`),le&&W(hd,{"data-type":`inside`,ref:se,onFocus:e=>{if(u)ed(B()[0]);else if(F!=null&&F.preserveTabOrder&&F.portalNode){if(f&&(L.current=!0),mu(e,F.portalNode))pu(y)?.focus();else{var t;(t=F.afterOutsideRef.current)==null||t.focus()}}}})]})}var jd=0,Md=`--floating-ui-scrollbar-width`;function Nd(){let e=Il(),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(Md,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(Md),t&&(Object.assign(n,{position:``,top:``,left:``,right:``}),window.scrollTo(a,o))}}var Pd=()=>{},Fd=b(function(e,t){let{lockScroll:n=!1,...r}=e;return au(()=>{if(n)return jd++,jd===1&&(Pd=Nd()),()=>{jd--,jd===0&&Pd()}},[n]),W(`div`,{ref:t,...r,style:{position:`fixed`,overflow:`auto`,top:0,right:0,bottom:0,left:0,...r.style}})});function Id(e){return t(e.target)&&e.target.tagName===`BUTTON`}function Ld(e){return t(e.target)&&e.target.tagName===`A`}function Rd(e){return Yl(e)}function zd(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=w(),p=w(!1),m=D(()=>({onPointerDown(e){f.current=e.pointerType},onMouseDown(e){let t=f.current;e.button===0&&s!==`click`&&(iu(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;if(s===`mousedown`&&f.current){f.current=void 0;return}iu(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||Id(e))&&(e.key===` `&&!Rd(a)&&(e.preventDefault(),p.current=!0),!Ld(e)&&e.key===`Enter`&&r(!(n&&c),e.nativeEvent,`click`))},onKeyUp(e){e.defaultPrevented||!u||Id(e)||Rd(a)||e.key===` `&&p.current&&(p.current=!1,r(!(n&&c),e.nativeEvent,`click`))}}),[i,a,s,l,u,r,n,d,c]);return D(()=>o?{reference:m}:{},[o,m])}var Bd={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},Vd={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},Hd=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function Ud(e,n){n===void 0&&(n={});let{open:r,onOpenChange:a,elements:o,dataRef:s}=e,{enabled:c=!0,escapeKey:l=!0,outsidePress:u=!0,outsidePressEvent:d=`pointerdown`,referencePress:f=!1,referencePressEvent:p=`pointerdown`,ancestorScroll:g=!1,bubbles:_,capture:v}=n,b=Ku(),x=lu(typeof u==`function`?u:()=>!1),S=typeof u==`function`?x:u,C=w(!1),{escapeKey:T,outsidePress:E}=Hd(_),{escapeKey:O,outsidePress:k}=Hd(v),A=w(!1),j=lu(e=>{if(!r||!c||!l||e.key!==`Escape`||A.current)return;let t=s.current.floatingContext?.nodeId,n=b?Ql(b.nodesRef.current,t):[];if(!T&&(e.stopPropagation(),n.length>0)){let e=!0;if(n.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}a(!1,tu(e)?e.nativeEvent:e,`escape-key`)}),M=lu(e=>{var t;let n=()=>{var t;j(e),(t=Gl(e))==null||t.removeEventListener(`keydown`,n)};(t=Gl(e))==null||t.addEventListener(`keydown`,n)}),P=lu(e=>{let n=s.current.insideReactTree;s.current.insideReactTree=!1;let r=C.current;if(C.current=!1,d===`click`&&r||n||typeof S==`function`&&!S(e))return;let i=Gl(e),c=`[`+qu(`inert`)+`]`,l=Jl(o.floating).querySelectorAll(c),u=re(i)?i:null;for(;u&&!ne(u);){let e=m(u);if(ne(e)||!re(e))break;u=e}if(l.length&&re(i)&&!ql(i)&&!Wl(i,o.floating)&&Array.from(l).every(e=>!Wl(u,e)))return;if(t(i)&&ee){let t=ne(i),n=y(i),r=/auto|scroll/,a=t||r.test(n.overflowX),o=t||r.test(n.overflowY),s=a&&i.clientWidth>0&&i.scrollWidth>i.clientWidth,c=o&&i.clientHeight>0&&i.scrollHeight>i.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=i.offsetWidth-i.clientWidth:e.offsetX>i.clientWidth),d=s&&e.offsetY>i.clientHeight;if(u||d)return}let f=s.current.floatingContext?.nodeId,p=b&&Ql(b.nodesRef.current,f).some(t=>Kl(e,t.context?.elements.floating));if(Kl(e,o.floating)||Kl(e,o.domReference)||p)return;let h=b?Ql(b.nodesRef.current,f):[];if(h.length>0){let e=!0;if(h.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}a(!1,e,`outside-press`)}),F=lu(e=>{var t;let n=()=>{var t;P(e),(t=Gl(e))==null||t.removeEventListener(d,n)};(t=Gl(e))==null||t.addEventListener(d,n)});N(()=>{if(!r||!c)return;s.current.__escapeKeyBubbles=T,s.current.__outsidePressBubbles=E;let e=-1;function t(e){a(!1,e,`ancestor-scroll`)}function n(){window.clearTimeout(e),A.current=!0}function u(){e=window.setTimeout(()=>{A.current=!1},h()?5:0)}let f=Jl(o.floating);l&&(f.addEventListener(`keydown`,O?M:j,O),f.addEventListener(`compositionstart`,n),f.addEventListener(`compositionend`,u)),S&&f.addEventListener(d,k?F:P,k);let p=[];return g&&(re(o.domReference)&&(p=i(o.domReference)),re(o.floating)&&(p=p.concat(i(o.floating))),!re(o.reference)&&o.reference&&o.reference.contextElement&&(p=p.concat(i(o.reference.contextElement)))),p=p.filter(e=>e!==f.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{l&&(f.removeEventListener(`keydown`,O?M:j,O),f.removeEventListener(`compositionstart`,n),f.removeEventListener(`compositionend`,u)),S&&f.removeEventListener(d,k?F:P,k),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[s,o,l,S,d,r,a,g,c,T,E,j,O,M,P,k,F]),N(()=>{s.current.insideReactTree=!1},[s,S,d]);let I=D(()=>({onKeyDown:j,...f&&{[Bd[p]]:e=>{a(!1,e.nativeEvent,`reference-press`)},...p!==`click`&&{onClick(e){a(!1,e.nativeEvent,`reference-press`)}}}}),[j,a,f,p]),ee=D(()=>({onKeyDown:j,onMouseDown(){C.current=!0},onMouseUp(){C.current=!0},[Vd[d]]:()=>{s.current.insideReactTree=!0}}),[j,d,s]);return D(()=>c?{reference:I,floating:ee}:{},[c,I,ee])}function Wd(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=Vu(),a=w({}),[o]=V(()=>Hu()),s=Gu()!=null,[c,l]=V(r.reference),u=lu((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=D(()=>({setPositionReference:l}),[]),f=D(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return D(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function Gd(e){e===void 0&&(e={});let{nodeId:t}=e,n=Wd({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[a,o]=V(null),[s,c]=V(null),l=i?.domReference||a,u=w(null),d=Ku();au(()=>{l&&(u.current=l)},[l]);let f=Su({...e,elements:{...i,...s&&{reference:s}}}),p=U(e=>{let t=re(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;c(t),f.refs.setReference(t)},[f.refs]),m=U(e=>{(re(e)||e===null)&&(u.current=e,o(e)),(re(f.refs.reference.current)||f.refs.reference.current===null||e!==null&&!re(e))&&f.refs.setReference(e)},[f.refs]),h=D(()=>({...f.refs,setReference:m,setPositionReference:p,domReference:u}),[f.refs,m,p]),g=D(()=>({...f.elements,domReference:l}),[f.elements,l]),_=D(()=>({...f,...r,refs:h,elements:g,nodeId:t}),[f,h,g,t,r]);return au(()=>{r.dataRef.current.floatingContext=_;let e=d?.nodesRef.current.find(e=>e.id===t);e&&(e.context=_)}),D(()=>({...f,context:_,refs:h,elements:g}),[f,h,g,_])}function Kd(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[Ou]:t,[ku]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[Du]:``},...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&&[Ou,ku].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 qd(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=U(t=>Kd(t,e,`reference`),t),a=U(t=>Kd(t,e,`floating`),n),o=U(t=>Kd(t,e,`item`),r);return D(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}var Jd=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Yd(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=Vu(),c=r.domReference?.id||s,l=D(()=>Zl(r.floating)?.id||i,[r.floating,i]),u=Jd.get(o)??o,d=Gu()!=null,f=D(()=>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=D(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=U(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 D(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}var Xd=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?`-`:``)+e.toLowerCase());function Zd(e,t){return typeof e==`function`?e(t):e}function Qd(e,t){let[n,r]=V(e);return e&&!n&&r(!0),N(()=>{if(!e&&n){let e=setTimeout(()=>r(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}function $d(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]=V(`unmounted`),c=Qd(n,a);return!c&&o===`close`&&s(`unmounted`),au(()=>{if(r){if(n){s(`initial`);let e=requestAnimationFrame(()=>{x(()=>{s(`open`)})});return()=>{cancelAnimationFrame(e)}}s(`close`)}},[n,r]),{isMounted:c,status:o}}function ef(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=D(()=>({side:c,placement:s}),[c,s]),u=typeof o==`number`,d=(u?o:o.open)||0,f=(u?o:o.close)||0,[p,m]=V(()=>({...Zd(a,l),...Zd(n,l)})),{isMounted:h,status:g}=$d(e,{duration:o}),_=su(n),v=su(r),y=su(i),b=su(a);return au(()=>{let e=Zd(_.current,l),t=Zd(y.current,l),n=Zd(b.current,l),r=Zd(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(Xd).join(`,`),transitionDuration:d+`ms`,...n,...r}),g===`close`){let r=t||e;m({transitionProperty:Object.keys(r).map(Xd).join(`,`),transitionDuration:f+`ms`,...n,...r})}},[f,y,_,v,b,d,g,l]),{isMounted:h,styles:p}}function tf(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...tf(e,t.id,n)])}function nf(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 rf(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function af(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(){Ju(i),u()}if(Ju(i),!c.domReference||!c.floating||s==null||n==null||o==null)return;let{clientX:m,clientY:h}=e,g=[m,h],_=nd(e),v=e.type===`mouseleave`,y=td(c.floating,_),b=td(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=rf(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&&re(e.relatedTarget)&&td(c.floating,e.relatedTarget)||f&&tf(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(!nf([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()}nf([m,h],P([n,o]))?!a&&r&&(i.current=window.setTimeout(p,40)):p()}}};return u.__options={blockPointerEvents:n},u}le();var of=({className:e,style:t}={})=>ie(`iframe`,{src:cr(),title:`Connect your FKN account`,className:e,style:{border:`none`,width:150,height:40,background:`transparent`,colorScheme:`normal`,...t}}),sf=8e3,cf=async(e,t=sf)=>{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)}},lf=()=>Promise.race([ve.info(),new Promise(e=>setTimeout(()=>e(null),4e3))]),uf=()=>{let[e,t]=V(null),[n,r]=V(!1),i=U(()=>lf().then(e=>{t(e),r(!0)}).catch(()=>r(!0)),[]);return N(()=>{let e=!1,t=ve.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:U(async()=>{let e=await cf(()=>ve.logout());return await i(),e},[i])}},df={categoryBar:1,hoverCard:150,sourcePopup:300,filterMenu:500,mediaModal:1e3,header:1100,headerPopup:1150,franchiseDialog:1200,pluginPrompt:2e3,partyCursor:3e3};H();var ff=`https://fkn.app/account`,pf=150,mf=40,hf=l`
23
23
  display: flex;
24
24
  align-items: center;
25
25
  gap: 0.8rem;
@@ -68,8 +68,8 @@ https://bit.ly/2XbVrpR#`;function oi(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
68
68
  .tier.free { color: rgba(255, 255, 255, 0.45); }
69
69
 
70
70
  .chevron { flex-shrink: 0; }
71
- `,_f=l`
72
- z-index: ${ff.headerPopup};
71
+ `,gf=l`
72
+ z-index: ${df.headerPopup};
73
73
  display: flex;
74
74
  flex-direction: column;
75
75
  min-width: 18rem;
@@ -108,10 +108,10 @@ https://bit.ly/2XbVrpR#`;function oi(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
108
108
 
109
109
  svg { flex-shrink: 0; }
110
110
  }
111
- `,vf=l`
112
- width: ${mf}px;
113
- height: ${hf}px;
114
- `,yf=()=>{let{info:e,ready:t,logout:n}=df(),[r,i]=V(!1),[a,o]=V(!1),{refs:s,floatingStyles:c,context:l}=Kd({open:r,onOpenChange:i,placement:`bottom-end`,middleware:[wu(8),Eu(),Tu({padding:8})],whileElementsMounted:he}),{getReferenceProps:u,getFloatingProps:d}=Jd([Bd(l),Wd(l),Xd(l,{role:`menu`})]);N(()=>{e||(i(!1),o(!1))},[e]);let f=async()=>{o(!0);try{await n()}finally{o(!1),i(!1)}};return t?e?I(B,{children:[I(`button`,{ref:s.setReference,css:gf,type:`button`,"aria-label":`FKN account: ${e.name||`Account`}`,...u(),children:[I(`span`,{className:`who`,children:[L(`span`,{className:`name`,children:e.name||`Account`}),L(`span`,{className:`tier ${e.premium?`premium`:`free`}`,children:e.premium?`Premium`:`Free`})]}),L(bc,{size:16,className:`chevron`})]}),r?L(bd,{children:L(jd,{context:l,modal:!1,children:I(`div`,{ref:s.setFloating,style:c,css:_f,...d(),children:[I(`a`,{className:`item`,href:pf,target:`_blank`,rel:`noreferrer`,children:[L(wc,{size:16}),`Manage account`]}),I(`button`,{className:`item`,type:`button`,disabled:a,onClick:f,children:[L(Ac,{size:16}),a?`Disconnecting...`:`Disconnect`]})]})})}):void 0]}):L(sf,{style:{flex:`none`,width:mf,height:hf}}):L(`div`,{css:vf})},bf=new Set([`nav`,`scroll`,`cursor`,`playback`,`state`,`pong`]),xf=e=>bf.has(e.t),Sf=e=>e.trim().slice(0,500)||void 0,Cf=e=>e.trim().replace(/\s+/g,` `).slice(0,32)||void 0,wf=e=>JSON.stringify({v:1,...e}),Tf=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 Ef(n.path)?{t:`nav`,path:n.path}:void 0;case`scroll`:return Of(n.y)?{t:`scroll`,y:n.y}:void 0;case`cursor`:return Of(n.x)&&Of(n.y)?{t:`cursor`,x:n.x,y:n.y}:void 0;case`chat`:{let e=typeof n.text==`string`?Sf(n.text):void 0;return e?{t:`chat`,text:e}:void 0}case`name`:{let e=typeof n.name==`string`?Cf(n.name):void 0;return e?{t:`name`,name:e}:void 0}case`ping`:return Df(n.n)&&Df(n.at)?{t:`ping`,n:n.n,at:n.at}:void 0;case`pong`:return Df(n.n)&&Df(n.at)&&Df(n.host)?{t:`pong`,n:n.n,at:n.at,host:n.host}:void 0;case`playback`:return kf(n.s)?{t:`playback`,s:n.s}:void 0;case`state`:return!Ef(n.path)||!Of(n.y)||n.s!==void 0&&!kf(n.s)?void 0:{t:`state`,path:n.path,y:n.y,...n.s?{s:n.s}:{}};default:return}},Ef=e=>typeof e==`string`&&e.length>0&&e.length<=2048&&e.startsWith(`/`)&&!e.startsWith(`//`)&&!e.startsWith(`/\\`)&&!/[\r\n\t]/.test(e),Df=e=>typeof e==`number`&&Number.isFinite(e),Of=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=1,kf=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.paused==`boolean`&&typeof t.time==`number`&&Number.isFinite(t.time)&&t.time>=0&&typeof t.rate==`number`&&Number.isFinite(t.rate)&&t.rate>0&&t.rate<=16&&typeof t.at==`number`&&Number.isFinite(t.at)},Af=1.05,jf=5e3,Mf=(e,t,n=!1)=>{if(e.paused)return e.time;let r=Math.max(t-e.at,0),i=(n?r:Math.min(r,Nf))/1e3;return e.time+i*e.rate},Nf=2e3,Pf=(e,t,n,r=!1)=>{let i={},a=Mf(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?t.rate*(o>0?Af:1/Af):t.rate;return Math.abs(e.rate-s)>.001&&(i.rate=s),i},Ff=(e,t,n)=>({...e,time:e.paused?e.time:e.time+Math.max(0,n-t)/1e3*e.rate,at:n}),If=(e,t,n)=>({rtt:n-e,offset:t-(e+n)/2}),Lf=e=>e.length?e.reduce((e,t)=>t.rtt<e.rtt?t:e):void 0,Rf=(e,t)=>e-t,zf=4e3,Bf=`stub-party-invite`,Vf=`stub-party-name`,Hf=1e4,Uf=3e4,Wf=6e4,Gf=()=>{try{return globalThis.sessionStorage}catch{return}},Kf=e=>e instanceof Error&&typeof e.code==`string`,qf=(e,t=Gf())=>{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,h,g=new Map,_=1,v=(()=>{try{return t?.getItem(`stub-party-name`)??void 0}catch{return}})(),y=e=>{n=e;for(let e of o)e(n)},b=e=>{try{t?.setItem(Bf,e)}catch{}},x=()=>{try{t?.removeItem(Bf)}catch{}},S=()=>{try{return t?.getItem(`stub-party-invite`)??void 0}catch{return}},C=e=>e.owner===e.self.id?`host`:`guest`,w=(e,t)=>{for(let n of s)n(e,t)},T=async e=>{let t=await e.members().catch(()=>void 0);r===e&&n.status===`active`&&t&&y({...n,members:t.length})},E=e=>{r&&n.status===`active`&&(xf(e)&&n.role!==`host`||r.send(wf(e)).catch(()=>{}))},D=()=>{if(!r||n.status!==`active`||n.role!==`guest`)return;let e=r,t=[];m=t;for(let n=0;n<5;n++)setTimeout(()=>{if(m!==t||r!==e)return;let n=Date.now(),i=_++;g.set(i,n),setTimeout(()=>g.delete(i),zf),E({t:`ping`,n:i,at:n})},n*400);setTimeout(()=>{if(m!==t||r!==e)return;m=void 0;let n=Lf(t);n&&(p=n)},2e3+zf)},O=()=>({t:`state`,path:a.path,y:a.y,...a.playback?{s:Ff(a.playback,a.playbackAt??Date.now(),Date.now())}:{}}),k=()=>{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},A=()=>{i?.(),i=void 0,r=void 0,c&&clearInterval(c),c=void 0,l&&clearInterval(l),l=void 0,h&&clearInterval(h),h=void 0,m=void 0,p=void 0,g.clear()},j=async e=>{r=e;let t=C(e);if(d.clear(),f.length=0,y({status:`active`,role:t,invite:e.invite,members:1,self:e.self.id,owner:e.owner}),b(e.invite),i=await e.on(n=>{if(r===e)switch(n.type){case`message`:{let r=Tf(n.message.text);if(!r)return;let i=n.message.from,a=i===e.self.id;if(r.t===`ping`){t===`host`&&!a&&E({t:`pong`,n:r.n,at:r.at,host:Date.now()});return}if(r.t===`pong`){if(t!==`guest`||i!==e.owner)return;let n=g.get(r.n);if(n===void 0||n!==r.at)return;g.delete(r.n);let a=If(n,r.host,Date.now());if(a.rtt>4e3)return;m?.push(a),p||=a;return}if(xf(r)){if(i!==e.owner||t===`host`)return;u.delete(r.t),u.set(r.t,r),w(r,{replayed:!1,from:i,self:a});return}r.t===`name`&&d.set(i,r.name),r.t===`chat`&&(f.push({seq:n.message.seq,from:i,name:d.get(i),text:r.text,at:n.message.at,self:a}),f.length>200&&f.splice(0,f.length-200)),w(r,{replayed:!1,from:i,self:a});return}case`joined`:t===`host`&&E(O()),v&&E({t:`name`,name:v}),T(e);return;case`left`:if(t===`guest`&&n.id===e.owner){M(`host-left`);return}T(e);return}}),r!==e){i(),i=void 0;return}t===`host`&&(c=setInterval(()=>E(O()),Hf)),t===`guest`&&(D(),h=setInterval(D,Wf)),l=setInterval(()=>{v&&E({t:`name`,name:v})},Uf),v&&E({t:`name`,name:v}),T(e),e.closed.then(({reason:t})=>{r===e&&(A(),x(),y({status:`ended`,reason:t}))})},M=async e=>{let t=r;A(),x(),y({status:`ended`,reason:e}),await t?.leave().catch(()=>{})},N=(e,t)=>{if(x(),t){y({status:`idle`});return}y({status:`failed`,code:Kf(e)?e.code:`unknown`})},P=async(e,t,n=!1)=>{r&&await M(`left`),u.clear(),y({status:`joining`,invite:e??``});try{let e=await t();await j(e)}catch(e){N(e,n)}};return{getState:()=>n,subscribe:e=>(o.add(e),()=>{o.delete(e)}),onMessage:e=>(s.add(e),()=>{s.delete(e)}),create:()=>P(void 0,()=>e.create()),join:t=>P(t,()=>e.join(t)),resume:async()=>{let t=S();t&&!r&&await P(t,()=>e.join(t),!0)},leave:async()=>{r&&await M(`left`)},send:E,setLocation:(e,t)=>{a.path=e,a.y=t},setPlayback:e=>{a.playback=e,a.playbackAt=Date.now()},invite:()=>n.status===`active`?n.invite:void 0,hostClock:()=>p,hostPath:()=>[...u.values()].filter(e=>`path`in e).at(-1)?.path,replay:()=>{for(let e of[`state`,`nav`,`scroll`,`playback`]){let t=e===`state`?k():u.get(e);t&&r&&w(t,{replayed:!0,from:r.owner,self:!1})}},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=>{v=e;try{e?t?.setItem(Vf,e):t?.removeItem(Vf)}catch{}e&&E({t:`name`,name:e})},name:()=>v,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),dismiss:()=>{(n.status===`ended`||n.status===`failed`)&&y({status:`idle`})}}},Jf=`/party`,Yf=(e,t)=>`${e}${Jf}#${Zf(e,t)}`,Xf=(e,t)=>{let n=e.startsWith(`#`)?e.slice(1):e,r;try{r=decodeURIComponent(n).trim()}catch{return}if(ep.test(r))return r;if(!tp.test(r))return;let i=r.indexOf(`.`),a=`${r.slice(0,i)}.${t}/${r.slice(i+1)}`;return ep.test(a)?a:void 0},Zf=(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},Qf=`[A-Za-z0-9_-]{43}`,$f=`[a-z0-9][a-z0-9._-]{0,63}`,ep=RegExp(`^${Qf}\\.[\\x21-\\x7e]{1,256}\\/${$f}$`),tp=RegExp(`^${Qf}\\.${$f}$`),Z=qf(De);H();var np=()=>{let[e,t]=V(Z.getState);return N(()=>Z.subscribe(t),[]),e},rp=e=>{let[t]=V(()=>({current:e}));t.current=e,N(()=>Z.onMessage((e,n)=>t.current(e,n)),[])};H();var ip=l`
111
+ `,_f=l`
112
+ width: ${pf}px;
113
+ height: ${mf}px;
114
+ `,vf=()=>{let{info:e,ready:t,logout:n}=uf(),[r,i]=V(!1),[a,o]=V(!1),{refs:s,floatingStyles:c,context:l}=Gd({open:r,onOpenChange:i,placement:`bottom-end`,middleware:[Cu(8),Tu(),wu({padding:8})],whileElementsMounted:he}),{getReferenceProps:u,getFloatingProps:d}=qd([zd(l),Ud(l),Yd(l,{role:`menu`})]);N(()=>{e||(i(!1),o(!1))},[e]);let f=async()=>{o(!0);try{await n()}finally{o(!1),i(!1)}};return t?e?I(B,{children:[I(`button`,{ref:s.setReference,css:hf,type:`button`,"aria-label":`FKN account: ${e.name||`Account`}`,...u(),children:[I(`span`,{className:`who`,children:[L(`span`,{className:`name`,children:e.name||`Account`}),L(`span`,{className:`tier ${e.premium?`premium`:`free`}`,children:e.premium?`Premium`:`Free`})]}),L(yc,{size:16,className:`chevron`})]}),r?L(yd,{children:L(Ad,{context:l,modal:!1,children:I(`div`,{ref:s.setFloating,style:c,css:gf,...d(),children:[I(`a`,{className:`item`,href:ff,target:`_blank`,rel:`noreferrer`,children:[L(Cc,{size:16}),`Manage account`]}),I(`button`,{className:`item`,type:`button`,disabled:a,onClick:f,children:[L(kc,{size:16}),a?`Disconnecting...`:`Disconnect`]})]})})}):void 0]}):L(of,{style:{flex:`none`,width:pf,height:mf}}):L(`div`,{css:_f})},yf=new Set([`nav`,`scroll`,`cursor`,`playback`,`state`,`pong`]),bf=e=>yf.has(e.t),xf=e=>e.trim().slice(0,500)||void 0,Sf=e=>e.trim().replace(/\s+/g,` `).slice(0,32)||void 0,Cf=e=>JSON.stringify({v:1,...e}),wf=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 Tf(n.path)?{t:`nav`,path:n.path}:void 0;case`scroll`:return Df(n.y)?{t:`scroll`,y:n.y}:void 0;case`cursor`:return Df(n.x)&&Df(n.y)?{t:`cursor`,x:n.x,y:n.y}:void 0;case`chat`:{let e=typeof n.text==`string`?xf(n.text):void 0;return e?{t:`chat`,text:e}:void 0}case`name`:{let e=typeof n.name==`string`?Sf(n.name):void 0;return e?{t:`name`,name:e}:void 0}case`ping`:return Ef(n.n)&&Ef(n.at)?{t:`ping`,n:n.n,at:n.at}:void 0;case`pong`:return Ef(n.n)&&Ef(n.at)&&Ef(n.host)?{t:`pong`,n:n.n,at:n.at,host:n.host}:void 0;case`playback`:return Of(n.s)?{t:`playback`,s:n.s}:void 0;case`state`:return!Tf(n.path)||!Df(n.y)||n.s!==void 0&&!Of(n.s)?void 0:{t:`state`,path:n.path,y:n.y,...n.s?{s:n.s}:{}};default:return}},Tf=e=>typeof e==`string`&&e.length>0&&e.length<=2048&&e.startsWith(`/`)&&!e.startsWith(`//`)&&!e.startsWith(`/\\`)&&!/[\r\n\t]/.test(e),Ef=e=>typeof e==`number`&&Number.isFinite(e),Df=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=1,Of=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.paused==`boolean`&&typeof t.time==`number`&&Number.isFinite(t.time)&&t.time>=0&&typeof t.rate==`number`&&Number.isFinite(t.rate)&&t.rate>0&&t.rate<=16&&typeof t.at==`number`&&Number.isFinite(t.at)},kf=1.05,Af=5e3,jf=(e,t,n=!1)=>{if(e.paused)return e.time;let r=Math.max(t-e.at,0),i=(n?r:Math.min(r,Mf))/1e3;return e.time+i*e.rate},Mf=2e3,Nf=(e,t,n,r=!1)=>{let i={},a=jf(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?t.rate*(o>0?kf:1/kf):t.rate;return Math.abs(e.rate-s)>.001&&(i.rate=s),i},Pf=(e,t,n)=>({...e,time:e.paused?e.time:e.time+Math.max(0,n-t)/1e3*e.rate,at:n}),Ff=(e,t,n)=>({rtt:n-e,offset:t-(e+n)/2}),If=e=>e.length?e.reduce((e,t)=>t.rtt<e.rtt?t:e):void 0,Lf=(e,t)=>e-t,Rf=4e3,zf=`stub-party-invite`,Bf=`stub-party-name`,Vf=1e4,Hf=3e4,Uf=6e4,Wf=()=>{try{return globalThis.sessionStorage}catch{return}},Gf=e=>e instanceof Error&&typeof e.code==`string`,Kf=(e,t=Wf())=>{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,h,g=new Map,_=1,v=(()=>{try{return t?.getItem(`stub-party-name`)??void 0}catch{return}})(),y=e=>{n=e;for(let e of o)e(n)},b=e=>{try{t?.setItem(zf,e)}catch{}},x=()=>{try{t?.removeItem(zf)}catch{}},S=()=>{try{return t?.getItem(`stub-party-invite`)??void 0}catch{return}},C=e=>e.owner===e.self.id?`host`:`guest`,w=(e,t)=>{for(let n of s)n(e,t)},T=async e=>{let t=await e.members().catch(()=>void 0);r===e&&n.status===`active`&&t&&y({...n,members:t.length})},E=e=>{r&&n.status===`active`&&(bf(e)&&n.role!==`host`||r.send(Cf(e)).catch(()=>{}))},D=()=>{if(!r||n.status!==`active`||n.role!==`guest`)return;let e=r,t=[];m=t;for(let n=0;n<5;n++)setTimeout(()=>{if(m!==t||r!==e)return;let n=Date.now(),i=_++;g.set(i,n),setTimeout(()=>g.delete(i),Rf),E({t:`ping`,n:i,at:n})},n*400);setTimeout(()=>{if(m!==t||r!==e)return;m=void 0;let n=If(t);n&&(p=n)},2e3+Rf)},O=()=>({t:`state`,path:a.path,y:a.y,...a.playback?{s:Pf(a.playback,a.playbackAt??Date.now(),Date.now())}:{}}),k=()=>{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},A=()=>{i?.(),i=void 0,r=void 0,c&&clearInterval(c),c=void 0,l&&clearInterval(l),l=void 0,h&&clearInterval(h),h=void 0,m=void 0,p=void 0,g.clear()},j=async e=>{r=e;let t=C(e);if(d.clear(),f.length=0,y({status:`active`,role:t,invite:e.invite,members:1,self:e.self.id,owner:e.owner}),b(e.invite),i=await e.on(n=>{if(r===e)switch(n.type){case`message`:{let r=wf(n.message.text);if(!r)return;let i=n.message.from,a=i===e.self.id;if(r.t===`ping`){t===`host`&&!a&&E({t:`pong`,n:r.n,at:r.at,host:Date.now()});return}if(r.t===`pong`){if(t!==`guest`||i!==e.owner)return;let n=g.get(r.n);if(n===void 0||n!==r.at)return;g.delete(r.n);let a=Ff(n,r.host,Date.now());if(a.rtt>4e3)return;m?.push(a),p||=a;return}if(bf(r)){if(i!==e.owner||t===`host`)return;u.delete(r.t),u.set(r.t,r),w(r,{replayed:!1,from:i,self:a});return}r.t===`name`&&d.set(i,r.name),r.t===`chat`&&(f.push({seq:n.message.seq,from:i,name:d.get(i),text:r.text,at:n.message.at,self:a}),f.length>200&&f.splice(0,f.length-200)),w(r,{replayed:!1,from:i,self:a});return}case`joined`:t===`host`&&E(O()),v&&E({t:`name`,name:v}),T(e);return;case`left`:if(t===`guest`&&n.id===e.owner){M(`host-left`);return}T(e);return}}),r!==e){i(),i=void 0;return}t===`host`&&(c=setInterval(()=>E(O()),Vf)),t===`guest`&&(D(),h=setInterval(D,Uf)),l=setInterval(()=>{v&&E({t:`name`,name:v})},Hf),v&&E({t:`name`,name:v}),T(e),e.closed.then(({reason:t})=>{r===e&&(A(),x(),y({status:`ended`,reason:t}))})},M=async e=>{let t=r;A(),x(),y({status:`ended`,reason:e}),await t?.leave().catch(()=>{})},N=(e,t)=>{if(x(),t){y({status:`idle`});return}y({status:`failed`,code:Gf(e)?e.code:`unknown`})},P=async(e,t,n=!1)=>{r&&await M(`left`),u.clear(),y({status:`joining`,invite:e??``});try{let e=await t();await j(e)}catch(e){N(e,n)}};return{getState:()=>n,subscribe:e=>(o.add(e),()=>{o.delete(e)}),onMessage:e=>(s.add(e),()=>{s.delete(e)}),create:()=>P(void 0,()=>e.create()),join:t=>P(t,()=>e.join(t)),resume:async()=>{let t=S();t&&!r&&await P(t,()=>e.join(t),!0)},leave:async()=>{r&&await M(`left`)},send:E,setLocation:(e,t)=>{a.path=e,a.y=t},setPlayback:e=>{a.playback=e,a.playbackAt=Date.now()},invite:()=>n.status===`active`?n.invite:void 0,hostClock:()=>p,hostPath:()=>[...u.values()].filter(e=>`path`in e).at(-1)?.path,replay:()=>{for(let e of[`state`,`nav`,`scroll`,`playback`]){let t=e===`state`?k():u.get(e);t&&r&&w(t,{replayed:!0,from:r.owner,self:!1})}},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=>{v=e;try{e?t?.setItem(Bf,e):t?.removeItem(Bf)}catch{}e&&E({t:`name`,name:e})},name:()=>v,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),dismiss:()=>{(n.status===`ended`||n.status===`failed`)&&y({status:`idle`})}}},qf=`/party`,Jf=(e,t)=>`${e}${qf}#${Xf(e,t)}`,Yf=(e,t)=>{let n=e.startsWith(`#`)?e.slice(1):e,r;try{r=decodeURIComponent(n).trim()}catch{return}if($f.test(r))return r;if(!ep.test(r))return;let i=r.indexOf(`.`),a=`${r.slice(0,i)}.${t}/${r.slice(i+1)}`;return $f.test(a)?a:void 0},Xf=(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},Zf=`[A-Za-z0-9_-]{43}`,Qf=`[a-z0-9][a-z0-9._-]{0,63}`,$f=RegExp(`^${Zf}\\.[\\x21-\\x7e]{1,256}\\/${Qf}$`),ep=RegExp(`^${Zf}\\.${Qf}$`),Z=Kf(De);H();var tp=()=>{let[e,t]=V(Z.getState);return N(()=>Z.subscribe(t),[]),e},np=e=>{let[t]=V(()=>({current:e}));t.current=e,N(()=>Z.onMessage((e,n)=>t.current(e,n)),[])};H();var rp=l`
115
115
  display: flex;
116
116
  align-items: center;
117
117
  gap: 0.6rem;
@@ -156,7 +156,7 @@ https://bit.ly/2XbVrpR#`;function oi(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
156
156
  padding: 0 1rem;
157
157
  .label { display: none; }
158
158
  }
159
- `,ap=l`
159
+ `,ip=l`
160
160
  width: 30rem;
161
161
  padding: 1.2rem;
162
162
  border-radius: 0.8rem;
@@ -165,7 +165,7 @@ https://bit.ly/2XbVrpR#`;function oi(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
165
165
  color: rgba(255, 255, 255, 0.85);
166
166
  font-size: 1.3rem;
167
167
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
168
- z-index: ${ff.headerPopup};
168
+ z-index: ${df.headerPopup};
169
169
 
170
170
  .title {
171
171
  font-size: 1.4rem;
@@ -222,7 +222,7 @@ https://bit.ly/2XbVrpR#`;function oi(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
222
222
 
223
223
  button:hover { border-color: rgba(255, 255, 255, 0.4); color: #fff; }
224
224
  button.primary { background: rgba(255, 255, 255, 0.1); }
225
- `,op={"not-found":`That party has ended.`,"bad-key":`That invite link is not valid.`,invalid:`That invite link is broken.`,full:`That party is full.`,blocked:`You cannot join that party.`,unavailable:`Parties are not available right now. Is FKN connected?`,"rate-limited":`Too many attempts. Try again in a moment.`},sp={"host-left":`The host left the party.`,removed:`You were removed from the party.`,blocked:`You were removed from the party.`,ended:`The party ended.`,unavailable:`The party was lost. Parties are unavailable right now.`,left:`You left the party.`},cp=()=>{let e=np(),[t,n]=V(!1),[r,i]=V(!1),[,a]=Do(),o=()=>{n(!1),a(Ho(Y.PARTY))},{refs:s,floatingStyles:c,context:l}=Kd({open:t,onOpenChange:n,placement:`bottom-end`,whileElementsMounted:he,middleware:[wu(8),Eu(),Tu({padding:12})]}),{getReferenceProps:u,getFloatingProps:d}=Jd([Bd(l),Wd(l),Xd(l,{role:`dialog`})]);N(()=>{if(!r)return;let e=setTimeout(()=>i(!1),1500);return()=>clearTimeout(e)},[r]),N(()=>{(e.status===`ended`||e.status===`failed`)&&n(!0)},[e.status]);let f=e.status===`active`?Yf(location.origin,e.invite):void 0,p=async()=>{if(f)try{await navigator.clipboard.writeText(f),i(!0)}catch{}};if(e.status===`idle`)return I(`button`,{type:`button`,css:ip,onClick:()=>{Z.create()},title:`Watch together`,children:[L(Kc,{size:16}),L(`span`,{className:`label`,children:`Watch together`})]});let m=e.status===`active`,h=e.status===`joining`?`Joining…`:e.status===`active`?e.role===`host`?`Hosting`:`Following`:e.status===`ended`?`Party over`:`Party failed`;return I(B,{children:[I(`button`,{type:`button`,ref:s.setReference,css:ip,className:m?`live`:e.status===`joining`?void 0:`over`,...u(),children:[m&&e.role===`host`?L(Rc,{size:16}):L(Kc,{size:16}),L(`span`,{className:`label`,children:h}),m&&L(`span`,{className:`count`,children:e.members})]}),t&&L(bd,{children:L(jd,{context:l,modal:!1,children:I(`div`,{ref:s.setFloating,css:ap,style:c,...d(),children:[e.status===`joining`&&L(`div`,{className:`title`,children:`Joining the party…`}),e.status===`active`&&e.role===`host`&&I(B,{children:[L(`div`,{className:`title`,children:`You are hosting`}),I(`div`,{className:`hint`,children:[e.members===1?`Nobody has joined yet.`:`${e.members-1} ${e.members===2?`person is`:`people are`} following you.`,` `,`Everyone who opens this link follows you around and watches what you play.`]}),I(`div`,{className:`link`,children:[L(`input`,{readOnly:!0,value:f,"aria-label":`Invite link`,onFocus:e=>e.currentTarget.select()}),L(`button`,{type:`button`,onClick:()=>{p()},"aria-label":`Copy invite link`,children:L(r?yc:Cc,{size:14})})]}),I(`div`,{className:`actions`,children:[I(`button`,{type:`button`,className:`primary`,onClick:o,children:[L(Kc,{size:14}),` Party`]}),I(`button`,{type:`button`,onClick:()=>{Z.leave(),n(!1)},children:[L(Ac,{size:14}),` End party`]})]})]}),e.status===`active`&&e.role===`guest`&&I(B,{children:[L(`div`,{className:`title`,children:`You are following the host`}),I(`div`,{className:`hint`,children:[e.members,` in the party. The host decides where the party goes and what plays. Wander off if you like, and catch up when you want back.`]}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,className:`primary`,onClick:()=>{Z.replay(),n(!1)},children:`Catch up`}),I(`button`,{type:`button`,onClick:o,children:[L(Kc,{size:14}),` Party`]}),I(`button`,{type:`button`,onClick:()=>{Z.leave(),n(!1)},children:[L(Ac,{size:14}),` Leave`]})]})]}),(e.status===`ended`||e.status===`failed`)&&I(B,{children:[L(`div`,{className:`title`,children:e.status===`ended`?sp[e.reason]??`The party ended.`:op[e.code]??`The party could not start.`}),L(`div`,{className:`actions`,children:L(`button`,{type:`button`,className:`primary`,onClick:()=>{Z.dismiss(),n(!1)},children:`OK`})})]})]})})})]})};H();var lp=l`
225
+ `,ap={"not-found":`That party has ended.`,"bad-key":`That invite link is not valid.`,invalid:`That invite link is broken.`,full:`That party is full.`,blocked:`You cannot join that party.`,unavailable:`Parties are not available right now. Is FKN connected?`,"rate-limited":`Too many attempts. Try again in a moment.`},op={"host-left":`The host left the party.`,removed:`You were removed from the party.`,blocked:`You were removed from the party.`,ended:`The party ended.`,unavailable:`The party was lost. Parties are unavailable right now.`,left:`You left the party.`},sp=()=>{let e=tp(),[t,n]=V(!1),[r,i]=V(!1),[,a]=Do(),o=()=>{n(!1),a(Ho(Y.PARTY))},{refs:s,floatingStyles:c,context:l}=Gd({open:t,onOpenChange:n,placement:`bottom-end`,whileElementsMounted:he,middleware:[Cu(8),Tu(),wu({padding:12})]}),{getReferenceProps:u,getFloatingProps:d}=qd([zd(l),Ud(l),Yd(l,{role:`dialog`})]);N(()=>{if(!r)return;let e=setTimeout(()=>i(!1),1500);return()=>clearTimeout(e)},[r]),N(()=>{(e.status===`ended`||e.status===`failed`)&&n(!0)},[e.status]);let f=e.status===`active`?Jf(location.origin,e.invite):void 0,p=async()=>{if(f)try{await navigator.clipboard.writeText(f),i(!0)}catch{}};if(e.status===`idle`)return I(`button`,{type:`button`,css:rp,onClick:()=>{Z.create()},title:`Watch together`,children:[L(Gc,{size:16}),L(`span`,{className:`label`,children:`Watch together`})]});let m=e.status===`active`,h=e.status===`joining`?`Joining…`:e.status===`active`?e.role===`host`?`Hosting`:`Following`:e.status===`ended`?`Party over`:`Party failed`;return I(B,{children:[I(`button`,{type:`button`,ref:s.setReference,css:rp,className:m?`live`:e.status===`joining`?void 0:`over`,...u(),children:[m&&e.role===`host`?L(Lc,{size:16}):L(Gc,{size:16}),L(`span`,{className:`label`,children:h}),m&&L(`span`,{className:`count`,children:e.members})]}),t&&L(yd,{children:L(Ad,{context:l,modal:!1,children:I(`div`,{ref:s.setFloating,css:ip,style:c,...d(),children:[e.status===`joining`&&L(`div`,{className:`title`,children:`Joining the party…`}),e.status===`active`&&e.role===`host`&&I(B,{children:[L(`div`,{className:`title`,children:`You are hosting`}),I(`div`,{className:`hint`,children:[e.members===1?`Nobody has joined yet.`:`${e.members-1} ${e.members===2?`person is`:`people are`} following you.`,` `,`Everyone who opens this link follows you around and watches what you play.`]}),I(`div`,{className:`link`,children:[L(`input`,{readOnly:!0,value:f,"aria-label":`Invite link`,onFocus:e=>e.currentTarget.select()}),L(`button`,{type:`button`,onClick:()=>{p()},"aria-label":`Copy invite link`,children:L(r?vc:Sc,{size:14})})]}),I(`div`,{className:`actions`,children:[I(`button`,{type:`button`,className:`primary`,onClick:o,children:[L(Gc,{size:14}),` Party`]}),I(`button`,{type:`button`,onClick:()=>{Z.leave(),n(!1)},children:[L(kc,{size:14}),` End party`]})]})]}),e.status===`active`&&e.role===`guest`&&I(B,{children:[L(`div`,{className:`title`,children:`You are following the host`}),I(`div`,{className:`hint`,children:[e.members,` in the party. The host decides where the party goes and what plays. Wander off if you like, and catch up when you want back.`]}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,className:`primary`,onClick:()=>{Z.replay(),n(!1)},children:`Catch up`}),I(`button`,{type:`button`,onClick:o,children:[L(Gc,{size:14}),` Party`]}),I(`button`,{type:`button`,onClick:()=>{Z.leave(),n(!1)},children:[L(kc,{size:14}),` Leave`]})]})]}),(e.status===`ended`||e.status===`failed`)&&I(B,{children:[L(`div`,{className:`title`,children:e.status===`ended`?op[e.reason]??`The party ended.`:ap[e.code]??`The party could not start.`}),L(`div`,{className:`actions`,children:L(`button`,{type:`button`,className:`primary`,onClick:()=>{Z.dismiss(),n(!1)},children:`OK`})})]})]})})})]})};H();var cp=l`
226
226
  position: fixed;
227
227
  /* the FKN broker's docked bar reserves the page's top strip with a root margin, which cannot
228
228
  move a fixed element; the variable is its half of the contract and reads 0 everywhere else */
@@ -231,7 +231,7 @@ https://bit.ly/2XbVrpR#`;function oi(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
231
231
  right: 0;
232
232
  /* the bar itself; what its controls OPEN is layer.headerPopup, since a portalled menu inherits
233
233
  nothing from this one */
234
- z-index: ${ff.header};
234
+ z-index: ${df.header};
235
235
  /* three tracks rather than a flex row: the search field stays centred on the VIEWPORT whatever the
236
236
  wordmark and the action cluster happen to measure, which auto margins on a flex item cannot promise */
237
237
  display: grid;
@@ -378,7 +378,7 @@ https://bit.ly/2XbVrpR#`;function oi(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
378
378
  }
379
379
  }
380
380
  }
381
- `,up=()=>{let[,e]=Do(),[t]=Ao(Vo(Y.LOGIN_CALLBACK)),[n]=Ao(Vo(Y.WATCH)),r=ks(Oo()),i=r.query,a=w(r);a.current=r;let[o,s]=V(i),c=w(null),l=w(void 0);N(()=>{document.activeElement!==c.current&&i!==o&&s(i)},[i]);let u=(t,n)=>{let r=t.trim();r&&e(Ns({...a.current,query:r}),{replace:n})};return t?null:I(`header`,{css:lp,className:n?`docked`:void 0,children:[L(Fo,{to:Ho(Y.HOME),className:`logo`,onClick:al,children:`stub`}),I(`form`,{className:`search`,onSubmit:e=>{e.preventDefault(),l.current&&clearTimeout(l.current),u(o,!1),c.current?.blur()},children:[L(zc,{size:20}),L(`input`,{ref:c,type:`text`,value:o,placeholder:`Search anime, shows, movies…`,"aria-label":`Search`,onInput:e=>{let t=e.currentTarget.value;s(t),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>u(t,!0),350)}})]}),I(`div`,{className:`actions`,children:[L(cp,{}),L(Fo,{to:Ho(Y.SETTINGS),className:`icon-button`,"aria-label":`Settings`,title:`Settings`,children:L(Vc,{size:20})}),L(yf,{})]})]})},dp=l`
381
+ `,lp=()=>{let[,e]=Do(),[t]=Ao(Vo(Y.LOGIN_CALLBACK)),[n]=Ao(Vo(Y.WATCH)),r=Os(Oo()),i=r.query,a=w(r);a.current=r;let[o,s]=V(i),c=w(null),l=w(void 0);N(()=>{document.activeElement!==c.current&&i!==o&&s(i)},[i]);let u=(t,n)=>{let r=t.trim();r&&e(Ms({...a.current,query:r}),{replace:n})};return t?null:I(`header`,{css:cp,className:n?`docked`:void 0,children:[L(Fo,{to:Ho(Y.HOME),className:`logo`,onClick:il,children:`stub`}),I(`form`,{className:`search`,onSubmit:e=>{e.preventDefault(),l.current&&clearTimeout(l.current),u(o,!1),c.current?.blur()},children:[L(Rc,{size:20}),L(`input`,{ref:c,type:`text`,value:o,placeholder:`Search anime, shows, movies…`,"aria-label":`Search`,onInput:e=>{let t=e.currentTarget.value;s(t),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>u(t,!0),350)}})]}),I(`div`,{className:`actions`,children:[L(sp,{}),L(Fo,{to:Ho(Y.SETTINGS),className:`icon-button`,"aria-label":`Settings`,title:`Settings`,children:L(Bc,{size:20})}),L(vf,{})]})]})},up=l`
382
382
  display: flex;
383
383
  align-items: center;
384
384
  gap: 2rem;
@@ -424,12 +424,12 @@ https://bit.ly/2XbVrpR#`;function oi(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
424
424
  gap: 1.2rem;
425
425
  padding: 2rem 1.5rem;
426
426
  }
427
- `,fp=()=>{let[e]=Ao(Vo(Y.WATCH)),[t]=Ao(Vo(Y.LOGIN_CALLBACK));return e||t?null:I(`footer`,{css:dp,children:[L(Fo,{to:Ho(Y.HOME),className:`wordmark`,onClick:al,children:`stub`}),L(Fo,{to:Ho(Y.LEGAL),className:`nav-link`,children:`Legal`}),L(Fo,{to:Ho(Y.PRIVACY),className:`nav-link`,children:`Privacy`}),I(`span`,{className:`version`,title:`stub v0.0.45, commit 5845f42`,children:[`v`,`0.0.45`,` `,L(`span`,{className:`commit`,children:`5845f42`})]})]})};H();var pp=l`
427
+ `,dp=()=>{let[e]=Ao(Vo(Y.WATCH)),[t]=Ao(Vo(Y.LOGIN_CALLBACK));return e||t?null:I(`footer`,{css:up,children:[L(Fo,{to:Ho(Y.HOME),className:`wordmark`,onClick:il,children:`stub`}),L(Fo,{to:Ho(Y.LEGAL),className:`nav-link`,children:`Legal`}),L(Fo,{to:Ho(Y.PRIVACY),className:`nav-link`,children:`Privacy`}),I(`span`,{className:`version`,title:`stub v0.0.46, commit 6d1b8c7`,children:[`v`,`0.0.46`,` `,L(`span`,{className:`commit`,children:`6d1b8c7`})]})]})};H();var fp=l`
428
428
  position: fixed;
429
429
  inset: 0;
430
430
  /* a sibling of the modal's portal rather than a child of it, so it competes at the root and 200
431
431
  put it behind the modal on any /media route */
432
- z-index: ${ff.pluginPrompt};
432
+ z-index: ${df.pluginPrompt};
433
433
  display: flex;
434
434
  align-items: center;
435
435
  justify-content: center;
@@ -529,7 +529,7 @@ https://bit.ly/2XbVrpR#`;function oi(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
529
529
  color: inherit;
530
530
  font-weight: 400;
531
531
  }
532
- `,mp=e=>e.state===`installing`?`adding…`:e.state===`error`?e.error??`failed`:``,hp=()=>{let[e,t]=V($s);if(N(()=>(t($s()),Qs(()=>t($s()))),[]),!e.length)return null;let n=e.some(e=>e.state===`installing`);return L(`div`,{css:pp,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`plugin-prompt-title`,children:I(`div`,{className:`dialog`,children:[L(`h2`,{id:`plugin-prompt-title`,children:e.length>1?`Add these sources?`:`Add this source?`}),I(`p`,{className:`intro`,children:[`This link was shared with `,e.length>1?`sources`:`a source`,` you have not added.`,` `,`Sources are community-made, installed through FKN, and run isolated from stub.`]}),L(`div`,{className:`list`,children:e.map(e=>I(`div`,{className:`invite`,children:[L(`span`,{className:`uri`,children:e.uri}),L(`span`,{className:`state${e.state===`error`?` error`:``}`,children:mp(e)}),e.state===`error`&&L(`button`,{type:`button`,className:`dismiss`,onClick:()=>ic(e.uri),children:`Dismiss`})]},e.uri))}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,className:`decline`,disabled:n,onClick:()=>nc(),children:`Not now`}),L(`button`,{type:`button`,disabled:n,onClick:()=>{rc()},children:e.length>1?`Add sources`:`Add source`})]})]})})},gp={"\n subscription MediaTracking($input: TrackingInput!) {\n tracking(input: $input) {\n _id\n disagreements\n summary {\n _id\n status\n progress\n score\n episodeCount\n }\n answers {\n _id\n state\n candidates\n error\n pending\n episodeCount\n tracker {\n id\n name\n icon\n color\n canWrite\n account\n scoreScale\n writeNotice\n keepsPageEpisodeCount\n keeps\n rewatchThroughCompleted\n }\n entry {\n _id\n status\n progress\n score\n scoreLabel\n startedAt { year month day }\n completedAt { year month day }\n rewatchCount\n episodeCount\n updatedAt\n }\n }\n }\n }\n":$o,"\n mutation SaveListEntry($input: SaveListEntryInput!) {\n saveListEntry(input: $input) {\n tracker\n outcome\n error\n entry {\n _id\n status\n progress\n score\n scoreLabel\n startedAt { year month day }\n completedAt { year month day }\n rewatchCount\n episodeCount\n updatedAt\n }\n }\n }\n":es,"\n mutation DeleteListEntry($input: DeleteListEntryInput!) {\n deleteListEntry(input: $input) {\n tracker\n outcome\n error\n }\n }\n":ts,"\n subscription StubTrackerStorage {\n stubTrackerStorage {\n location\n signedIn\n locked\n waiting\n held\n error\n }\n }\n":ns,"\n mutation AddHeldStubEntries {\n addHeldStubEntries {\n location\n signedIn\n locked\n waiting\n held\n error\n }\n }\n":rs,"\n subscription GetReleasingMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {\n mediaPage(input: $input) {\n nodes {\n ...MediaFragment\n score\n episodeCount\n titles {\n language\n title\n score\n }\n shortDescriptions(input: $shortDescriptionInput) {\n language\n shortDescription\n }\n covers {\n language\n url\n }\n banners {\n language\n url\n }\n trailers {\n uri\n origin\n id\n url\n thumbnail\n }\n popularity\n }\n }\n }\n":is,"\n subscription GetMediaModal($input: MediaInput!, $descriptionInput: MediaDescriptionInput!) {\n media(input: $input) {\n ...MediaFragment\n titles {\n language\n title\n score\n }\n descriptions(input: $descriptionInput) {\n language\n description\n }\n covers {\n language\n url\n }\n banners {\n language\n url\n }\n trailers {\n uri\n origin\n id\n url\n thumbnail\n }\n popularity\n categories\n franchise {\n nodes {\n uri\n format\n status\n episodeCount\n startDate\n titles {\n title\n }\n }\n edges {\n from\n to\n relation\n }\n }\n relations {\n relation\n format\n node {\n _id\n uri\n origin\n id\n url\n status\n episodeCount\n startDate\n titles {\n title\n }\n covers {\n url\n color\n }\n }\n }\n episodes {\n ...EpisodeFragment\n episodeNumber\n releaseDate\n titles {\n title\n }\n shortDescriptions {\n language\n shortDescription\n }\n thumbnails {\n url\n }\n handles {\n relation\n node {\n ...EpisodeFragment\n episodeNumber\n releaseDate\n titles {\n title\n }\n shortDescriptions {\n language\n shortDescription\n }\n thumbnails {\n url\n }\n }\n }\n }\n handles {\n relation\n node {\n ...MediaFragment\n handles {\n relation\n node {\n ...MediaFragment\n episodes {\n ...EpisodeFragment\n }\n }\n }\n episodes {\n ...EpisodeFragment\n }\n }\n }\n episodeCount\n }\n }\n":as,"\n subscription GetMediaModalOrigins($input: OriginPageInput!) {\n originPage(input: $input) {\n nodes {\n ...OriginFragment\n }\n }\n }\n":os,"\n subscription GetTheatherMedia($input: MediaInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {\n media(input: $input) {\n ...MediaFragment\n titles {\n language\n title\n score\n }\n shortDescriptions(input: $shortDescriptionInput) {\n language\n shortDescription\n }\n covers {\n language\n url\n }\n banners {\n language\n url\n }\n trailers {\n uri\n origin\n id\n url\n thumbnail\n }\n popularity\n }\n }\n":ss,"\n subscription SearchMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {\n mediaPage(input: $input) {\n nodes {\n ...MediaFragment\n score\n episodeCount\n titles {\n language\n title\n score\n }\n shortDescriptions(input: $shortDescriptionInput) {\n language\n shortDescription\n }\n covers {\n language\n url\n color\n }\n banners {\n language\n url\n }\n trailers {\n uri\n origin\n id\n url\n thumbnail\n }\n popularity\n genres\n tags\n averageScore\n status\n type\n season\n seasonYear\n nextAiringEpisode {\n episodeNumber\n airingAt\n }\n }\n }\n }\n":cs,"\n subscription GetWatchMedia($input: MediaInput!) {\n media(input: $input) {\n _id\n uri\n origin\n id\n titles {\n title\n }\n episodes {\n ...EpisodeFragment\n episodeNumber\n titles {\n title\n }\n thumbnails {\n url\n }\n handles {\n relation\n node {\n _id\n uri\n origin\n id\n url\n embedUrl\n mediaUri\n episodeNumber\n titles {\n title\n }\n shortDescriptions {\n language\n shortDescription\n }\n }\n }\n }\n handles {\n relation\n node {\n ...MediaFragment\n handles {\n relation\n node {\n ...MediaFragment\n episodes {\n ...EpisodeFragment\n }\n }\n }\n episodes {\n ...EpisodeFragment\n episodeNumber\n }\n }\n }\n }\n }\n":ls,"\n subscription GetWatchOrigins($input: OriginPageInput!) {\n originPage(input: $input) {\n nodes {\n id\n url\n name\n icon\n color\n isApiOnly\n }\n }\n }\n":us,"\n fragment EpisodeFragment on Episode {\n _id\n uri\n origin\n id\n url\n mediaUri\n handles {\n relation\n node {\n _id\n uri\n origin\n id\n url\n mediaUri\n }\n }\n }\n":Xo,"\n fragment MediaFragment on Media {\n _id\n uri\n origin\n id\n url\n handles {\n relation\n node {\n _id\n uri\n origin\n id\n url\n }\n }\n }\n":Zo,"\n fragment OriginFragment on Origin {\n id\n url\n name\n icon\n color\n isApiOnly\n }\n":Qo};function _p(e){return gp[e]??{}}var vp=e=>{let t;try{t=new URL(e)}catch{return null}let n=t.hostname.replace(/^(?:www|m)\./,``);return n===`youtu.be`?t.pathname.split(`/`)[1]||null:n!==`youtube.com`&&n!==`youtube-nocookie.com`?null:t.pathname===`/watch`?t.searchParams.get(`v`)||null:t.pathname.match(/^\/(?:embed|v|shorts)\/([^/?#]+)/)?.[1]??null};le();var yp=`https://www.youtube.com`,bp=0,xp=250,Sp=40,Cp=l`
532
+ `,pp=e=>e.state===`installing`?`adding…`:e.state===`error`?e.error??`failed`:``,mp=()=>{let[e,t]=V(Qs);if(N(()=>(t(Qs()),Zs(()=>t(Qs()))),[]),!e.length)return null;let n=e.some(e=>e.state===`installing`);return L(`div`,{css:fp,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`plugin-prompt-title`,children:I(`div`,{className:`dialog`,children:[L(`h2`,{id:`plugin-prompt-title`,children:e.length>1?`Add these sources?`:`Add this source?`}),I(`p`,{className:`intro`,children:[`This link was shared with `,e.length>1?`sources`:`a source`,` you have not added.`,` `,`Sources are community-made, installed through FKN, and run isolated from stub.`]}),L(`div`,{className:`list`,children:e.map(e=>I(`div`,{className:`invite`,children:[L(`span`,{className:`uri`,children:e.uri}),L(`span`,{className:`state${e.state===`error`?` error`:``}`,children:pp(e)}),e.state===`error`&&L(`button`,{type:`button`,className:`dismiss`,onClick:()=>rc(e.uri),children:`Dismiss`})]},e.uri))}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,className:`decline`,disabled:n,onClick:()=>tc(),children:`Not now`}),L(`button`,{type:`button`,disabled:n,onClick:()=>{nc()},children:e.length>1?`Add sources`:`Add source`})]})]})})},hp={"\n subscription MediaTracking($input: TrackingInput!) {\n tracking(input: $input) {\n _id\n disagreements\n summary {\n _id\n status\n progress\n score\n episodeCount\n }\n answers {\n _id\n state\n candidates\n error\n pending\n episodeCount\n tracker {\n id\n name\n icon\n color\n canWrite\n account\n scoreScale\n writeNotice\n keepsPageEpisodeCount\n keeps\n rewatchThroughCompleted\n }\n entry {\n _id\n status\n progress\n score\n scoreLabel\n startedAt { year month day }\n completedAt { year month day }\n rewatchCount\n episodeCount\n updatedAt\n }\n }\n }\n }\n":$o,"\n mutation SaveListEntry($input: SaveListEntryInput!) {\n saveListEntry(input: $input) {\n tracker\n outcome\n error\n entry {\n _id\n status\n progress\n score\n scoreLabel\n startedAt { year month day }\n completedAt { year month day }\n rewatchCount\n episodeCount\n updatedAt\n }\n }\n }\n":es,"\n mutation DeleteListEntry($input: DeleteListEntryInput!) {\n deleteListEntry(input: $input) {\n tracker\n outcome\n error\n }\n }\n":ts,"\n subscription StubTrackerStorage {\n stubTrackerStorage {\n location\n signedIn\n locked\n waiting\n held\n error\n }\n }\n":ns,"\n mutation AddHeldStubEntries {\n addHeldStubEntries {\n location\n signedIn\n locked\n waiting\n held\n error\n }\n }\n":rs,"\n subscription GetReleasingMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {\n mediaPage(input: $input) {\n nodes {\n ...MediaFragment\n score\n episodeCount\n titles {\n language\n title\n score\n }\n shortDescriptions(input: $shortDescriptionInput) {\n language\n shortDescription\n }\n covers {\n language\n url\n }\n banners {\n language\n url\n }\n trailers {\n uri\n origin\n id\n url\n thumbnail\n }\n popularity\n }\n }\n }\n":is,"\n subscription GetMediaModal($input: MediaInput!, $descriptionInput: MediaDescriptionInput!) {\n media(input: $input) {\n ...MediaFragment\n titles {\n language\n title\n score\n }\n descriptions(input: $descriptionInput) {\n language\n description\n }\n covers {\n language\n url\n }\n banners {\n language\n url\n }\n trailers {\n uri\n origin\n id\n url\n thumbnail\n }\n popularity\n categories\n franchise {\n nodes {\n uri\n format\n status\n episodeCount\n startDate\n titles {\n title\n }\n }\n edges {\n from\n to\n relation\n }\n }\n relations {\n relation\n format\n node {\n _id\n uri\n origin\n id\n url\n status\n episodeCount\n startDate\n titles {\n title\n }\n covers {\n url\n color\n }\n }\n }\n episodes {\n ...EpisodeFragment\n episodeNumber\n releaseDate\n titles {\n title\n }\n shortDescriptions {\n language\n shortDescription\n }\n thumbnails {\n url\n }\n handles {\n relation\n node {\n ...EpisodeFragment\n episodeNumber\n releaseDate\n titles {\n title\n }\n shortDescriptions {\n language\n shortDescription\n }\n thumbnails {\n url\n }\n }\n }\n }\n handles {\n relation\n node {\n ...MediaFragment\n handles {\n relation\n node {\n ...MediaFragment\n episodes {\n ...EpisodeFragment\n }\n }\n }\n episodes {\n ...EpisodeFragment\n }\n }\n }\n episodeCount\n }\n }\n":as,"\n subscription GetMediaModalOrigins($input: OriginPageInput!) {\n originPage(input: $input) {\n nodes {\n ...OriginFragment\n }\n }\n }\n":os,"\n subscription SearchMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {\n mediaPage(input: $input) {\n nodes {\n ...MediaFragment\n score\n episodeCount\n titles {\n language\n title\n score\n }\n shortDescriptions(input: $shortDescriptionInput) {\n language\n shortDescription\n }\n covers {\n language\n url\n color\n }\n banners {\n language\n url\n }\n trailers {\n uri\n origin\n id\n url\n thumbnail\n }\n popularity\n genres\n tags\n averageScore\n status\n type\n season\n seasonYear\n nextAiringEpisode {\n episodeNumber\n airingAt\n }\n }\n }\n }\n":ss,"\n subscription GetWatchMedia($input: MediaInput!) {\n media(input: $input) {\n _id\n uri\n origin\n id\n titles {\n title\n }\n episodes {\n ...EpisodeFragment\n episodeNumber\n titles {\n title\n }\n thumbnails {\n url\n }\n handles {\n relation\n node {\n _id\n uri\n origin\n id\n url\n embedUrl\n mediaUri\n episodeNumber\n titles {\n title\n }\n shortDescriptions {\n language\n shortDescription\n }\n }\n }\n }\n handles {\n relation\n node {\n ...MediaFragment\n handles {\n relation\n node {\n ...MediaFragment\n episodes {\n ...EpisodeFragment\n }\n }\n }\n episodes {\n ...EpisodeFragment\n episodeNumber\n }\n }\n }\n }\n }\n":cs,"\n subscription GetWatchOrigins($input: OriginPageInput!) {\n originPage(input: $input) {\n nodes {\n id\n url\n name\n icon\n color\n isApiOnly\n }\n }\n }\n":ls,"\n fragment EpisodeFragment on Episode {\n _id\n uri\n origin\n id\n url\n mediaUri\n handles {\n relation\n node {\n _id\n uri\n origin\n id\n url\n mediaUri\n }\n }\n }\n":Xo,"\n fragment MediaFragment on Media {\n _id\n uri\n origin\n id\n url\n handles {\n relation\n node {\n _id\n uri\n origin\n id\n url\n }\n }\n }\n":Zo,"\n fragment OriginFragment on Origin {\n id\n url\n name\n icon\n color\n isApiOnly\n }\n":Qo};function gp(e){return hp[e]??{}}var _p=e=>{let t;try{t=new URL(e)}catch{return null}let n=t.hostname.replace(/^(?:www|m)\./,``);return n===`youtu.be`?t.pathname.split(`/`)[1]||null:n!==`youtube.com`&&n!==`youtube-nocookie.com`?null:t.pathname===`/watch`?t.searchParams.get(`v`)||null:t.pathname.match(/^\/(?:embed|v|shorts)\/([^/?#]+)/)?.[1]??null};le();var vp=`https://www.youtube.com`,yp=0,bp=250,xp=40,Sp=l`
533
533
  position: absolute;
534
534
  top: 0;
535
535
  left: 0;
@@ -543,7 +543,7 @@ container-type: size;
543
543
  position: absolute;
544
544
  inset: 0;
545
545
  }
546
- `,wp=l`
546
+ `,Cp=l`
547
547
  position: absolute;
548
548
  top: 50%;
549
549
  left: 50%;
@@ -552,7 +552,7 @@ width: max(100cqw, 100cqh * 16 / 9);
552
552
  height: calc(max(100cqh, 100cqw * 9 / 16) + 160px);
553
553
  pointer-events: none;
554
554
  border: 0;
555
- `,Tp=e=>typeof e==`object`&&e&&typeof e.playerState==`number`?e.playerState:null,Ep=e=>{let t=new URLSearchParams({enablejsapi:`1`,controls:`0`,disablekb:`1`,modestbranding:`1`,rel:`0`,playsinline:`1`,iv_load_policy:`3`,autoplay:`1`,mute:`1`,loop:`1`,playlist:e,origin:location.origin});return`${yp}/embed/${encodeURIComponent(e)}?${t.toString()}`},Dp=({url:e,redirectTo:t,volume:n=1,paused:r=!1,onError:i,...a})=>{let o=w(null),s=w(null),[c,l]=V(!1),u=vp(e),d=w(i);d.current=i;let f=U((e,t=[])=>{o.current?.contentWindow?.postMessage(JSON.stringify({event:`command`,func:e,args:t}),yp)},[]);if(N(()=>{u||d.current?.()},[e,u]),N(()=>{l(!1);let e=o.current;if(!u||!e)return;let t=t=>{if(t.origin!==yp||t.source!==e.contentWindow)return;let n;try{n=typeof t.data==`string`?JSON.parse(t.data):t.data}catch{return}if(n?.event===`onReady`){clearInterval(r),l(!0);return}if(n?.event===`onError`){l(!1),d.current?.();return}(n?.event===`onStateChange`&&typeof n.info==`number`?n.info:Tp(n?.info))===bp&&f(`playVideo`)};addEventListener(`message`,t);let n=0,r=setInterval(()=>{if(s.current===e&&++n>Sp){clearInterval(r),d.current?.();return}e.contentWindow?.postMessage(JSON.stringify({event:`listening`,id:1,channel:`widget`}),yp)},xp);return()=>{removeEventListener(`message`,t),clearInterval(r)}},[u,f]),N(()=>{c&&(n===0?f(`mute`):(f(`unMute`),f(`setVolume`,[Math.round(Math.min(Math.max(n,0),1)*100)])))},[c,n,f]),N(()=>{c&&f(r?`pauseVideo`:`playVideo`)},[c,r,f]),!u)return null;let p=L(`iframe`,{ref:o,onLoad:e=>{s.current=e.currentTarget},css:wp,src:Ep(u),title:`Trailer`,allow:`autoplay; encrypted-media; picture-in-picture`,referrerPolicy:`strict-origin-when-cross-origin`,loading:`eager`,style:{display:c?``:`none`}},u);return L(`div`,{css:Cp,...a,children:t?L(Fo,{to:t,children:p}):p})};le();var Op=({element:e,defaultValue:t})=>{let[n,r]=V(t),[i,a]=V(!1),o=U(t=>{if(a(!0),!e)return;let{clientX:n}=t,{left:i,right:o}=e.getBoundingClientRect();r(Math.min(Math.max((n-i)/(o-i),0),1))},[e]);return N(()=>{if(!i)return;let t=()=>a(!1),n=t=>{if(!e)return;let{clientX:n}=t,{left:i,right:a}=e.getBoundingClientRect();r(Math.min(Math.max((n-i)/(a-i),0),1))};return document.addEventListener(`mousemove`,n),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,n),document.removeEventListener(`mouseup`,t)}},[e,i]),{value:n,scrubbing:i,scrubHandler:o}};H();var kp=l`
555
+ `,wp=e=>typeof e==`object`&&e&&typeof e.playerState==`number`?e.playerState:null,Tp=e=>{let t=new URLSearchParams({enablejsapi:`1`,controls:`0`,disablekb:`1`,modestbranding:`1`,rel:`0`,playsinline:`1`,iv_load_policy:`3`,autoplay:`1`,mute:`1`,loop:`1`,playlist:e,origin:location.origin});return`${vp}/embed/${encodeURIComponent(e)}?${t.toString()}`},Ep=({url:e,redirectTo:t,volume:n=1,paused:r=!1,onError:i,...a})=>{let o=w(null),s=w(null),[c,l]=V(!1),u=_p(e),d=w(i);d.current=i;let f=U((e,t=[])=>{o.current?.contentWindow?.postMessage(JSON.stringify({event:`command`,func:e,args:t}),vp)},[]);if(N(()=>{u||d.current?.()},[e,u]),N(()=>{l(!1);let e=o.current;if(!u||!e)return;let t=t=>{if(t.origin!==vp||t.source!==e.contentWindow)return;let n;try{n=typeof t.data==`string`?JSON.parse(t.data):t.data}catch{return}if(n?.event===`onReady`){clearInterval(r),l(!0);return}if(n?.event===`onError`){l(!1),d.current?.();return}(n?.event===`onStateChange`&&typeof n.info==`number`?n.info:wp(n?.info))===yp&&f(`playVideo`)};addEventListener(`message`,t);let n=0,r=setInterval(()=>{if(s.current===e&&++n>xp){clearInterval(r),d.current?.();return}e.contentWindow?.postMessage(JSON.stringify({event:`listening`,id:1,channel:`widget`}),vp)},bp);return()=>{removeEventListener(`message`,t),clearInterval(r)}},[u,f]),N(()=>{c&&(n===0?f(`mute`):(f(`unMute`),f(`setVolume`,[Math.round(Math.min(Math.max(n,0),1)*100)])))},[c,n,f]),N(()=>{c&&f(r?`pauseVideo`:`playVideo`)},[c,r,f]),!u)return null;let p=L(`iframe`,{ref:o,onLoad:e=>{s.current=e.currentTarget},css:Cp,src:Tp(u),title:`Trailer`,allow:`autoplay; encrypted-media; picture-in-picture`,referrerPolicy:`strict-origin-when-cross-origin`,loading:`eager`,style:{display:c?``:`none`}},u);return L(`div`,{css:Sp,...a,children:t?L(Fo,{to:t,children:p}):p})};le();var Dp=({element:e,defaultValue:t})=>{let[n,r]=V(t),[i,a]=V(!1),o=U(t=>{if(a(!0),!e)return;let{clientX:n}=t,{left:i,right:o}=e.getBoundingClientRect();r(Math.min(Math.max((n-i)/(o-i),0),1))},[e]);return N(()=>{if(!i)return;let t=()=>a(!1),n=t=>{if(!e)return;let{clientX:n}=t,{left:i,right:a}=e.getBoundingClientRect();r(Math.min(Math.max((n-i)/(a-i),0),1))};return document.addEventListener(`mousemove`,n),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,n),document.removeEventListener(`mouseup`,t)}},[e,i]),{value:n,scrubbing:i,scrubHandler:o}};H();var Op=l`
556
556
  display: flex;
557
557
  align-items: center;
558
558
  justify-content: center;
@@ -654,20 +654,22 @@ gap: 0.5rem;
654
654
  }
655
655
  }
656
656
  }
657
- `,Ap=({defaultMuted:e=!0,defaultVolume:t=1,onMutedUpdate:n,onVolumeUpdate:r})=>{let[i,a]=V(t),[o,s]=V(e),[c,l]=V(null),[u,d]=V(!0),{scrubHandler:f,value:p}=Op({element:c,defaultValue:i});N(()=>{p!==void 0&&(a(p),r(p**2,p))},[a,p]);let m=U(()=>{p!==void 0&&(s(e=>!e),n(!o))},[s,a,p,o]),h=U(()=>{d(!1)},[d]),g=U(e=>{d(!0)},[d]),_=o?Yc:(i??0)>.66?Jc:(i??0)>.33?qc:(i??0)>0?Xc:Yc;return I(`div`,{css:kp,onMouseLeave:g,children:[L(`button`,{className:`volume-icon`,onClick:m,onMouseOver:h,children:I(B,{children:[L(_,{className:`icon-outline`,size:30,strokeWidth:3,color:`black`}),L(_,{className:`icon-body`,size:30})]})}),L(`div`,{className:`volume-area`,onMouseOver:h,children:L(`div`,{ref:e=>l(e),className:`volume-panel${u?``:` volume-control-hover`}`,onMouseDown:f,children:L(`div`,{className:`slider`,children:L(`div`,{className:`slider-handle`,style:{left:`${(i??0)*100}%`}})})})})]})};H();var jp=l`
657
+ `,kp=({defaultMuted:e=!0,defaultVolume:t=1,onMutedUpdate:n,onVolumeUpdate:r})=>{let[i,a]=V(t),[o,s]=V(e),[c,l]=V(null),[u,d]=V(!0),{scrubHandler:f,value:p}=Dp({element:c,defaultValue:i});N(()=>{p!==void 0&&(a(p),r(p**2,p))},[a,p]);let m=U(()=>{p!==void 0&&(s(e=>!e),n(!o))},[s,a,p,o]),h=U(()=>{d(!1)},[d]),g=U(e=>{d(!0)},[d]),_=o?Jc:(i??0)>.66?qc:(i??0)>.33?Kc:(i??0)>0?Yc:Jc;return I(`div`,{css:Op,onMouseLeave:g,children:[L(`button`,{className:`volume-icon`,onClick:m,onMouseOver:h,children:I(B,{children:[L(_,{className:`icon-outline`,size:30,strokeWidth:3,color:`black`}),L(_,{className:`icon-body`,size:30})]})}),L(`div`,{className:`volume-area`,onMouseOver:h,children:L(`div`,{ref:e=>l(e),className:`volume-panel${u?``:` volume-control-hover`}`,onMouseDown:f,children:L(`div`,{className:`slider`,children:L(`div`,{className:`slider-handle`,style:{left:`${(i??0)*100}%`}})})})})]})};H();var Ap=l`
658
658
  display: -webkit-box;
659
659
  -webkit-box-orient: vertical;
660
660
  overflow: hidden;
661
661
  text-overflow: ellipsis;
662
662
  width: 100%;
663
663
  height: 100%;
664
- `,Mp=({children:e,...t})=>{let[n,r]=V(null),[i,a]=V(0),[o,s]=V(0);return N(()=>{if(!n)return;let e=0,t=()=>{let e=window.getComputedStyle(n),t;t=e.lineHeight===`normal`?parseFloat(e.fontSize)*1.2:parseFloat(e.lineHeight);let r=n.clientHeight;if(a(e=>e===t?e:t),t&&r){let e=Math.max(1,Math.floor(r/t));s(t=>t===e?t:e)}},r=new ResizeObserver(()=>{cancelAnimationFrame(e),e=requestAnimationFrame(t)});return r.observe(n),()=>{cancelAnimationFrame(e),r.disconnect()}},[n]),L(`div`,{...t,ref:r,css:jp,style:{...typeof t.style==`object`?t.style:void 0,WebkitLineClamp:o,height:i&&o?o*i:void 0},children:e})},Np=e=>e._id??e.uri??``,Pp=e=>{let t=e.filter(e=>e.titles?.length&&e.shortDescriptions?.length),n=t.filter(e=>e.trailers?.length);return n.length?n:t},Fp=(e,t,n=[],r=e=>Math.floor(Math.random()*e))=>{let i=e.slice(0,10).filter(e=>!n.includes(Np(e))),a=t&&i.find(e=>Np(e)===t);if(a)return a;if(i.length)return i[Math.min(i.length-1,Math.max(0,r(i.length)))]};le();var Ip=l`
664
+ `,jp=({children:e,...t})=>{let[n,r]=V(null),[i,a]=V(0),[o,s]=V(0);return N(()=>{if(!n)return;let e=0,t=()=>{let e=window.getComputedStyle(n),t;t=e.lineHeight===`normal`?parseFloat(e.fontSize)*1.2:parseFloat(e.lineHeight);let r=n.clientHeight;if(a(e=>e===t?e:t),t&&r){let e=Math.max(1,Math.floor(r/t));s(t=>t===e?t:e)}},r=new ResizeObserver(()=>{cancelAnimationFrame(e),e=requestAnimationFrame(t)});return r.observe(n),()=>{cancelAnimationFrame(e),r.disconnect()}},[n]),L(`div`,{...t,ref:r,css:Ap,style:{...typeof t.style==`object`?t.style:void 0,WebkitLineClamp:o,height:i&&o?o*i:void 0},children:e})},Mp=e=>e._id??e.uri??``,Np=e=>{let t=e.filter(e=>e.titles?.length&&e.shortDescriptions?.length),n=t.filter(e=>e.trailers?.length);return n.length?n:t},Pp=.3,Fp=e=>(e.titles?.[0]?.score??0)>Pp,Ip=5e3,Lp=(e,t,n=e=>Math.floor(Math.random()*e))=>{let r=t&&e.find(e=>Mp(e)===Mp(t));if(t&&r)return Fp(t)?t:r;let i=e.slice(0,10);return i.length?i[Math.min(i.length-1,Math.max(0,n(i.length)))]:t};H();var Rp=new Map,zp=3e4,Bp=e=>{let t=Rp.get(e);if(t)return t;let n=new Promise(t=>{let n=new Image;n.onload=()=>t(!0),n.onerror=()=>{setTimeout(()=>Rp.delete(e),zp),t(!1)},n.src=e});return Rp.set(e,n),n},Vp=e=>{let t=(e??[]).map(e=>e?.url).filter(e=>!!e),n=t.join(`|`),[r,i]=V(t[0]);return N(()=>{let e=!1;return i(t[0]),(async()=>{for(let n of t){let t=await Bp(n);if(e)return;if(t){i(n);return}}})(),()=>{e=!0}},[n]),r};le();var Hp=l`
665
665
  height: 70vh;
666
666
  .player-wrapper {
667
667
  position: absolute;
668
668
  width: 100%;
669
669
  height: calc(100vh - 5rem);
670
670
  user-select: none;
671
+ background-size: cover;
672
+ background-position: center 20%;
671
673
 
672
674
  .shadow {
673
675
  position: absolute;
@@ -764,38 +766,7 @@ height: 70vh;
764
766
  }
765
767
  }
766
768
  }
767
- `,Lp=_p(`
768
- subscription GetTheatherMedia($input: MediaInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
769
- media(input: $input) {
770
- ...MediaFragment
771
- titles {
772
- language
773
- title
774
- score
775
- }
776
- shortDescriptions(input: $shortDescriptionInput) {
777
- language
778
- shortDescription
779
- }
780
- covers {
781
- language
782
- url
783
- }
784
- banners {
785
- language
786
- url
787
- }
788
- trailers {
789
- uri
790
- origin
791
- id
792
- url
793
- thumbnail
794
- }
795
- popularity
796
- }
797
- }
798
- `),Rp=({mediaNodes:e})=>{let[t]=Ao(Vo(Y.MEDIA)),[n,r]=V([]),i=D(()=>Pp(e),[e]),a=w(void 0),o=D(()=>{let e=Fp(i,a.current,n);return a.current=e?Np(e):void 0,e},[i,n]),[{data:s}]=sr({query:Lp,variables:{input:{uri:o?.uri},shortDescriptionInput:{count:1}},pause:!o}),c=s?.media??o,l=D(()=>c?.titles?.at(0)?.title,[c]),u=D(()=>c?.shortDescriptions?.at(0)?.shortDescription,[c]),d=D(()=>c?.trailers?.at(0),[c]),[f,p]=V(!1),[m,h]=V(!0),[g,_]=V(.25),v=U(()=>{let e=o&&Np(o);e&&r(t=>t.includes(e)?t:[...t,e])},[o]);return I(`div`,{css:Ip,className:`theater`,children:[I(`div`,{className:`player-wrapper`,children:[d?.url&&L(Dp,{url:d.url,paused:f||t,onError:v,volume:m?0:g,className:`player`}),L(`div`,{className:`shadow`})]}),I(`div`,{className:`information`,css:Ip,children:[I(`div`,{className:`player-controls`,children:[I(`span`,{className:`playback`,children:[f?L(Ic,{className:`icon-outline`,size:30,strokeWidth:3,color:`black`,onClick:()=>p(!1)}):L(Fc,{className:`icon-outline`,size:30,strokeWidth:3,color:`black`,onClick:()=>p(!0)}),f?L(Ic,{className:`icon-body`,size:30,onClick:()=>p(!1)}):L(Fc,{className:`icon-body`,size:30,onClick:()=>p(!0)})]}),L(Ap,{defaultMuted:m,onMutedUpdate:h,defaultVolume:g,onVolumeUpdate:e=>_(e)})]}),L(`div`,{className:`title`,children:l}),L(Mp,{className:`short-description`,children:u})]})]})};le();function zp(e){let t=e;for(;t;){if(t.dir)return t.dir===`rtl`;t=t.parentElement}return!1}function Bp(e,t){let[n,r]=V(t===`rtl`);return S(()=>{e&&(t||r(zp(e)))},[t,e]),n}var Vp=typeof window<`u`?S:N;function Hp(e){if(e!==void 0)switch(typeof e){case`number`:return e;case`string`:if(e.endsWith(`px`))return parseFloat(e)}}function Up({box:e,defaultHeight:t,defaultWidth:n,disabled:r,element:i,mode:a,style:o}){let{styleHeight:s,styleWidth:c}=D(()=>({styleHeight:Hp(o?.height),styleWidth:Hp(o?.width)}),[o?.height,o?.width]),[l,u]=V({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 Vp(()=>{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]),D(()=>({height:s??l.height,width:c??l.width}),[l,s,c])}function Wp(e){let t=w(()=>{throw Error(`Cannot call an event handler while rendering.`)});return Vp(()=>{t.current=e},[e]),U(e=>t.current?.(e),[t])}var Gp=null;function Kp(e=!1){if(Gp===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?Gp=`positive-descending`:(e.scrollLeft=1,Gp=e.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(e),Gp}return Gp}function qp({containerElement:e,direction:t,isRtl:n,scrollOffset:r}){if(t===`horizontal`&&n)switch(Kp()){case`negative`:return-r;case`positive-descending`:if(e){let{clientWidth:t,scrollLeft:n,scrollWidth:r}=e;return r-t-n}}return r}function Jp(e,t=`Assertion error`){if(!e)throw console.error(t),Error(t)}function Yp({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 Jp(n!==void 0,`Unexpected bounds cache miss`),t*((n.scrollOffset+n.size)/e.size)}}function Xp({align:e,cachedBounds:t,index:n,itemCount:r,itemSize:i,containerScrollOffset:a,containerSize:o}){let s=Yp({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 Zp({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 Qp({itemCount:e,itemProps:t,itemSize:n}){let r=new Map;return{get(i){for(Jp(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);Jp(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 Jp(a!==void 0,`Unexpected bounds cache miss for index ${i}`),a},set(e,t){r.set(e,t)},get size(){return r.size}}}function $p({itemCount:e,itemProps:t,itemSize:n}){return D(()=>Qp({itemCount:e,itemProps:t,itemSize:n}),[e,t,n])}function em({containerSize:e,itemSize:t}){let n;switch(typeof t){case`string`:Jp(t.endsWith(`%`),`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`),Jp(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 tm({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]=V([0,-1]),[f,p]=[Math.min(a-1,u[0]),Math.min(a-1,u[1])],{height:m=n,width:h=n}=Up({defaultHeight:r===`vertical`?n:void 0,defaultWidth:r===`horizontal`?n:void 0,element:e,mode:r===`vertical`?`only-height`:`only-width`,style:t}),g=w({height:0,width:0}),_=r===`vertical`?m:h,v=em({containerSize:_,itemSize:s});S(()=>{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=$p({itemCount:a,itemProps:o,itemSize:v}),b=U(e=>y.get(e),[y]),x=U(()=>Yp({cachedBounds:y,itemCount:a,itemSize:v}),[y,a,v]),C=U(t=>{let n=qp({containerElement:e,direction:r,isRtl:i,scrollOffset:t});return Zp({cachedBounds:y,containerScrollOffset:n,containerSize:_,itemCount:a,overscanCount:l})},[y,e,_,r,i,a,l]);return Vp(()=>{let t=(r===`vertical`?e?.scrollTop:e?.scrollLeft)??0;d(C(t))},[e,r,C]),Vp(()=>{if(!e)return;let t=()=>{d(t=>{let{scrollLeft:n,scrollTop:o}=e,s=qp({containerElement:e,direction:r,isRtl:i,scrollOffset:r===`vertical`?o:n}),c=Zp({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:Wp(({align:t=`auto`,behavior:n=`auto`,containerScrollOffset:o,index:s})=>{let c=Xp({align:t,cachedBounds:y,containerScrollOffset:o,containerSize:_,index:s,itemCount:a,itemSize:v});if(e){if(c=qp({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=C(c);(e[0]!==f||e[1]!==p)&&d(e)}}}),startIndex:f,stopIndex:p}}function nm(e){return D(()=>e,Object.values(e))}function rm(e,t){if(e===t)return!0;if(!!e!=!!t||(Jp(e!==void 0),Jp(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 im(e,t){let{style:n,...r}=e,{style:i,...a}=t;return rm(n,i)&&rm(r,a)}function am({cellComponent:t,cellProps:n,className:r,columnCount:i,columnWidth:a,defaultHeight:o=0,defaultWidth:s=0,dir:c,gridRef:l,onCellsRendered:u,onResize:d,overscanCount:f=3,rowCount:p,rowHeight:m,style:h,...g}){let v=nm(n),y=D(()=>_(t,im),[t]),[b,x]=V(null),S=Bp(b,c),{getCellBounds:C,getEstimatedSize:w,startIndex:T,scrollToIndex:E,stopIndex:O}=tm({containerElement:b,defaultContainerSize:s,direction:`horizontal`,isRtl:S,itemCount:i,itemProps:v,itemSize:a,onResize:d,overscanCount:f}),{getCellBounds:k,getEstimatedSize:A,startIndex:j,scrollToIndex:M,stopIndex:P}=tm({containerElement:b,defaultContainerSize:o,direction:`vertical`,itemCount:p,itemProps:v,itemSize:m,onResize:d,overscanCount:f});e(l,()=>({get element(){return b},scrollToCell({behavior:e=`auto`,columnAlign:t=`auto`,columnIndex:n,rowAlign:r=`auto`,rowIndex:i}){M({align:r,behavior:e,containerScrollOffset:b?.scrollTop??0,index:i}),E({align:t,behavior:e,containerScrollOffset:b?.scrollLeft??0,index:n})},scrollToColumn({align:e=`auto`,behavior:t=`auto`,index:n}){E({align:e,behavior:t,containerScrollOffset:b?.scrollLeft??0,index:n})},scrollToRow({align:e=`auto`,behavior:t=`auto`,index:n}){M({align:e,behavior:t,containerScrollOffset:b?.scrollTop??0,index:n})}}),[b,E,M]),N(()=>{T>=0&&O>=0&&j>=0&&P>=0&&u&&u({columnStartIndex:T,columnStopIndex:O,rowStartIndex:j,rowStopIndex:P})},[u,T,O,j,P]);let F=D(()=>{let e=[];if(i>0&&p>0)for(let t=j;t<=P;t++){let n=k(t);for(let r=T;r<=O;r++){let i=C(r);e.push(ie(y,{...v,columnIndex:r,key:`${t}-${r}`,rowIndex:t,style:{position:`absolute`,left:S?void 0:0,right:S?0:void 0,transform:`translate(${S?-i.scrollOffset:i.scrollOffset}px, ${n.scrollOffset}px)`,height:p>1?n.size:`100%`,width:i.size}}))}}return e},[y,v,i,T,O,C,k,S,p,j,P]);return W(`div`,{...g,className:r,dir:c,ref:x,style:{width:`100%`,height:`100%`,...h,maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`},children:W(`div`,{className:r,style:{position:`relative`,height:A(),width:w()},children:F})})}var om=w;H();var sm=new Map,cm=3e4,lm=e=>{let t=sm.get(e);if(t)return t;let n=new Promise(t=>{let n=new Image;n.onload=()=>t(!0),n.onerror=()=>{setTimeout(()=>sm.delete(e),cm),t(!1)},n.src=e});return sm.set(e,n),n},um=e=>{let t=(e??[]).map(e=>e?.url).filter(e=>!!e),n=t.join(`|`),[r,i]=V(t[0]);return N(()=>{let e=!1;return i(t[0]),(async()=>{for(let n of t){let t=await lm(n);if(e)return;if(t){i(n);return}}})(),()=>{e=!0}},[n]),r},dm=l`
769
+ `,Up=({mediaNodes:e})=>{let[t]=Ao(Vo(Y.MEDIA)),[n,r]=V(!0);N(()=>{let e=setTimeout(()=>r(!1),Ip);return()=>clearTimeout(e)},[]);let i=D(()=>Np(e).filter(e=>!n||Fp(e)),[e,n]),a=w(void 0);a.current=Lp(i,a.current);let o=a.current,s=o?.titles?.at(0)?.title,c=o?.shortDescriptions?.at(0)?.shortDescription,[l,u]=V([]),d=o?.trailers?.find(e=>!l.includes(e.uri)),f=Vp(d?.url?void 0:o?.banners?.length?o.banners:o?.covers),[p,m]=V(!1),[h,g]=V(!0),[_,v]=V(.25),y=U(()=>{d&&u(e=>[...e,d.uri])},[d]);return I(`div`,{css:Hp,className:`theater`,children:[I(`div`,{className:`player-wrapper`,style:!d?.url&&f?{backgroundImage:`url(${f})`}:void 0,children:[d?.url&&L(Ep,{url:d.url,paused:p||t,onError:y,volume:h?0:_,className:`player`}),L(`div`,{className:`shadow`})]}),I(`div`,{className:`information`,css:Hp,children:[d?.url&&I(`div`,{className:`player-controls`,children:[I(`span`,{className:`playback`,children:[p?L(Fc,{className:`icon-outline`,size:30,strokeWidth:3,color:`black`,onClick:()=>m(!1)}):L(Pc,{className:`icon-outline`,size:30,strokeWidth:3,color:`black`,onClick:()=>m(!0)}),p?L(Fc,{className:`icon-body`,size:30,onClick:()=>m(!1)}):L(Pc,{className:`icon-body`,size:30,onClick:()=>m(!0)})]}),L(kp,{defaultMuted:h,onMutedUpdate:g,defaultVolume:_,onVolumeUpdate:e=>v(e)})]}),L(`div`,{className:`title`,children:s}),L(jp,{className:`short-description`,children:c})]})]})};le();function Wp(e){let t=e;for(;t;){if(t.dir)return t.dir===`rtl`;t=t.parentElement}return!1}function Gp(e,t){let[n,r]=V(t===`rtl`);return S(()=>{e&&(t||r(Wp(e)))},[t,e]),n}var Kp=typeof window<`u`?S:N;function qp(e){if(e!==void 0)switch(typeof e){case`number`:return e;case`string`:if(e.endsWith(`px`))return parseFloat(e)}}function Jp({box:e,defaultHeight:t,defaultWidth:n,disabled:r,element:i,mode:a,style:o}){let{styleHeight:s,styleWidth:c}=D(()=>({styleHeight:qp(o?.height),styleWidth:qp(o?.width)}),[o?.height,o?.width]),[l,u]=V({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 Kp(()=>{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]),D(()=>({height:s??l.height,width:c??l.width}),[l,s,c])}function Yp(e){let t=w(()=>{throw Error(`Cannot call an event handler while rendering.`)});return Kp(()=>{t.current=e},[e]),U(e=>t.current?.(e),[t])}var Xp=null;function Zp(e=!1){if(Xp===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?Xp=`positive-descending`:(e.scrollLeft=1,Xp=e.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(e),Xp}return Xp}function Qp({containerElement:e,direction:t,isRtl:n,scrollOffset:r}){if(t===`horizontal`&&n)switch(Zp()){case`negative`:return-r;case`positive-descending`:if(e){let{clientWidth:t,scrollLeft:n,scrollWidth:r}=e;return r-t-n}}return r}function $p(e,t=`Assertion error`){if(!e)throw console.error(t),Error(t)}function em({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 $p(n!==void 0,`Unexpected bounds cache miss`),t*((n.scrollOffset+n.size)/e.size)}}function tm({align:e,cachedBounds:t,index:n,itemCount:r,itemSize:i,containerScrollOffset:a,containerSize:o}){let s=em({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 nm({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 rm({itemCount:e,itemProps:t,itemSize:n}){let r=new Map;return{get(i){for($p(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);$p(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 $p(a!==void 0,`Unexpected bounds cache miss for index ${i}`),a},set(e,t){r.set(e,t)},get size(){return r.size}}}function im({itemCount:e,itemProps:t,itemSize:n}){return D(()=>rm({itemCount:e,itemProps:t,itemSize:n}),[e,t,n])}function am({containerSize:e,itemSize:t}){let n;switch(typeof t){case`string`:$p(t.endsWith(`%`),`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`),$p(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 om({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]=V([0,-1]),[f,p]=[Math.min(a-1,u[0]),Math.min(a-1,u[1])],{height:m=n,width:h=n}=Jp({defaultHeight:r===`vertical`?n:void 0,defaultWidth:r===`horizontal`?n:void 0,element:e,mode:r===`vertical`?`only-height`:`only-width`,style:t}),g=w({height:0,width:0}),_=r===`vertical`?m:h,v=am({containerSize:_,itemSize:s});S(()=>{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=im({itemCount:a,itemProps:o,itemSize:v}),b=U(e=>y.get(e),[y]),x=U(()=>em({cachedBounds:y,itemCount:a,itemSize:v}),[y,a,v]),C=U(t=>{let n=Qp({containerElement:e,direction:r,isRtl:i,scrollOffset:t});return nm({cachedBounds:y,containerScrollOffset:n,containerSize:_,itemCount:a,overscanCount:l})},[y,e,_,r,i,a,l]);return Kp(()=>{let t=(r===`vertical`?e?.scrollTop:e?.scrollLeft)??0;d(C(t))},[e,r,C]),Kp(()=>{if(!e)return;let t=()=>{d(t=>{let{scrollLeft:n,scrollTop:o}=e,s=Qp({containerElement:e,direction:r,isRtl:i,scrollOffset:r===`vertical`?o:n}),c=nm({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:Yp(({align:t=`auto`,behavior:n=`auto`,containerScrollOffset:o,index:s})=>{let c=tm({align:t,cachedBounds:y,containerScrollOffset:o,containerSize:_,index:s,itemCount:a,itemSize:v});if(e){if(c=Qp({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=C(c);(e[0]!==f||e[1]!==p)&&d(e)}}}),startIndex:f,stopIndex:p}}function sm(e){return D(()=>e,Object.values(e))}function cm(e,t){if(e===t)return!0;if(!!e!=!!t||($p(e!==void 0),$p(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 lm(e,t){let{style:n,...r}=e,{style:i,...a}=t;return cm(n,i)&&cm(r,a)}function um({cellComponent:t,cellProps:n,className:r,columnCount:i,columnWidth:a,defaultHeight:o=0,defaultWidth:s=0,dir:c,gridRef:l,onCellsRendered:u,onResize:d,overscanCount:f=3,rowCount:p,rowHeight:m,style:h,...g}){let v=sm(n),y=D(()=>_(t,lm),[t]),[b,x]=V(null),S=Gp(b,c),{getCellBounds:C,getEstimatedSize:w,startIndex:T,scrollToIndex:E,stopIndex:O}=om({containerElement:b,defaultContainerSize:s,direction:`horizontal`,isRtl:S,itemCount:i,itemProps:v,itemSize:a,onResize:d,overscanCount:f}),{getCellBounds:k,getEstimatedSize:A,startIndex:j,scrollToIndex:M,stopIndex:P}=om({containerElement:b,defaultContainerSize:o,direction:`vertical`,itemCount:p,itemProps:v,itemSize:m,onResize:d,overscanCount:f});e(l,()=>({get element(){return b},scrollToCell({behavior:e=`auto`,columnAlign:t=`auto`,columnIndex:n,rowAlign:r=`auto`,rowIndex:i}){M({align:r,behavior:e,containerScrollOffset:b?.scrollTop??0,index:i}),E({align:t,behavior:e,containerScrollOffset:b?.scrollLeft??0,index:n})},scrollToColumn({align:e=`auto`,behavior:t=`auto`,index:n}){E({align:e,behavior:t,containerScrollOffset:b?.scrollLeft??0,index:n})},scrollToRow({align:e=`auto`,behavior:t=`auto`,index:n}){M({align:e,behavior:t,containerScrollOffset:b?.scrollTop??0,index:n})}}),[b,E,M]),N(()=>{T>=0&&O>=0&&j>=0&&P>=0&&u&&u({columnStartIndex:T,columnStopIndex:O,rowStartIndex:j,rowStopIndex:P})},[u,T,O,j,P]);let F=D(()=>{let e=[];if(i>0&&p>0)for(let t=j;t<=P;t++){let n=k(t);for(let r=T;r<=O;r++){let i=C(r);e.push(ie(y,{...v,columnIndex:r,key:`${t}-${r}`,rowIndex:t,style:{position:`absolute`,left:S?void 0:0,right:S?0:void 0,transform:`translate(${S?-i.scrollOffset:i.scrollOffset}px, ${n.scrollOffset}px)`,height:p>1?n.size:`100%`,width:i.size}}))}}return e},[y,v,i,T,O,C,k,S,p,j,P]);return W(`div`,{...g,className:r,dir:c,ref:x,style:{width:`100%`,height:`100%`,...h,maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`},children:W(`div`,{className:r,style:{position:`relative`,height:A(),width:w()},children:F})})}var dm=w,fm=l`
799
770
  &.card, .card {
800
771
  position: relative;
801
772
  display: flex;
@@ -867,7 +838,7 @@ height: 70vh;
867
838
  aspect-ratio: 5 / 7;
868
839
  }
869
840
  }
870
- `,fm=({media:e,to:t,ellipsis:n=!0,...r})=>{let i=e.titles?.at(0)?.title,a=um(e.covers);return I(`div`,{...r,css:dm,className:`card category-item${n?``:` full-title`}`,style:{...typeof r.style==`object`?r.style:void 0,backgroundImage:`url(${a})`,backgroundSize:`cover`},children:[L(Fo,{tabIndex:-1,to:t,className:`card link`}),L(`div`,{className:`information`,children:L(`div`,{className:`title`,children:L(Fo,{to:t,className:`title-text`,children:n?L(Mp,{children:i}):i})})})]})};le();var pm=l`
841
+ `,pm=({media:e,to:t,ellipsis:n=!0,...r})=>{let i=e.titles?.at(0)?.title,a=Vp(e.covers);return I(`div`,{...r,css:fm,className:`card category-item${n?``:` full-title`}`,style:{...typeof r.style==`object`?r.style:void 0,backgroundImage:`url(${a})`,backgroundSize:`cover`},children:[L(Fo,{tabIndex:-1,to:t,className:`card link`}),L(`div`,{className:`information`,children:L(`div`,{className:`title`,children:L(Fo,{to:t,className:`title-text`,children:n?L(jp,{children:i}):i})})})]})};le();var mm=l`
871
842
  cursor: grab;
872
843
  &:active {
873
844
  cursor: grabbing;
@@ -875,7 +846,7 @@ height: 70vh;
875
846
  &.active * {
876
847
  pointer-events: none;
877
848
  }
878
- `,mm=({children:e,isDragging:t,setIsDragging:n})=>{if(`ontouchstart`in document.documentElement)return L(B,{children:e});let[r,i]=V(null),[a,o]=V(!1),[s,c]=V(),l=w({startX:0,startY:0,scrollLeft:0,scrollTop:0}),u=D(()=>globalThis,[]),d=U(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=U(e=>{o(!1),n(!1),u.removeEventListener(`mousemove`,p),s&&clearTimeout(s),c(globalThis.setTimeout(()=>n(!1),50))},[o,n,c,s,r]),p=U(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 N(()=>{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]),L(`div`,{ref:e=>i(e),className:`draggable ${t?`active`:``}`,css:pm,children:e})};H();var hm=l`
849
+ `,hm=({children:e,isDragging:t,setIsDragging:n})=>{if(`ontouchstart`in document.documentElement)return L(B,{children:e});let[r,i]=V(null),[a,o]=V(!1),[s,c]=V(),l=w({startX:0,startY:0,scrollLeft:0,scrollTop:0}),u=D(()=>globalThis,[]),d=U(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=U(e=>{o(!1),n(!1),u.removeEventListener(`mousemove`,p),s&&clearTimeout(s),c(globalThis.setTimeout(()=>n(!1),50))},[o,n,c,s,r]),p=U(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 N(()=>{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]),L(`div`,{ref:e=>i(e),className:`draggable ${t?`active`:``}`,css:mm,children:e})};H();var gm=l`
879
850
  display: grid;
880
851
  background-color: rgb(35, 35, 35);
881
852
  border-radius: 1rem;
@@ -942,7 +913,7 @@ a {
942
913
  background-size: cover;
943
914
  background-position: center;
944
915
  }
945
- `,gm=({ref:e,media:t,...n})=>{let r=D(()=>t?.titles?.at(0)?.title,[t]),i=D(()=>t?.shortDescriptions?.at(0)?.shortDescription,[t]),a=um(t?.covers),[o,s]=V([]),c=D(()=>t?.trailers.filter(e=>!o.includes(e.uri)).at(0),[o]),l=U(()=>{c&&s([...o,c.uri])},[c,o]);return I(`div`,{ref:e,className:`title-hovercard`,css:hm,...n,children:[c?.url?L(Dp,{volume:0,url:c?.url,onError:l,redirectTo:Ho(Y.MEDIA,{uri:t.uri}),className:`title-hovercard-player`}):a?L(Fo,{className:`trailer-fallback-cover`,style:{backgroundImage:`url(${a})`},to:Ho(Y.MEDIA,{uri:t.uri})}):void 0,L(Fo,{to:Ho(Y.MEDIA,{uri:t.uri}),children:I(`div`,{className:`content`,children:[L(`div`,{className:`title`,children:r}),L(`div`,{className:`top`,children:I(`span`,{className:`episodes`,children:[t.episodeCount??`?`,` Episodes`]})}),L(Mp,{className:`description`,children:i})]})})]})};le();var _m=l`
916
+ `,_m=({ref:e,media:t,...n})=>{let r=D(()=>t?.titles?.at(0)?.title,[t]),i=D(()=>t?.shortDescriptions?.at(0)?.shortDescription,[t]),a=Vp(t?.covers),[o,s]=V([]),c=D(()=>t?.trailers.filter(e=>!o.includes(e.uri)).at(0),[o]),l=U(()=>{c&&s([...o,c.uri])},[c,o]);return I(`div`,{ref:e,className:`title-hovercard`,css:gm,...n,children:[c?.url?L(Ep,{volume:0,url:c?.url,onError:l,redirectTo:Ho(Y.MEDIA,{uri:t.uri}),className:`title-hovercard-player`}):a?L(Fo,{className:`trailer-fallback-cover`,style:{backgroundImage:`url(${a})`},to:Ho(Y.MEDIA,{uri:t.uri})}):void 0,L(Fo,{to:Ho(Y.MEDIA,{uri:t.uri}),children:I(`div`,{className:`content`,children:[L(`div`,{className:`title`,children:r}),L(`div`,{className:`top`,children:I(`span`,{className:`episodes`,children:[t.episodeCount??`?`,` Episodes`]})}),L(jp,{className:`description`,children:i})]})})]})};le();var vm=l`
946
917
  display: flex;
947
918
  flex-direction: column;
948
919
  position: relative;
@@ -1012,7 +983,7 @@ position: relative;
1012
983
  display: none;
1013
984
  }
1014
985
  }
1015
- `,vm=({style:e,mediaNodes:t,columnIndex:n})=>{let r=t[n];if(!r)return null;let[i,a]=V(!1),{x:o,y:s,strategy:c,refs:l,context:u}=Kd({open:i,onOpenChange:a,whileElementsMounted:he,placement:`top`,middleware:[wu(({rects:e})=>-e.reference.height/2-e.floating.height/2),Tu({crossAxis:!0,padding:25})]}),d=$u(u,{restMs:400,handleClose:of()}),{styles:f}=tf(u,{initial:{opacity:0,transform:`scale(0.8)`},open:{opacity:1,transform:`scale(1)`},duration:150}),{getReferenceProps:p,getFloatingProps:m}=Jd([d]);return I(B,{children:[i&&L(bd,{children:L(gm,{media:r,ref:l.setFloating,style:{...f,position:c,top:s??0,left:o??0,zIndex:ff.hoverCard},...m()})}),L(fm,{media:r,to:Ho(Y.MEDIA,{uri:r.uri}),style:{...e,width:250,marginLeft:`var(--card-gutter, 100px)`},onMouseEnter:e=>{e.target instanceof HTMLElement&&l.setReference(e.target)},...p()},r._id)]})},ym=({title:e,titleTo:t,mediaNodes:n})=>{let[r,i]=V(0),[a,o]=V(0),[s,c]=V(!1),l=om(null),u=U(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]);return I(`div`,{css:_m,children:[t?L(Fo,{to:t,className:`title`,children:e}):L(`span`,{className:`title`,children:e}),I(`div`,{className:`list-container`,children:[L(mm,{isDragging:s,setIsDragging:c,children:L(am,{gridRef:l,className:`virtual-list`,cellComponent:vm,cellProps:{mediaNodes:n},columnCount:n.length,columnWidth:260,rowCount:1,rowHeight:350,overscanCount:5,onCellsRendered:({columnStartIndex:e,columnStopIndex:t})=>{i(e),o(t)}})}),L(`button`,{className:`scroll-button left`,onClick:()=>u(`left`),children:L(xc,{})}),L(`button`,{className:`scroll-button right`,onClick:()=>u(`right`),children:L(Sc,{})})]})]})};H();var bm=l`
986
+ `,ym=({style:e,mediaNodes:t,columnIndex:n})=>{let r=t[n];if(!r)return null;let[i,a]=V(!1),{x:o,y:s,strategy:c,refs:l,context:u}=Gd({open:i,onOpenChange:a,whileElementsMounted:he,placement:`top`,middleware:[Cu(({rects:e})=>-e.reference.height/2-e.floating.height/2),wu({crossAxis:!0,padding:25})]}),d=Qu(u,{restMs:400,handleClose:af()}),{styles:f}=ef(u,{initial:{opacity:0,transform:`scale(0.8)`},open:{opacity:1,transform:`scale(1)`},duration:150}),{getReferenceProps:p,getFloatingProps:m}=qd([d]);return I(B,{children:[i&&L(yd,{children:L(_m,{media:r,ref:l.setFloating,style:{...f,position:c,top:s??0,left:o??0,zIndex:df.hoverCard},...m()})}),L(pm,{media:r,to:Ho(Y.MEDIA,{uri:r.uri}),style:{...e,width:250,marginLeft:`var(--card-gutter, 100px)`},onMouseEnter:e=>{e.target instanceof HTMLElement&&l.setReference(e.target)},...p()},r._id)]})},bm=({title:e,titleTo:t,mediaNodes:n})=>{let[r,i]=V(0),[a,o]=V(0),[s,c]=V(!1),l=dm(null),u=U(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]);return I(`div`,{css:vm,children:[t?L(Fo,{to:t,className:`title`,children:e}):L(`span`,{className:`title`,children:e}),I(`div`,{className:`list-container`,children:[L(hm,{isDragging:s,setIsDragging:c,children:L(um,{gridRef:l,className:`virtual-list`,cellComponent:ym,cellProps:{mediaNodes:n},columnCount:n.length,columnWidth:260,rowCount:1,rowHeight:350,overscanCount:5,onCellsRendered:({columnStartIndex:e,columnStopIndex:t})=>{i(e),o(t)}})}),L(`button`,{className:`scroll-button left`,onClick:()=>u(`left`),children:L(bc,{})}),L(`button`,{className:`scroll-button right`,onClick:()=>u(`right`),children:L(xc,{})})]})]})};H();var xm=l`
1016
987
  position: relative;
1017
988
  overflow: hidden;
1018
989
  transition: max-height 0.3s ease-in-out;
@@ -1049,7 +1020,7 @@ transition: max-height 0.3s ease-in-out;
1049
1020
  width: 100%;
1050
1021
  background-color: rgb(35, 35, 35);
1051
1022
  }
1052
- `,xm=({children:e,collapsedHeight:t=200,...n})=>{let[r,i]=V(!1),[a,o]=V(!1),s=w(null),[c,l]=V(0);N(()=>{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 I(`div`,{...n,ref:s,css:bm,className:`${n.className||``} ${!r&&a?`collapsed`:`expanded`}`,children:[L(`div`,{className:`content`,children:e}),a&&!r?L(`div`,{className:`fade-overlay`}):void 0,a?L(`button`,{className:`toggle-button`,onClick:u,children:r?`Collapse`:`Expand`}):void 0]})},Sm=`this build of the worker exposes no traceGraph, so there is nothing to read a trace from`,Cm=async()=>await Ce(()=>import(`./worker-BUw9_QQ0.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),wm=async e=>{let t=await Cm();if(typeof t.traceGraph!=`function`)throw Error(Sm);return t.traceGraph(e)},Tm=async e=>{let t=await Cm();if(typeof t.traceAnswer!=`function`)throw Error(Sm);return t.traceAnswer(e)},Em=[`graph`,`store`],Dm=({uri:e,search:t}={})=>{let n=Ho(Y.DEBUG_TRACE),r=new URLSearchParams;e&&r.set(`uri`,e);let i=jm(t??``);for(let e of Em)for(let t of i.getAll(e))r.append(e,t);let a=r.toString();return a?`${n}?${a}`:n},Om=e=>{let t=jm(Nm(e)),n=new URLSearchParams;for(let e of Em)for(let r of t.getAll(e))n.append(e,r);let r=n.toString();return r?`?${r}`:``},km=(e,t=`graph`)=>{let n=jm(e);return n.set(t,`1`),`${Ho(Y.DEBUG_TRACE)}?${n.toString()}`},Am=e=>{let t=jm(e);t.delete(`store`);let n=t.toString();return`${Ho(Y.DEBUG_TRACE)}${n?`?${n}`:``}`},jm=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),Mm=typeof location>`u`?``:location.search,Nm=(e=``)=>{let t=jm(Mm);for(let[n,r]of jm(e))t.set(n,r);return t.toString()},Pm=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e).get(`uri`)??``,Fm={PREQUEL:`SEQUEL`,ADAPTATION:`SOURCE`,COMPILATION:`CONTAINS`,SIDE_STORY:`PARENT`},Im=e=>{let t=new Set,n=[];for(let r of e){if(!r?.from||!r?.to||r.from===r.to)continue;let e=Fm[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},Lm=new Set([`TV`,`TV_SHORT`,`MOVIE`,`SPECIAL`,`OVA`,`ONA`,`MUSIC`]),Rm=e=>!e||Lm.has(e),zm=e=>[...new Set((e.nodes??[]).map(e=>e.format??``).filter(Boolean))].sort(),Bm=(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))}},Vm=e=>`${e.from}\u0000${e.to}\u0000${e.relation}`,Hm=(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(Vm))}}let n=t.find(t=>Vm(t)===e.key);return n?{nodes:new Set([n.from,n.to]),edges:new Set([e.key])}:{nodes:new Set,edges:new Set}},Um=e=>e.titles?.[0]?.title||e.uri,Wm=e=>[...e].sort((e,t)=>(e.startDate??`9999`).localeCompare(t.startDate??`9999`)||Um(e).localeCompare(Um(t))),Gm=(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},Km=(e,t=`story`)=>{let n=Im(e.edges??[]),r=new Set((e.nodes??[]).map(e=>e.uri)),i=n.filter(e=>r.has(e.from)&&r.has(e.to)),a=Wm(e.nodes??[]),o=t===`graph`?Gm(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())}},qm={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`},Jm=[`SOURCE`,`PREQUEL`,`SEQUEL`,`PARENT`,`SIDE_STORY`,`SPIN_OFF`,`ALTERNATIVE`,`ADAPTATION`,`SUMMARY`,`COMPILATION`,`CONTAINS`,`CHARACTER`,`OTHER`],Ym=e=>{let t=Jm.indexOf(e);return t===-1?Jm.length:t},Xm=e=>e&&qm[e]||qm.OTHER,Zm={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`},Qm=e=>e?Zm[e]||e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):void 0,$m=e=>[...e].sort((e,t)=>Ym(e.relation)-Ym(t.relation)),eh=e=>e.filter(e=>Rm(e.format)),th=e=>{let t=$m(e);return{before:t.filter(e=>e.relation===`PREQUEL`),middle:t.filter(e=>e.relation!==`PREQUEL`&&e.relation!==`SEQUEL`),after:t.filter(e=>e.relation===`SEQUEL`)}},nh=l`
1023
+ `,Sm=({children:e,collapsedHeight:t=200,...n})=>{let[r,i]=V(!1),[a,o]=V(!1),s=w(null),[c,l]=V(0);N(()=>{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 I(`div`,{...n,ref:s,css:xm,className:`${n.className||``} ${!r&&a?`collapsed`:`expanded`}`,children:[L(`div`,{className:`content`,children:e}),a&&!r?L(`div`,{className:`fade-overlay`}):void 0,a?L(`button`,{className:`toggle-button`,onClick:u,children:r?`Collapse`:`Expand`}):void 0]})},Cm=`this build of the worker exposes no traceGraph, so there is nothing to read a trace from`,wm=async()=>await Ce(()=>import(`./worker-BUw9_QQ0.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),Tm=async e=>{let t=await wm();if(typeof t.traceGraph!=`function`)throw Error(Cm);return t.traceGraph(e)},Em=async e=>{let t=await wm();if(typeof t.traceAnswer!=`function`)throw Error(Cm);return t.traceAnswer(e)},Dm=[`graph`,`store`],Om=({uri:e,search:t}={})=>{let n=Ho(Y.DEBUG_TRACE),r=new URLSearchParams;e&&r.set(`uri`,e);let i=Mm(t??``);for(let e of Dm)for(let t of i.getAll(e))r.append(e,t);let a=r.toString();return a?`${n}?${a}`:n},km=e=>{let t=Mm(Pm(e)),n=new URLSearchParams;for(let e of Dm)for(let r of t.getAll(e))n.append(e,r);let r=n.toString();return r?`?${r}`:``},Am=(e,t=`graph`)=>{let n=Mm(e);return n.set(t,`1`),`${Ho(Y.DEBUG_TRACE)}?${n.toString()}`},jm=e=>{let t=Mm(e);t.delete(`store`);let n=t.toString();return`${Ho(Y.DEBUG_TRACE)}${n?`?${n}`:``}`},Mm=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),Nm=typeof location>`u`?``:location.search,Pm=(e=``)=>{let t=Mm(Nm);for(let[n,r]of Mm(e))t.set(n,r);return t.toString()},Fm=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e).get(`uri`)??``,Im={PREQUEL:`SEQUEL`,ADAPTATION:`SOURCE`,COMPILATION:`CONTAINS`,SIDE_STORY:`PARENT`},Lm=e=>{let t=new Set,n=[];for(let r of e){if(!r?.from||!r?.to||r.from===r.to)continue;let e=Im[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},Rm=new Set([`TV`,`TV_SHORT`,`MOVIE`,`SPECIAL`,`OVA`,`ONA`,`MUSIC`]),zm=e=>!e||Rm.has(e),Bm=e=>[...new Set((e.nodes??[]).map(e=>e.format??``).filter(Boolean))].sort(),Vm=(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))}},Hm=e=>`${e.from}\u0000${e.to}\u0000${e.relation}`,Um=(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(Hm))}}let n=t.find(t=>Hm(t)===e.key);return n?{nodes:new Set([n.from,n.to]),edges:new Set([e.key])}:{nodes:new Set,edges:new Set}},Wm=e=>e.titles?.[0]?.title||e.uri,Gm=e=>[...e].sort((e,t)=>(e.startDate??`9999`).localeCompare(t.startDate??`9999`)||Wm(e).localeCompare(Wm(t))),Km=(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},qm=(e,t=`story`)=>{let n=Lm(e.edges??[]),r=new Set((e.nodes??[]).map(e=>e.uri)),i=n.filter(e=>r.has(e.from)&&r.has(e.to)),a=Gm(e.nodes??[]),o=t===`graph`?Km(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())}},Jm={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`},Ym=[`SOURCE`,`PREQUEL`,`SEQUEL`,`PARENT`,`SIDE_STORY`,`SPIN_OFF`,`ALTERNATIVE`,`ADAPTATION`,`SUMMARY`,`COMPILATION`,`CONTAINS`,`CHARACTER`,`OTHER`],Xm=e=>{let t=Ym.indexOf(e);return t===-1?Ym.length:t},Zm=e=>e&&Jm[e]||Jm.OTHER,Qm={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`},$m=e=>e?Qm[e]||e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):void 0,eh=e=>[...e].sort((e,t)=>Xm(e.relation)-Xm(t.relation)),th=e=>e.filter(e=>zm(e.format)),nh=e=>{let t=eh(e);return{before:t.filter(e=>e.relation===`PREQUEL`),middle:t.filter(e=>e.relation!==`PREQUEL`&&e.relation!==`SEQUEL`),after:t.filter(e=>e.relation===`SEQUEL`)}},rh=l`
1053
1024
  margin-top: 4rem;
1054
1025
 
1055
1026
  & > .heading {
@@ -1090,7 +1061,7 @@ transition: max-height 0.3s ease-in-out;
1090
1061
  @media (max-width: 768px) {
1091
1062
  & > .grid > .lane { flex: 1 1 100%; justify-content: flex-start; }
1092
1063
  }
1093
- `,rh=l`
1064
+ `,ih=l`
1094
1065
  /* A card sized itself off the grid track until the lanes replaced it, so it needs its own basis
1095
1066
  now. 28rem is the track's old minimum, and shrinking is left on so a narrow modal wraps rather
1096
1067
  than overflows. */
@@ -1151,13 +1122,13 @@ transition: max-height 0.3s ease-in-out;
1151
1122
  font-size: 1.25rem;
1152
1123
  color: rgba(255, 255, 255, 0.55);
1153
1124
  }
1154
- `,ih=({edge:e,search:t})=>{let n=um(e.node.covers),r=e.node.titles?.at(0)?.title,i=[Qm(e.format),Is(e.node.status)].filter(Boolean).join(` · `);return I(Fo,{className:`relation-card`,css:rh,to:`${Ho(Y.MEDIA,{uri:oe(e.node.uri)})}${t}`,children:[n?L(`img`,{className:`cover`,src:n,alt:``}):L(`div`,{className:`cover`}),I(`div`,{className:`body`,children:[L(`div`,{className:`relation`,children:Xm(e.relation)}),L(`div`,{className:`title`,children:r??e.node.uri}),i?L(`div`,{className:`meta`,children:i}):void 0]})]})},ah=({relations:e,action:t})=>{let n=Om(Oo()),r=eh(e);if(!r.length)return null;let i=th(r);return I(`div`,{css:nh,"data-relations":!0,children:[I(`div`,{className:`heading`,children:[L(`span`,{children:`Relations`}),t]}),L(`div`,{className:`grid`,children:[`before`,`middle`,`after`].map(e=>L(`div`,{className:`lane ${e}`,children:i[e].map(e=>L(ih,{edge:e,search:n},`${e.relation}:${e.node.uri}`))},e))})]})};function oh(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=oh(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var sh={value:()=>{}};function ch(){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 lh(n)}function lh(e){this._=e}function uh(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}})}lh.prototype=ch.prototype={constructor:lh,on:function(e,t){var n=this._,r=uh(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=dh(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=fh(n[i],e.name,t);else if(t==null)for(i in n)n[i]=fh(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 lh(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 dh(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function fh(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=sh,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var ph={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 mh(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),ph.hasOwnProperty(t)?{space:ph[t],local:e}:e}function hh(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 gh(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _h(e){var t=mh(e);return(t.local?gh:hh)(t)}function vh(){}function yh(e){return e==null?vh:function(){return this.querySelector(e)}}function bh(e){typeof e!=`function`&&(e=yh(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 c_(r,this._parents)}function xh(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Sh(){return[]}function Ch(e){return e==null?Sh:function(){return this.querySelectorAll(e)}}function wh(e){return function(){return xh(e.apply(this,arguments))}}function Th(e){e=typeof e==`function`?wh(e):Ch(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 c_(r,i)}function Eh(e){return function(){return this.matches(e)}}function Dh(e){return function(t){return t.matches(e)}}var Oh=Array.prototype.find;function kh(e){return function(){return Oh.call(this.children,e)}}function Ah(){return this.firstElementChild}function jh(e){return this.select(e==null?Ah:kh(typeof e==`function`?e:Dh(e)))}var Mh=Array.prototype.filter;function Nh(){return Array.from(this.children)}function Ph(e){return function(){return Mh.call(this.children,e)}}function Fh(e){return this.selectAll(e==null?Nh:Ph(typeof e==`function`?e:Dh(e)))}function Ih(e){typeof e!=`function`&&(e=Eh(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 c_(r,this._parents)}function Lh(e){return Array(e.length)}function Rh(){return new c_(this._enter||this._groups.map(Lh),this._parents)}function zh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}zh.prototype={constructor:zh,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 Bh(e){return function(){return e}}function Vh(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 zh(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Hh(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 zh(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Uh(e){return e.__data__}function Wh(e,t){if(!arguments.length)return Array.from(this,Uh);var n=t?Hh:Vh,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Bh(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=Gh(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 c_(o,r),o._enter=s,o._exit=c,o}function Gh(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Kh(){return new c_(this._exit||this._groups.map(Lh),this._parents)}function qh(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 Jh(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 c_(s,this._parents)}function Yh(){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 Xh(e){e||=Zh;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 c_(i,this._parents).order()}function Zh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Qh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function $h(){return Array.from(this)}function eg(){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 tg(){let e=0;for(let t of this)++e;return e}function ng(){return!this.node()}function rg(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 ig(e){return function(){this.removeAttribute(e)}}function ag(e){return function(){this.removeAttributeNS(e.space,e.local)}}function og(e,t){return function(){this.setAttribute(e,t)}}function sg(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function cg(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function lg(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 ug(e,t){var n=mh(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?ag:ig:typeof t==`function`?n.local?lg:cg:n.local?sg:og)(n,t))}function dg(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fg(e){return function(){this.style.removeProperty(e)}}function pg(e,t,n){return function(){this.style.setProperty(e,t,n)}}function mg(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function hg(e,t,n){return arguments.length>1?this.each((t==null?fg:typeof t==`function`?mg:pg)(e,t,n??``)):gg(this.node(),e)}function gg(e,t){return e.style.getPropertyValue(t)||dg(e).getComputedStyle(e,null).getPropertyValue(t)}function _g(e){return function(){delete this[e]}}function vg(e,t){return function(){this[e]=t}}function yg(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function bg(e,t){return arguments.length>1?this.each((t==null?_g:typeof t==`function`?yg:vg)(e,t)):this.node()[e]}function xg(e){return e.trim().split(/^|\s+/)}function Sg(e){return e.classList||new Cg(e)}function Cg(e){this._node=e,this._names=xg(e.getAttribute(`class`)||``)}Cg.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 wg(e,t){for(var n=Sg(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Tg(e,t){for(var n=Sg(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Eg(e){return function(){wg(this,e)}}function Dg(e){return function(){Tg(this,e)}}function Og(e,t){return function(){(t.apply(this,arguments)?wg:Tg)(this,e)}}function kg(e,t){var n=xg(e+``);if(arguments.length<2){for(var r=Sg(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Og:t?Eg:Dg)(n,t))}function Ag(){this.textContent=``}function jg(e){return function(){this.textContent=e}}function Mg(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Ng(e){return arguments.length?this.each(e==null?Ag:(typeof e==`function`?Mg:jg)(e)):this.node().textContent}function Pg(){this.innerHTML=``}function Fg(e){return function(){this.innerHTML=e}}function Ig(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Lg(e){return arguments.length?this.each(e==null?Pg:(typeof e==`function`?Ig:Fg)(e)):this.node().innerHTML}function Rg(){this.nextSibling&&this.parentNode.appendChild(this)}function zg(){return this.each(Rg)}function Bg(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Vg(){return this.each(Bg)}function Hg(e){var t=typeof e==`function`?e:_h(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ug(){return null}function Wg(e,t){var n=typeof e==`function`?e:_h(e),r=t==null?Ug:typeof t==`function`?t:yh(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Gg(){var e=this.parentNode;e&&e.removeChild(this)}function Kg(){return this.each(Gg)}function qg(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Jg(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Yg(e){return this.select(e?Jg:qg)}function Xg(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Zg(e){return function(t){e.call(this,t,this.__data__)}}function Qg(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 $g(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 e_(e,t,n){return function(){var r=this.__on,i,a=Zg(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 t_(e,t,n){var r=Qg(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}return}for(s=t?e_:$g,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function n_(e,t,n){var r=dg(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 r_(e,t){return function(){return n_(this,e,t)}}function i_(e,t){return function(){return n_(this,e,t.apply(this,arguments))}}function a_(e,t){return this.each((typeof t==`function`?i_:r_)(e,t))}function*o_(){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 s_=[null];function c_(e,t){this._groups=e,this._parents=t}function l_(){return new c_([[document.documentElement]],s_)}function u_(){return this}c_.prototype=l_.prototype={constructor:c_,select:bh,selectAll:Th,selectChild:jh,selectChildren:Fh,filter:Ih,data:Wh,enter:Rh,exit:Kh,join:qh,merge:Jh,selection:u_,order:Yh,sort:Xh,call:Qh,nodes:$h,node:eg,size:tg,empty:ng,each:rg,attr:ug,style:hg,property:bg,classed:kg,text:Ng,html:Lg,raise:zg,lower:Vg,append:Hg,insert:Wg,remove:Kg,clone:Yg,datum:Xg,on:t_,dispatch:a_,[Symbol.iterator]:o_};function d_(e){return typeof e==`string`?new c_([[document.querySelector(e)]],[document.documentElement]):new c_([[e]],s_)}function f_(e){let t;for(;t=e.sourceEvent;)e=t;return e}function p_(e,t){if(e=f_(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 m_={passive:!1},h_={capture:!0,passive:!1};function g_(e){e.stopImmediatePropagation()}function __(e){e.preventDefault(),e.stopImmediatePropagation()}function v_(e){var t=e.document.documentElement,n=d_(e).on(`dragstart.drag`,__,h_);`onselectstart`in t?n.on(`selectstart.drag`,__,h_):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function y_(e,t){var n=e.document.documentElement,r=d_(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,__,h_),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 b_=e=>()=>e;function x_(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}})}x_.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function S_(e){return!e.ctrlKey&&!e.button}function C_(){return this.parentNode}function w_(e,t){return t??{x:e.x,y:e.y}}function T_(){return navigator.maxTouchPoints||`ontouchstart`in this}function E_(){var e=S_,t=C_,n=w_,r=T_,i={},a=ch(`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`,_,m_).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&&(d_(n.view).on(`mousemove.drag`,m,h_).on(`mouseup.drag`,h,h_),v_(n.view),g_(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(__(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){d_(e.view).on(`mousemove.drag mouseup.drag`,null),y_(e.view,l),__(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]))&&(g_(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])&&(__(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])&&(g_(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=p_(l||r,t),p,m,h;if((h=n.call(e,new x_(`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=p_(l||a,t),_=o}u.call(r,e,new x_(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:b_(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:b_(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:b_(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:b_(!!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 D_(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function O_(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function k_(){}var A_=.7,j_=1/A_,M_=`\\s*([+-]?\\d+)\\s*`,N_=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,P_=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,F_=/^#([0-9a-f]{3,8})$/,I_=RegExp(`^rgb\\(${M_},${M_},${M_}\\)$`),L_=RegExp(`^rgb\\(${P_},${P_},${P_}\\)$`),R_=RegExp(`^rgba\\(${M_},${M_},${M_},${N_}\\)$`),z_=RegExp(`^rgba\\(${P_},${P_},${P_},${N_}\\)$`),B_=RegExp(`^hsl\\(${N_},${P_},${P_}\\)$`),V_=RegExp(`^hsla\\(${N_},${P_},${P_},${N_}\\)$`),H_={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};D_(k_,q_,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:U_,formatHex:U_,formatHex8:W_,formatHsl:G_,formatRgb:K_,toString:K_});function U_(){return this.rgb().formatHex()}function W_(){return this.rgb().formatHex8()}function G_(){return ov(this).formatHsl()}function K_(){return this.rgb().formatRgb()}function q_(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=F_.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?J_(t):n===3?new Q_(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Y_(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Y_(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=I_.exec(e))?new Q_(t[1],t[2],t[3],1):(t=L_.exec(e))?new Q_(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=R_.exec(e))?Y_(t[1],t[2],t[3],t[4]):(t=z_.exec(e))?Y_(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=B_.exec(e))?av(t[1],t[2]/100,t[3]/100,1):(t=V_.exec(e))?av(t[1],t[2]/100,t[3]/100,t[4]):H_.hasOwnProperty(e)?J_(H_[e]):e===`transparent`?new Q_(NaN,NaN,NaN,0):null}function J_(e){return new Q_(e>>16&255,e>>8&255,e&255,1)}function Y_(e,t,n,r){return r<=0&&(e=t=n=NaN),new Q_(e,t,n,r)}function X_(e){return e instanceof k_||(e=q_(e)),e?(e=e.rgb(),new Q_(e.r,e.g,e.b,e.opacity)):new Q_}function Z_(e,t,n,r){return arguments.length===1?X_(e):new Q_(e,t,n,r??1)}function Q_(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}D_(Q_,Z_,O_(k_,{brighter(e){return e=e==null?j_:j_**+e,new Q_(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?A_:A_**+e,new Q_(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Q_(rv(this.r),rv(this.g),rv(this.b),nv(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:$_,formatHex:$_,formatHex8:ev,formatRgb:tv,toString:tv}));function $_(){return`#${iv(this.r)}${iv(this.g)}${iv(this.b)}`}function ev(){return`#${iv(this.r)}${iv(this.g)}${iv(this.b)}${iv((isNaN(this.opacity)?1:this.opacity)*255)}`}function tv(){let e=nv(this.opacity);return`${e===1?`rgb(`:`rgba(`}${rv(this.r)}, ${rv(this.g)}, ${rv(this.b)}${e===1?`)`:`, ${e})`}`}function nv(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rv(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function iv(e){return e=rv(e),(e<16?`0`:``)+e.toString(16)}function av(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new cv(e,t,n,r)}function ov(e){if(e instanceof cv)return new cv(e.h,e.s,e.l,e.opacity);if(e instanceof k_||(e=q_(e)),!e)return new cv;if(e instanceof cv)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 cv(o,s,c,e.opacity)}function sv(e,t,n,r){return arguments.length===1?ov(e):new cv(e,t,n,r??1)}function cv(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}D_(cv,sv,O_(k_,{brighter(e){return e=e==null?j_:j_**+e,new cv(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?A_:A_**+e,new cv(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 Q_(dv(e>=240?e-240:e+120,i,r),dv(e,i,r),dv(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new cv(lv(this.h),uv(this.s),uv(this.l),nv(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=nv(this.opacity);return`${e===1?`hsl(`:`hsla(`}${lv(this.h)}, ${uv(this.s)*100}%, ${uv(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function lv(e){return e=(e||0)%360,e<0?e+360:e}function uv(e){return Math.max(0,Math.min(1,e||0))}function dv(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 fv=e=>()=>e;function pv(e,t){return function(n){return e+n*t}}function mv(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function hv(e){return(e=+e)==1?gv:function(t,n){return n-t?mv(t,n,e):fv(isNaN(t)?n:t)}}function gv(e,t){var n=t-e;return n?pv(e,n):fv(isNaN(e)?t:e)}var _v=(function e(t){var n=hv(t);function r(e,t){var r=n((e=Z_(e)).r,(t=Z_(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=gv(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 vv(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 yv(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function bv(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]=kv(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 xv(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Sv(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Cv(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]=kv(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var wv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tv=new RegExp(wv.source,`g`);function Ev(e){return function(){return e}}function Dv(e){return function(t){return e(t)+``}}function Ov(e,t){var n=wv.lastIndex=Tv.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=wv.exec(e))&&(i=Tv.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:Sv(r,i)})),n=Tv.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?Dv(c[0].x):Ev(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 kv(e,t){var n=typeof t,r;return t==null||n===`boolean`?fv(t):(n===`number`?Sv:n===`string`?(r=q_(t))?(t=r,_v):Ov:t instanceof q_?_v:t instanceof Date?xv:yv(t)?vv:Array.isArray(t)?bv:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Cv:Sv)(e,t)}var Av=180/Math.PI,jv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Mv(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)*Av,skewX:Math.atan(c)*Av,scaleX:o,scaleY:s}}var Nv;function Pv(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?jv:Mv(t.a,t.b,t.c,t.d,t.e,t.f)}function Fv(e){return e==null||(Nv||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),Nv.setAttribute(`transform`,e),!(e=Nv.transform.baseVal.consolidate()))?jv:(e=e.matrix,Mv(e.a,e.b,e.c,e.d,e.e,e.f))}function Iv(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:Sv(e,i)},{i:c-2,x:Sv(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:Sv(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:Sv(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:Sv(e,n)},{i:s-2,x:Sv(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 Lv=Iv(Pv,`px, `,`px)`,`deg)`),Rv=Iv(Fv,`, `,`)`,`)`),zv=1e-12;function Bv(e){return((e=Math.exp(e))+1/e)/2}function Vv(e){return((e=Math.exp(e))-1/e)/2}function Hv(e){return((e=Math.exp(2*e))-1)/(e+1)}var Uv=(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<zv)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=Bv(y),c=s/(n*g)*(i*Hv(t*r+y)-Vv(y));return[a+c*d,o+c*f,s*i/Bv(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),Wv=0,Gv=0,Kv=0,qv=1e3,Jv,Yv,Xv=0,Zv=0,Qv=0,$v=typeof performance==`object`&&performance.now?performance:Date,ey=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ty(){return Zv||=(ey(ny),$v.now()+Qv)}function ny(){Zv=0}function ry(){this._call=this._time=this._next=null}ry.prototype=iy.prototype={constructor:ry,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?ty():+n)+(t==null?0:+t),!this._next&&Yv!==this&&(Yv?Yv._next=this:Jv=this,Yv=this),this._call=e,this._time=n,ly()},stop:function(){this._call&&(this._call=null,this._time=1/0,ly())}};function iy(e,t,n){var r=new ry;return r.restart(e,t,n),r}function ay(){ty(),++Wv;for(var e=Jv,t;e;)(t=Zv-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Wv}function oy(){Zv=(Xv=$v.now())+Qv,Wv=Gv=0;try{ay()}finally{Wv=0,cy(),Zv=0}}function sy(){var e=$v.now(),t=e-Xv;t>qv&&(Qv-=t,Xv=e)}function cy(){for(var e,t=Jv,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:Jv=n);Yv=e,ly(r)}function ly(e){Wv||(Gv&&=clearTimeout(Gv),e-Zv>24?(e<1/0&&(Gv=setTimeout(oy,e-$v.now()-Qv)),Kv&&=clearInterval(Kv)):(Kv||=(Xv=$v.now(),setInterval(sy,qv)),Wv=1,ey(oy)))}function uy(e,t,n){var r=new ry;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var dy=ch(`start`,`end`,`cancel`,`interrupt`),fy=[];function py(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;_y(e,n,{name:t,index:r,group:i,on:dy,tween:fy,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function my(e,t){var n=gy(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function hy(e,t){var n=gy(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function gy(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function _y(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=iy(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 uy(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(uy(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 vy(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}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&&delete e.__transition}}function yy(e){return this.each(function(){vy(this,e)})}function by(e,t){var n,r;return function(){var i=hy(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 xy(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=hy(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 Sy(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=gy(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?by:xy)(n,e,t))}function Cy(e,t,n){var r=e._id;return e.each(function(){var e=hy(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return gy(e,r).value[t]}}function wy(e,t){var n;return(typeof t==`number`?Sv:t instanceof q_?_v:(n=q_(t))?(t=n,_v):Ov)(e,t)}function Ty(e){return function(){this.removeAttribute(e)}}function Ey(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Dy(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 Oy(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 ky(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 Ay(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 jy(e,t){var n=mh(e),r=n===`transform`?Rv:wy;return this.attrTween(e,typeof t==`function`?(n.local?Ay:ky)(n,r,Cy(this,`attr.`+e,t)):t==null?(n.local?Ey:Ty)(n):(n.local?Oy:Dy)(n,r,t))}function My(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ny(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Py(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ny(e,i)),n}return i._value=t,i}function Fy(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&My(e,i)),n}return i._value=t,i}function Iy(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=mh(e);return this.tween(n,(r.local?Py:Fy)(r,t))}function Ly(e,t){return function(){my(this,e).delay=+t.apply(this,arguments)}}function Ry(e,t){return t=+t,function(){my(this,e).delay=t}}function zy(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ly:Ry)(t,e)):gy(this.node(),t).delay}function By(e,t){return function(){hy(this,e).duration=+t.apply(this,arguments)}}function Vy(e,t){return t=+t,function(){hy(this,e).duration=t}}function Hy(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?By:Vy)(t,e)):gy(this.node(),t).duration}function Uy(e,t){if(typeof t!=`function`)throw Error();return function(){hy(this,e).ease=t}}function Wy(e){var t=this._id;return arguments.length?this.each(Uy(t,e)):gy(this.node(),t).ease}function Gy(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();hy(this,e).ease=n}}function Ky(e){if(typeof e!=`function`)throw Error();return this.each(Gy(this._id,e))}function qy(e){typeof e!=`function`&&(e=Eh(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 Sb(r,this._parents,this._name,this._id)}function Jy(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 Sb(o,this._parents,this._name,this._id)}function Yy(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 Xy(e,t,n){var r,i,a=Yy(t)?my:hy;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Zy(e,t){var n=this._id;return arguments.length<2?gy(this.node(),n).on.on(e):this.each(Xy(n,e,t))}function Qy(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function $y(){return this.on(`end.remove`,Qy(this._id))}function eb(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=yh(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,py(l[f],t,n,f,l,gy(u,n)));return new Sb(a,this._parents,t,n)}function tb(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ch(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=gy(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&py(p,t,n,h,f,m);a.push(f),o.push(u)}return new Sb(a,o,t,n)}var nb=l_.prototype.constructor;function rb(){return new nb(this._groups,this._parents)}function ib(e,t){var n,r,i;return function(){var a=gg(this,e),o=(this.style.removeProperty(e),gg(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ab(e){return function(){this.style.removeProperty(e)}}function ob(e,t,n){var r,i=n+``,a;return function(){var o=gg(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function sb(e,t,n){var r,i,a;return function(){var o=gg(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),gg(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function cb(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=hy(this,e),l=c.on,u=c.value[a]==null?s||=ab(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function lb(e,t,n){var r=(e+=``)==`transform`?Lv:wy;return t==null?this.styleTween(e,ib(e,r)).on(`end.style.`+e,ab(e)):typeof t==`function`?this.styleTween(e,sb(e,r,Cy(this,`style.`+e,t))).each(cb(this._id,e)):this.styleTween(e,ob(e,r,t),n).on(`end.style.`+e,null)}function ub(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function db(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&ub(e,a,n)),r}return a._value=t,a}function fb(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,db(e,t,n??``))}function pb(e){return function(){this.textContent=e}}function mb(e){return function(){var t=e(this);this.textContent=t??``}}function hb(e){return this.tween(`text`,typeof e==`function`?mb(Cy(this,`text`,e)):pb(e==null?``:e+``))}function gb(e){return function(t){this.textContent=e.call(this,t)}}function _b(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&gb(r)),t}return r._value=e,r}function vb(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,_b(e))}function yb(){for(var e=this._name,t=this._id,n=Cb(),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=gy(c,t);py(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Sb(r,this._parents,e,n)}function bb(){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=hy(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 xb=0;function Sb(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Cb(){return++xb}var wb=l_.prototype;Sb.prototype={constructor:Sb,select:eb,selectAll:tb,selectChild:wb.selectChild,selectChildren:wb.selectChildren,filter:qy,merge:Jy,selection:rb,transition:yb,call:wb.call,nodes:wb.nodes,node:wb.node,size:wb.size,empty:wb.empty,each:wb.each,on:Zy,attr:jy,attrTween:Iy,style:lb,styleTween:fb,text:hb,textTween:vb,remove:$y,tween:Sy,delay:zy,duration:Hy,ease:Wy,easeVarying:Ky,end:bb,[Symbol.iterator]:wb[Symbol.iterator]};function Tb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Eb={time:null,delay:0,duration:250,ease:Tb};function Db(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Ob(e){var t,n;e instanceof Sb?(t=e._id,e=e._name):(t=Cb(),(n=Eb).time=ty(),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])&&py(c,e,t,l,o,n||Db(c,t));return new Sb(r,this._parents,e,t)}l_.prototype.interrupt=yy,l_.prototype.transition=Ob;var kb=e=>()=>e;function Ab(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 jb(e,t,n){this.k=e,this.x=t,this.y=n}jb.prototype={constructor:jb,scale:function(e){return e===1?this:new jb(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new jb(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 Mb=new jb(1,0,0);Nb.prototype=jb.prototype;function Nb(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Mb;return e.__zoom}function Pb(e){e.stopImmediatePropagation()}function Fb(e){e.preventDefault(),e.stopImmediatePropagation()}function Ib(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Lb(){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 Rb(){return this.__zoom||Mb}function zb(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Bb(){return navigator.maxTouchPoints||`ontouchstart`in this}function Vb(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 Hb(){var e=Ib,t=Lb,n=Vb,r=zb,i=Bb,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Uv,l=ch(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Rb).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`,Rb),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(Mb.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 jb(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 jb(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 jb(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=d_(this.that).datum();l.call(e,this.that,new Ab(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=p_(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)],vy(this),s.start();Fb(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=d_(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=p_(t,i),l=t.clientX,u=t.clientY;v_(t.view),Pb(t),a.mouse=[c,this.__zoom.invert(c)],vy(this),a.start();function d(e){if(Fb(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]=p_(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),y_(e.view,a.moved),Fb(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=p_(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);Fb(r),s>0?d_(this).transition().duration(s).call(x,d,c,r):d_(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(Pb(t),s=0;s<i;++s)c=r[s],l=p_(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)),vy(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(Fb(e),s=0;s<a;++s)c=i[s],l=p_(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(Pb(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=p_(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=d_(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:kb(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:kb(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:kb(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:kb([[+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 Ub={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.`},Wb=[[-1/0,-1/0],[1/0,1/0]],Gb=[`Enter`,` `,`Escape`],Kb={"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`},qb;(function(e){e.Strict=`strict`,e.Loose=`loose`})(qb||={});var Jb;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Jb||={});var Yb;(function(e){e.Partial=`partial`,e.Full=`full`})(Yb||={});var Xb={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Zb;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(Zb||={});var Qb;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Qb||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var $b={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top},ex=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,tx=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),nx=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),rx=(e,t=[0,0])=>{let{width:n,height:r}=Lx(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},ix=(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):nx(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,_x(e,xx(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?yx(r):{x:0,y:0,width:0,height:0}},ax=(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=_x(n,xx(e)),r=!0)}),r?yx(n):{x:0,y:0,width:0,height:0}},ox=(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=Cx(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},sx=(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 cx(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}=Lx(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 lx({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Px(ax(cx(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 ux({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`,Ub.error005());else{let{width:e,height:t}=Lx(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&Ix(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=Ix(d)?px(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,Ub.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 dx({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=sx(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 fx=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),px=(e={x:0,y:0},t,n)=>({x:fx(e.x,t[0][0],t[1][0]-(n?.width??0)),y:fx(e.y,t[0][1],t[1][1]-(n?.height??0))});function mx(e,t,n){let{width:r,height:i}=Lx(n),{x:a,y:o}=n.internals.positionAbsolute;return px(e,[[a,o],[a+r,o+i]],t)}var hx=(e,t,n)=>e<t?fx(Math.abs(e-t),1,t)/t:e>n?-fx(Math.abs(e-n),1,t)/t:0,gx=(e,t,n=15,r=40)=>[hx(e.x,r,t.width-r)*n,hx(e.y,r,t.height-r)*n],_x=(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)}),vx=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),yx=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),bx=(e,t=[0,0])=>{let{x:n,y:r}=nx(e)?e.internals.positionAbsolute:rx(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}},xx=(e,t=[0,0])=>{let{x:n,y:r}=nx(e)?e.internals.positionAbsolute:rx(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)}},Sx=(e,t)=>yx(_x(vx(e),vx(t))),Cx=(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)},wx=(e,t)=>Cx(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Tx=e=>Ex(e.width)&&Ex(e.height)&&Ex(e.x)&&Ex(e.y),Ex=e=>!isNaN(e)&&isFinite(e),Dx=(e,t)=>(e,t)=>{},Ox=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),kx=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?Ox(s,o):s},Ax=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function jx(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 Mx(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=jx(e,n),i=jx(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=jx(e.top??e.y??0,n),i=jx(e.bottom??e.y??0,n),a=jx(e.left??e.x??0,t),o=jx(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 Nx(e,t,n,r,i,a){let{x:o,y:s}=Ax(e,[t,n,r]),{x:c,y:l}=Ax({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 Px=(e,t,n,r,i,a)=>{let o=Mx(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=fx(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=Nx(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}},Fx=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Ix(e){return e!=null&&e!==`parent`}function Lx(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Rx(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function zx(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 Bx(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Vx(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Hx(e){return{...Kb,...e||{}}}function Ux(e){return e===null?null:e?`valid`:`invalid`}function Wx(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Xx(e),s=kx({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?Ox(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Gx=e=>({width:e.offsetWidth,height:e.offsetHeight}),Kx=e=>e?.getRootNode?.()||window?.document,qx=[`INPUT`,`SELECT`,`TEXTAREA`];function Jx(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?qx.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Yx=e=>`clientX`in e,Xx=(e,t)=>{let n=Yx(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)}},Zx=(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,...Gx(t)}})};function Qx({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 $x(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function eS({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-$x(t-r,a),n];case Q.Right:return[t+$x(r-t,a),n];case Q.Top:return[t,n-$x(n-i,a)];case Q.Bottom:return[t,n+$x(i-n,a)]}}function tS({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=eS({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=eS({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Qx({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 nS({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 rS({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 iS({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=_x(xx(e),xx(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),wx({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},yx(a))>0}var aS=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,oS=(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)),sS=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,Ub.error006()),t;let r=n.getEdgeId||aS,i;return i=ex(e)?{...e}:{...e,id:r(e)},oS(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function cS({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=nS({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var lS={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},uS=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.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},dS=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function fS({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=lS[t],c=lS[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=uS({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]=nS({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 pS(e,t,n,r){let i=Math.min(dS(e,t)/2,dS(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 mS({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=fS({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+=pS(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 hS(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function gS(e){let{sourceNode:t,targetNode:n}=e;if(!hS(t)||!hS(n))return null;let r=t.internals.handleBounds||_S(t.handles),i=n.internals.handleBounds||_S(n.handles),a=yS(r?.source??[],e.sourceHandle),o=yS(e.connectionMode===qb.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,Ub.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||Q.Bottom,c=o?.position||Q.Top,l=vS(t,a,s),u=vS(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function _S(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 vS(e,t,n=Q.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??Lx(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function yS(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function bS(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function xS(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=bS(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 SS=1e3,CS=10,wS={nodeOrigin:[0,0],nodeExtent:Wb,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},TS={...wS,checkEquality:!0};function ES(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function DS(e,t,n){let r=ES(wS,n);for(let n of e.values())if(n.parentId)MS(n,e,t,r);else{let e=px(rx(n,r.nodeOrigin),Ix(n.extent)?n.extent:r.nodeExtent,Lx(n));n.internals.positionAbsolute=e}}function OS(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 kS(e){return e===`manual`}function AS(e,t,n,r={}){let i=ES(TS,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!kS(i.zIndexMode)?SS: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=px(rx(u,i.nodeOrigin),Ix(u.extent)?u.extent:i.nodeExtent,Lx(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:OS(u,e),z:NS(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&&MS(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function jS(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 MS(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=ES(wS,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}jS(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*CS),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=PS(e,u,o,s,a&&!kS(c)?SS: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 NS(e,t,n){let r=Ex(e.zIndex)?e.zIndex:0;return kS(n)?r:r+(e.selected?t:0)}function PS(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Lx(e),l=rx(e,n),u=Ix(e.extent)?px(l,e.extent,c):l,d=px({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=mx(d,c,t));let f=NS(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function FS(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=Sx(a.get(n.parentId)?.expandedRect??bx(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=Lx(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 IS(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=Gx(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=Ix(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=mx(h,s,n))}else m&&(h=px(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:Zx(`source`,r.nodeElement,p,d,e.id),target:Zx(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&MS(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:bx(g,i)}))}}if(f.length>0){let e=FS(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function LS({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 RS(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 zS(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}`;RS(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),RS(`target`,s,c,e,i,o),t.set(r.id,r)}}function BS(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:BS(n,t):!1}function VS(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 HS(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!BS(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 US({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 WS({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=Ox(a,t);return{x:o.x-a.x,y:o.y-a.y}}function GS({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=d_(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?vx(ax(s)):null,x=v&&l?WS({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)}:Ox(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}=ux({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]=US({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]=gx(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=Wx(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=HS(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=US({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=E_().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=Wx(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Xx(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Wx(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=Xx(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=Xx(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}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]=US({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||!VS(t,`.${g}`,v))&&(!_||VS(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function KS(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())wx(i,bx(e))>0&&r.push(e);return r}var qS=250;function JS(e,t,n,r){let i=[],a=1/0,o=KS(e,n,t+qS);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}=vS(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 YS(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,...vS(o,c,c.position,!0)}:c}function XS(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function ZS(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var QS=()=>!0;function $S(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:_=QS,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Kx(e.target),E=0,D,{x:O,y:k}=Xx(e),A=XS(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=YS(i,A,r,c,t);if(!N)return;let P=Xx(e,j),F=!1,I=null,ee=!1,L=null;function te(){if(!u||!j)return;let[e,t]=gx(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(te)}let R={...N,nodeId:i,type:A,position:N.position},ne=c.get(i),re={inProgress:!0,isValid:null,from:vS(ne,R,Q.Left,!0),fromHandle:R,fromPosition:R.position,fromNode:ne,to:P,toHandle:null,toPosition:$b[R.position],toNode:null,pointer:P};function z(){M=!0,y(re),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&z();function ie(e){if(!M){let{x:t,y:n}=Xx(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;z()}if(!x()||!R){B(e);return}let a=b();P=Xx(e,j),D=JS(kx(P,a,!1,[1,1]),n,c,R),F||=(te(),!0);let s=eC(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,I=s.connection,ee=ZS(!!D,s.isValid);let u=c.get(i),f=u?vS(u,R,Q.Left,!0):re.from,p={...re,from:f,isValid:ee,to:s.toHandle&&ee?Ax({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:ee&&s.toHandle?s.toHandle.position:$b[R.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),re=p}function B(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&I&&ee&&h?.(I);let{inProgress:t,...n}=re,r={...n,toPosition:re.toHandle?re.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,ee=!1,I=null,L=null,T.removeEventListener(`mousemove`,ie),T.removeEventListener(`mouseup`,B),T.removeEventListener(`touchmove`,ie),T.removeEventListener(`touchend`,B)}}T.addEventListener(`mousemove`,ie),T.addEventListener(`mouseup`,B),T.addEventListener(`touchmove`,ie),T.addEventListener(`touchend`,B)}function eC(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=QS,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}=Xx(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=XS(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===qb.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=YS(t,e,a,u,n,!0)}return _}var tC={onPointerDown:$S,isValid:eC};function nC({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=d_(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&&Fx()?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=Hb().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:p_}}var rC=e=>({x:e.x,y:e.y,zoom:e.k}),iC=({x:e,y:t,zoom:n})=>Mb.translate(e,t).scale(n),aC=(e,t)=>e.target.closest(`.${t}`),oC=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),sC=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,cC=(e,t=0,n=sC,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},lC=e=>{let t=e.ctrlKey&&Fx()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function uC({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(aC(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=p_(u),t=d*2**lC(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Jb.Vertical?0:u.deltaX*f,m=i===Jb.Horizontal?0:u.deltaY*f;!Fx()&&u.shiftKey&&i!==Jb.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=rC(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 dC({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=aC(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function fC({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=rC(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 pC({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&oC(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,rC(a.transform))}}function mC({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&oC(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=rC(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function hC({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`&&(aC(f,`${u}-flow__node`)||aC(f,`${u}-flow__edge`)||aC(f,`${u}-flow__selection`)||aC(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||aC(f,c)&&h||aC(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 gC({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=Hb().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=d_(e).call(f);y({x:i.x,y:i.y,zoom:fx(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(lC);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?kv:Uv).transform(cC(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:!Ex(D)||D<0?0:D);let A=k?uC({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):dC({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,A,{passive:!1});let j=fC({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,j);let M=pC({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,M);let N=mC({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,N);let P=hC({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=iC(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=iC(e);return await g(n,t),n}function x(e){if(p){let t=iC(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?Nb(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`?kv:Uv).scaleTo(cC(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?kv:Uv).scaleBy(cC(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=!Ex(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 _C;(function(e){e.Line=`line`,e.Handle=`handle`})(_C||={});function vC({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 yC(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 bC(e,t){return Math.max(0,t-e)}function xC(e,t){return Math.max(0,e-t)}function SC(e,t,n){return Math.max(0,t-e,e-n)}function CC(e,t){return e?!t:t}function wC(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=SC(E,h,g),j=SC(D,_,v);if(o){let e=0,t=0;c&&w<0?e=bC(y+w+O,o[0][0]):!c&&w>0&&(e=xC(y+E+O,o[1][0])),l&&T<0?t=bC(b+T+k,o[0][1]):!l&&T>0&&(t=xC(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=xC(y+w,s[0][0]):!c&&w<0&&(e=bC(y+E,s[1][0])),l&&T>0?t=xC(b+T,s[0][1]):!l&&T<0&&(t=bC(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=SC(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?xC(b+k+E/C,o[1][1])*C:bC(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?bC(b+E/C,s[1][1])*C:xC(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=SC(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?xC(y+D*C+O,o[1][0])/C:bC(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?bC(y+D*C,s[1][0])/C:xC(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=(CC(c,l)?-w:w)/C:w=(CC(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 TC={width:0,height:0,x:0,y:0},EC={...TC,pointerX:0,pointerY:0,aspectRatio:1};function DC(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 OC({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=d_(e),o={controlDirection:yC(`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={...TC},h={...EC};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:yC(e)};let g,_=null,v=[],y,b,x,S=!1,C=E_().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}=Wx(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=Ix(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=DC(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=Wx(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}=wC(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 F=vC({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),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 kC=ce((e=>{var t=(le(),ee(s)),n=qa();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.useSyncExternalStore,o=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var d=o(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(!a){if(a=!0,o=e,e=r(e),s!==void 0&&f.hasValue){var t=f.value;if(s(t,e))return c=t}return c=e}if(t=c,i(o,e))return t;var n=r(e);return s!==void 0&&s(t,n)?(o=e,t):(o=e,c=n)}var a=!1,o,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,s]);var p=a(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),AC=T(ce(((e,t)=>{t.exports=kC()}))(),1),jC=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},MC=e=>e?jC(e):jC;le();var{useDebugValue:NC}=n,{useSyncExternalStoreWithSelector:PC}=AC.default,FC=e=>e;function IC(e,t=FC,n){let r=PC(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return NC(r),r}var LC=(e,t)=>{let n=MC(e),r=(e,r=t)=>IC(n,e,r);return Object.assign(r,n),r},RC=(e,t)=>e?LC(e,t):LC;function zC(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}me(),le();var BC=A(null),VC=BC.Provider,HC=Ub.error001(`react`);function UC(e,t){let n=R(BC);if(n===null)throw Error(HC);return IC(n,e,t)}function WC(){let e=R(BC);if(e===null)throw Error(HC);return D(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var GC={display:`none`},KC={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},qC=`react-flow__node-desc`,JC=`react-flow__edge-desc`,YC=`react-flow__aria-live`,XC=e=>e.ariaLiveMessage,ZC=e=>e.ariaLabelConfig;function QC({rfId:e}){let t=UC(XC);return W(`div`,{id:`${YC}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:KC,children:t})}function $C({rfId:e,disableKeyboardA11y:t}){let n=UC(ZC);return W(M,{children:[W(`div`,{id:`${qC}-${e}`,style:GC,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),W(`div`,{id:`${JC}-${e}`,style:GC,children:n[`edge.a11yDescription.default`]}),!t&&W(QC,{rfId:e})]})}var ew=b(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return W(`div`,{className:oh([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});ew.displayName=`Panel`;var tw=`https://reactflow.dev?utm_source=attribution`;function nw({proOptions:e,position:t=`bottom-right`}){return N(()=>{},[]),e?.hideAttribution?null:W(ew,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${tw}`,children:W(`a`,{href:tw,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var rw=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}},iw=e=>e.id;function aw(e,t){return zC(e.selectedNodes.map(iw),t.selectedNodes.map(iw))&&zC(e.selectedEdges.map(iw),t.selectedEdges.map(iw))}function ow({onSelectionChange:e}){let t=WC(),{selectedNodes:n,selectedEdges:r}=UC(rw,aw);return N(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var sw=e=>!!e.onSelectionChangeHandlers;function cw({onSelectionChange:e}){let t=UC(sw);return e||t?W(ow,{onSelectionChange:e}):null}var lw=[0,0],uw={x:0,y:0,zoom:1},dw=[...`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`],fw=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}),pw={translateExtent:Wb,nodeOrigin:lw,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function mw(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=UC(fw,zC),l=WC();N(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=pw,s()}),[]);let u=w(pw);return N(()=>{for(let s of dw){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:Hx(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},dw.map(t=>e[t])),null}function hw(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function gw(e){let[t,n]=V(e===`system`?null:e);return N(()=>{if(e!==`system`){n(e);return}let t=hw(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?hw()?.matches?`dark`:`light`:t}var _w=typeof document<`u`?document:null;function vw(e=null,t={target:_w,actInsideInputWithModifier:!0}){let[n,r]=V(!1),i=w(!1),a=w(new Set([])),[o,s]=D(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
1125
+ `,ah=({edge:e,search:t})=>{let n=Vp(e.node.covers),r=e.node.titles?.at(0)?.title,i=[$m(e.format),Fs(e.node.status)].filter(Boolean).join(` · `);return I(Fo,{className:`relation-card`,css:ih,to:`${Ho(Y.MEDIA,{uri:oe(e.node.uri)})}${t}`,children:[n?L(`img`,{className:`cover`,src:n,alt:``}):L(`div`,{className:`cover`}),I(`div`,{className:`body`,children:[L(`div`,{className:`relation`,children:Zm(e.relation)}),L(`div`,{className:`title`,children:r??e.node.uri}),i?L(`div`,{className:`meta`,children:i}):void 0]})]})},oh=({relations:e,action:t})=>{let n=km(Oo()),r=th(e);if(!r.length)return null;let i=nh(r);return I(`div`,{css:rh,"data-relations":!0,children:[I(`div`,{className:`heading`,children:[L(`span`,{children:`Relations`}),t]}),L(`div`,{className:`grid`,children:[`before`,`middle`,`after`].map(e=>L(`div`,{className:`lane ${e}`,children:i[e].map(e=>L(ah,{edge:e,search:n},`${e.relation}:${e.node.uri}`))},e))})]})};function sh(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=sh(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var ch={value:()=>{}};function lh(){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 uh(n)}function uh(e){this._=e}function dh(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}})}uh.prototype=lh.prototype={constructor:uh,on:function(e,t){var n=this._,r=dh(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=fh(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=ph(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ph(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 uh(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 fh(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function ph(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=ch,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var mh={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 hh(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),mh.hasOwnProperty(t)?{space:mh[t],local:e}:e}function gh(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 _h(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function vh(e){var t=hh(e);return(t.local?_h:gh)(t)}function yh(){}function bh(e){return e==null?yh:function(){return this.querySelector(e)}}function xh(e){typeof e!=`function`&&(e=bh(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 l_(r,this._parents)}function Sh(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ch(){return[]}function wh(e){return e==null?Ch:function(){return this.querySelectorAll(e)}}function Th(e){return function(){return Sh(e.apply(this,arguments))}}function Eh(e){e=typeof e==`function`?Th(e):wh(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 l_(r,i)}function Dh(e){return function(){return this.matches(e)}}function Oh(e){return function(t){return t.matches(e)}}var kh=Array.prototype.find;function Ah(e){return function(){return kh.call(this.children,e)}}function jh(){return this.firstElementChild}function Mh(e){return this.select(e==null?jh:Ah(typeof e==`function`?e:Oh(e)))}var Nh=Array.prototype.filter;function Ph(){return Array.from(this.children)}function Fh(e){return function(){return Nh.call(this.children,e)}}function Ih(e){return this.selectAll(e==null?Ph:Fh(typeof e==`function`?e:Oh(e)))}function Lh(e){typeof e!=`function`&&(e=Dh(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 l_(r,this._parents)}function Rh(e){return Array(e.length)}function zh(){return new l_(this._enter||this._groups.map(Rh),this._parents)}function Bh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Bh.prototype={constructor:Bh,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 Vh(e){return function(){return e}}function Hh(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 Bh(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Uh(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 Bh(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Wh(e){return e.__data__}function Gh(e,t){if(!arguments.length)return Array.from(this,Wh);var n=t?Uh:Hh,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Vh(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=Kh(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 l_(o,r),o._enter=s,o._exit=c,o}function Kh(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function qh(){return new l_(this._exit||this._groups.map(Rh),this._parents)}function Jh(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 Yh(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 l_(s,this._parents)}function Xh(){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 Zh(e){e||=Qh;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 l_(i,this._parents).order()}function Qh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function $h(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function eg(){return Array.from(this)}function tg(){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 ng(){let e=0;for(let t of this)++e;return e}function rg(){return!this.node()}function ig(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 ag(e){return function(){this.removeAttribute(e)}}function og(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sg(e,t){return function(){this.setAttribute(e,t)}}function cg(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function lg(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ug(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 dg(e,t){var n=hh(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?og:ag:typeof t==`function`?n.local?ug:lg:n.local?cg:sg)(n,t))}function fg(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function pg(e){return function(){this.style.removeProperty(e)}}function mg(e,t,n){return function(){this.style.setProperty(e,t,n)}}function hg(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function gg(e,t,n){return arguments.length>1?this.each((t==null?pg:typeof t==`function`?hg:mg)(e,t,n??``)):_g(this.node(),e)}function _g(e,t){return e.style.getPropertyValue(t)||fg(e).getComputedStyle(e,null).getPropertyValue(t)}function vg(e){return function(){delete this[e]}}function yg(e,t){return function(){this[e]=t}}function bg(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function xg(e,t){return arguments.length>1?this.each((t==null?vg:typeof t==`function`?bg:yg)(e,t)):this.node()[e]}function Sg(e){return e.trim().split(/^|\s+/)}function Cg(e){return e.classList||new wg(e)}function wg(e){this._node=e,this._names=Sg(e.getAttribute(`class`)||``)}wg.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 Tg(e,t){for(var n=Cg(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Eg(e,t){for(var n=Cg(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Dg(e){return function(){Tg(this,e)}}function Og(e){return function(){Eg(this,e)}}function kg(e,t){return function(){(t.apply(this,arguments)?Tg:Eg)(this,e)}}function Ag(e,t){var n=Sg(e+``);if(arguments.length<2){for(var r=Cg(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?kg:t?Dg:Og)(n,t))}function jg(){this.textContent=``}function Mg(e){return function(){this.textContent=e}}function Ng(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Pg(e){return arguments.length?this.each(e==null?jg:(typeof e==`function`?Ng:Mg)(e)):this.node().textContent}function Fg(){this.innerHTML=``}function Ig(e){return function(){this.innerHTML=e}}function Lg(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Rg(e){return arguments.length?this.each(e==null?Fg:(typeof e==`function`?Lg:Ig)(e)):this.node().innerHTML}function zg(){this.nextSibling&&this.parentNode.appendChild(this)}function Bg(){return this.each(zg)}function Vg(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Hg(){return this.each(Vg)}function Ug(e){var t=typeof e==`function`?e:vh(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Wg(){return null}function Gg(e,t){var n=typeof e==`function`?e:vh(e),r=t==null?Wg:typeof t==`function`?t:bh(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Kg(){var e=this.parentNode;e&&e.removeChild(this)}function qg(){return this.each(Kg)}function Jg(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Yg(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Xg(e){return this.select(e?Yg:Jg)}function Zg(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Qg(e){return function(t){e.call(this,t,this.__data__)}}function $g(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 e_(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 t_(e,t,n){return function(){var r=this.__on,i,a=Qg(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 n_(e,t,n){var r=$g(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}return}for(s=t?t_:e_,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function r_(e,t,n){var r=fg(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 i_(e,t){return function(){return r_(this,e,t)}}function a_(e,t){return function(){return r_(this,e,t.apply(this,arguments))}}function o_(e,t){return this.each((typeof t==`function`?a_:i_)(e,t))}function*s_(){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 c_=[null];function l_(e,t){this._groups=e,this._parents=t}function u_(){return new l_([[document.documentElement]],c_)}function d_(){return this}l_.prototype=u_.prototype={constructor:l_,select:xh,selectAll:Eh,selectChild:Mh,selectChildren:Ih,filter:Lh,data:Gh,enter:zh,exit:qh,join:Jh,merge:Yh,selection:d_,order:Xh,sort:Zh,call:$h,nodes:eg,node:tg,size:ng,empty:rg,each:ig,attr:dg,style:gg,property:xg,classed:Ag,text:Pg,html:Rg,raise:Bg,lower:Hg,append:Ug,insert:Gg,remove:qg,clone:Xg,datum:Zg,on:n_,dispatch:o_,[Symbol.iterator]:s_};function f_(e){return typeof e==`string`?new l_([[document.querySelector(e)]],[document.documentElement]):new l_([[e]],c_)}function p_(e){let t;for(;t=e.sourceEvent;)e=t;return e}function m_(e,t){if(e=p_(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 h_={passive:!1},g_={capture:!0,passive:!1};function __(e){e.stopImmediatePropagation()}function v_(e){e.preventDefault(),e.stopImmediatePropagation()}function y_(e){var t=e.document.documentElement,n=f_(e).on(`dragstart.drag`,v_,g_);`onselectstart`in t?n.on(`selectstart.drag`,v_,g_):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function b_(e,t){var n=e.document.documentElement,r=f_(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,v_,g_),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 x_=e=>()=>e;function S_(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}})}S_.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function C_(e){return!e.ctrlKey&&!e.button}function w_(){return this.parentNode}function T_(e,t){return t??{x:e.x,y:e.y}}function E_(){return navigator.maxTouchPoints||`ontouchstart`in this}function D_(){var e=C_,t=w_,n=T_,r=E_,i={},a=lh(`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`,_,h_).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&&(f_(n.view).on(`mousemove.drag`,m,g_).on(`mouseup.drag`,h,g_),y_(n.view),__(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(v_(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){f_(e.view).on(`mousemove.drag mouseup.drag`,null),b_(e.view,l),v_(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]))&&(__(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])&&(v_(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])&&(__(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=m_(l||r,t),p,m,h;if((h=n.call(e,new S_(`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=m_(l||a,t),_=o}u.call(r,e,new S_(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:x_(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:x_(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:x_(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:x_(!!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 O_(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function k_(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function A_(){}var j_=.7,M_=1/j_,N_=`\\s*([+-]?\\d+)\\s*`,P_=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,F_=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,I_=/^#([0-9a-f]{3,8})$/,L_=RegExp(`^rgb\\(${N_},${N_},${N_}\\)$`),R_=RegExp(`^rgb\\(${F_},${F_},${F_}\\)$`),z_=RegExp(`^rgba\\(${N_},${N_},${N_},${P_}\\)$`),B_=RegExp(`^rgba\\(${F_},${F_},${F_},${P_}\\)$`),V_=RegExp(`^hsl\\(${P_},${F_},${F_}\\)$`),H_=RegExp(`^hsla\\(${P_},${F_},${F_},${P_}\\)$`),U_={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};O_(A_,J_,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:W_,formatHex:W_,formatHex8:G_,formatHsl:K_,formatRgb:q_,toString:q_});function W_(){return this.rgb().formatHex()}function G_(){return this.rgb().formatHex8()}function K_(){return sv(this).formatHsl()}function q_(){return this.rgb().formatRgb()}function J_(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=I_.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Y_(t):n===3?new $_(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?X_(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?X_(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=L_.exec(e))?new $_(t[1],t[2],t[3],1):(t=R_.exec(e))?new $_(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=z_.exec(e))?X_(t[1],t[2],t[3],t[4]):(t=B_.exec(e))?X_(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=V_.exec(e))?ov(t[1],t[2]/100,t[3]/100,1):(t=H_.exec(e))?ov(t[1],t[2]/100,t[3]/100,t[4]):U_.hasOwnProperty(e)?Y_(U_[e]):e===`transparent`?new $_(NaN,NaN,NaN,0):null}function Y_(e){return new $_(e>>16&255,e>>8&255,e&255,1)}function X_(e,t,n,r){return r<=0&&(e=t=n=NaN),new $_(e,t,n,r)}function Z_(e){return e instanceof A_||(e=J_(e)),e?(e=e.rgb(),new $_(e.r,e.g,e.b,e.opacity)):new $_}function Q_(e,t,n,r){return arguments.length===1?Z_(e):new $_(e,t,n,r??1)}function $_(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}O_($_,Q_,k_(A_,{brighter(e){return e=e==null?M_:M_**+e,new $_(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?j_:j_**+e,new $_(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new $_(iv(this.r),iv(this.g),iv(this.b),rv(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:ev,formatHex:ev,formatHex8:tv,formatRgb:nv,toString:nv}));function ev(){return`#${av(this.r)}${av(this.g)}${av(this.b)}`}function tv(){return`#${av(this.r)}${av(this.g)}${av(this.b)}${av((isNaN(this.opacity)?1:this.opacity)*255)}`}function nv(){let e=rv(this.opacity);return`${e===1?`rgb(`:`rgba(`}${iv(this.r)}, ${iv(this.g)}, ${iv(this.b)}${e===1?`)`:`, ${e})`}`}function rv(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function iv(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function av(e){return e=iv(e),(e<16?`0`:``)+e.toString(16)}function ov(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new lv(e,t,n,r)}function sv(e){if(e instanceof lv)return new lv(e.h,e.s,e.l,e.opacity);if(e instanceof A_||(e=J_(e)),!e)return new lv;if(e instanceof lv)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 lv(o,s,c,e.opacity)}function cv(e,t,n,r){return arguments.length===1?sv(e):new lv(e,t,n,r??1)}function lv(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}O_(lv,cv,k_(A_,{brighter(e){return e=e==null?M_:M_**+e,new lv(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?j_:j_**+e,new lv(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 $_(fv(e>=240?e-240:e+120,i,r),fv(e,i,r),fv(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new lv(uv(this.h),dv(this.s),dv(this.l),rv(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=rv(this.opacity);return`${e===1?`hsl(`:`hsla(`}${uv(this.h)}, ${dv(this.s)*100}%, ${dv(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function uv(e){return e=(e||0)%360,e<0?e+360:e}function dv(e){return Math.max(0,Math.min(1,e||0))}function fv(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 pv=e=>()=>e;function mv(e,t){return function(n){return e+n*t}}function hv(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function gv(e){return(e=+e)==1?_v:function(t,n){return n-t?hv(t,n,e):pv(isNaN(t)?n:t)}}function _v(e,t){var n=t-e;return n?mv(e,n):pv(isNaN(e)?t:e)}var vv=(function e(t){var n=gv(t);function r(e,t){var r=n((e=Q_(e)).r,(t=Q_(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=_v(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 yv(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 bv(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xv(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]=Av(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 Sv(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Cv(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function wv(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]=Av(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var Tv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ev=new RegExp(Tv.source,`g`);function Dv(e){return function(){return e}}function Ov(e){return function(t){return e(t)+``}}function kv(e,t){var n=Tv.lastIndex=Ev.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Tv.exec(e))&&(i=Ev.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:Cv(r,i)})),n=Ev.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?Ov(c[0].x):Dv(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 Av(e,t){var n=typeof t,r;return t==null||n===`boolean`?pv(t):(n===`number`?Cv:n===`string`?(r=J_(t))?(t=r,vv):kv:t instanceof J_?vv:t instanceof Date?Sv:bv(t)?yv:Array.isArray(t)?xv:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?wv:Cv)(e,t)}var jv=180/Math.PI,Mv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Nv(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)*jv,skewX:Math.atan(c)*jv,scaleX:o,scaleY:s}}var Pv;function Fv(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Mv:Nv(t.a,t.b,t.c,t.d,t.e,t.f)}function Iv(e){return e==null||(Pv||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),Pv.setAttribute(`transform`,e),!(e=Pv.transform.baseVal.consolidate()))?Mv:(e=e.matrix,Nv(e.a,e.b,e.c,e.d,e.e,e.f))}function Lv(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:Cv(e,i)},{i:c-2,x:Cv(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:Cv(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:Cv(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:Cv(e,n)},{i:s-2,x:Cv(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 Rv=Lv(Fv,`px, `,`px)`,`deg)`),zv=Lv(Iv,`, `,`)`,`)`),Bv=1e-12;function Vv(e){return((e=Math.exp(e))+1/e)/2}function Hv(e){return((e=Math.exp(e))-1/e)/2}function Uv(e){return((e=Math.exp(2*e))-1)/(e+1)}var Wv=(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<Bv)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=Vv(y),c=s/(n*g)*(i*Uv(t*r+y)-Hv(y));return[a+c*d,o+c*f,s*i/Vv(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),Gv=0,Kv=0,qv=0,Jv=1e3,Yv,Xv,Zv=0,Qv=0,$v=0,ey=typeof performance==`object`&&performance.now?performance:Date,ty=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ny(){return Qv||=(ty(ry),ey.now()+$v)}function ry(){Qv=0}function iy(){this._call=this._time=this._next=null}iy.prototype=ay.prototype={constructor:iy,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?ny():+n)+(t==null?0:+t),!this._next&&Xv!==this&&(Xv?Xv._next=this:Yv=this,Xv=this),this._call=e,this._time=n,uy()},stop:function(){this._call&&(this._call=null,this._time=1/0,uy())}};function ay(e,t,n){var r=new iy;return r.restart(e,t,n),r}function oy(){ny(),++Gv;for(var e=Yv,t;e;)(t=Qv-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Gv}function sy(){Qv=(Zv=ey.now())+$v,Gv=Kv=0;try{oy()}finally{Gv=0,ly(),Qv=0}}function cy(){var e=ey.now(),t=e-Zv;t>Jv&&($v-=t,Zv=e)}function ly(){for(var e,t=Yv,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:Yv=n);Xv=e,uy(r)}function uy(e){Gv||(Kv&&=clearTimeout(Kv),e-Qv>24?(e<1/0&&(Kv=setTimeout(sy,e-ey.now()-$v)),qv&&=clearInterval(qv)):(qv||=(Zv=ey.now(),setInterval(cy,Jv)),Gv=1,ty(sy)))}function dy(e,t,n){var r=new iy;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var fy=lh(`start`,`end`,`cancel`,`interrupt`),py=[];function my(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;vy(e,n,{name:t,index:r,group:i,on:fy,tween:py,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function hy(e,t){var n=_y(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function gy(e,t){var n=_y(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function _y(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function vy(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=ay(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 dy(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(dy(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 yy(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}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&&delete e.__transition}}function by(e){return this.each(function(){yy(this,e)})}function xy(e,t){var n,r;return function(){var i=gy(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 Sy(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=gy(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 Cy(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=_y(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?xy:Sy)(n,e,t))}function wy(e,t,n){var r=e._id;return e.each(function(){var e=gy(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return _y(e,r).value[t]}}function Ty(e,t){var n;return(typeof t==`number`?Cv:t instanceof J_?vv:(n=J_(t))?(t=n,vv):kv)(e,t)}function Ey(e){return function(){this.removeAttribute(e)}}function Dy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Oy(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 ky(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 Ay(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 jy(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 My(e,t){var n=hh(e),r=n===`transform`?zv:Ty;return this.attrTween(e,typeof t==`function`?(n.local?jy:Ay)(n,r,wy(this,`attr.`+e,t)):t==null?(n.local?Dy:Ey)(n):(n.local?ky:Oy)(n,r,t))}function Ny(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Py(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Fy(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Py(e,i)),n}return i._value=t,i}function Iy(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ny(e,i)),n}return i._value=t,i}function Ly(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=hh(e);return this.tween(n,(r.local?Fy:Iy)(r,t))}function Ry(e,t){return function(){hy(this,e).delay=+t.apply(this,arguments)}}function zy(e,t){return t=+t,function(){hy(this,e).delay=t}}function By(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ry:zy)(t,e)):_y(this.node(),t).delay}function Vy(e,t){return function(){gy(this,e).duration=+t.apply(this,arguments)}}function Hy(e,t){return t=+t,function(){gy(this,e).duration=t}}function Uy(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Vy:Hy)(t,e)):_y(this.node(),t).duration}function Wy(e,t){if(typeof t!=`function`)throw Error();return function(){gy(this,e).ease=t}}function Gy(e){var t=this._id;return arguments.length?this.each(Wy(t,e)):_y(this.node(),t).ease}function Ky(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();gy(this,e).ease=n}}function qy(e){if(typeof e!=`function`)throw Error();return this.each(Ky(this._id,e))}function Jy(e){typeof e!=`function`&&(e=Dh(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 Cb(r,this._parents,this._name,this._id)}function Yy(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 Cb(o,this._parents,this._name,this._id)}function Xy(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 Zy(e,t,n){var r,i,a=Xy(t)?hy:gy;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Qy(e,t){var n=this._id;return arguments.length<2?_y(this.node(),n).on.on(e):this.each(Zy(n,e,t))}function $y(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function eb(){return this.on(`end.remove`,$y(this._id))}function tb(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=bh(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,my(l[f],t,n,f,l,_y(u,n)));return new Cb(a,this._parents,t,n)}function nb(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=wh(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=_y(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&my(p,t,n,h,f,m);a.push(f),o.push(u)}return new Cb(a,o,t,n)}var rb=u_.prototype.constructor;function ib(){return new rb(this._groups,this._parents)}function ab(e,t){var n,r,i;return function(){var a=_g(this,e),o=(this.style.removeProperty(e),_g(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ob(e){return function(){this.style.removeProperty(e)}}function sb(e,t,n){var r,i=n+``,a;return function(){var o=_g(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function cb(e,t,n){var r,i,a;return function(){var o=_g(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),_g(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function lb(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=gy(this,e),l=c.on,u=c.value[a]==null?s||=ob(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function ub(e,t,n){var r=(e+=``)==`transform`?Rv:Ty;return t==null?this.styleTween(e,ab(e,r)).on(`end.style.`+e,ob(e)):typeof t==`function`?this.styleTween(e,cb(e,r,wy(this,`style.`+e,t))).each(lb(this._id,e)):this.styleTween(e,sb(e,r,t),n).on(`end.style.`+e,null)}function db(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function fb(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&db(e,a,n)),r}return a._value=t,a}function pb(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,fb(e,t,n??``))}function mb(e){return function(){this.textContent=e}}function hb(e){return function(){var t=e(this);this.textContent=t??``}}function gb(e){return this.tween(`text`,typeof e==`function`?hb(wy(this,`text`,e)):mb(e==null?``:e+``))}function _b(e){return function(t){this.textContent=e.call(this,t)}}function vb(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&_b(r)),t}return r._value=e,r}function yb(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,vb(e))}function bb(){for(var e=this._name,t=this._id,n=wb(),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=_y(c,t);my(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Cb(r,this._parents,e,n)}function xb(){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=gy(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 Sb=0;function Cb(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function wb(){return++Sb}var Tb=u_.prototype;Cb.prototype={constructor:Cb,select:tb,selectAll:nb,selectChild:Tb.selectChild,selectChildren:Tb.selectChildren,filter:Jy,merge:Yy,selection:ib,transition:bb,call:Tb.call,nodes:Tb.nodes,node:Tb.node,size:Tb.size,empty:Tb.empty,each:Tb.each,on:Qy,attr:My,attrTween:Ly,style:ub,styleTween:pb,text:gb,textTween:yb,remove:eb,tween:Cy,delay:By,duration:Uy,ease:Gy,easeVarying:qy,end:xb,[Symbol.iterator]:Tb[Symbol.iterator]};function Eb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Db={time:null,delay:0,duration:250,ease:Eb};function Ob(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function kb(e){var t,n;e instanceof Cb?(t=e._id,e=e._name):(t=wb(),(n=Db).time=ny(),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])&&my(c,e,t,l,o,n||Ob(c,t));return new Cb(r,this._parents,e,t)}u_.prototype.interrupt=by,u_.prototype.transition=kb;var Ab=e=>()=>e;function jb(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 Mb(e,t,n){this.k=e,this.x=t,this.y=n}Mb.prototype={constructor:Mb,scale:function(e){return e===1?this:new Mb(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Mb(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 Nb=new Mb(1,0,0);Pb.prototype=Mb.prototype;function Pb(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Nb;return e.__zoom}function Fb(e){e.stopImmediatePropagation()}function Ib(e){e.preventDefault(),e.stopImmediatePropagation()}function Lb(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Rb(){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 zb(){return this.__zoom||Nb}function Bb(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Vb(){return navigator.maxTouchPoints||`ontouchstart`in this}function Hb(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 Ub(){var e=Lb,t=Rb,n=Hb,r=Bb,i=Vb,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Wv,l=lh(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,zb).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`,zb),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(Nb.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 Mb(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 Mb(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 Mb(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=f_(this.that).datum();l.call(e,this.that,new jb(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=m_(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)],yy(this),s.start();Ib(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=f_(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=m_(t,i),l=t.clientX,u=t.clientY;y_(t.view),Fb(t),a.mouse=[c,this.__zoom.invert(c)],yy(this),a.start();function d(e){if(Ib(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]=m_(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),b_(e.view,a.moved),Ib(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=m_(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);Ib(r),s>0?f_(this).transition().duration(s).call(x,d,c,r):f_(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(Fb(t),s=0;s<i;++s)c=r[s],l=m_(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)),yy(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(Ib(e),s=0;s<a;++s)c=i[s],l=m_(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(Fb(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=m_(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=f_(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Ab(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Ab(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Ab(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Ab([[+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 Wb={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.`},Gb=[[-1/0,-1/0],[1/0,1/0]],Kb=[`Enter`,` `,`Escape`],qb={"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`},Jb;(function(e){e.Strict=`strict`,e.Loose=`loose`})(Jb||={});var Yb;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Yb||={});var Xb;(function(e){e.Partial=`partial`,e.Full=`full`})(Xb||={});var Zb={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Qb;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(Qb||={});var $b;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})($b||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var ex={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top},tx=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,nx=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),rx=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),ix=(e,t=[0,0])=>{let{width:n,height:r}=Rx(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},ax=(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):rx(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,vx(e,Sx(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?bx(r):{x:0,y:0,width:0,height:0}},ox=(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=vx(n,Sx(e)),r=!0)}),r?bx(n):{x:0,y:0,width:0,height:0}},sx=(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=wx(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},cx=(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 lx(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}=Rx(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 ux({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Fx(ox(lx(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 dx({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`,Wb.error005());else{let{width:e,height:t}=Rx(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&Lx(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=Lx(d)?mx(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,Wb.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 fx({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=cx(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 px=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),mx=(e={x:0,y:0},t,n)=>({x:px(e.x,t[0][0],t[1][0]-(n?.width??0)),y:px(e.y,t[0][1],t[1][1]-(n?.height??0))});function hx(e,t,n){let{width:r,height:i}=Rx(n),{x:a,y:o}=n.internals.positionAbsolute;return mx(e,[[a,o],[a+r,o+i]],t)}var gx=(e,t,n)=>e<t?px(Math.abs(e-t),1,t)/t:e>n?-px(Math.abs(e-n),1,t)/t:0,_x=(e,t,n=15,r=40)=>[gx(e.x,r,t.width-r)*n,gx(e.y,r,t.height-r)*n],vx=(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)}),yx=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),bx=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),xx=(e,t=[0,0])=>{let{x:n,y:r}=rx(e)?e.internals.positionAbsolute:ix(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}},Sx=(e,t=[0,0])=>{let{x:n,y:r}=rx(e)?e.internals.positionAbsolute:ix(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)}},Cx=(e,t)=>bx(vx(yx(e),yx(t))),wx=(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)},Tx=(e,t)=>wx(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Ex=e=>Dx(e.width)&&Dx(e.height)&&Dx(e.x)&&Dx(e.y),Dx=e=>!isNaN(e)&&isFinite(e),Ox=(e,t)=>(e,t)=>{},kx=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ax=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?kx(s,o):s},jx=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Mx(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 Nx(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=Mx(e,n),i=Mx(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=Mx(e.top??e.y??0,n),i=Mx(e.bottom??e.y??0,n),a=Mx(e.left??e.x??0,t),o=Mx(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 Px(e,t,n,r,i,a){let{x:o,y:s}=jx(e,[t,n,r]),{x:c,y:l}=jx({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 Fx=(e,t,n,r,i,a)=>{let o=Nx(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=px(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=Px(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}},Ix=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Lx(e){return e!=null&&e!==`parent`}function Rx(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function zx(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Bx(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 Vx(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Hx(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Ux(e){return{...qb,...e||{}}}function Wx(e){return e===null?null:e?`valid`:`invalid`}function Gx(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Zx(e),s=Ax({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?kx(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Kx=e=>({width:e.offsetWidth,height:e.offsetHeight}),qx=e=>e?.getRootNode?.()||window?.document,Jx=[`INPUT`,`SELECT`,`TEXTAREA`];function Yx(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Jx.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Xx=e=>`clientX`in e,Zx=(e,t)=>{let n=Xx(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)}},Qx=(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,...Kx(t)}})};function $x({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 eS(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function tS({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-eS(t-r,a),n];case Q.Right:return[t+eS(r-t,a),n];case Q.Top:return[t,n-eS(n-i,a)];case Q.Bottom:return[t,n+eS(i-n,a)]}}function nS({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=tS({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=tS({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=$x({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 rS({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 iS({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 aS({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=vx(Sx(e),Sx(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),Tx({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},bx(a))>0}var oS=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,sS=(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)),cS=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,Wb.error006()),t;let r=n.getEdgeId||oS,i;return i=tx(e)?{...e}:{...e,id:r(e)},sS(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function lS({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=rS({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var uS={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},dS=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.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},fS=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function pS({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=uS[t],c=uS[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=dS({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]=rS({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 mS(e,t,n,r){let i=Math.min(fS(e,t)/2,fS(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 hS({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=pS({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+=mS(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 gS(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function _S(e){let{sourceNode:t,targetNode:n}=e;if(!gS(t)||!gS(n))return null;let r=t.internals.handleBounds||vS(t.handles),i=n.internals.handleBounds||vS(n.handles),a=bS(r?.source??[],e.sourceHandle),o=bS(e.connectionMode===Jb.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,Wb.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||Q.Bottom,c=o?.position||Q.Top,l=yS(t,a,s),u=yS(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function vS(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 yS(e,t,n=Q.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??Rx(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function bS(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function xS(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function SS(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=xS(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 CS=1e3,wS=10,TS={nodeOrigin:[0,0],nodeExtent:Gb,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},ES={...TS,checkEquality:!0};function DS(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function OS(e,t,n){let r=DS(TS,n);for(let n of e.values())if(n.parentId)NS(n,e,t,r);else{let e=mx(ix(n,r.nodeOrigin),Lx(n.extent)?n.extent:r.nodeExtent,Rx(n));n.internals.positionAbsolute=e}}function kS(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 AS(e){return e===`manual`}function jS(e,t,n,r={}){let i=DS(ES,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!AS(i.zIndexMode)?CS: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=mx(ix(u,i.nodeOrigin),Lx(u.extent)?u.extent:i.nodeExtent,Rx(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:kS(u,e),z:PS(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&&NS(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function MS(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 NS(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=DS(TS,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}MS(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*wS),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=FS(e,u,o,s,a&&!AS(c)?CS: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 PS(e,t,n){let r=Dx(e.zIndex)?e.zIndex:0;return AS(n)?r:r+(e.selected?t:0)}function FS(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Rx(e),l=ix(e,n),u=Lx(e.extent)?mx(l,e.extent,c):l,d=mx({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=hx(d,c,t));let f=PS(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function IS(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=Cx(a.get(n.parentId)?.expandedRect??xx(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=Rx(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 LS(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=Kx(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=Lx(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=hx(h,s,n))}else m&&(h=mx(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:Qx(`source`,r.nodeElement,p,d,e.id),target:Qx(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&NS(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:xx(g,i)}))}}if(f.length>0){let e=IS(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function RS({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 zS(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 BS(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}`;zS(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),zS(`target`,s,c,e,i,o),t.set(r.id,r)}}function VS(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:VS(n,t):!1}function HS(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 US(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!VS(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 WS({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 GS({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=kx(a,t);return{x:o.x-a.x,y:o.y-a.y}}function KS({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=f_(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?yx(ox(s)):null,x=v&&l?GS({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)}:kx(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}=dx({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]=WS({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]=_x(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=Gx(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=US(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=WS({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=D_().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=Gx(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Zx(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Gx(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=Zx(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=Zx(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}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]=WS({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||!HS(t,`.${g}`,v))&&(!_||HS(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function qS(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())Tx(i,xx(e))>0&&r.push(e);return r}var JS=250;function YS(e,t,n,r){let i=[],a=1/0,o=qS(e,n,t+JS);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}=yS(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 XS(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,...yS(o,c,c.position,!0)}:c}function ZS(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function QS(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var $S=()=>!0;function eC(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:_=$S,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=qx(e.target),E=0,D,{x:O,y:k}=Zx(e),A=ZS(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=XS(i,A,r,c,t);if(!N)return;let P=Zx(e,j),F=!1,I=null,ee=!1,L=null;function te(){if(!u||!j)return;let[e,t]=_x(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(te)}let R={...N,nodeId:i,type:A,position:N.position},ne=c.get(i),re={inProgress:!0,isValid:null,from:yS(ne,R,Q.Left,!0),fromHandle:R,fromPosition:R.position,fromNode:ne,to:P,toHandle:null,toPosition:ex[R.position],toNode:null,pointer:P};function z(){M=!0,y(re),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&z();function ie(e){if(!M){let{x:t,y:n}=Zx(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;z()}if(!x()||!R){B(e);return}let a=b();P=Zx(e,j),D=YS(Ax(P,a,!1,[1,1]),n,c,R),F||=(te(),!0);let s=tC(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,I=s.connection,ee=QS(!!D,s.isValid);let u=c.get(i),f=u?yS(u,R,Q.Left,!0):re.from,p={...re,from:f,isValid:ee,to:s.toHandle&&ee?jx({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:ee&&s.toHandle?s.toHandle.position:ex[R.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),re=p}function B(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&I&&ee&&h?.(I);let{inProgress:t,...n}=re,r={...n,toPosition:re.toHandle?re.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,ee=!1,I=null,L=null,T.removeEventListener(`mousemove`,ie),T.removeEventListener(`mouseup`,B),T.removeEventListener(`touchmove`,ie),T.removeEventListener(`touchend`,B)}}T.addEventListener(`mousemove`,ie),T.addEventListener(`mouseup`,B),T.addEventListener(`touchmove`,ie),T.addEventListener(`touchend`,B)}function tC(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=$S,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}=Zx(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=ZS(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===Jb.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=XS(t,e,a,u,n,!0)}return _}var nC={onPointerDown:eC,isValid:tC};function rC({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=f_(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&&Ix()?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=Ub().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:m_}}var iC=e=>({x:e.x,y:e.y,zoom:e.k}),aC=({x:e,y:t,zoom:n})=>Nb.translate(e,t).scale(n),oC=(e,t)=>e.target.closest(`.${t}`),sC=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),cC=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,lC=(e,t=0,n=cC,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},uC=e=>{let t=e.ctrlKey&&Ix()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function dC({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(oC(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=m_(u),t=d*2**uC(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Yb.Vertical?0:u.deltaX*f,m=i===Yb.Horizontal?0:u.deltaY*f;!Ix()&&u.shiftKey&&i!==Yb.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=iC(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 fC({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=oC(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function pC({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=iC(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 mC({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&sC(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,iC(a.transform))}}function hC({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&sC(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=iC(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function gC({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`&&(oC(f,`${u}-flow__node`)||oC(f,`${u}-flow__edge`)||oC(f,`${u}-flow__selection`)||oC(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||oC(f,c)&&h||oC(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 _C({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=Ub().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=f_(e).call(f);y({x:i.x,y:i.y,zoom:px(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(uC);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Av:Wv).transform(lC(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:!Dx(D)||D<0?0:D);let A=k?dC({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):fC({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,A,{passive:!1});let j=pC({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,j);let M=mC({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,M);let N=hC({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,N);let P=gC({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=aC(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=aC(e);return await g(n,t),n}function x(e){if(p){let t=aC(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?Pb(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`?Av:Wv).scaleTo(lC(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Av:Wv).scaleBy(lC(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=!Dx(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 vC;(function(e){e.Line=`line`,e.Handle=`handle`})(vC||={});function yC({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 bC(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 xC(e,t){return Math.max(0,t-e)}function SC(e,t){return Math.max(0,e-t)}function CC(e,t,n){return Math.max(0,t-e,e-n)}function wC(e,t){return e?!t:t}function TC(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=CC(E,h,g),j=CC(D,_,v);if(o){let e=0,t=0;c&&w<0?e=xC(y+w+O,o[0][0]):!c&&w>0&&(e=SC(y+E+O,o[1][0])),l&&T<0?t=xC(b+T+k,o[0][1]):!l&&T>0&&(t=SC(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=SC(y+w,s[0][0]):!c&&w<0&&(e=xC(y+E,s[1][0])),l&&T>0?t=SC(b+T,s[0][1]):!l&&T<0&&(t=xC(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=CC(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?SC(b+k+E/C,o[1][1])*C:xC(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?xC(b+E/C,s[1][1])*C:SC(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=CC(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?SC(y+D*C+O,o[1][0])/C:xC(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?xC(y+D*C,s[1][0])/C:SC(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=(wC(c,l)?-w:w)/C:w=(wC(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 EC={width:0,height:0,x:0,y:0},DC={...EC,pointerX:0,pointerY:0,aspectRatio:1};function OC(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 kC({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=f_(e),o={controlDirection:bC(`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={...EC},h={...DC};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:bC(e)};let g,_=null,v=[],y,b,x,S=!1,C=D_().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}=Gx(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=Lx(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=OC(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=Gx(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}=TC(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 F=yC({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),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 AC=ce((e=>{var t=(le(),ee(s)),n=qa();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.useSyncExternalStore,o=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var d=o(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(!a){if(a=!0,o=e,e=r(e),s!==void 0&&f.hasValue){var t=f.value;if(s(t,e))return c=t}return c=e}if(t=c,i(o,e))return t;var n=r(e);return s!==void 0&&s(t,n)?(o=e,t):(o=e,c=n)}var a=!1,o,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,s]);var p=a(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),jC=T(ce(((e,t)=>{t.exports=AC()}))(),1),MC=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},NC=e=>e?MC(e):MC;le();var{useDebugValue:PC}=n,{useSyncExternalStoreWithSelector:FC}=jC.default,IC=e=>e;function LC(e,t=IC,n){let r=FC(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return PC(r),r}var RC=(e,t)=>{let n=NC(e),r=(e,r=t)=>LC(n,e,r);return Object.assign(r,n),r},zC=(e,t)=>e?RC(e,t):RC;function BC(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}me(),le();var VC=A(null),HC=VC.Provider,UC=Wb.error001(`react`);function WC(e,t){let n=R(VC);if(n===null)throw Error(UC);return LC(n,e,t)}function GC(){let e=R(VC);if(e===null)throw Error(UC);return D(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var KC={display:`none`},qC={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},JC=`react-flow__node-desc`,YC=`react-flow__edge-desc`,XC=`react-flow__aria-live`,ZC=e=>e.ariaLiveMessage,QC=e=>e.ariaLabelConfig;function $C({rfId:e}){let t=WC(ZC);return W(`div`,{id:`${XC}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:qC,children:t})}function ew({rfId:e,disableKeyboardA11y:t}){let n=WC(QC);return W(M,{children:[W(`div`,{id:`${JC}-${e}`,style:KC,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),W(`div`,{id:`${YC}-${e}`,style:KC,children:n[`edge.a11yDescription.default`]}),!t&&W($C,{rfId:e})]})}var tw=b(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return W(`div`,{className:sh([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});tw.displayName=`Panel`;var nw=`https://reactflow.dev?utm_source=attribution`;function rw({proOptions:e,position:t=`bottom-right`}){return N(()=>{},[]),e?.hideAttribution?null:W(tw,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${nw}`,children:W(`a`,{href:nw,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var iw=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}},aw=e=>e.id;function ow(e,t){return BC(e.selectedNodes.map(aw),t.selectedNodes.map(aw))&&BC(e.selectedEdges.map(aw),t.selectedEdges.map(aw))}function sw({onSelectionChange:e}){let t=GC(),{selectedNodes:n,selectedEdges:r}=WC(iw,ow);return N(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var cw=e=>!!e.onSelectionChangeHandlers;function lw({onSelectionChange:e}){let t=WC(cw);return e||t?W(sw,{onSelectionChange:e}):null}var uw=[0,0],dw={x:0,y:0,zoom:1},fw=[...`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`],pw=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}),mw={translateExtent:Gb,nodeOrigin:uw,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function hw(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=WC(pw,BC),l=GC();N(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=mw,s()}),[]);let u=w(mw);return N(()=>{for(let s of fw){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:Ux(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},fw.map(t=>e[t])),null}function gw(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function _w(e){let[t,n]=V(e===`system`?null:e);return N(()=>{if(e!==`system`){n(e);return}let t=gw(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?gw()?.matches?`dark`:`light`:t}var vw=typeof document<`u`?document:null;function yw(e=null,t={target:vw,actInsideInputWithModifier:!0}){let[n,r]=V(!1),i=w(!1),a=w(new Set([])),[o,s]=D(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
1155
1126
  `).replace(`
1156
1127
 
1157
1128
  `,`
1158
1129
  +`).split(`
1159
- `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return N(()=>{let n=t?.target??_w,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)&&Jx(e))return!1;let n=bw(e.code,s);if(a.current.add(e[n]),yw(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=bw(e.code,s);yw(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 yw(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function bw(e,t){return t.includes(e)?`code`:`key`}var xw=()=>{let e=WC();return D(()=>({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=Px(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 kx(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=Ax(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Sw(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)Cw(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 Cw(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 ww(e,t){return Sw(e,t)}function Tw(e,t){return Sw(e,t)}function Ew(e,t){return{id:e,type:`select`,selected:t}}function Dw(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(Ew(a.id,e)))}return r}function Ow({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 kw(e){return{id:e.id,type:`remove`}}var Aw=Dx(`React Flow`,`https://reactflow.dev/`);function jw(e,t,n={}){return sS(e,t,{...n,onError:n.onError??Aw})}var Mw=e=>tx(e),Nw=e=>ex(e);function Pw(e){return b(e)}var Fw=typeof window<`u`?S:N;function Iw(e){let[t,n]=V(BigInt(0)),[r]=V(()=>Lw(()=>n(e=>e+BigInt(1))));return Fw(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Lw(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Rw=A(null);function zw({children:e}){let t=WC(),n=Iw(U(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=Ow({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=Iw(U(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(Ow({items:s,lookup:o}))},[])),i=D(()=>({nodeQueue:n,edgeQueue:r}),[]);return W(Rw.Provider,{value:i,children:e})}function Bw(){let e=R(Rw);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Vw=e=>!!e.panZoom;function Hw(){let e=xw(),t=WC(),n=Bw(),r=UC(Vw),i=D(()=>{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=Mw(e)?e:n.get(e.id),a=i.parentId?zx(i.position,i.measured,i.parentId,n,r):i.position;return bx({...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&&Mw(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&&Nw(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 dx({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(kw);o?.(f),c(e)}if(m){let e=d.map(kw);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=Tx(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=bx(s?r:a),l=wx(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=Tx(e)?e:a(e);if(!r)return!1;let i=wx(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 ix(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??Vx();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return D(()=>({...i,...e,viewportInitialized:r}),[r])}var Uw=e=>e.selected,Ww=typeof window<`u`?window:void 0;function Gw({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=WC(),{deleteElements:r}=Hw(),i=vw(e,{actInsideInputWithModifier:!1}),a=vw(t,{target:Ww});N(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Uw),edges:e.filter(Uw)}),n.setState({nodesSelectionActive:!1})}},[i]),N(()=>{n.setState({multiSelectionActive:a})},[a])}function Kw(e){let t=WC();N(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Gx(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,Ub.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 qw={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Jw=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Yw({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=Jb.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=WC(),C=w(null),{userSelectionActive:T,lib:E,connectionInProgress:D}=UC(Jw,zC),O=vw(p),k=w();Kw(C);let A=U(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),y||S.setState({transform:e})},[v,y]);return N(()=>{if(C.current){k.current=gC({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}=k.current.getViewport();return S.setState({panZoom:k.current,transform:[e,t,n],domNode:C.current.closest(`.react-flow`)}),()=>{k.current?.destroy()}}},[]),N(()=>{k.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:O,preventScrolling:m,noPanClassName:_,userSelectionActive:T,noWheelClassName:g,lib:E,onTransformChange:A,connectionInProgress:D,selectionOnDrag:x,paneClickDistance:b})},[e,t,n,r,i,a,o,s,c,O,m,_,T,g,E,A,D,x,b]),W(`div`,{className:`react-flow__renderer`,ref:C,style:qw,children:h})}var Xw=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Zw(){let{userSelectionActive:e,userSelectionRect:t}=UC(Xw,zC);return e&&t?W(`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 Qw=(e,t)=>n=>{n.target===t.current&&e?.(n)},$w=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function eT({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Yb.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=w(0),_=WC(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=UC($w,zC),C=y&&(e||v),T=w(null),E=w(),D=w(new Set),O=w(new Set),k=w(!1),A=w(!1),j=w({x:0,y:0}),M=w(!1),P=e=>{if(A.current||k.current||_.getState().connection.inProgress){A.current=!1,k.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},F=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},I=d?e=>d(e):void 0,ee=e=>{A.current&&=(e.stopPropagation(),!1)},L=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(E.current=i?.getBoundingClientRect(),!E.current)return;let s=n.target===T.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),A.current=!1;let{x:c,y:l}=Xx(n.nativeEvent,E.current),u=kx({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 te(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}=Ax(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=D.current,g=O.current;D.current=new Set(ox(a,m,i,n===Yb.Partial,!0).map(e=>e.id)),O.current=new Set;let v=u?.selectable??!0;for(let e of D.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&O.current.add(e)}}Bx(h,D.current)||c(Dw(a,D.current,!0)),Bx(g,O.current)||l(Dw(o,O.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function R(){if(!i||!E.current)return;let[e,t]=gx(j.current,E.current,S);x({x:e,y:t}).then(e=>{if(!A.current||!e){g.current=requestAnimationFrame(R);return}let{x:t,y:n}=j.current;te(t,n),g.current=requestAnimationFrame(R)})}let ne=()=>{cancelAnimationFrame(g.current),g.current=0,M.current=!1};N(()=>()=>ne(),[]);let re=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!E.current||!n)return;let{x:o,y:c}=Xx(e.nativeEvent,E.current);j.current={x:o,y:c};let l=Ax({x:n.startX,y:n.startY},r);if(!A.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}A.current=!0,M.current||=(R(),!0),te(o,c)},z=e=>{if(!C){e.target===T.current&&_.getState().connection.inProgress&&(k.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===T.current&&_.getState().userSelectionRect&&P?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),A.current&&(c?.(e),_.setState({nodesSelectionActive:D.current.size>0})),ne())},ie=e=>{e.target?.releasePointerCapture?.(e.pointerId),ne()},B=r===!0||Array.isArray(r)&&r.includes(0);return W(`div`,{className:oh([`react-flow__pane`,{draggable:B,dragging:b,selection:e}]),onClick:C?void 0:Qw(P,T),onContextMenu:Qw(F,T),onWheel:Qw(I,T),onPointerEnter:C?void 0:f,onPointerMove:C?re:p,onPointerUp:z,onPointerCancel:C?ie:void 0,onPointerDownCapture:C?L:void 0,onClickCapture:C?ee:void 0,onPointerLeave:m,ref:T,style:qw,children:[h,W(Zw,{})]})}function tT({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);if(!l){c?.(`012`,Ub.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function nT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=WC(),[c,l]=V(!1),u=w();return N(()=>{if(!t)return u.current=GS({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{tT({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),N(()=>{!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 rT=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function iT(){let e=WC();return U(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=rT(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=Ox(t,i));let{position:a,positionAbsolute:s}=ux({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 aT=A(null),oT=aT.Provider;aT.Consumer;var sT=()=>R(aT),cT=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),lT=A(null);function uT({children:e}){let t=UC(cT,zC);return W(lT.Provider,{value:t,children:e})}function dT(){let e=R(lT);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var fT={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},pT=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return fT;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===qb.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function mT({type:e=`source`,position:t=Q.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=WC(),_=sT(),{connectOnClick:v,noPanClassName:y,rfId:b}=dT(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=UC(pT(_,m,e),zC);_||g.getState().onError?.(`010`,Ub.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(jw(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Yx(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();tC.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 W(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:oh([`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=Kx(t.target),h=n||c,{connection:v,isValid:y}=tC.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 hT=_(Pw(mT));function gT({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return W(M,{children:[e?.label,W(hT,{type:`source`,position:n,isConnectable:t})]})}function _T({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return W(M,{children:[W(hT,{type:`target`,position:n,isConnectable:t}),e?.label,W(hT,{type:`source`,position:r,isConnectable:t})]})}function vT(){return null}function yT({data:e,isConnectable:t,targetPosition:n=Q.Top}){return W(M,{children:[W(hT,{type:`target`,position:n,isConnectable:t}),e?.label]})}var bT={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},xT={input:gT,default:_T,output:yT,group:vT};function ST(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 CT=e=>{let{width:t,height:n,x:r,y:i}=ax(e.nodeLookup,{filter:e=>!!e.selected});return{width:Ex(t)?t:null,height:Ex(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 wT({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=WC(),{width:i,height:a,transformString:o,userSelectionActive:s}=UC(CT,zC),c=iT(),l=w(null);N(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(nT({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return W(`div`,{className:oh([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:W(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(bT,e.key)&&(e.preventDefault(),c({direction:bT[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var TT=typeof window<`u`?window:void 0,ET=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function DT({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:F,isControlledViewport:I}){let{nodesSelectionActive:ee,userSelectionActive:L}=UC(ET,zC),te=vw(l,{target:TT}),R=vw(h,{target:TT}),ne=R||w,re=R||b,z=u&&ne!==!0,ie=te||L||z;return Gw({deleteKeyCode:c,multiSelectionKeyCode:m}),W(Yw,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:re,panActivationKeyPressed:R,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!te&&ne,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:z,children:W(eT,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ne,autoPanOnSelection:T,isSelecting:!!ie,selectionMode:d,selectionKeyPressed:te,paneClickDistance:s,selectionOnDrag:z,children:[e,ee&&W(wT,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}DT.displayName=`FlowRenderer`;var OT=_(DT),kT=e=>t=>e?ox(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 AT(e){return UC(U(kT(e),[e]),zC)}var jT=e=>e.updateNodeInternals;function MT(){let e=UC(jT),[t]=V(()=>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 N(()=>()=>{t?.disconnect()},[t]),t}function NT({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=WC(),a=w(null),o=w(null),s=w(e.sourcePosition),c=w(e.targetPosition),l=w(t),u=n&&!!e.internals.handleBounds;return N(()=>{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]),N(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),N(()=>{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 PT({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}=UC(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},zC),S=y.type||`default`,C=g?.[S]||xT[S];C===void 0&&(v?.(`003`,Ub.error003(S)),S=`default`,C=g?.default||xT.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=WC(),k=Rx(y),A=NT({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=nT({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=iT();if(y.hidden)return null;let N=Lx(y),P=ST(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,ee=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,te=a?e=>a(e,{...b.userNode}):void 0,R=o?e=>o(e,{...b.userNode}):void 0,ne=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&tT({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},re=t=>{if(!(Jx(t.nativeEvent)||m)){if(Gb.includes(t.key)&&T){let n=t.key===`Escape`;tT({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(bT,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:bT[t.key],factor:t.shiftKey?4:1})}}},z=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(ox(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 W(`div`,{className:oh([`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:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:ee,onMouseLeave:L,onContextMenu:te,onClick:ne,onDoubleClick:R,onKeyDown:D?re:void 0,tabIndex:D?0:void 0,onFocus:D?z:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${qC}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:W(oT,{value:e,children:W(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 FT=_(PT),IT=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function LT(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=UC(IT,zC),a=AT(e.onlyRenderVisibleElements),o=MT();return W(`div`,{className:`react-flow__nodes`,style:qw,children:a.map(a=>W(FT,{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))})}LT.displayName=`NodeRenderer`;var RT=_(LT);function zT(e){return UC(U(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&&iS({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),zC)}var BT=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return W(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},VT=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return W(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},HT={[Qb.Arrow]:BT,[Qb.ArrowClosed]:VT};function UT(e){let t=WC();return D(()=>Object.prototype.hasOwnProperty.call(HT,e)?HT[e]:(t.getState().onError?.(`009`,Ub.error009(e)),null),[e])}var WT=({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=UT(t);return c?W(`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:W(c,{color:n,strokeWidth:o})}):null},GT=({defaultColor:e,rfId:t})=>{let n=UC(e=>e.edges),r=UC(e=>e.defaultEdgeOptions),i=D(()=>xS(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?W(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:W(`defs`,{children:i.map(e=>W(WT,{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};GT.displayName=`MarkerDefinitions`;var KT=_(GT);function qT({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]=V({x:1,y:0,width:0,height:0}),p=oh([`react-flow__edge-textwrapper`,l]),m=w(null);return N(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?W(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&W(`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}),W(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}qT.displayName=`EdgeText`;var JT=_(qT);function YT({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return W(M,{children:[W(`path`,{...u,d:e,fill:`none`,className:oh([`react-flow__edge-path`,u.className])}),l?W(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&Ex(t)&&Ex(n)?W(JT,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function XT({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function ZT({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=XT({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=XT({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Qx({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 QT(e){return _(({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]=ZT({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return W(YT,{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 $T=QT({isInternal:!1}),eE=QT({isInternal:!0});$T.displayName=`SimpleBezierEdge`,eE.displayName=`SimpleBezierEdgeInternal`;function tE(e){return _(({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=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=mS({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 W(YT,{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 nE=tE({isInternal:!1}),rE=tE({isInternal:!0});nE.displayName=`SmoothStepEdge`,rE.displayName=`SmoothStepEdgeInternal`;function iE(e){return _(({id:t,...n})=>{let r=e.isInternal?void 0:t;return W(nE,{...n,id:r,pathOptions:D(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var aE=iE({isInternal:!1}),oE=iE({isInternal:!0});aE.displayName=`StepEdge`,oE.displayName=`StepEdgeInternal`;function sE(e){return _(({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]=cS({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return W(YT,{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 cE=sE({isInternal:!1}),lE=sE({isInternal:!0});cE.displayName=`StraightEdge`,lE.displayName=`StraightEdgeInternal`;function uE(e){return _(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.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]=tS({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return W(YT,{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 dE=uE({isInternal:!1}),fE=uE({isInternal:!0});dE.displayName=`BezierEdge`,fE.displayName=`BezierEdgeInternal`;var pE={default:fE,straight:lE,step:oE,smoothstep:rE,simplebezier:eE},mE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},hE=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,gE=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,_E=`react-flow__edgeupdater`;function vE({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return W(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:oh([_E,`${_E}-${s}`]),cx:hE(t,r,e),cy:gE(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function yE({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=WC(),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`;tC.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 W(M,{children:[(e===!0||e===`source`)&&W(vE,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&W(vE,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function bE({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=UC(t=>t.edgeLookup.get(e)),b=UC(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||pE[x];S===void 0&&(_?.(`011`,Ub.error011(x)),x=`default`,S=h?.default||pE.default);let C=!!(y.focusable||t&&y.focusable===void 0),T=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),E=!!(y.selectable||r&&y.selectable===void 0),O=w(null),[k,A]=V(!1),[j,M]=V(!1),N=WC(),{zIndex:P=y.zIndex,sourceX:F,sourceY:I,targetX:ee,targetY:L,sourcePosition:te,targetPosition:R}=UC(U(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return mE;let i=gS({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=rS({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||mE,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex,_]),zC),ne=D(()=>y.markerStart?`url('#${bS(y.markerStart,m)}')`:void 0,[y.markerStart,m]),re=D(()=>y.markerEnd?`url('#${bS(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||F===null||I===null||ee===null||L===null)return null;let z=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=N.getState();E&&(N.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),O.current?.blur()):n([e])),i&&i(t,y)},ie=a?e=>{a(e,{...y})}:void 0,B=o?e=>{o(e,{...y})}:void 0,ae=s?e=>{s(e,{...y})}:void 0,oe=c?e=>{c(e,{...y})}:void 0,se=l?e=>{l(e,{...y})}:void 0;return W(`svg`,{style:{zIndex:P},children:W(`g`,{className:oh([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!E&&!i,updating:k,selectable:E}]),onClick:z,onDoubleClick:ie,onContextMenu:B,onMouseEnter:ae,onMouseMove:oe,onMouseLeave:se,onKeyDown:C?t=>{if(!v&&Gb.includes(t.key)&&E){let{unselectNodesAndEdges:n,addSelectedEdges:r}=N.getState();t.key===`Escape`?(O.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?`${JC}-${m}`:void 0,ref:O,...y.domAttributes,children:[!j&&W(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:E,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:F,sourceY:I,targetX:ee,targetY:L,sourcePosition:te,targetPosition:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:ne,markerEnd:re,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),T&&W(yE,{edge:y,isReconnectable:T,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:F,sourceY:I,targetX:ee,targetY:L,sourcePosition:te,targetPosition:R,setUpdateHover:A,setReconnecting:M})]})})}var xE=_(bE),SE=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function CE({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}=UC(SE,zC),b=zT(t);return W(`div`,{className:`react-flow__edges`,children:[W(KT,{defaultColor:e,rfId:n}),b.map(e=>W(xE,{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))]})}CE.displayName=`EdgeRenderer`;var wE=_(CE),TE=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function EE({children:e}){let t=WC(),n=w(null),[r]=V(()=>t.getState().transform);return Fw(()=>{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=TE(r)))};return r(),t.subscribe(r)},[t]),W(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:TE(r)},children:e})}function DE(e){let t=Hw(),n=w(!1);N(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var OE=e=>e.panZoom?.syncViewport;function kE(e){let t=UC(OE),n=WC();return N(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function AE(e){return e.connection.inProgress?{...e.connection,to:kx(e.connection.to,e.transform)}:{...e.connection}}function jE(e){return e?t=>e(AE(t)):AE}function ME(e){return UC(jE(e),zC)}var NE=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function PE({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=UC(NE,zC);return a&&i&&c?W(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:W(`g`,{className:oh([`react-flow__connection`,Ux(s)]),children:W(FE,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var FE=({style:e,type:t=Zb.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}=ME();if(!i)return;if(n)return W(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:Ux(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 Zb.Bezier:[m]=tS(h);break;case Zb.SimpleBezier:[m]=ZT(h);break;case Zb.Step:[m]=mS({...h,borderRadius:0});break;case Zb.SmoothStep:[m]=mS(h);break;default:[m]=cS(h)}return W(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};FE.displayName=`ConnectionLine`;var IE={};function LE(e=IE){w(e),WC(),N(()=>{},[e])}function RE(){WC(),w(!1),N(()=>{},[])}function zE({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:F,panOnScrollSpeed:I,panOnScrollMode:ee,zoomOnDoubleClick:L,panOnDrag:te,autoPanOnSelection:R,onPaneClick:ne,onPaneMouseEnter:re,onPaneMouseMove:z,onPaneMouseLeave:ie,onPaneScroll:B,onPaneContextMenu:ae,paneClickDistance:V,nodeClickDistance:oe,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:H,onReconnect:de,onReconnectStart:fe,onReconnectEnd:U,noDragClassName:pe,noWheelClassName:me,noPanClassName:he,disableKeyboardA11y:ge,nodeExtent:_e,rfId:ve,viewport:ye,onViewportChange:be,nodesDraggable:xe}){return LE(e),LE(t),RE(),DE(n),kE(ye),W(OT,{onPaneClick:ne,onPaneMouseEnter:re,onPaneMouseMove:z,onPaneMouseLeave:ie,onPaneContextMenu:ae,onPaneScroll:B,paneClickDistance:V,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:L,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:ee,panOnDrag:te,autoPanOnSelection:R,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:pe,noWheelClassName:me,noPanClassName:he,disableKeyboardA11y:ge,onViewportChange:be,isControlledViewport:!!ye,children:W(EE,{children:[W(wE,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:de,onReconnectStart:fe,onReconnectEnd:U,onlyRenderVisibleElements:T,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:H,defaultMarkerColor:M,noPanClassName:he,disableKeyboardA11y:ge,rfId:ve}),W(PE,{style:h,type:m,component:g,containerStyle:_}),W(`div`,{className:`react-flow__edgelabel-renderer`}),W(RT,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:oe,onlyRenderVisibleElements:T,noPanClassName:he,noDragClassName:pe,disableKeyboardA11y:ge,nodeExtent:_e,rfId:ve,nodesDraggable:xe}),W(`div`,{className:`react-flow__viewport-portal`})]})})}zE.displayName=`GraphView`;var BE=_(zE),VE=Dx(`React Flow`,`https://reactflow.dev/`),HE=({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??Wb;zS(h,g,_);let{nodesInitialized:x}=AS(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=Px(ax(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:Wb,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:qb.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:{...Xb},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:VE,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:Kb,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}},UE=({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})=>RC((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 lx({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...HE({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}=AS(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();zS(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}=IS(e,n,r,i,a,o,l);d&&(DS(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=vS(e,o.fromHandle,Q.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=FS(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(ww(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(Tw(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();if(t){i(e.map(e=>Ew(e,!0)));return}i(Dw(r,new Set([...e]),!0)),a(Dw(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>Ew(e,!0)));return}a(Dw(n,new Set([...e]))),i(Dw(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(Ew(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(Ew(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,Ew(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,Ew(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])&&(AS(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 LS({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:{...Xb}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...HE()})}},Object.is);function WE({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]=V(()=>UE({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 W(VC,{value:m,children:W(zw,{children:W(uT,{children:p})})})}function GE({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 R(BC)?W(M,{children:e}):W(WE,{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 KE={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function qE({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:F,onBeforeDelete:I,connectionMode:ee,connectionLineType:L=Zb.Bezier,connectionLineStyle:te,connectionLineComponent:R,connectionLineContainerStyle:ne,deleteKeyCode:re=`Backspace`,selectionKeyCode:z=`Shift`,selectionOnDrag:ie=!1,selectionMode:B=Yb.Full,panActivationKeyCode:ae=`Space`,multiSelectionKeyCode:V=Fx()?`Meta`:`Control`,zoomActivationKeyCode:oe=Fx()?`Meta`:`Control`,snapToGrid:se,snapGrid:ce,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:ue,nodesDraggable:H,autoPanOnNodeFocus:de,nodesConnectable:fe,nodesFocusable:pe,nodeOrigin:me=lw,edgesFocusable:he,edgesReconnectable:ge,elementsSelectable:_e=!0,defaultViewport:ve=uw,minZoom:ye=.5,maxZoom:be=2,translateExtent:xe=Wb,preventScrolling:Se=!0,nodeExtent:Ce,defaultMarkerColor:we=`#b1b1b7`,zoomOnScroll:Te=!0,zoomOnPinch:Ee=!0,panOnScroll:De=!1,panOnScrollSpeed:Oe=.5,panOnScrollMode:ke=Jb.Free,zoomOnDoubleClick:Ae=!0,panOnDrag:je=!0,onPaneClick:Me,onPaneMouseEnter:Ne,onPaneMouseMove:Pe,onPaneMouseLeave:Fe,onPaneScroll:Ie,onPaneContextMenu:Le,paneClickDistance:Re=1,nodeClickDistance:ze=0,children:Be,onReconnect:Ve,onReconnectStart:He,onReconnectEnd:Ue,onEdgeContextMenu:We,onEdgeDoubleClick:Ge,onEdgeMouseEnter:Ke,onEdgeMouseMove:qe,onEdgeMouseLeave:Je,reconnectRadius:Ye=10,onNodesChange:Xe,onEdgesChange:Ze,noDragClassName:Qe=`nodrag`,noWheelClassName:$e=`nowheel`,noPanClassName:et=`nopan`,fitView:G,fitViewOptions:K,connectOnClick:tt,attributionPosition:nt,proOptions:rt,defaultEdgeOptions:it,elevateNodesOnSelect:q=!0,elevateEdgesOnSelect:at=!1,disableKeyboardA11y:ot=!1,autoPanOnConnect:st,autoPanOnNodeDrag:ct,autoPanOnSelection:lt=!0,autoPanSpeed:ut,connectionRadius:dt,isValidConnection:ft,onError:pt,style:mt,id:ht,nodeDragThreshold:gt,connectionDragThreshold:_t,viewport:vt,onViewportChange:yt,width:bt,height:xt,colorMode:St=`light`,debug:Ct,onScroll:wt,ariaLabelConfig:Tt,zIndexMode:Et=`basic`,...Dt},Ot){let kt=ht||`1`,At=gw(St),jt=U(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),wt?.(e)},[wt]);return W(`div`,{"data-testid":`rf__wrapper`,...Dt,onScroll:jt,style:{...mt,...KE},ref:Ot,className:oh([`react-flow`,i,At]),id:ht,role:`application`,children:W(GE,{nodes:e,edges:t,width:bt,height:xt,fitView:G,fitViewOptions:K,minZoom:ye,maxZoom:be,nodeOrigin:me,nodeExtent:Ce,zIndexMode:Et,children:[W(mw,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:H,autoPanOnNodeFocus:de,nodesConnectable:fe,nodesFocusable:pe,edgesFocusable:he,edgesReconnectable:ge,elementsSelectable:_e,elevateNodesOnSelect:q,elevateEdgesOnSelect:at,minZoom:ye,maxZoom:be,nodeExtent:Ce,onNodesChange:Xe,onEdgesChange:Ze,snapToGrid:se,snapGrid:ce,connectionMode:ee,translateExtent:xe,connectOnClick:tt,defaultEdgeOptions:it,fitView:G,fitViewOptions:K,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:et,nodeOrigin:me,rfId:kt,autoPanOnConnect:st,autoPanOnNodeDrag:ct,autoPanSpeed:ut,onError:pt,connectionRadius:dt,isValidConnection:ft,selectNodesOnDrag:ue,nodeDragThreshold:gt,connectionDragThreshold:_t,onBeforeDelete:I,debug:Ct,ariaLabelConfig:Tt,zIndexMode:Et}),W(BE,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:te,connectionLineComponent:R,connectionLineContainerStyle:ne,selectionKeyCode:z,selectionOnDrag:ie,selectionMode:B,deleteKeyCode:re,multiSelectionKeyCode:V,panActivationKeyCode:ae,zoomActivationKeyCode:oe,onlyRenderVisibleElements:le,defaultViewport:ve,translateExtent:xe,minZoom:ye,maxZoom:be,preventScrolling:Se,zoomOnScroll:Te,zoomOnPinch:Ee,zoomOnDoubleClick:Ae,panOnScroll:De,panOnScrollSpeed:Oe,panOnScrollMode:ke,panOnDrag:je,autoPanOnSelection:lt,onPaneClick:Me,onPaneMouseEnter:Ne,onPaneMouseMove:Pe,onPaneMouseLeave:Fe,onPaneScroll:Ie,onPaneContextMenu:Le,paneClickDistance:Re,nodeClickDistance:ze,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Ve,onReconnectStart:He,onReconnectEnd:Ue,onEdgeContextMenu:We,onEdgeDoubleClick:Ge,onEdgeMouseEnter:Ke,onEdgeMouseMove:qe,onEdgeMouseLeave:Je,reconnectRadius:Ye,defaultMarkerColor:we,noDragClassName:Qe,noWheelClassName:$e,noPanClassName:et,rfId:kt,disableKeyboardA11y:ot,nodeExtent:Ce,viewport:vt,onViewportChange:yt,nodesDraggable:H}),W(cw,{onSelectionChange:k}),Be,W(nw,{proOptions:rt,position:nt}),W($C,{rfId:kt,disableKeyboardA11y:ot})]})})}var JE=Pw(qE);Ub.error014();function YE({dimensions:e,lineWidth:t,variant:n,className:r}){return W(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:oh([`react-flow__background-pattern`,n,r])})}function XE({radius:e,className:t}){return W(`circle`,{cx:e,cy:e,r:e,className:oh([`react-flow__background-pattern`,`dots`,t])})}var ZE;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(ZE||={});var QE={[ZE.Dots]:1,[ZE.Lines]:1,[ZE.Cross]:6},$E=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function eD({id:e,variant:t=ZE.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=w(null),{transform:f,patternId:p}=UC($E,zC),m=r||QE[t],h=t===ZE.Dots,g=t===ZE.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 W(`svg`,{className:oh([`react-flow__background`,l]),style:{...c,...qw,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[W(`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?W(XE,{radius:y/2,className:u}):W(YE,{dimensions:x,lineWidth:i,variant:t,className:u})}),W(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}eD.displayName=`Background`;var tD=_(eD);function nD(){return W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:W(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function rD(){return W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:W(`path`,{d:`M0 0h32v4.2H0z`})})}function iD(){return W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:W(`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 aD(){return W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:W(`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 oD(){return W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:W(`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 sD({children:e,className:t,...n}){return W(`button`,{type:`button`,className:oh([`react-flow__controls-button`,t]),...n,children:e})}var cD=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function lD({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=WC(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=UC(cD,zC),{zoomIn:y,zoomOut:b,fitView:x}=Hw();return W(ew,{className:oh([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&W(M,{children:[W(sD,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:W(nD,{})}),W(sD,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:W(rD,{})})]}),n&&W(sD,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:W(iD,{})}),r&&W(sD,{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:W(h?oD:aD,{})}),u]})}lD.displayName=`Controls`,_(lD);function uD({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 W(`rect`,{className:oh([`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 dD=_(uD),fD=e=>e.nodes.map(e=>e.id),pD=e=>e instanceof Function?e:()=>e;function mD({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=dD,onClick:o}){let s=UC(fD,zC),c=pD(t),l=pD(e),u=pD(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return W(M,{children:s.map(e=>W(gD,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function hD({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}=UC(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}=Lx(r);return{node:r,x:i,y:a,width:o,height:s}},zC);return!l||l.hidden||!Rx(l)?null:W(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 gD=_(hD),_D=_(mD),vD=200,yD=150,bD=e=>!e.hidden,xD=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?Sx(ax(e.nodeLookup,{filter:bD}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},SD=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,CD=(e,t)=>SD(e.viewBB,t.viewBB)&&SD(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,wD=`react-flow__minimap-desc`;function TD({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=WC(),S=w(null),{boundingRect:C,panZoom:T,viewBB:E,rfId:D,translateExtent:O,flowWidth:k,flowHeight:A,ariaLabelConfig:j}=UC(xD,CD),M=e?.width??vD,P=e?.height??yD,F=C.width/M,I=C.height/P,ee=Math.max(F,I),L=ee*M,te=ee*P,R=b*ee,ne=C.x-(L-C.width)/2-R,re=C.y-(te-C.height)/2-R,z=L+R*2,ie=te+R*2,B=`${wD}-${D}`,ae=w(0),V=w();ae.current=ee,N(()=>{let e=x.getState().panZoom;if(S.current&&e)return V.current=nC({domNode:S.current,panZoom:e,getTransform:()=>x.getState().transform,getViewScale:()=>ae.current}),()=>{V.current?.destroy()}},[T]),N(()=>{V.current?.update({translateExtent:O,width:k,height:A,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,O,k,A]);let oe=p?e=>{let[t,n]=V.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,se=U((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),ce=m?se:void 0,le=_??j[`minimap.ariaLabel`];return W(ew,{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:oh([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:W(`svg`,{width:M,height:P,viewBox:`${ne} ${re} ${z} ${ie}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":B,ref:S,onClick:oe,children:[le&&W(`title`,{id:B,children:le}),W(_D,{onClick:ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),W(`path`,{className:`react-flow__minimap-mask`,d:`M${ne-R},${re-R}h${z+R*2}v${ie+R*2}h${-z-R*2}z
1160
- M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}TD.displayName=`MiniMap`,_(TD);var ED=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,DD={[_C.Line]:`right`,[_C.Handle]:`bottom-right`};function OD({nodeId:e,position:t,variant:n=_C.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=sT(),y=typeof e==`string`?e:v,b=WC(),x=w(null),S=n===_C.Handle,C=UC(U(ED(S&&p),[S,p]),zC),T=w(null),E=t??DD[n];N(()=>{if(x.current&&y)return T.current||=OC({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=FS([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...zx({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])}}),T.current.update({controlPosition:E,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{T.current?.destroy()}},[E,s,c,l,u,d,h,g,_,m]);let D=E.split(`-`);return W(`div`,{className:oh([`react-flow__resize-control`,`nodrag`,...D,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}_(OD);var kD=40,AD=280,jD=98,MD=24,ND=e=>{let t=e.split(/\s+/).filter(Boolean),n=[],r=``;for(let e of t){let t=r?`${r} ${e}`:e;if(t.length<=MD){r=t;continue}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,MD)]},PD=(e,t)=>{let n=Hm(t.hover,e.edges),r=new Set(e.nodes.map(e=>e.uri)),i=e.nodes.map(e=>{let r=Um(e);return{id:e.uri,type:`work`,position:{x:kD+e.column*AD,y:kD+e.row*jD},width:190,height:74,draggable:!1,selectable:!1,data:{uri:e.uri,title:r,lines:ND(r),meta:[Qm(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=Vm(e);return{id:t,type:`relation`,source:e.from,target:e.to,data:{kind:`relation`,label:Xm(e.relation).toUpperCase(),lit:n.edges.has(t)}}});return{nodes:i,edges:[...o,...s]}};H();var FD=l`
1130
+ `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return N(()=>{let n=t?.target??vw,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)&&Yx(e))return!1;let n=xw(e.code,s);if(a.current.add(e[n]),bw(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=xw(e.code,s);bw(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 bw(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function xw(e,t){return t.includes(e)?`code`:`key`}var Sw=()=>{let e=GC();return D(()=>({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=Fx(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 Ax(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=jx(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Cw(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)ww(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 ww(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 Tw(e,t){return Cw(e,t)}function Ew(e,t){return Cw(e,t)}function Dw(e,t){return{id:e,type:`select`,selected:t}}function Ow(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(Dw(a.id,e)))}return r}function kw({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 Aw(e){return{id:e.id,type:`remove`}}var jw=Ox(`React Flow`,`https://reactflow.dev/`);function Mw(e,t,n={}){return cS(e,t,{...n,onError:n.onError??jw})}var Nw=e=>nx(e),Pw=e=>tx(e);function Fw(e){return b(e)}var Iw=typeof window<`u`?S:N;function Lw(e){let[t,n]=V(BigInt(0)),[r]=V(()=>Rw(()=>n(e=>e+BigInt(1))));return Iw(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Rw(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var zw=A(null);function Bw({children:e}){let t=GC(),n=Lw(U(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=kw({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=Lw(U(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(kw({items:s,lookup:o}))},[])),i=D(()=>({nodeQueue:n,edgeQueue:r}),[]);return W(zw.Provider,{value:i,children:e})}function Vw(){let e=R(zw);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Hw=e=>!!e.panZoom;function Uw(){let e=Sw(),t=GC(),n=Vw(),r=WC(Hw),i=D(()=>{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=Nw(e)?e:n.get(e.id),a=i.parentId?Bx(i.position,i.measured,i.parentId,n,r):i.position;return xx({...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&&Nw(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&&Pw(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 fx({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(Aw);o?.(f),c(e)}if(m){let e=d.map(Aw);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=Ex(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=xx(s?r:a),l=Tx(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=Ex(e)?e:a(e);if(!r)return!1;let i=Tx(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 ax(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??Hx();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return D(()=>({...i,...e,viewportInitialized:r}),[r])}var Ww=e=>e.selected,Gw=typeof window<`u`?window:void 0;function Kw({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=GC(),{deleteElements:r}=Uw(),i=yw(e,{actInsideInputWithModifier:!1}),a=yw(t,{target:Gw});N(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Ww),edges:e.filter(Ww)}),n.setState({nodesSelectionActive:!1})}},[i]),N(()=>{n.setState({multiSelectionActive:a})},[a])}function qw(e){let t=GC();N(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Kx(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,Wb.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 Jw={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Yw=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Xw({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=Yb.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=GC(),C=w(null),{userSelectionActive:T,lib:E,connectionInProgress:D}=WC(Yw,BC),O=yw(p),k=w();qw(C);let A=U(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),y||S.setState({transform:e})},[v,y]);return N(()=>{if(C.current){k.current=_C({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}=k.current.getViewport();return S.setState({panZoom:k.current,transform:[e,t,n],domNode:C.current.closest(`.react-flow`)}),()=>{k.current?.destroy()}}},[]),N(()=>{k.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:O,preventScrolling:m,noPanClassName:_,userSelectionActive:T,noWheelClassName:g,lib:E,onTransformChange:A,connectionInProgress:D,selectionOnDrag:x,paneClickDistance:b})},[e,t,n,r,i,a,o,s,c,O,m,_,T,g,E,A,D,x,b]),W(`div`,{className:`react-flow__renderer`,ref:C,style:Jw,children:h})}var Zw=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Qw(){let{userSelectionActive:e,userSelectionRect:t}=WC(Zw,BC);return e&&t?W(`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 $w=(e,t)=>n=>{n.target===t.current&&e?.(n)},eT=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function tT({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Xb.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=w(0),_=GC(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=WC(eT,BC),C=y&&(e||v),T=w(null),E=w(),D=w(new Set),O=w(new Set),k=w(!1),A=w(!1),j=w({x:0,y:0}),M=w(!1),P=e=>{if(A.current||k.current||_.getState().connection.inProgress){A.current=!1,k.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},F=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},I=d?e=>d(e):void 0,ee=e=>{A.current&&=(e.stopPropagation(),!1)},L=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(E.current=i?.getBoundingClientRect(),!E.current)return;let s=n.target===T.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),A.current=!1;let{x:c,y:l}=Zx(n.nativeEvent,E.current),u=Ax({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 te(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}=jx(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=D.current,g=O.current;D.current=new Set(sx(a,m,i,n===Xb.Partial,!0).map(e=>e.id)),O.current=new Set;let v=u?.selectable??!0;for(let e of D.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&O.current.add(e)}}Vx(h,D.current)||c(Ow(a,D.current,!0)),Vx(g,O.current)||l(Ow(o,O.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function R(){if(!i||!E.current)return;let[e,t]=_x(j.current,E.current,S);x({x:e,y:t}).then(e=>{if(!A.current||!e){g.current=requestAnimationFrame(R);return}let{x:t,y:n}=j.current;te(t,n),g.current=requestAnimationFrame(R)})}let ne=()=>{cancelAnimationFrame(g.current),g.current=0,M.current=!1};N(()=>()=>ne(),[]);let re=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!E.current||!n)return;let{x:o,y:c}=Zx(e.nativeEvent,E.current);j.current={x:o,y:c};let l=jx({x:n.startX,y:n.startY},r);if(!A.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}A.current=!0,M.current||=(R(),!0),te(o,c)},z=e=>{if(!C){e.target===T.current&&_.getState().connection.inProgress&&(k.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===T.current&&_.getState().userSelectionRect&&P?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),A.current&&(c?.(e),_.setState({nodesSelectionActive:D.current.size>0})),ne())},ie=e=>{e.target?.releasePointerCapture?.(e.pointerId),ne()},B=r===!0||Array.isArray(r)&&r.includes(0);return W(`div`,{className:sh([`react-flow__pane`,{draggable:B,dragging:b,selection:e}]),onClick:C?void 0:$w(P,T),onContextMenu:$w(F,T),onWheel:$w(I,T),onPointerEnter:C?void 0:f,onPointerMove:C?re:p,onPointerUp:z,onPointerCancel:C?ie:void 0,onPointerDownCapture:C?L:void 0,onClickCapture:C?ee:void 0,onPointerLeave:m,ref:T,style:Jw,children:[h,W(Qw,{})]})}function nT({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);if(!l){c?.(`012`,Wb.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function rT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=GC(),[c,l]=V(!1),u=w();return N(()=>{if(!t)return u.current=KS({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{nT({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),N(()=>{!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 iT=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function aT(){let e=GC();return U(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=iT(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=kx(t,i));let{position:a,positionAbsolute:s}=dx({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 oT=A(null),sT=oT.Provider;oT.Consumer;var cT=()=>R(oT),lT=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),uT=A(null);function dT({children:e}){let t=WC(lT,BC);return W(uT.Provider,{value:t,children:e})}function fT(){let e=R(uT);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var pT={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},mT=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return pT;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===Jb.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function hT({type:e=`source`,position:t=Q.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=GC(),_=cT(),{connectOnClick:v,noPanClassName:y,rfId:b}=fT(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=WC(mT(_,m,e),BC);_||g.getState().onError?.(`010`,Wb.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(Mw(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Xx(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();nC.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 W(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:sh([`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=qx(t.target),h=n||c,{connection:v,isValid:y}=nC.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 gT=_(Fw(hT));function _T({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return W(M,{children:[e?.label,W(gT,{type:`source`,position:n,isConnectable:t})]})}function vT({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return W(M,{children:[W(gT,{type:`target`,position:n,isConnectable:t}),e?.label,W(gT,{type:`source`,position:r,isConnectable:t})]})}function yT(){return null}function bT({data:e,isConnectable:t,targetPosition:n=Q.Top}){return W(M,{children:[W(gT,{type:`target`,position:n,isConnectable:t}),e?.label]})}var xT={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},ST={input:_T,default:vT,output:bT,group:yT};function CT(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 wT=e=>{let{width:t,height:n,x:r,y:i}=ox(e.nodeLookup,{filter:e=>!!e.selected});return{width:Dx(t)?t:null,height:Dx(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 TT({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=GC(),{width:i,height:a,transformString:o,userSelectionActive:s}=WC(wT,BC),c=aT(),l=w(null);N(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(rT({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return W(`div`,{className:sh([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:W(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(xT,e.key)&&(e.preventDefault(),c({direction:xT[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var ET=typeof window<`u`?window:void 0,DT=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function OT({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:F,isControlledViewport:I}){let{nodesSelectionActive:ee,userSelectionActive:L}=WC(DT,BC),te=yw(l,{target:ET}),R=yw(h,{target:ET}),ne=R||w,re=R||b,z=u&&ne!==!0,ie=te||L||z;return Kw({deleteKeyCode:c,multiSelectionKeyCode:m}),W(Xw,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:re,panActivationKeyPressed:R,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!te&&ne,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:z,children:W(tT,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ne,autoPanOnSelection:T,isSelecting:!!ie,selectionMode:d,selectionKeyPressed:te,paneClickDistance:s,selectionOnDrag:z,children:[e,ee&&W(TT,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}OT.displayName=`FlowRenderer`;var kT=_(OT),AT=e=>t=>e?sx(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 jT(e){return WC(U(AT(e),[e]),BC)}var MT=e=>e.updateNodeInternals;function NT(){let e=WC(MT),[t]=V(()=>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 N(()=>()=>{t?.disconnect()},[t]),t}function PT({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=GC(),a=w(null),o=w(null),s=w(e.sourcePosition),c=w(e.targetPosition),l=w(t),u=n&&!!e.internals.handleBounds;return N(()=>{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]),N(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),N(()=>{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 FT({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}=WC(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},BC),S=y.type||`default`,C=g?.[S]||ST[S];C===void 0&&(v?.(`003`,Wb.error003(S)),S=`default`,C=g?.default||ST.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=GC(),k=zx(y),A=PT({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=rT({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=aT();if(y.hidden)return null;let N=Rx(y),P=CT(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,ee=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,te=a?e=>a(e,{...b.userNode}):void 0,R=o?e=>o(e,{...b.userNode}):void 0,ne=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&nT({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},re=t=>{if(!(Yx(t.nativeEvent)||m)){if(Kb.includes(t.key)&&T){let n=t.key===`Escape`;nT({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(xT,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:xT[t.key],factor:t.shiftKey?4:1})}}},z=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(sx(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 W(`div`,{className:sh([`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:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:ee,onMouseLeave:L,onContextMenu:te,onClick:ne,onDoubleClick:R,onKeyDown:D?re:void 0,tabIndex:D?0:void 0,onFocus:D?z:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${JC}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:W(sT,{value:e,children:W(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 IT=_(FT),LT=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function RT(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=WC(LT,BC),a=jT(e.onlyRenderVisibleElements),o=NT();return W(`div`,{className:`react-flow__nodes`,style:Jw,children:a.map(a=>W(IT,{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))})}RT.displayName=`NodeRenderer`;var zT=_(RT);function BT(e){return WC(U(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&&aS({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),BC)}var VT=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return W(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},HT=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return W(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},UT={[$b.Arrow]:VT,[$b.ArrowClosed]:HT};function WT(e){let t=GC();return D(()=>Object.prototype.hasOwnProperty.call(UT,e)?UT[e]:(t.getState().onError?.(`009`,Wb.error009(e)),null),[e])}var GT=({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=WT(t);return c?W(`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:W(c,{color:n,strokeWidth:o})}):null},KT=({defaultColor:e,rfId:t})=>{let n=WC(e=>e.edges),r=WC(e=>e.defaultEdgeOptions),i=D(()=>SS(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?W(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:W(`defs`,{children:i.map(e=>W(GT,{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};KT.displayName=`MarkerDefinitions`;var qT=_(KT);function JT({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]=V({x:1,y:0,width:0,height:0}),p=sh([`react-flow__edge-textwrapper`,l]),m=w(null);return N(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?W(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&W(`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}),W(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}JT.displayName=`EdgeText`;var YT=_(JT);function XT({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return W(M,{children:[W(`path`,{...u,d:e,fill:`none`,className:sh([`react-flow__edge-path`,u.className])}),l?W(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&Dx(t)&&Dx(n)?W(YT,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function ZT({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function QT({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=ZT({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=ZT({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=$x({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 $T(e){return _(({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]=QT({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return W(XT,{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 eE=$T({isInternal:!1}),tE=$T({isInternal:!0});eE.displayName=`SimpleBezierEdge`,tE.displayName=`SimpleBezierEdgeInternal`;function nE(e){return _(({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=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=hS({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 W(XT,{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 rE=nE({isInternal:!1}),iE=nE({isInternal:!0});rE.displayName=`SmoothStepEdge`,iE.displayName=`SmoothStepEdgeInternal`;function aE(e){return _(({id:t,...n})=>{let r=e.isInternal?void 0:t;return W(rE,{...n,id:r,pathOptions:D(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var oE=aE({isInternal:!1}),sE=aE({isInternal:!0});oE.displayName=`StepEdge`,sE.displayName=`StepEdgeInternal`;function cE(e){return _(({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]=lS({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return W(XT,{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 lE=cE({isInternal:!1}),uE=cE({isInternal:!0});lE.displayName=`StraightEdge`,uE.displayName=`StraightEdgeInternal`;function dE(e){return _(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.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]=nS({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return W(XT,{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 fE=dE({isInternal:!1}),pE=dE({isInternal:!0});fE.displayName=`BezierEdge`,pE.displayName=`BezierEdgeInternal`;var mE={default:pE,straight:uE,step:sE,smoothstep:iE,simplebezier:tE},hE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},gE=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,_E=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,vE=`react-flow__edgeupdater`;function yE({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return W(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:sh([vE,`${vE}-${s}`]),cx:gE(t,r,e),cy:_E(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function bE({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=GC(),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`;nC.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 W(M,{children:[(e===!0||e===`source`)&&W(yE,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&W(yE,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function xE({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=WC(t=>t.edgeLookup.get(e)),b=WC(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||mE[x];S===void 0&&(_?.(`011`,Wb.error011(x)),x=`default`,S=h?.default||mE.default);let C=!!(y.focusable||t&&y.focusable===void 0),T=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),E=!!(y.selectable||r&&y.selectable===void 0),O=w(null),[k,A]=V(!1),[j,M]=V(!1),N=GC(),{zIndex:P=y.zIndex,sourceX:F,sourceY:I,targetX:ee,targetY:L,sourcePosition:te,targetPosition:R}=WC(U(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return hE;let i=_S({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=iS({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||hE,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex,_]),BC),ne=D(()=>y.markerStart?`url('#${xS(y.markerStart,m)}')`:void 0,[y.markerStart,m]),re=D(()=>y.markerEnd?`url('#${xS(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||F===null||I===null||ee===null||L===null)return null;let z=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=N.getState();E&&(N.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),O.current?.blur()):n([e])),i&&i(t,y)},ie=a?e=>{a(e,{...y})}:void 0,B=o?e=>{o(e,{...y})}:void 0,ae=s?e=>{s(e,{...y})}:void 0,oe=c?e=>{c(e,{...y})}:void 0,se=l?e=>{l(e,{...y})}:void 0;return W(`svg`,{style:{zIndex:P},children:W(`g`,{className:sh([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!E&&!i,updating:k,selectable:E}]),onClick:z,onDoubleClick:ie,onContextMenu:B,onMouseEnter:ae,onMouseMove:oe,onMouseLeave:se,onKeyDown:C?t=>{if(!v&&Kb.includes(t.key)&&E){let{unselectNodesAndEdges:n,addSelectedEdges:r}=N.getState();t.key===`Escape`?(O.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?`${YC}-${m}`:void 0,ref:O,...y.domAttributes,children:[!j&&W(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:E,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:F,sourceY:I,targetX:ee,targetY:L,sourcePosition:te,targetPosition:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:ne,markerEnd:re,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),T&&W(bE,{edge:y,isReconnectable:T,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:F,sourceY:I,targetX:ee,targetY:L,sourcePosition:te,targetPosition:R,setUpdateHover:A,setReconnecting:M})]})})}var SE=_(xE),CE=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function wE({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}=WC(CE,BC),b=BT(t);return W(`div`,{className:`react-flow__edges`,children:[W(qT,{defaultColor:e,rfId:n}),b.map(e=>W(SE,{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))]})}wE.displayName=`EdgeRenderer`;var TE=_(wE),EE=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function DE({children:e}){let t=GC(),n=w(null),[r]=V(()=>t.getState().transform);return Iw(()=>{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=EE(r)))};return r(),t.subscribe(r)},[t]),W(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:EE(r)},children:e})}function OE(e){let t=Uw(),n=w(!1);N(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var kE=e=>e.panZoom?.syncViewport;function AE(e){let t=WC(kE),n=GC();return N(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function jE(e){return e.connection.inProgress?{...e.connection,to:Ax(e.connection.to,e.transform)}:{...e.connection}}function ME(e){return e?t=>e(jE(t)):jE}function NE(e){return WC(ME(e),BC)}var PE=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function FE({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=WC(PE,BC);return a&&i&&c?W(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:W(`g`,{className:sh([`react-flow__connection`,Wx(s)]),children:W(IE,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var IE=({style:e,type:t=Qb.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}=NE();if(!i)return;if(n)return W(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:Wx(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 Qb.Bezier:[m]=nS(h);break;case Qb.SimpleBezier:[m]=QT(h);break;case Qb.Step:[m]=hS({...h,borderRadius:0});break;case Qb.SmoothStep:[m]=hS(h);break;default:[m]=lS(h)}return W(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};IE.displayName=`ConnectionLine`;var LE={};function RE(e=LE){w(e),GC(),N(()=>{},[e])}function zE(){GC(),w(!1),N(()=>{},[])}function BE({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:F,panOnScrollSpeed:I,panOnScrollMode:ee,zoomOnDoubleClick:L,panOnDrag:te,autoPanOnSelection:R,onPaneClick:ne,onPaneMouseEnter:re,onPaneMouseMove:z,onPaneMouseLeave:ie,onPaneScroll:B,onPaneContextMenu:ae,paneClickDistance:V,nodeClickDistance:oe,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:H,onReconnect:de,onReconnectStart:fe,onReconnectEnd:U,noDragClassName:pe,noWheelClassName:me,noPanClassName:he,disableKeyboardA11y:ge,nodeExtent:_e,rfId:ve,viewport:ye,onViewportChange:be,nodesDraggable:xe}){return RE(e),RE(t),zE(),OE(n),AE(ye),W(kT,{onPaneClick:ne,onPaneMouseEnter:re,onPaneMouseMove:z,onPaneMouseLeave:ie,onPaneContextMenu:ae,onPaneScroll:B,paneClickDistance:V,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:L,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:ee,panOnDrag:te,autoPanOnSelection:R,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:pe,noWheelClassName:me,noPanClassName:he,disableKeyboardA11y:ge,onViewportChange:be,isControlledViewport:!!ye,children:W(DE,{children:[W(TE,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:de,onReconnectStart:fe,onReconnectEnd:U,onlyRenderVisibleElements:T,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:H,defaultMarkerColor:M,noPanClassName:he,disableKeyboardA11y:ge,rfId:ve}),W(FE,{style:h,type:m,component:g,containerStyle:_}),W(`div`,{className:`react-flow__edgelabel-renderer`}),W(zT,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:oe,onlyRenderVisibleElements:T,noPanClassName:he,noDragClassName:pe,disableKeyboardA11y:ge,nodeExtent:_e,rfId:ve,nodesDraggable:xe}),W(`div`,{className:`react-flow__viewport-portal`})]})})}BE.displayName=`GraphView`;var VE=_(BE),HE=Ox(`React Flow`,`https://reactflow.dev/`),UE=({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??Gb;BS(h,g,_);let{nodesInitialized:x}=jS(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=Fx(ox(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:Gb,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Jb.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:{...Zb},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:HE,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:qb,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}},WE=({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})=>zC((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 ux({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...UE({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}=jS(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();BS(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}=LS(e,n,r,i,a,o,l);d&&(OS(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=yS(e,o.fromHandle,Q.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=IS(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(Tw(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(Ew(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();if(t){i(e.map(e=>Dw(e,!0)));return}i(Ow(r,new Set([...e]),!0)),a(Ow(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>Dw(e,!0)));return}a(Ow(n,new Set([...e]))),i(Ow(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(Dw(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(Dw(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,Dw(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,Dw(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])&&(jS(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 RS({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:{...Zb}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...UE()})}},Object.is);function GE({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]=V(()=>WE({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 W(HC,{value:m,children:W(Bw,{children:W(dT,{children:p})})})}function KE({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 R(VC)?W(M,{children:e}):W(GE,{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 qE={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function JE({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:F,onBeforeDelete:I,connectionMode:ee,connectionLineType:L=Qb.Bezier,connectionLineStyle:te,connectionLineComponent:R,connectionLineContainerStyle:ne,deleteKeyCode:re=`Backspace`,selectionKeyCode:z=`Shift`,selectionOnDrag:ie=!1,selectionMode:B=Xb.Full,panActivationKeyCode:ae=`Space`,multiSelectionKeyCode:V=Ix()?`Meta`:`Control`,zoomActivationKeyCode:oe=Ix()?`Meta`:`Control`,snapToGrid:se,snapGrid:ce,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:ue,nodesDraggable:H,autoPanOnNodeFocus:de,nodesConnectable:fe,nodesFocusable:pe,nodeOrigin:me=uw,edgesFocusable:he,edgesReconnectable:ge,elementsSelectable:_e=!0,defaultViewport:ve=dw,minZoom:ye=.5,maxZoom:be=2,translateExtent:xe=Gb,preventScrolling:Se=!0,nodeExtent:Ce,defaultMarkerColor:we=`#b1b1b7`,zoomOnScroll:Te=!0,zoomOnPinch:Ee=!0,panOnScroll:De=!1,panOnScrollSpeed:Oe=.5,panOnScrollMode:ke=Yb.Free,zoomOnDoubleClick:Ae=!0,panOnDrag:je=!0,onPaneClick:Me,onPaneMouseEnter:Ne,onPaneMouseMove:Pe,onPaneMouseLeave:Fe,onPaneScroll:Ie,onPaneContextMenu:Le,paneClickDistance:Re=1,nodeClickDistance:ze=0,children:Be,onReconnect:Ve,onReconnectStart:He,onReconnectEnd:Ue,onEdgeContextMenu:We,onEdgeDoubleClick:Ge,onEdgeMouseEnter:Ke,onEdgeMouseMove:qe,onEdgeMouseLeave:Je,reconnectRadius:Ye=10,onNodesChange:Xe,onEdgesChange:Ze,noDragClassName:Qe=`nodrag`,noWheelClassName:$e=`nowheel`,noPanClassName:et=`nopan`,fitView:G,fitViewOptions:K,connectOnClick:tt,attributionPosition:nt,proOptions:rt,defaultEdgeOptions:it,elevateNodesOnSelect:q=!0,elevateEdgesOnSelect:at=!1,disableKeyboardA11y:ot=!1,autoPanOnConnect:st,autoPanOnNodeDrag:ct,autoPanOnSelection:lt=!0,autoPanSpeed:ut,connectionRadius:dt,isValidConnection:ft,onError:pt,style:mt,id:ht,nodeDragThreshold:gt,connectionDragThreshold:_t,viewport:vt,onViewportChange:yt,width:bt,height:xt,colorMode:St=`light`,debug:Ct,onScroll:wt,ariaLabelConfig:Tt,zIndexMode:Et=`basic`,...Dt},Ot){let kt=ht||`1`,At=_w(St),jt=U(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),wt?.(e)},[wt]);return W(`div`,{"data-testid":`rf__wrapper`,...Dt,onScroll:jt,style:{...mt,...qE},ref:Ot,className:sh([`react-flow`,i,At]),id:ht,role:`application`,children:W(KE,{nodes:e,edges:t,width:bt,height:xt,fitView:G,fitViewOptions:K,minZoom:ye,maxZoom:be,nodeOrigin:me,nodeExtent:Ce,zIndexMode:Et,children:[W(hw,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:H,autoPanOnNodeFocus:de,nodesConnectable:fe,nodesFocusable:pe,edgesFocusable:he,edgesReconnectable:ge,elementsSelectable:_e,elevateNodesOnSelect:q,elevateEdgesOnSelect:at,minZoom:ye,maxZoom:be,nodeExtent:Ce,onNodesChange:Xe,onEdgesChange:Ze,snapToGrid:se,snapGrid:ce,connectionMode:ee,translateExtent:xe,connectOnClick:tt,defaultEdgeOptions:it,fitView:G,fitViewOptions:K,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:et,nodeOrigin:me,rfId:kt,autoPanOnConnect:st,autoPanOnNodeDrag:ct,autoPanSpeed:ut,onError:pt,connectionRadius:dt,isValidConnection:ft,selectNodesOnDrag:ue,nodeDragThreshold:gt,connectionDragThreshold:_t,onBeforeDelete:I,debug:Ct,ariaLabelConfig:Tt,zIndexMode:Et}),W(VE,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:te,connectionLineComponent:R,connectionLineContainerStyle:ne,selectionKeyCode:z,selectionOnDrag:ie,selectionMode:B,deleteKeyCode:re,multiSelectionKeyCode:V,panActivationKeyCode:ae,zoomActivationKeyCode:oe,onlyRenderVisibleElements:le,defaultViewport:ve,translateExtent:xe,minZoom:ye,maxZoom:be,preventScrolling:Se,zoomOnScroll:Te,zoomOnPinch:Ee,zoomOnDoubleClick:Ae,panOnScroll:De,panOnScrollSpeed:Oe,panOnScrollMode:ke,panOnDrag:je,autoPanOnSelection:lt,onPaneClick:Me,onPaneMouseEnter:Ne,onPaneMouseMove:Pe,onPaneMouseLeave:Fe,onPaneScroll:Ie,onPaneContextMenu:Le,paneClickDistance:Re,nodeClickDistance:ze,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Ve,onReconnectStart:He,onReconnectEnd:Ue,onEdgeContextMenu:We,onEdgeDoubleClick:Ge,onEdgeMouseEnter:Ke,onEdgeMouseMove:qe,onEdgeMouseLeave:Je,reconnectRadius:Ye,defaultMarkerColor:we,noDragClassName:Qe,noWheelClassName:$e,noPanClassName:et,rfId:kt,disableKeyboardA11y:ot,nodeExtent:Ce,viewport:vt,onViewportChange:yt,nodesDraggable:H}),W(lw,{onSelectionChange:k}),Be,W(rw,{proOptions:rt,position:nt}),W(ew,{rfId:kt,disableKeyboardA11y:ot})]})})}var YE=Fw(JE);Wb.error014();function XE({dimensions:e,lineWidth:t,variant:n,className:r}){return W(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:sh([`react-flow__background-pattern`,n,r])})}function ZE({radius:e,className:t}){return W(`circle`,{cx:e,cy:e,r:e,className:sh([`react-flow__background-pattern`,`dots`,t])})}var QE;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(QE||={});var $E={[QE.Dots]:1,[QE.Lines]:1,[QE.Cross]:6},eD=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function tD({id:e,variant:t=QE.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=w(null),{transform:f,patternId:p}=WC(eD,BC),m=r||$E[t],h=t===QE.Dots,g=t===QE.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 W(`svg`,{className:sh([`react-flow__background`,l]),style:{...c,...Jw,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[W(`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?W(ZE,{radius:y/2,className:u}):W(XE,{dimensions:x,lineWidth:i,variant:t,className:u})}),W(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}tD.displayName=`Background`;var nD=_(tD);function rD(){return W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:W(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function iD(){return W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:W(`path`,{d:`M0 0h32v4.2H0z`})})}function aD(){return W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:W(`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 oD(){return W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:W(`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 sD(){return W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:W(`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 cD({children:e,className:t,...n}){return W(`button`,{type:`button`,className:sh([`react-flow__controls-button`,t]),...n,children:e})}var lD=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function uD({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=GC(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=WC(lD,BC),{zoomIn:y,zoomOut:b,fitView:x}=Uw();return W(tw,{className:sh([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&W(M,{children:[W(cD,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:W(rD,{})}),W(cD,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:W(iD,{})})]}),n&&W(cD,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:W(aD,{})}),r&&W(cD,{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:W(h?sD:oD,{})}),u]})}uD.displayName=`Controls`,_(uD);function dD({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 W(`rect`,{className:sh([`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 fD=_(dD),pD=e=>e.nodes.map(e=>e.id),mD=e=>e instanceof Function?e:()=>e;function hD({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=fD,onClick:o}){let s=WC(pD,BC),c=mD(t),l=mD(e),u=mD(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return W(M,{children:s.map(e=>W(_D,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function gD({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}=WC(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}=Rx(r);return{node:r,x:i,y:a,width:o,height:s}},BC);return!l||l.hidden||!zx(l)?null:W(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 _D=_(gD),vD=_(hD),yD=200,bD=150,xD=e=>!e.hidden,SD=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?Cx(ox(e.nodeLookup,{filter:xD}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},CD=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,wD=(e,t)=>CD(e.viewBB,t.viewBB)&&CD(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,TD=`react-flow__minimap-desc`;function ED({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=GC(),S=w(null),{boundingRect:C,panZoom:T,viewBB:E,rfId:D,translateExtent:O,flowWidth:k,flowHeight:A,ariaLabelConfig:j}=WC(SD,wD),M=e?.width??yD,P=e?.height??bD,F=C.width/M,I=C.height/P,ee=Math.max(F,I),L=ee*M,te=ee*P,R=b*ee,ne=C.x-(L-C.width)/2-R,re=C.y-(te-C.height)/2-R,z=L+R*2,ie=te+R*2,B=`${TD}-${D}`,ae=w(0),V=w();ae.current=ee,N(()=>{let e=x.getState().panZoom;if(S.current&&e)return V.current=rC({domNode:S.current,panZoom:e,getTransform:()=>x.getState().transform,getViewScale:()=>ae.current}),()=>{V.current?.destroy()}},[T]),N(()=>{V.current?.update({translateExtent:O,width:k,height:A,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,O,k,A]);let oe=p?e=>{let[t,n]=V.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,se=U((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),ce=m?se:void 0,le=_??j[`minimap.ariaLabel`];return W(tw,{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:sh([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:W(`svg`,{width:M,height:P,viewBox:`${ne} ${re} ${z} ${ie}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":B,ref:S,onClick:oe,children:[le&&W(`title`,{id:B,children:le}),W(vD,{onClick:ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),W(`path`,{className:`react-flow__minimap-mask`,d:`M${ne-R},${re-R}h${z+R*2}v${ie+R*2}h${-z-R*2}z
1131
+ M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}ED.displayName=`MiniMap`,_(ED);var DD=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,OD={[vC.Line]:`right`,[vC.Handle]:`bottom-right`};function kD({nodeId:e,position:t,variant:n=vC.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=cT(),y=typeof e==`string`?e:v,b=GC(),x=w(null),S=n===vC.Handle,C=WC(U(DD(S&&p),[S,p]),BC),T=w(null),E=t??OD[n];N(()=>{if(x.current&&y)return T.current||=kC({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=IS([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...Bx({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])}}),T.current.update({controlPosition:E,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{T.current?.destroy()}},[E,s,c,l,u,d,h,g,_,m]);let D=E.split(`-`);return W(`div`,{className:sh([`react-flow__resize-control`,`nodrag`,...D,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}_(kD);var AD=40,jD=280,MD=98,ND=24,PD=e=>{let t=e.split(/\s+/).filter(Boolean),n=[],r=``;for(let e of t){let t=r?`${r} ${e}`:e;if(t.length<=ND){r=t;continue}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,ND)]},FD=(e,t)=>{let n=Um(t.hover,e.edges),r=new Set(e.nodes.map(e=>e.uri)),i=e.nodes.map(e=>{let r=Wm(e);return{id:e.uri,type:`work`,position:{x:AD+e.column*jD,y:AD+e.row*MD},width:190,height:74,draggable:!1,selectable:!1,data:{uri:e.uri,title:r,lines:PD(r),meta:[$m(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=Hm(e);return{id:t,type:`relation`,source:e.from,target:e.to,data:{kind:`relation`,label:Zm(e.relation).toUpperCase(),lit:n.edges.has(t)}}});return{nodes:i,edges:[...o,...s]}};H();var ID=l`
1161
1132
  display: inline-flex;
1162
1133
  align-items: center;
1163
1134
  gap: 0.6rem;
@@ -1179,13 +1150,13 @@ transition: max-height 0.3s ease-in-out;
1179
1150
  }
1180
1151
 
1181
1152
  svg { width: 1.5rem; height: 1.5rem; }
1182
- `,ID=l`
1153
+ `,LD=l`
1183
1154
  display: flex;
1184
1155
  align-items: center;
1185
1156
  justify-content: center;
1186
1157
  padding: 4rem;
1187
1158
  background: rgba(0, 0, 0, 0.75);
1188
- z-index: ${ff.franchiseDialog};
1159
+ z-index: ${df.franchiseDialog};
1189
1160
 
1190
1161
  .sheet {
1191
1162
  position: relative;
@@ -1371,7 +1342,7 @@ transition: max-height 0.3s ease-in-out;
1371
1342
 
1372
1343
  /* the text alone is a thin target, so each label carries an invisible pad it can be caught by */
1373
1344
  .label-hit { fill: transparent; cursor: pointer; }
1374
- `,LD=A(()=>{}),RD=({data:e})=>{let t=R(zD);return I(Fo,{className:`work-node${e.current?` current`:``}${e.lit?` lit`:``}`,to:`${Ho(Y.MEDIA,{uri:oe(e.uri)})}${t}`,title:e.title,children:[L(hT,{type:`target`,position:Q.Left}),L(`div`,{className:`title`,children:e.lines.map(e=>L(`div`,{children:e},e))}),e.meta?L(`div`,{className:`meta`,children:e.meta}):void 0,L(hT,{type:`source`,position:Q.Right})]})},zD=A(``),BD=(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}`},VD=({data:e,sourceX:t,sourceY:n,targetX:r,targetY:i})=>L(`path`,{className:`chain${e?.lit?` lit`:``}`,d:BD(t,n,r,i)}),HD=({id:e,data:t,sourceX:n,sourceY:r,targetX:i,targetY:a})=>{let o=R(LD),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 I(B,{children:[L(`path`,{className:`edge${c}`,d:BD(n,r,i,a)}),I(`g`,{className:`label`,onPointerEnter:()=>o({kind:`edge`,key:e}),onPointerLeave:()=>o(void 0),children:[L(`rect`,{className:`label-hit`,x:u-f/2,y:d-11,width:f,height:15}),L(`text`,{className:`edge-label${c}`,x:u,y:d,children:s})]})]})},UD={work:RD},WD={chain:VD,relation:HD},GD=({franchise:e,currentUris:t})=>{let n=Om(Oo()),r=D(()=>zm(e),[e]),[i,a]=V(()=>new Set(r.filter(Rm))),o=[...i].every(Rm)?`story`:`graph`,s=D(()=>Km(Bm(e,e=>!e.format||i.has(e.format)),o),[e,i,o]),[c,l]=V(void 0),u=D(()=>new Set(t),[t]),{nodes:d,edges:f}=D(()=>PD(s,{current:u,hover:c}),[s,u,c]),p=U((e,t)=>l({kind:`node`,uri:t.id}),[]),m=U(()=>l(void 0),[]),h=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return I(B,{children:[L(`div`,{className:`bar`,children:L(`div`,{className:`title`,children:`Series`})}),I(`div`,{className:`canvas`,"data-canvas":!0,children:[r.length?I(`div`,{className:`kinds`,onPointerDown:e=>e.stopPropagation(),children:[L(`div`,{className:`legend`,children:`Show`}),r.map(e=>I(`label`,{className:i.has(e)?`on`:void 0,children:[L(`input`,{type:`checkbox`,checked:i.has(e),onChange:()=>h(e)}),L(`span`,{children:Qm(e)})]},e))]}):void 0,L(zD.Provider,{value:n,children:L(LD.Provider,{value:l,children:L(JE,{nodes:d,edges:f,nodeTypes:UD,edgeTypes:WD,onNodeMouseEnter:p,onNodeMouseLeave:m,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,fitView:!0,minZoom:.05,maxZoom:20,"aria-label":`Every work in this series, in order`,children:L(tD,{variant:ZE.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.14)`})})})})]})]})},KD=({franchise:e,currentUris:t})=>{let[n,r]=V(!1),{refs:i,context:a}=Kd({open:n,onOpenChange:r}),{getReferenceProps:o,getFloatingProps:s}=Jd([Bd(a),Wd(a,{outsidePress:!0}),Xd(a,{role:`dialog`})]);return!e||(e.nodes?.length??0)<2?null:I(B,{children:[I(`button`,{type:`button`,css:FD,ref:i.setReference,...o(),"data-franchise-open":!0,children:[L(Pc,{}),`See detailed relation graph`]}),n?L(bd,{children:L(Id,{lockScroll:!0,css:ID,"data-franchise":!0,children:L(jd,{context:a,children:I(`div`,{className:`sheet`,ref:i.setFloating,...s(),children:[L(GD,{franchise:e,currentUris:t}),L(`button`,{type:`button`,className:`close`,"aria-label":`Close`,onClick:()=>r(!1),children:L(Zc,{})})]})})})}):void 0]})},qD=`stub.tracking.compact`,JD={advanced:!1,targets:{}},YD=()=>{try{return globalThis.localStorage}catch{return}},XD=e=>{try{let t=JSON.parse(e??`null`);return{advanced:t?.advanced===!0,targets:Object.fromEntries(Object.entries(t?.targets??{}).filter(([,e])=>typeof e==`boolean`))}}catch{return JD}},ZD=(e=YD())=>{let t;return{read:()=>{if(t)return t;try{return XD(e?.getItem(qD))}catch{return JD}},write:n=>{try{if(!e)throw Error(`No storage`);e.setItem(qD,JSON.stringify(n)),t=void 0}catch{t=n}}}},QD=[`mal`,`anilist`,`kitsu`,`anidb`],$D=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,tO.unregister(this),e}free(){let e=this.__destroy_into_raw();$.__wbg_haystacks_free(e,0)}bytesView(){return $.haystacks_bytesView(this.__wbg_ptr)}clear(){$.haystacks_clear(this.__wbg_ptr)}commit(e,t){let n=$.haystacks_commit(this.__wbg_ptr,e,t);if(n[1])throw fO(n[0])}get length(){return $.haystacks_length(this.__wbg_ptr)>>>0}constructor(e){var t=lO(e)?0:uO(e,$.__wbindgen_malloc),n=mO;let r=$.haystacks_new(t,n);return this.__wbg_ptr=r,tO.register(this,this.__wbg_ptr,this),this}offsetsView(){return $.haystacks_offsetsView(this.__wbg_ptr)}push(e){let t=uO(e,$.__wbindgen_malloc),n=mO;$.haystacks_push(this.__wbg_ptr,t,n)}reserve(e,t){$.haystacks_reserve(this.__wbg_ptr,e,t)}};Symbol.dispose&&($D.prototype[Symbol.dispose]=$D.prototype.free);var eO=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,nO.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,nO.unregister(this),e}free(){let e=this.__destroy_into_raw();$.__wbg_matcher_free(e,0)}static fromPatterns(t,n){let r=$.matcher_fromPatterns(t,lO(n)?0:rO(n));if(r[2])throw fO(r[1]);return e.__wrap(r[0])}static fromQuery(t,n){let r=dO(t,$.__wbindgen_malloc,$.__wbindgen_realloc),i=mO,a=$.matcher_fromQuery(r,i,lO(n)?0:rO(n));if(a[2])throw fO(a[1]);return e.__wrap(a[0])}matchHaystacks(e){return iO(e,$D),$.matcher_matchHaystacks(this.__wbg_ptr,e.__wbg_ptr)}matchHaystacksIndices(e){return iO(e,$D),$.matcher_matchHaystacksIndices(this.__wbg_ptr,e.__wbg_ptr)}matchList(e){let t=uO(e,$.__wbindgen_malloc),n=mO;return $.matcher_matchList(this.__wbg_ptr,t,n)}matchListIndices(e){let t=uO(e,$.__wbindgen_malloc),n=mO;return $.matcher_matchListIndices(this.__wbg_ptr,t,n)}matchOne(e,t){let n=dO(e,$.__wbindgen_malloc,$.__wbindgen_realloc),r=mO;return $.matcher_matchOne(this.__wbg_ptr,n,r,t)}matchOneIndices(e,t){let n=dO(e,$.__wbindgen_malloc,$.__wbindgen_realloc),r=mO;return $.matcher_matchOneIndices(this.__wbg_ptr,n,r,t)}constructor(e,t){let n=dO(e,$.__wbindgen_malloc,$.__wbindgen_realloc),r=mO,i=$.matcher_new(n,r,lO(t)?0:rO(t));if(i[2])throw fO(i[1]);return this.__wbg_ptr=i[0],nO.register(this,this.__wbg_ptr,this),this}setConfig(e){let t=$.matcher_setConfig(this.__wbg_ptr,e);if(t[1])throw fO(t[0])}setPattern(e){let t=$.matcher_setPattern(this.__wbg_ptr,e);if(t[1])throw fO(t[0])}setPatterns(e){let t=$.matcher_setPatterns(this.__wbg_ptr,e);if(t[1])throw fO(t[0])}};Symbol.dispose&&(eO.prototype[Symbol.dispose]=eO.prototype.free);var tO=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>$.__wbg_haystacks_free(e,1)),nO=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>$.__wbg_matcher_free(e,1));function rO(e){let t=$.__externref_table_alloc();return $.__wbindgen_externrefs.set(t,e),t}function iO(e,t){if(!(e instanceof t))throw Error(`expected instance of ${t.name}`)}var aO=null;function oO(){return(aO===null||aO.buffer.detached===!0||aO.buffer.detached===void 0&&aO.buffer!==$.memory.buffer)&&(aO=new DataView($.memory.buffer)),aO}var sO=null;function cO(){return(sO===null||sO.byteLength===0)&&(sO=new Uint8Array($.memory.buffer)),sO}function lO(e){return e==null}function uO(e,t){let n=t(e.length*4,4)>>>0;for(let t=0;t<e.length;t++){let r=rO(e[t]);oO().setUint32(n+4*t,r,!0)}return mO=e.length,n}function dO(e,t,n){if(n===void 0){let n=pO.encode(e),r=t(n.length,1)>>>0;return cO().subarray(r,r+n.length).set(n),mO=n.length,r}let r=e.length,i=t(r,1)>>>0,a=cO(),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=cO().subarray(i+o,i+r),a=pO.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return mO=o,i}function fO(e){let t=$.__wbindgen_externrefs.get(e);return $.__externref_table_dealloc(e),t}new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode();var pO=new TextEncoder;`encodeInto`in pO||(pO.encodeInto=function(e,t){let n=pO.encode(e);return t.set(n),{read:e.length,written:n.length}});var mO=0,$,hO=new TextEncoder;function gO(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+=hO.encodeInto(t[e],r.subarray(a)).written,i[e]=a;return e.commit(a,t.length),e}var _O=class extends $D{constructor(e){super(),e?.length&&gO(this,e)}push(e){gO(this,e)}},vO;function yO(e){return vO??=new _O,vO.clear(),gO(vO,e)}eO.prototype.matchList=function(e){return this.matchHaystacks(e instanceof $D?e:yO(e))},eO.prototype.matchListIndices=function(e){return this.matchHaystacksIndices(e instanceof $D?e:yO(e))};var bO=[`winter`,`spring`,`summer`,`fall`],xO=(e=new Date)=>({season:bO[Math.floor(e.getMonth()/3)],year:e.getFullYear()}),SO=e=>e.toUpperCase(),CO=(e=new Date)=>{let{season:t,year:n}=xO(e);return{season:SO(t),year:n}},wO=`\\u002d\\u2013\\u2014\\u007e\\uff5e\\u301c`;RegExp(`(?:^|\\s)([${wO}])\\s*[^${wO}]{2,}\\s*\\1\\s*$`),Jo.Tv,Jo.Movie,Jo.Ova,Jo.Ona,Jo.Special,new Set(QD);var TO=`tracking/v1/`;`${TO}`;var EO=`FKN_E2E_LOCKED`,DO=`FKN_STORAGE_NOT_FOUND`,OO=`FKN_ACCOUNT_CHANGED`,kO=`fkn:account-changed`,AO=`FKN_ACCOUNT_PIN_UNSUPPORTED`,jO=`FKN has to update before this list can reach your FKN account`,MO=e=>{let t=e?.code,n=e instanceof Error?e.message:String(e);return t===EO?{locked:!0}:t===DO?{missing:!0}:t===OO||n.startsWith(kO)?{changed:!0}:t===AO?{error:jO}:{error:n}};((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(MO(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(TO)).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:Se,list:Te,encryption:xe,readFile:e=>be.readFile(e,{encoding:`utf8`}),writeFile:(e,t)=>be.writeFile(e,t)});var NO=()=>we().catch(()=>!1);H();var PO=l`
1345
+ `,RD=A(()=>{}),zD=({data:e})=>{let t=R(BD);return I(Fo,{className:`work-node${e.current?` current`:``}${e.lit?` lit`:``}`,to:`${Ho(Y.MEDIA,{uri:oe(e.uri)})}${t}`,title:e.title,children:[L(gT,{type:`target`,position:Q.Left}),L(`div`,{className:`title`,children:e.lines.map(e=>L(`div`,{children:e},e))}),e.meta?L(`div`,{className:`meta`,children:e.meta}):void 0,L(gT,{type:`source`,position:Q.Right})]})},BD=A(``),VD=(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}`},HD=({data:e,sourceX:t,sourceY:n,targetX:r,targetY:i})=>L(`path`,{className:`chain${e?.lit?` lit`:``}`,d:VD(t,n,r,i)}),UD=({id:e,data:t,sourceX:n,sourceY:r,targetX:i,targetY:a})=>{let o=R(RD),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 I(B,{children:[L(`path`,{className:`edge${c}`,d:VD(n,r,i,a)}),I(`g`,{className:`label`,onPointerEnter:()=>o({kind:`edge`,key:e}),onPointerLeave:()=>o(void 0),children:[L(`rect`,{className:`label-hit`,x:u-f/2,y:d-11,width:f,height:15}),L(`text`,{className:`edge-label${c}`,x:u,y:d,children:s})]})]})},WD={work:zD},GD={chain:HD,relation:UD},KD=({franchise:e,currentUris:t})=>{let n=km(Oo()),r=D(()=>Bm(e),[e]),[i,a]=V(()=>new Set(r.filter(zm))),o=[...i].every(zm)?`story`:`graph`,s=D(()=>qm(Vm(e,e=>!e.format||i.has(e.format)),o),[e,i,o]),[c,l]=V(void 0),u=D(()=>new Set(t),[t]),{nodes:d,edges:f}=D(()=>FD(s,{current:u,hover:c}),[s,u,c]),p=U((e,t)=>l({kind:`node`,uri:t.id}),[]),m=U(()=>l(void 0),[]),h=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return I(B,{children:[L(`div`,{className:`bar`,children:L(`div`,{className:`title`,children:`Series`})}),I(`div`,{className:`canvas`,"data-canvas":!0,children:[r.length?I(`div`,{className:`kinds`,onPointerDown:e=>e.stopPropagation(),children:[L(`div`,{className:`legend`,children:`Show`}),r.map(e=>I(`label`,{className:i.has(e)?`on`:void 0,children:[L(`input`,{type:`checkbox`,checked:i.has(e),onChange:()=>h(e)}),L(`span`,{children:$m(e)})]},e))]}):void 0,L(BD.Provider,{value:n,children:L(RD.Provider,{value:l,children:L(YE,{nodes:d,edges:f,nodeTypes:WD,edgeTypes:GD,onNodeMouseEnter:p,onNodeMouseLeave:m,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,fitView:!0,minZoom:.05,maxZoom:20,"aria-label":`Every work in this series, in order`,children:L(nD,{variant:QE.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.14)`})})})})]})]})},qD=({franchise:e,currentUris:t})=>{let[n,r]=V(!1),{refs:i,context:a}=Gd({open:n,onOpenChange:r}),{getReferenceProps:o,getFloatingProps:s}=qd([zd(a),Ud(a,{outsidePress:!0}),Yd(a,{role:`dialog`})]);return!e||(e.nodes?.length??0)<2?null:I(B,{children:[I(`button`,{type:`button`,css:ID,ref:i.setReference,...o(),"data-franchise-open":!0,children:[L(Nc,{}),`See detailed relation graph`]}),n?L(yd,{children:L(Fd,{lockScroll:!0,css:LD,"data-franchise":!0,children:L(Ad,{context:a,children:I(`div`,{className:`sheet`,ref:i.setFloating,...s(),children:[L(KD,{franchise:e,currentUris:t}),L(`button`,{type:`button`,className:`close`,"aria-label":`Close`,onClick:()=>r(!1),children:L(Xc,{})})]})})})}):void 0]})},JD=`stub.tracking.compact`,YD={advanced:!1,targets:{}},XD=()=>{try{return globalThis.localStorage}catch{return}},ZD=e=>{try{let t=JSON.parse(e??`null`);return{advanced:t?.advanced===!0,targets:Object.fromEntries(Object.entries(t?.targets??{}).filter(([,e])=>typeof e==`boolean`))}}catch{return YD}},QD=(e=XD())=>{let t;return{read:()=>{if(t)return t;try{return ZD(e?.getItem(JD))}catch{return YD}},write:n=>{try{if(!e)throw Error(`No storage`);e.setItem(JD,JSON.stringify(n)),t=void 0}catch{t=n}}}},$D=[`mal`,`anilist`,`kitsu`,`anidb`],eO=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,nO.unregister(this),e}free(){let e=this.__destroy_into_raw();$.__wbg_haystacks_free(e,0)}bytesView(){return $.haystacks_bytesView(this.__wbg_ptr)}clear(){$.haystacks_clear(this.__wbg_ptr)}commit(e,t){let n=$.haystacks_commit(this.__wbg_ptr,e,t);if(n[1])throw pO(n[0])}get length(){return $.haystacks_length(this.__wbg_ptr)>>>0}constructor(e){var t=uO(e)?0:dO(e,$.__wbindgen_malloc),n=hO;let r=$.haystacks_new(t,n);return this.__wbg_ptr=r,nO.register(this,this.__wbg_ptr,this),this}offsetsView(){return $.haystacks_offsetsView(this.__wbg_ptr)}push(e){let t=dO(e,$.__wbindgen_malloc),n=hO;$.haystacks_push(this.__wbg_ptr,t,n)}reserve(e,t){$.haystacks_reserve(this.__wbg_ptr,e,t)}};Symbol.dispose&&(eO.prototype[Symbol.dispose]=eO.prototype.free);var tO=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();$.__wbg_matcher_free(e,0)}static fromPatterns(t,n){let r=$.matcher_fromPatterns(t,uO(n)?0:iO(n));if(r[2])throw pO(r[1]);return e.__wrap(r[0])}static fromQuery(t,n){let r=fO(t,$.__wbindgen_malloc,$.__wbindgen_realloc),i=hO,a=$.matcher_fromQuery(r,i,uO(n)?0:iO(n));if(a[2])throw pO(a[1]);return e.__wrap(a[0])}matchHaystacks(e){return aO(e,eO),$.matcher_matchHaystacks(this.__wbg_ptr,e.__wbg_ptr)}matchHaystacksIndices(e){return aO(e,eO),$.matcher_matchHaystacksIndices(this.__wbg_ptr,e.__wbg_ptr)}matchList(e){let t=dO(e,$.__wbindgen_malloc),n=hO;return $.matcher_matchList(this.__wbg_ptr,t,n)}matchListIndices(e){let t=dO(e,$.__wbindgen_malloc),n=hO;return $.matcher_matchListIndices(this.__wbg_ptr,t,n)}matchOne(e,t){let n=fO(e,$.__wbindgen_malloc,$.__wbindgen_realloc),r=hO;return $.matcher_matchOne(this.__wbg_ptr,n,r,t)}matchOneIndices(e,t){let n=fO(e,$.__wbindgen_malloc,$.__wbindgen_realloc),r=hO;return $.matcher_matchOneIndices(this.__wbg_ptr,n,r,t)}constructor(e,t){let n=fO(e,$.__wbindgen_malloc,$.__wbindgen_realloc),r=hO,i=$.matcher_new(n,r,uO(t)?0:iO(t));if(i[2])throw pO(i[1]);return this.__wbg_ptr=i[0],rO.register(this,this.__wbg_ptr,this),this}setConfig(e){let t=$.matcher_setConfig(this.__wbg_ptr,e);if(t[1])throw pO(t[0])}setPattern(e){let t=$.matcher_setPattern(this.__wbg_ptr,e);if(t[1])throw pO(t[0])}setPatterns(e){let t=$.matcher_setPatterns(this.__wbg_ptr,e);if(t[1])throw pO(t[0])}};Symbol.dispose&&(tO.prototype[Symbol.dispose]=tO.prototype.free);var nO=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>$.__wbg_haystacks_free(e,1)),rO=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>$.__wbg_matcher_free(e,1));function iO(e){let t=$.__externref_table_alloc();return $.__wbindgen_externrefs.set(t,e),t}function aO(e,t){if(!(e instanceof t))throw Error(`expected instance of ${t.name}`)}var oO=null;function sO(){return(oO===null||oO.buffer.detached===!0||oO.buffer.detached===void 0&&oO.buffer!==$.memory.buffer)&&(oO=new DataView($.memory.buffer)),oO}var cO=null;function lO(){return(cO===null||cO.byteLength===0)&&(cO=new Uint8Array($.memory.buffer)),cO}function uO(e){return e==null}function dO(e,t){let n=t(e.length*4,4)>>>0;for(let t=0;t<e.length;t++){let r=iO(e[t]);sO().setUint32(n+4*t,r,!0)}return hO=e.length,n}function fO(e,t,n){if(n===void 0){let n=mO.encode(e),r=t(n.length,1)>>>0;return lO().subarray(r,r+n.length).set(n),hO=n.length,r}let r=e.length,i=t(r,1)>>>0,a=lO(),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=lO().subarray(i+o,i+r),a=mO.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return hO=o,i}function pO(e){let t=$.__wbindgen_externrefs.get(e);return $.__externref_table_dealloc(e),t}new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode();var mO=new TextEncoder;`encodeInto`in mO||(mO.encodeInto=function(e,t){let n=mO.encode(e);return t.set(n),{read:e.length,written:n.length}});var hO=0,$,gO=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+=gO.encodeInto(t[e],r.subarray(a)).written,i[e]=a;return e.commit(a,t.length),e}var vO=class extends eO{constructor(e){super(),e?.length&&_O(this,e)}push(e){_O(this,e)}},yO;function bO(e){return yO??=new vO,yO.clear(),_O(yO,e)}tO.prototype.matchList=function(e){return this.matchHaystacks(e instanceof eO?e:bO(e))},tO.prototype.matchListIndices=function(e){return this.matchHaystacksIndices(e instanceof eO?e:bO(e))};var xO=[`winter`,`spring`,`summer`,`fall`],SO=(e=new Date)=>({season:xO[Math.floor(e.getMonth()/3)],year:e.getFullYear()}),CO=e=>e.toUpperCase(),wO=(e=new Date)=>{let{season:t,year:n}=SO(e);return{season:CO(t),year:n}},TO=`\\u002d\\u2013\\u2014\\u007e\\uff5e\\u301c`;RegExp(`(?:^|\\s)([${TO}])\\s*[^${TO}]{2,}\\s*\\1\\s*$`),Jo.Tv,Jo.Movie,Jo.Ova,Jo.Ona,Jo.Special,new Set($D);var EO=`tracking/v1/`;`${EO}`;var DO=`FKN_E2E_LOCKED`,OO=`FKN_STORAGE_NOT_FOUND`,kO=`FKN_ACCOUNT_CHANGED`,AO=`fkn:account-changed`,jO=`FKN_ACCOUNT_PIN_UNSUPPORTED`,MO=`FKN has to update before this list can reach your FKN account`,NO=e=>{let t=e?.code,n=e instanceof Error?e.message:String(e);return t===DO?{locked:!0}:t===OO?{missing:!0}:t===kO||n.startsWith(AO)?{changed:!0}:t===jO?{error:MO}:{error:n}};((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(NO(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(EO)).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:Se,list:Te,encryption:xe,readFile:e=>be.readFile(e,{encoding:`utf8`}),writeFile:(e,t)=>be.writeFile(e,t)});var PO=()=>we().catch(()=>!1);H();var FO=l`
1375
1346
  display: flex;
1376
1347
  flex-direction: column;
1377
1348
  gap: 0.8rem;
@@ -1398,7 +1369,7 @@ transition: max-height 0.3s ease-in-out;
1398
1369
  &:hover { background: rgba(255, 255, 255, 0.08); }
1399
1370
  &:disabled { opacity: 0.5; cursor: default; }
1400
1371
  }
1401
- `,FO=e=>e===1?`1 entry`:`${e} entries`,IO=({storage:e,onUnlock:t,onAdd:n})=>{let[r,i]=V(!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=e.held===1,l=[s?I(`div`,{className:`line`,children:[I(`span`,{children:[`Stub: your FKN account's list is locked on this device`,o?`, and changes wait here until it opens.`:`, so this device keeps its own list for now.`]}),L(`button`,{type:`button`,disabled:r,onClick:a(t),children:`Unlock`})]},`locked`):void 0,o&&!s&&e.held>0?I(`div`,{className:`line`,children:[I(`span`,{children:[`Stub: `,FO(e.held),` saved on this device before you signed in `,c?`stays`:`stay`,` on this device, apart from your FKN account's list, and `,c?`comes`:`come`,` back if you sign out.`]}),L(`button`,{type:`button`,disabled:r,onClick:a(n),children:`Add to my FKN account`})]},`held`):void 0,o&&!s&&e.waiting?L(`div`,{className:`line`,children:`Stub: some changes have not reached your FKN account yet.`},`waiting`):void 0,e.error?I(`div`,{className:`line problem`,children:[`Stub: `,e.error]},`error`):void 0].filter(Boolean);return l.length?L(`div`,{css:PO,className:`stub-list-notice`,role:`status`,children:l}):null},LO=e=>Math.max(1,e),RO={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=>LO(Math.floor(e/10)),raw:e=>e*10},POINT_5:{step:20,native:e=>LO(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}},zO=e=>RO[e??``]??RO.POINT_100,BO=e=>e!=null&&e>0,VO=(e,t)=>zO(t).native(e),HO=(e,t)=>{let{native:n,raw:r}=zO(t);return r(n(e))},UO=(e,t)=>zO(t).step>zO(e).step?t:e,WO=(e,t,n)=>{let r=n.reduce(UO,`POINT_100`);return VO(e,r)===VO(t,r)},GO=(e,t)=>{if(!e)return null;switch(t){case`POINT_10_DECIMAL`:return`${e.toFixed(1)} / 10`;case`POINT_10`:return`${Math.round(e)} / 10`;case`POINT_5`:return`${Math.round(e)} / 5`;case`POINT_3`:return[`:(`,`:|`,`:)`][Math.round(e)-1]??`${e} / 3`;default:return`${Math.round(e)} / 100`}},KO=new Set([`LISTED`,`NOT_LISTED`]),qO=e=>e.tracker.canWrite&&KO.has(e.state),JO=(e,t)=>{let n=e?.summary;return{status:n?.status??null,progress:n?.progress??0,score:BO(n?.score)?n.score:null,total:n?.episodeCount??t??null,differs:(e?.disagreements??[]).filter(e=>e===`STATUS`||e===`PROGRESS`||e===`SCORE`)}},YO=(e,t)=>{switch(e.state){case`SIGNED_OUT`:return{kind:`login`};case`NO_ID`:return{kind:`cannot`,reason:`Has no id for this media`};case`AMBIGUOUS`:return{kind:`cannot`,reason:`Names ${e.candidates.join(` and `)}, cannot tell which`}}if(!e.tracker.canWrite)return{kind:`cannot`,reason:`Is read only`};let n=t??!0;return{kind:`check`,checked:n,sendable:n&&qO(e)}},XO=(e,t)=>{let n=e.entry?.episodeCount;return n!=null&&t!=null&&n!==t},ZO=(e,t,n)=>{let r=`score`in t?t.score:n.score,i=e.state===`LISTED`?{...t}:{status:t.status??n.status??`WATCHING`,progress:t.progress??n.progress,...BO(r)?{score:r}:{}};return i.progress!==void 0&&(XO(e,n.total)?delete i.progress:i.progress=Math.max(0,Math.min(n.total??1/0,i.progress))),Object.keys(i).length?i:void 0},QO={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]},$O=e=>{if(!e.length)return;let t=e.map(e=>e&&QO[e]?e:`POINT_100`);return{scale:t.reduce((e,t)=>UO(e,t)??`POINT_100`,`POINT_100`),mixed:new Set(t).size>1}},ek=(e,t)=>HO(e,t),tk=({send:e,onChange:t=()=>{},delay:n=1e3,timers:r={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)}})=>{let i=new Map,a=new Set,o=new Map,s=new Map,c=new Map,l,u=n=>{let r=i.get(n);if(!r||!a.has(n)||o.has(n))return;i.delete(n),a.delete(n),o.set(n,r);let l=(e,a)=>{if(o.delete(n),e===`SAVED`||e===`QUEUED`)s.delete(n);else if(e===`REFUSED`)c.set(n,a??`Refused`);else{s.set(n,{fields:r,error:a??`Did not save`});let e=i.get(n);e&&i.set(n,{...r,...e})}t({tracker:n,outcome:e,fields:r,error:a}),u(n)};e(n,r).then(({outcome:e,error:t})=>l(e,t),e=>l(`FAILED`,e instanceof Error?e.message:String(e))),t()},d=()=>{l!==void 0&&r.clear(l),l=void 0;for(let e of i.keys())a.add(e);for(let e of[...a])u(e)};return{stage:(e,a)=>{for(let[t,n]of Object.entries(e)){let e=s.get(t)?.fields;s.delete(t),c.delete(t),i.set(t,{...e,...i.get(t),...n})}a?d():(l!==void 0&&r.clear(l),l=r.set(d,n),t())},flush:d,fail:(e,n,r)=>{s.set(e,{fields:{...s.get(e)?.fields,...n},error:r}),t({tracker:e,outcome:`FAILED`,fields:n,error:r})},retry:e=>{let n=s.get(e);n&&(s.delete(e),i.set(e,{...n.fields,...i.get(e)}),a.add(e),u(e),t())},drop:e=>{i.delete(e),a.delete(e),s.delete(e),c.delete(e),t()},dismiss:e=>{c.delete(e),t()},state:e=>({busy:o.has(e)||i.has(e),failed:s.get(e),refused:c.get(e)}),idle:()=>!o.size&&!i.size}},nk=(e,t)=>String(e??0).padStart(t,`0`),rk=e=>e?.year?`${nk(e.year,4)}-${nk(e.month,2)}-${nk(e.day,2)}`:void 0,ik=[`STATUS`,`PROGRESS`,`SCORE`,`STARTED_AT`,`COMPLETED_AT`,`REWATCH_COUNT`],ak={STATUS:`Status`,PROGRESS:`Progress`,SCORE:`Score`,STARTED_AT:`Started`,COMPLETED_AT:`Completed`,REWATCH_COUNT:`Rewatches`},ok={WATCHING:`Watching`,REWATCHING:`Rewatching`,PLANNING:`Plan to watch`,COMPLETED:`Completed`,PAUSED:`Paused`,DROPPED:`Dropped`},sk=e=>e?ok[e]??e:null,ck={STATUS:`the status`,PROGRESS:`progress`,SCORE:`the score`,STARTED_AT:`the start date`,COMPLETED_AT:`the completion date`,REWATCH_COUNT:`the rewatch count`},lk=(e,t)=>!e.tracker.keeps||e.tracker.keeps.includes(t),uk=(e,t)=>e==null?null:t?`${e} / ${t}`:String(e),dk=(e,t,n)=>BO(e)?t&&t!==`POINT_100`?n??GO(VO(e,t),t):`${e}%`:null,fk=e=>String(e).padStart(2,`0`),pk=e=>e?.year?e.month==null?String(e.year):e.day==null?`${e.year}-${fk(e.month)}`:`${e.year}-${fk(e.month)}-${fk(e.day)}`:null,mk=(e,t,n)=>{if(!t)return null;switch(e){case`STATUS`:return sk(t.status);case`PROGRESS`:return uk(t.progress,t.episodeCount);case`SCORE`:return dk(t.score,n,t.scoreLabel);case`STARTED_AT`:return pk(t.startedAt);case`COMPLETED_AT`:return pk(t.completedAt);case`REWATCH_COUNT`:return t.rewatchCount?String(t.rewatchCount):null}},hk=e=>e.entry?.episodeCount??e.episodeCount??null,gk=(e,t)=>e.tracker.keepsPageEpisodeCount?t.episodeCount??hk(e):hk(e),_k=e=>({year:e.year??null,month:e.month??null,day:e.day??null}),vk=(e,t,n,r)=>{let i=t.entry,a=n.entry??null;if(!i||!lk(n,e))return;let o=n.tracker.scoreScale,s=(t,n,r,i)=>({change:{field:e,from:mk(e,a,o),to:t,backwards:n,...i?{note:i}:{}},input:r});switch(e){case`STATUS`:{if(!i.status||i.status===a?.status)return;let e=a?.status===`COMPLETED`&&i.status!==`COMPLETED`&&i.status!==`REWATCHING`,t=n.tracker.rewatchThroughCompleted&&a?.status===`REWATCHING`&&i.status===`COMPLETED`;return s(sk(i.status),e,{status:i.status},t?`counts one finished rewatch on ${n.tracker.name}`:void 0)}case`PROGRESS`:{if(i.progress==null||i.progress===a?.progress)return;let o=[hk(t),gk(n,r)];if(o[0]!=null&&o[1]!=null&&o[0]!==o[1])return{held:{field:e,reason:`${t.tracker.name} counts ${o[0]} episodes and ${n.tracker.name} counts ${o[1]}, so progress is not copied`}};let c=a?.progress!=null&&i.progress<a.progress;return s(uk(i.progress,o[1]),c,{progress:i.progress})}case`SCORE`:{let e=a?.score;if(!BO(i.score)||BO(e)&&WO(i.score,e,[t.tracker.scoreScale,o]))return;let n=HO(i.score,o);if(n===a?.score)return;let r=n===i.score?void 0:`rounded from ${t.tracker.name}'s ${dk(i.score,t.tracker.scoreScale,i.scoreLabel)}`;return s(dk(n,o),!1,{score:n},r)}case`STARTED_AT`:case`COMPLETED_AT`:{let t=e===`STARTED_AT`?`startedAt`:`completedAt`,n=i[t];return!n||!rk(n)||rk(n)===rk(a?.[t])?void 0:s(pk(n),!1,t===`startedAt`?{startedAt:_k(n)}:{completedAt:_k(n)})}case`REWATCH_COUNT`:return!i.rewatchCount||i.rewatchCount===(a?.rewatchCount??0)?void 0:s(String(i.rewatchCount),i.rewatchCount<(a?.rewatchCount??0),{rewatchCount:i.rewatchCount})}},yk={NOT_LISTED:e=>`${e} lists nothing for this media`,NO_ID:e=>`${e} has no id for this media`,AMBIGUOUS:e=>`${e} names two entries for this media and cannot tell which one is meant`,SIGNED_OUT:e=>`Sign in to ${e} first`,PAUSED:e=>`${e} asked stub to wait`,ERROR:e=>`${e} could not answer`},bk=e=>(yk[e.state]??(e=>`${e} could not answer`))(e.tracker.name),xk=e=>{if(e.state!==`LISTED`||!e.entry)return bk(e);let t=e.pending??0;if(t>0)return`${e.tracker.name} has ${t} change${t===1?``:`s`} still waiting to be sent`},Sk=e=>e.state!==`LISTED`&&e.state!==`NOT_LISTED`?bk(e):e.tracker.canWrite?void 0:`${e.tracker.name} takes no writes`,Ck=(e,t)=>{if(!t.tracker.rewatchThroughCompleted||!lk(t,`STATUS`))return;let n=e.entry?.status,r=t.entry?.status;if(n&&n!==r){if(n===`REWATCHING`&&r!==`COMPLETED`)return`${t.tracker.name} starts a rewatch only on an entry it lists as Completed`;if(r===`REWATCHING`&&n!==`COMPLETED`)return`${t.tracker.name} ends a rewatch only as Completed`}},wk=(e,t,n={})=>{let r=Sk(t)??Ck(e,t);if(r)return{tracker:t.tracker.id,refusal:r,changes:[],held:[],entry:null};let i=[],a=[],o={};for(let r of ik){if(!lk(t,r)){mk(r,e.entry,e.tracker.scoreScale)!=null&&a.push({field:r,reason:`${t.tracker.name} does not take ${ck[r]} from stub, so it is not copied`});continue}let s=vk(r,e,t,n);s&&(`held`in s?a.push(s.held):(i.push(s.change),o={...o,...s.input}))}return{tracker:t.tracker.id,changes:i,held:a,entry:i.length?o:null}},Tk=(e,t,n,r={})=>{let i=e.find(e=>e.tracker.id===t);if(!i)return{source:t,refusal:`There is no tracker called ${t}`,targets:[]};let a=xk(i);return a?{source:t,refusal:a,targets:[]}:{source:t,targets:[...new Set(n)].filter(e=>e!==t).map(t=>{let n=e.find(e=>e.tracker.id===t);return n?wk(i,n,r):{tracker:t,refusal:`There is no tracker called ${t}`,changes:[],held:[],entry:null}})}},Ek=e=>{let t=e.filter(e=>e.state===`LISTED`||e.state===`NOT_LISTED`);if(t.length<2)return[];let n=t.filter(e=>e.state===`LISTED`&&e.entry);return ik.filter(e=>n.some(n=>t.some(t=>t!==n&&vk(e,n,t,{})))).map(e=>({field:e,cells:t.map(t=>({tracker:t.tracker.id,text:mk(e,t.entry,t.tracker.scoreScale)}))}))},Dk=async(e,t)=>e.refusal?[]:await Promise.all(e.targets.flatMap(({tracker:e,refusal:n,entry:r})=>n||!r?[]:[(async()=>{try{let n=await t(e,r),i=n.find(t=>t.tracker===e)??n.find(e=>!e.tracker);return i?{tracker:e,outcome:i.outcome,error:i.error??null}:{tracker:e,outcome:`FAILED`,error:`The write came back with no answer for this tracker`}}catch(t){return{tracker:e,outcome:`FAILED`,error:t instanceof Error?t.message:String(t)}}})()]));H();var Ok=[Tc,jc,Uc],kk=[`bad`,`neutral`,`good`],Ak={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10,POINT_100:100},jk=l`
1372
+ `,IO=e=>e===1?`1 entry`:`${e} entries`,LO=({storage:e,onUnlock:t,onAdd:n})=>{let[r,i]=V(!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=e.held===1,l=[s?I(`div`,{className:`line`,children:[I(`span`,{children:[`Stub: your FKN account's list is locked on this device`,o?`, and changes wait here until it opens.`:`, so this device keeps its own list for now.`]}),L(`button`,{type:`button`,disabled:r,onClick:a(t),children:`Unlock`})]},`locked`):void 0,o&&!s&&e.held>0?I(`div`,{className:`line`,children:[I(`span`,{children:[`Stub: `,IO(e.held),` saved on this device before you signed in `,c?`stays`:`stay`,` on this device, apart from your FKN account's list, and `,c?`comes`:`come`,` back if you sign out.`]}),L(`button`,{type:`button`,disabled:r,onClick:a(n),children:`Add to my FKN account`})]},`held`):void 0,o&&!s&&e.waiting?L(`div`,{className:`line`,children:`Stub: some changes have not reached your FKN account yet.`},`waiting`):void 0,e.error?I(`div`,{className:`line problem`,children:[`Stub: `,e.error]},`error`):void 0].filter(Boolean);return l.length?L(`div`,{css:FO,className:`stub-list-notice`,role:`status`,children:l}):null},RO=e=>Math.max(1,e),zO={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=>RO(Math.floor(e/10)),raw:e=>e*10},POINT_5:{step:20,native:e=>RO(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}},BO=e=>zO[e??``]??zO.POINT_100,VO=e=>e!=null&&e>0,HO=(e,t)=>BO(t).native(e),UO=(e,t)=>{let{native:n,raw:r}=BO(t);return r(n(e))},WO=(e,t)=>BO(t).step>BO(e).step?t:e,GO=(e,t,n)=>{let r=n.reduce(WO,`POINT_100`);return HO(e,r)===HO(t,r)},KO=(e,t)=>{if(!e)return null;switch(t){case`POINT_10_DECIMAL`:return`${e.toFixed(1)} / 10`;case`POINT_10`:return`${Math.round(e)} / 10`;case`POINT_5`:return`${Math.round(e)} / 5`;case`POINT_3`:return[`:(`,`:|`,`:)`][Math.round(e)-1]??`${e} / 3`;default:return`${Math.round(e)} / 100`}},qO=new Set([`LISTED`,`NOT_LISTED`]),JO=e=>e.tracker.canWrite&&qO.has(e.state),YO=(e,t)=>{let n=e?.summary;return{status:n?.status??null,progress:n?.progress??0,score:VO(n?.score)?n.score:null,total:n?.episodeCount??t??null,differs:(e?.disagreements??[]).filter(e=>e===`STATUS`||e===`PROGRESS`||e===`SCORE`)}},XO=(e,t)=>{switch(e.state){case`SIGNED_OUT`:return{kind:`login`};case`NO_ID`:return{kind:`cannot`,reason:`Has no id for this media`};case`AMBIGUOUS`:return{kind:`cannot`,reason:`Names ${e.candidates.join(` and `)}, cannot tell which`}}if(!e.tracker.canWrite)return{kind:`cannot`,reason:`Is read only`};let n=t??!0;return{kind:`check`,checked:n,sendable:n&&JO(e)}},ZO=(e,t)=>{let n=e.entry?.episodeCount;return n!=null&&t!=null&&n!==t},QO=(e,t,n)=>{let r=`score`in t?t.score:n.score,i=e.state===`LISTED`?{...t}:{status:t.status??n.status??`WATCHING`,progress:t.progress??n.progress,...VO(r)?{score:r}:{}};return i.progress!==void 0&&(ZO(e,n.total)?delete i.progress:i.progress=Math.max(0,Math.min(n.total??1/0,i.progress))),Object.keys(i).length?i:void 0},$O={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]},ek=e=>{if(!e.length)return;let t=e.map(e=>e&&$O[e]?e:`POINT_100`);return{scale:t.reduce((e,t)=>WO(e,t)??`POINT_100`,`POINT_100`),mixed:new Set(t).size>1}},tk=(e,t)=>UO(e,t),nk=({send:e,onChange:t=()=>{},delay:n=1e3,timers:r={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)}})=>{let i=new Map,a=new Set,o=new Map,s=new Map,c=new Map,l,u=n=>{let r=i.get(n);if(!r||!a.has(n)||o.has(n))return;i.delete(n),a.delete(n),o.set(n,r);let l=(e,a)=>{if(o.delete(n),e===`SAVED`||e===`QUEUED`)s.delete(n);else if(e===`REFUSED`)c.set(n,a??`Refused`);else{s.set(n,{fields:r,error:a??`Did not save`});let e=i.get(n);e&&i.set(n,{...r,...e})}t({tracker:n,outcome:e,fields:r,error:a}),u(n)};e(n,r).then(({outcome:e,error:t})=>l(e,t),e=>l(`FAILED`,e instanceof Error?e.message:String(e))),t()},d=()=>{l!==void 0&&r.clear(l),l=void 0;for(let e of i.keys())a.add(e);for(let e of[...a])u(e)};return{stage:(e,a)=>{for(let[t,n]of Object.entries(e)){let e=s.get(t)?.fields;s.delete(t),c.delete(t),i.set(t,{...e,...i.get(t),...n})}a?d():(l!==void 0&&r.clear(l),l=r.set(d,n),t())},flush:d,fail:(e,n,r)=>{s.set(e,{fields:{...s.get(e)?.fields,...n},error:r}),t({tracker:e,outcome:`FAILED`,fields:n,error:r})},retry:e=>{let n=s.get(e);n&&(s.delete(e),i.set(e,{...n.fields,...i.get(e)}),a.add(e),u(e),t())},drop:e=>{i.delete(e),a.delete(e),s.delete(e),c.delete(e),t()},dismiss:e=>{c.delete(e),t()},state:e=>({busy:o.has(e)||i.has(e),failed:s.get(e),refused:c.get(e)}),idle:()=>!o.size&&!i.size}},rk=(e,t)=>String(e??0).padStart(t,`0`),ik=e=>e?.year?`${rk(e.year,4)}-${rk(e.month,2)}-${rk(e.day,2)}`:void 0,ak=[`STATUS`,`PROGRESS`,`SCORE`,`STARTED_AT`,`COMPLETED_AT`,`REWATCH_COUNT`],ok={STATUS:`Status`,PROGRESS:`Progress`,SCORE:`Score`,STARTED_AT:`Started`,COMPLETED_AT:`Completed`,REWATCH_COUNT:`Rewatches`},sk={WATCHING:`Watching`,REWATCHING:`Rewatching`,PLANNING:`Plan to watch`,COMPLETED:`Completed`,PAUSED:`Paused`,DROPPED:`Dropped`},ck=e=>e?sk[e]??e:null,lk={STATUS:`the status`,PROGRESS:`progress`,SCORE:`the score`,STARTED_AT:`the start date`,COMPLETED_AT:`the completion date`,REWATCH_COUNT:`the rewatch count`},uk=(e,t)=>!e.tracker.keeps||e.tracker.keeps.includes(t),dk=(e,t)=>e==null?null:t?`${e} / ${t}`:String(e),fk=(e,t,n)=>VO(e)?t&&t!==`POINT_100`?n??KO(HO(e,t),t):`${e}%`:null,pk=e=>String(e).padStart(2,`0`),mk=e=>e?.year?e.month==null?String(e.year):e.day==null?`${e.year}-${pk(e.month)}`:`${e.year}-${pk(e.month)}-${pk(e.day)}`:null,hk=(e,t,n)=>{if(!t)return null;switch(e){case`STATUS`:return ck(t.status);case`PROGRESS`:return dk(t.progress,t.episodeCount);case`SCORE`:return fk(t.score,n,t.scoreLabel);case`STARTED_AT`:return mk(t.startedAt);case`COMPLETED_AT`:return mk(t.completedAt);case`REWATCH_COUNT`:return t.rewatchCount?String(t.rewatchCount):null}},gk=e=>e.entry?.episodeCount??e.episodeCount??null,_k=(e,t)=>e.tracker.keepsPageEpisodeCount?t.episodeCount??gk(e):gk(e),vk=e=>({year:e.year??null,month:e.month??null,day:e.day??null}),yk=(e,t,n,r)=>{let i=t.entry,a=n.entry??null;if(!i||!uk(n,e))return;let o=n.tracker.scoreScale,s=(t,n,r,i)=>({change:{field:e,from:hk(e,a,o),to:t,backwards:n,...i?{note:i}:{}},input:r});switch(e){case`STATUS`:{if(!i.status||i.status===a?.status)return;let e=a?.status===`COMPLETED`&&i.status!==`COMPLETED`&&i.status!==`REWATCHING`,t=n.tracker.rewatchThroughCompleted&&a?.status===`REWATCHING`&&i.status===`COMPLETED`;return s(ck(i.status),e,{status:i.status},t?`counts one finished rewatch on ${n.tracker.name}`:void 0)}case`PROGRESS`:{if(i.progress==null||i.progress===a?.progress)return;let o=[gk(t),_k(n,r)];if(o[0]!=null&&o[1]!=null&&o[0]!==o[1])return{held:{field:e,reason:`${t.tracker.name} counts ${o[0]} episodes and ${n.tracker.name} counts ${o[1]}, so progress is not copied`}};let c=a?.progress!=null&&i.progress<a.progress;return s(dk(i.progress,o[1]),c,{progress:i.progress})}case`SCORE`:{let e=a?.score;if(!VO(i.score)||VO(e)&&GO(i.score,e,[t.tracker.scoreScale,o]))return;let n=UO(i.score,o);if(n===a?.score)return;let r=n===i.score?void 0:`rounded from ${t.tracker.name}'s ${fk(i.score,t.tracker.scoreScale,i.scoreLabel)}`;return s(fk(n,o),!1,{score:n},r)}case`STARTED_AT`:case`COMPLETED_AT`:{let t=e===`STARTED_AT`?`startedAt`:`completedAt`,n=i[t];return!n||!ik(n)||ik(n)===ik(a?.[t])?void 0:s(mk(n),!1,t===`startedAt`?{startedAt:vk(n)}:{completedAt:vk(n)})}case`REWATCH_COUNT`:return!i.rewatchCount||i.rewatchCount===(a?.rewatchCount??0)?void 0:s(String(i.rewatchCount),i.rewatchCount<(a?.rewatchCount??0),{rewatchCount:i.rewatchCount})}},bk={NOT_LISTED:e=>`${e} lists nothing for this media`,NO_ID:e=>`${e} has no id for this media`,AMBIGUOUS:e=>`${e} names two entries for this media and cannot tell which one is meant`,SIGNED_OUT:e=>`Sign in to ${e} first`,PAUSED:e=>`${e} asked stub to wait`,ERROR:e=>`${e} could not answer`},xk=e=>(bk[e.state]??(e=>`${e} could not answer`))(e.tracker.name),Sk=e=>{if(e.state!==`LISTED`||!e.entry)return xk(e);let t=e.pending??0;if(t>0)return`${e.tracker.name} has ${t} change${t===1?``:`s`} still waiting to be sent`},Ck=e=>e.state!==`LISTED`&&e.state!==`NOT_LISTED`?xk(e):e.tracker.canWrite?void 0:`${e.tracker.name} takes no writes`,wk=(e,t)=>{if(!t.tracker.rewatchThroughCompleted||!uk(t,`STATUS`))return;let n=e.entry?.status,r=t.entry?.status;if(n&&n!==r){if(n===`REWATCHING`&&r!==`COMPLETED`)return`${t.tracker.name} starts a rewatch only on an entry it lists as Completed`;if(r===`REWATCHING`&&n!==`COMPLETED`)return`${t.tracker.name} ends a rewatch only as Completed`}},Tk=(e,t,n={})=>{let r=Ck(t)??wk(e,t);if(r)return{tracker:t.tracker.id,refusal:r,changes:[],held:[],entry:null};let i=[],a=[],o={};for(let r of ak){if(!uk(t,r)){hk(r,e.entry,e.tracker.scoreScale)!=null&&a.push({field:r,reason:`${t.tracker.name} does not take ${lk[r]} from stub, so it is not copied`});continue}let s=yk(r,e,t,n);s&&(`held`in s?a.push(s.held):(i.push(s.change),o={...o,...s.input}))}return{tracker:t.tracker.id,changes:i,held:a,entry:i.length?o:null}},Ek=(e,t,n,r={})=>{let i=e.find(e=>e.tracker.id===t);if(!i)return{source:t,refusal:`There is no tracker called ${t}`,targets:[]};let a=Sk(i);return a?{source:t,refusal:a,targets:[]}:{source:t,targets:[...new Set(n)].filter(e=>e!==t).map(t=>{let n=e.find(e=>e.tracker.id===t);return n?Tk(i,n,r):{tracker:t,refusal:`There is no tracker called ${t}`,changes:[],held:[],entry:null}})}},Dk=e=>{let t=e.filter(e=>e.state===`LISTED`||e.state===`NOT_LISTED`);if(t.length<2)return[];let n=t.filter(e=>e.state===`LISTED`&&e.entry);return ak.filter(e=>n.some(n=>t.some(t=>t!==n&&yk(e,n,t,{})))).map(e=>({field:e,cells:t.map(t=>({tracker:t.tracker.id,text:hk(e,t.entry,t.tracker.scoreScale)}))}))},Ok=async(e,t)=>e.refusal?[]:await Promise.all(e.targets.flatMap(({tracker:e,refusal:n,entry:r})=>n||!r?[]:[(async()=>{try{let n=await t(e,r),i=n.find(t=>t.tracker===e)??n.find(e=>!e.tracker);return i?{tracker:e,outcome:i.outcome,error:i.error??null}:{tracker:e,outcome:`FAILED`,error:`The write came back with no answer for this tracker`}}catch(t){return{tracker:e,outcome:`FAILED`,error:t instanceof Error?t.message:String(t)}}})()]));H();var kk=[wc,Ac,Hc],Ak=[`bad`,`neutral`,`good`],jk={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10,POINT_100:100},Mk=l`
1402
1373
  position: relative;
1403
1374
  display: flex;
1404
1375
 
@@ -1426,7 +1397,7 @@ transition: max-height 0.3s ease-in-out;
1426
1397
  .caption { font-size: 1.2rem; color: rgba(255, 255, 255, 0.6); }
1427
1398
  .exact { display: flex; align-items: center; gap: 0.6rem; font-size: 1.2rem; color: rgba(255, 255, 255, 0.6); }
1428
1399
  .exact input { width: 7rem; }
1429
- `,Mk=({score:e,scale:t,size:n=16})=>{let r=VO(e,t);if(t===`POINT_3`){let e=Ok[r-1]??jc;return L(e,{size:n,"aria-hidden":`true`})}return L(`span`,{className:`value`,children:r})},Nk=(e,t)=>{let n=VO(e,t);return t===`POINT_3`?`${n} out of 3 (${kk[n-1]})`:`${n} out of ${Ak[t]??100}`},Pk=({score:e,scale:t,mixed:n,disabled:r,disabledTitle:i,onPick:a})=>{let[o,s]=V(!1),[c,l]=V(``),u=w(null),d=w(null),f=BO(e),p=f?VO(e,t):void 0,m=()=>{s(!1),d.current?.focus()},h=e=>{a(e),m()};N(()=>{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 g=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),m();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()},_=t===`POINT_10_DECIMAL`,v=()=>{let e=Number(c);c!==``&&Number.isFinite(e)&&h(ek(Math.min(100,Math.max(1,Math.round(_?e*10:e))),t))};return I(`span`,{css:jk,ref:u,children:[I(`button`,{ref:d,type:`button`,className:`star`,"aria-label":`Score, ${f?Nk(e,t):`none`}`,"aria-haspopup":`dialog`,"aria-expanded":o,title:r?i:void 0,disabled:r,onClick:()=>s(e=>!e),children:[L(Wc,{size:18,"aria-hidden":`true`,fill:f?`#facc15`:`none`,color:f?`#facc15`:`rgba(255, 255, 255, 0.45)`}),f?L(Mk,{score:e,scale:t}):void 0]}),o?I(`div`,{className:`menu`,role:`dialog`,"aria-label":`Score`,onKeyDown:g,children:[L(`div`,{className:`grid${t===`POINT_3`?` faces`:``}`,children:QO[t].map((e,n)=>{let r=VO(e,t),i=Ok[n];return L(`button`,{type:`button`,"aria-label":Nk(e,t),"aria-pressed":p===r,onClick:()=>h(ek(e,t)),children:t===`POINT_3`&&i?L(i,{size:16,"aria-hidden":`true`}):t===`POINT_100`?e/10:r},e)})}),t===`POINT_100`||_?I(`label`,{className:`exact`,children:[`Exact`,L(`input`,{type:`number`,name:`score-exact`,min:_?.1:1,max:_?10:100,step:_?.1:1,value:c,onInput:e=>l(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&v()}})]}):void 0,n?I(`span`,{className:`caption`,children:[`Out of `,Ak[t],`, the finest scale every checked list keeps`]}):void 0,f?L(`button`,{type:`button`,onClick:()=>h(null),children:`No score`}):void 0]}):void 0]})},Fk=e=>e>=75?`good`:e>=60?`mixed`:`poor`,Ik={good:Uc,mixed:jc,poor:Tc},Lk={good:`#4ade80`,mixed:`#fb923c`,poor:`#f87171`},Rk=l`
1400
+ `,Nk=({score:e,scale:t,size:n=16})=>{let r=HO(e,t);if(t===`POINT_3`){let e=kk[r-1]??Ac;return L(e,{size:n,"aria-hidden":`true`})}return L(`span`,{className:`value`,children:r})},Pk=(e,t)=>{let n=HO(e,t);return t===`POINT_3`?`${n} out of 3 (${Ak[n-1]})`:`${n} out of ${jk[t]??100}`},Fk=({score:e,scale:t,mixed:n,disabled:r,disabledTitle:i,onPick:a})=>{let[o,s]=V(!1),[c,l]=V(``),u=w(null),d=w(null),f=VO(e),p=f?HO(e,t):void 0,m=()=>{s(!1),d.current?.focus()},h=e=>{a(e),m()};N(()=>{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 g=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),m();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()},_=t===`POINT_10_DECIMAL`,v=()=>{let e=Number(c);c!==``&&Number.isFinite(e)&&h(tk(Math.min(100,Math.max(1,Math.round(_?e*10:e))),t))};return I(`span`,{css:Mk,ref:u,children:[I(`button`,{ref:d,type:`button`,className:`star`,"aria-label":`Score, ${f?Pk(e,t):`none`}`,"aria-haspopup":`dialog`,"aria-expanded":o,title:r?i:void 0,disabled:r,onClick:()=>s(e=>!e),children:[L(Uc,{size:18,"aria-hidden":`true`,fill:f?`#facc15`:`none`,color:f?`#facc15`:`rgba(255, 255, 255, 0.45)`}),f?L(Nk,{score:e,scale:t}):void 0]}),o?I(`div`,{className:`menu`,role:`dialog`,"aria-label":`Score`,onKeyDown:g,children:[L(`div`,{className:`grid${t===`POINT_3`?` faces`:``}`,children:$O[t].map((e,n)=>{let r=HO(e,t),i=kk[n];return L(`button`,{type:`button`,"aria-label":Pk(e,t),"aria-pressed":p===r,onClick:()=>h(tk(e,t)),children:t===`POINT_3`&&i?L(i,{size:16,"aria-hidden":`true`}):t===`POINT_100`?e/10:r},e)})}),t===`POINT_100`||_?I(`label`,{className:`exact`,children:[`Exact`,L(`input`,{type:`number`,name:`score-exact`,min:_?.1:1,max:_?10:100,step:_?.1:1,value:c,onInput:e=>l(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&v()}})]}):void 0,n?I(`span`,{className:`caption`,children:[`Out of `,jk[t],`, the finest scale every checked list keeps`]}):void 0,f?L(`button`,{type:`button`,onClick:()=>h(null),children:`No score`}):void 0]}):void 0]})},Ik=e=>e>=75?`good`:e>=60?`mixed`:`poor`,Lk={good:Hc,mixed:Ac,poor:wc},Rk={good:`#4ade80`,mixed:`#fb923c`,poor:`#f87171`},zk=l`
1430
1401
  display: inline-flex;
1431
1402
  align-items: center;
1432
1403
  gap: 0.6rem;
@@ -1435,7 +1406,7 @@ transition: max-height 0.3s ease-in-out;
1435
1406
  .face {
1436
1407
  display: flex;
1437
1408
  }
1438
- `,zk=({percent:e,size:t=18})=>{let n=Ik[Fk(e)];return I(`span`,{css:Rk,"aria-label":`Rated ${e} percent`,children:[L(`span`,{className:`face`,style:{color:Lk[Fk(e)]},children:L(n,{size:t})}),I(`span`,{className:`value`,children:[e,`%`]})]})};H();var Bk=new Set([`SAVED`,`QUEUED`]),Vk=l`
1409
+ `,Bk=({percent:e,size:t=18})=>{let n=Lk[Ik(e)];return I(`span`,{css:zk,"aria-label":`Rated ${e} percent`,children:[L(`span`,{className:`face`,style:{color:Rk[Ik(e)]},children:L(n,{size:t})}),I(`span`,{className:`value`,children:[e,`%`]})]})};H();var Vk=new Set([`SAVED`,`QUEUED`]),Hk=l`
1439
1410
  display: flex;
1440
1411
  flex-direction: column;
1441
1412
  gap: 1rem;
@@ -1469,7 +1440,7 @@ transition: max-height 0.3s ease-in-out;
1469
1440
  .outcome { display: flex; align-items: center; gap: 1rem; font-size: 1.2rem; color: rgba(255, 255, 255, 0.7); }
1470
1441
  .outcome.problem { color: #f87171; }
1471
1442
  .actions { display: flex; gap: 1rem; }
1472
- `,Hk=({answers:e,page:t,onWrite:n})=>{let[r,i]=V(!1),[a,o]=V(),[s,c]=V(new Set),[l,u]=V({}),[d,f]=V(new Set),p=Ek(e);if(!p.length)return null;let m=e.filter(e=>e.state===`LISTED`||e.state===`NOT_LISTED`),h=t=>e.find(e=>e.tracker.id===t),g=a?Tk(e,a,e.map(e=>e.tracker.id),t):void 0,_=(g?.targets??[]).filter(e=>!e.refusal&&e.entry).filter(e=>s.has(e.tracker)),v=e=>{o(e),c(new Set),u({})},y=(e,t)=>c(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),b=async r=>{if(a&&r.length){f(e=>new Set([...e,...r]));try{let i=await Dk(Tk(e,a,r,t),n);u(e=>({...e,...Object.fromEntries(i.map(e=>[e.tracker,e]))})),c(e=>new Set([...e].filter(e=>!i.some(t=>t.tracker===e&&Bk.has(t.outcome)))))}finally{f(e=>new Set([...e].filter(e=>!r.includes(e))))}}};return I(`div`,{css:Vk,className:`sync`,children:[I(`table`,{className:`differences`,"aria-label":`Where the trackers differ`,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{scope:`col`}),m.map(e=>L(`th`,{scope:`col`,children:e.tracker.name},e.tracker.id))]})}),L(`tbody`,{children:p.map(({field:e,cells:t})=>I(`tr`,{"data-field":e,children:[L(`th`,{scope:`row`,children:ak[e]}),t.map(e=>L(`td`,{"data-tracker":e.tracker,children:e.text??`None`},e.tracker))]},e))})]}),r?I(`div`,{className:`sheet`,role:`group`,"aria-label":`Sync`,children:[I(`div`,{className:`sources`,children:[L(`span`,{className:`heading`,children:`Copy from`}),e.map(e=>{let t=e.tracker.id,n=xk(e);return I(`label`,{"data-source":t,children:[L(`input`,{type:`radio`,name:`sync-source`,value:t,disabled:!!n,checked:a===t,onChange:()=>v(t)}),e.tracker.name,n?L(`span`,{className:`why`,children:n}):void 0]},t)})]}),g?I(`div`,{className:`targets`,children:[L(`span`,{className:`heading`,children:`Copy onto`}),g.targets.map(e=>{let t=e.tracker,n=h(t),r=!e.refusal&&!!e.entry,i=l[t],a=i&&!Bk.has(i.outcome);return I(`div`,{className:`target`,"data-target":t,children:[I(`label`,{children:[L(`input`,{type:`checkbox`,name:`sync-target-${t}`,disabled:!r||d.has(t),checked:r&&s.has(t),onChange:e=>y(t,e.currentTarget.checked)}),n?.tracker.name??t]}),e.refusal?L(`div`,{className:`why`,children:e.refusal}):e.changes.length?L(`ul`,{className:`changes`,children:e.changes.map(e=>I(`li`,{"data-field":e.field,className:e.backwards?`backwards`:void 0,children:[ak[e.field],`: `,e.from??`None`,` → `,e.to,e.note?` (${e.note})`:``,e.backwards?` (goes back)`:``]},e.field))}):L(`div`,{className:`why`,children:`Nothing to change`}),e.held.map(e=>L(`div`,{className:`held`,children:e.reason},e.field)),s.has(t)&&r&&n?.tracker.writeNotice?L(`div`,{className:`notice`,children:n.tracker.writeNotice}):void 0,i?I(`div`,{className:`outcome${a?` problem`:``}`,"data-outcome":t,children:[L(`span`,{children:a?i.error??i.outcome.toLowerCase():i.outcome===`QUEUED`?`Saved, sent later`:`Saved`}),a&&r?L(`button`,{type:`button`,disabled:d.has(t),onClick:()=>void b([t]),children:`Retry`}):void 0]}):void 0]},t)})]}):L(`div`,{className:`why`,children:`Pick the tracker to copy from.`}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,className:`primary`,disabled:!_.length||d.size>0,onClick:()=>void b(_.map(e=>e.tracker)),children:`Apply`}),L(`button`,{type:`button`,onClick:()=>{i(!1),o(void 0),c(new Set),u({})},children:`Close`})]})]}):L(`div`,{className:`actions`,children:L(`button`,{type:`button`,onClick:()=>i(!0),children:`Sync`})})]})};H();var Uk=new Set([`LISTED`,`NOT_LISTED`]),Wk=e=>e.tracker.canWrite&&Uk.has(e.state),Gk=l`
1443
+ `,Uk=({answers:e,page:t,onWrite:n})=>{let[r,i]=V(!1),[a,o]=V(),[s,c]=V(new Set),[l,u]=V({}),[d,f]=V(new Set),p=Dk(e);if(!p.length)return null;let m=e.filter(e=>e.state===`LISTED`||e.state===`NOT_LISTED`),h=t=>e.find(e=>e.tracker.id===t),g=a?Ek(e,a,e.map(e=>e.tracker.id),t):void 0,_=(g?.targets??[]).filter(e=>!e.refusal&&e.entry).filter(e=>s.has(e.tracker)),v=e=>{o(e),c(new Set),u({})},y=(e,t)=>c(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),b=async r=>{if(a&&r.length){f(e=>new Set([...e,...r]));try{let i=await Ok(Ek(e,a,r,t),n);u(e=>({...e,...Object.fromEntries(i.map(e=>[e.tracker,e]))})),c(e=>new Set([...e].filter(e=>!i.some(t=>t.tracker===e&&Vk.has(t.outcome)))))}finally{f(e=>new Set([...e].filter(e=>!r.includes(e))))}}};return I(`div`,{css:Hk,className:`sync`,children:[I(`table`,{className:`differences`,"aria-label":`Where the trackers differ`,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{scope:`col`}),m.map(e=>L(`th`,{scope:`col`,children:e.tracker.name},e.tracker.id))]})}),L(`tbody`,{children:p.map(({field:e,cells:t})=>I(`tr`,{"data-field":e,children:[L(`th`,{scope:`row`,children:ok[e]}),t.map(e=>L(`td`,{"data-tracker":e.tracker,children:e.text??`None`},e.tracker))]},e))})]}),r?I(`div`,{className:`sheet`,role:`group`,"aria-label":`Sync`,children:[I(`div`,{className:`sources`,children:[L(`span`,{className:`heading`,children:`Copy from`}),e.map(e=>{let t=e.tracker.id,n=Sk(e);return I(`label`,{"data-source":t,children:[L(`input`,{type:`radio`,name:`sync-source`,value:t,disabled:!!n,checked:a===t,onChange:()=>v(t)}),e.tracker.name,n?L(`span`,{className:`why`,children:n}):void 0]},t)})]}),g?I(`div`,{className:`targets`,children:[L(`span`,{className:`heading`,children:`Copy onto`}),g.targets.map(e=>{let t=e.tracker,n=h(t),r=!e.refusal&&!!e.entry,i=l[t],a=i&&!Vk.has(i.outcome);return I(`div`,{className:`target`,"data-target":t,children:[I(`label`,{children:[L(`input`,{type:`checkbox`,name:`sync-target-${t}`,disabled:!r||d.has(t),checked:r&&s.has(t),onChange:e=>y(t,e.currentTarget.checked)}),n?.tracker.name??t]}),e.refusal?L(`div`,{className:`why`,children:e.refusal}):e.changes.length?L(`ul`,{className:`changes`,children:e.changes.map(e=>I(`li`,{"data-field":e.field,className:e.backwards?`backwards`:void 0,children:[ok[e.field],`: `,e.from??`None`,` → `,e.to,e.note?` (${e.note})`:``,e.backwards?` (goes back)`:``]},e.field))}):L(`div`,{className:`why`,children:`Nothing to change`}),e.held.map(e=>L(`div`,{className:`held`,children:e.reason},e.field)),s.has(t)&&r&&n?.tracker.writeNotice?L(`div`,{className:`notice`,children:n.tracker.writeNotice}):void 0,i?I(`div`,{className:`outcome${a?` problem`:``}`,"data-outcome":t,children:[L(`span`,{children:a?i.error??i.outcome.toLowerCase():i.outcome===`QUEUED`?`Saved, sent later`:`Saved`}),a&&r?L(`button`,{type:`button`,disabled:d.has(t),onClick:()=>void b([t]),children:`Retry`}):void 0]}):void 0]},t)})]}):L(`div`,{className:`why`,children:`Pick the tracker to copy from.`}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,className:`primary`,disabled:!_.length||d.size>0,onClick:()=>void b(_.map(e=>e.tracker)),children:`Apply`}),L(`button`,{type:`button`,onClick:()=>{i(!1),o(void 0),c(new Set),u({})},children:`Close`})]})]}):L(`div`,{className:`actions`,children:L(`button`,{type:`button`,onClick:()=>i(!0),children:`Sync`})})]})};H();var Wk=new Set([`LISTED`,`NOT_LISTED`]),Gk=e=>e.tracker.canWrite&&Wk.has(e.state),Kk=l`
1473
1444
  margin-top: 2rem;
1474
1445
  display: flex;
1475
1446
  flex-direction: column;
@@ -1577,7 +1548,7 @@ transition: max-height 0.3s ease-in-out;
1577
1548
  .outcome { font-size: 1.2rem; color: rgba(255, 255, 255, 0.7); }
1578
1549
  .outcome.problem { color: #f87171; }
1579
1550
  }
1580
- `,Kk=(e,t)=>{let n=e.episodeCount??t;return e.progress==null?void 0:n?`${e.progress} / ${n}`:`${e.progress} episodes`},qk=(e,t)=>e.score==null?void 0:e.scoreLabel&&t&&t!==`POINT_100`?e.scoreLabel:`${e.score}%`,Jk=(e,t)=>{switch(e.state){case`LISTED`:{let n=e.entry;return{text:[n.status?ok[n.status]??n.status:void 0,Kk(n,t),qk(n,e.tracker.scoreScale)].filter(Boolean).join(` · `)||`Listed`}}case`NOT_LISTED`:return{text:`Not listed`};case`NO_ID`:return{text:`Has no id for this media`,problem:!0};case`AMBIGUOUS`:return{text:`Names ${e.candidates.join(` and `)}, cannot tell which`,problem:!0};case`SIGNED_OUT`:return{text:`Signed out`,problem:!0};case`PAUSED`:return{text:e.error||`Paused for a while`,problem:!0};default:return{text:e.error||`Could not answer`,problem:!0}}},Yk=({answers:e,edited:t,episodeCount:n,onSave:r,onDelete:i,onClose:a})=>{let[o,s]=V(t.entry?.status??`WATCHING`),[c,l]=V(t.entry?.progress??0),[u,d]=V(t.entry?.score??null),[f,p]=V(()=>new Set([t.tracker.id])),[m,h]=V(!1),[g,_]=V([]),v=t.entry?.episodeCount??n??void 0,y=async e=>{h(!0);try{let t=await e();_(t),t.length&&t.every(e=>e.outcome===`SAVED`||e.outcome===`QUEUED`)&&a()}catch(e){_([{tracker:``,outcome:`FAILED`,error:e instanceof Error?e.message:String(e)}])}finally{h(!1)}},b=(e,t)=>p(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),x=t=>e.find(e=>e.tracker.id===t)?.tracker.name??t,S=e.filter(e=>f.has(e.tracker.id)&&e.tracker.writeNotice);return I(`div`,{className:`editor`,role:`group`,"aria-label":`Edit on ${t.tracker.name}`,children:[I(`div`,{className:`fields`,children:[I(`label`,{children:[`Status`,L(`select`,{value:o,onChange:e=>s(e.currentTarget.value),children:Object.entries(ok).map(([e,t])=>L(`option`,{value:e,children:t},e))})]}),I(`label`,{children:[`Progress`,I(`span`,{className:`stepper`,children:[L(`button`,{type:`button`,"aria-label":`One episode less`,disabled:c<=0,onClick:()=>l(e=>Math.max(0,e-1)),children:L(Nc,{size:14})}),L(`input`,{type:`number`,name:`progress`,min:0,max:v,value:c,onInput:e=>l(Math.max(0,Math.floor(Number(e.currentTarget.value)||0)))}),L(`button`,{type:`button`,"aria-label":`One episode more`,disabled:v!=null&&c>=v,onClick:()=>l(e=>e+1),children:L(Lc,{size:14})}),v?I(`span`,{children:[`/ `,v]}):void 0]})]}),I(`label`,{children:[`Score`,L(`input`,{type:`number`,name:`score`,min:0,max:100,placeholder:`None`,value:u??``,onInput:e=>{let t=e.currentTarget.value;d(t===``?null:Math.min(100,Math.max(0,Math.round(Number(t)||0))))}})]})]}),I(`div`,{className:`targets`,children:[L(`span`,{children:`Save to`}),e.filter(Wk).map(e=>I(`label`,{children:[L(`input`,{type:`checkbox`,name:`target-${e.tracker.id}`,checked:f.has(e.tracker.id),onChange:t=>b(e.tracker.id,t.currentTarget.checked)}),e.tracker.name]},e.tracker.id))]}),S.map(e=>L(`div`,{className:`notice`,children:e.tracker.writeNotice},e.tracker.id)),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,className:`primary`,disabled:m||!f.size,onClick:()=>void y(()=>r([...f],{status:o,progress:c,score:u})),children:`Save`}),t.state===`LISTED`?L(`button`,{type:`button`,disabled:m||!f.size,onClick:()=>void y(()=>i([...f])),children:`Remove`}):void 0,L(`button`,{type:`button`,onClick:a,children:`Cancel`})]}),g.filter(e=>e.outcome!==`SAVED`).map(e=>I(`div`,{className:`outcome problem`,children:[e.tracker?`${x(e.tracker)}: `:``,e.error??e.outcome.toLowerCase()]},e.tracker))]})},Xk={blocked:()=>`The browser blocked the sign-in window. Allow pop-ups for this page and press Sign in again.`,unsupported:e=>`Sign in to ${e} in this browser, then press Sign in again.`},Zk=({tracking:e,episodeCount:t,onSave:n,onDelete:r,onSyncWrite:i,signIns:a={}})=>{let[o,s]=V(),[c,l]=V(new Set),[u,d]=V({});if(!e?.answers.length)return null;let f=e=>{let t=a[e.tracker.id];if(!t||c.has(e.tracker.id))return;let n=t(),r=e.tracker.id;l(e=>new Set(e).add(r)),d(({[r]:e,...t})=>t),n.then(t=>Xk[t]?.(e.tracker.name),e=>e instanceof Error?e.message:String(e)).then(e=>{e&&d(t=>({...t,[r]:e})),l(e=>{let t=new Set(e);return t.delete(r),t})})},{summary:p}=e,m=e.answers.find(e=>e.tracker.id===o);return I(`section`,{css:Gk,className:`tracking`,"aria-label":`Tracking`,children:[I(`div`,{className:`summary`,children:[L(`span`,{className:`label`,children:`Tracking`}),p?I(B,{children:[p.status?L(`span`,{className:`value`,children:ok[p.status]??p.status}):void 0,Kk(p,t)?L(`span`,{className:`progress`,children:Kk(p,t)}):void 0,p.score==null?void 0:L(zk,{percent:p.score,size:16}),e.disagreements.length?L(`span`,{className:`muted`,children:`Trackers differ`}):void 0]}):L(`span`,{className:`muted`,children:`Not on any list`})]}),L(`div`,{className:`rows`,children:e.answers.flatMap(e=>{let{text:n,problem:r}=Jk(e,t),i=e.tracker.id,o=e.state===`SIGNED_OUT`,l=o?u[i]:void 0,d=I(`div`,{className:`row`,"data-tracker":i,children:[L(`span`,{className:`icon`,style:e.tracker.color?{color:e.tracker.color}:void 0,children:e.tracker.icon?L(`img`,{src:e.tracker.icon,alt:``}):e.tracker.name.slice(0,1)}),L(`span`,{className:`name`,children:e.tracker.name}),e.tracker.account?L(`span`,{className:`account`,children:e.tracker.account}):void 0,L(`span`,{className:`state${r?` problem`:``}`,children:n}),Wk(e)?L(`button`,{type:`button`,onClick:()=>s(i),children:`Edit`}):void 0,o&&a[i]?L(`button`,{type:`button`,disabled:c.has(i),onClick:()=>f(e),children:c.has(i)?`Signing in`:`Sign in`}):void 0]},i);return l?[d,L(`div`,{className:`row-note`,"data-note":i,children:l},`${i}-note`)]:[d]})}),Ek(e.answers).length?L(Hk,{answers:e.answers,page:{episodeCount:t},onWrite:i}):void 0,m&&Wk(m)?L(Yk,{answers:e.answers,edited:m,episodeCount:t,onSave:n,onDelete:r,onClose:()=>s(void 0)},m.tracker.id):void 0]})};H();var Qk=l`
1551
+ `,qk=(e,t)=>{let n=e.episodeCount??t;return e.progress==null?void 0:n?`${e.progress} / ${n}`:`${e.progress} episodes`},Jk=(e,t)=>e.score==null?void 0:e.scoreLabel&&t&&t!==`POINT_100`?e.scoreLabel:`${e.score}%`,Yk=(e,t)=>{switch(e.state){case`LISTED`:{let n=e.entry;return{text:[n.status?sk[n.status]??n.status:void 0,qk(n,t),Jk(n,e.tracker.scoreScale)].filter(Boolean).join(` · `)||`Listed`}}case`NOT_LISTED`:return{text:`Not listed`};case`NO_ID`:return{text:`Has no id for this media`,problem:!0};case`AMBIGUOUS`:return{text:`Names ${e.candidates.join(` and `)}, cannot tell which`,problem:!0};case`SIGNED_OUT`:return{text:`Signed out`,problem:!0};case`PAUSED`:return{text:e.error||`Paused for a while`,problem:!0};default:return{text:e.error||`Could not answer`,problem:!0}}},Xk=({answers:e,edited:t,episodeCount:n,onSave:r,onDelete:i,onClose:a})=>{let[o,s]=V(t.entry?.status??`WATCHING`),[c,l]=V(t.entry?.progress??0),[u,d]=V(t.entry?.score??null),[f,p]=V(()=>new Set([t.tracker.id])),[m,h]=V(!1),[g,_]=V([]),v=t.entry?.episodeCount??n??void 0,y=async e=>{h(!0);try{let t=await e();_(t),t.length&&t.every(e=>e.outcome===`SAVED`||e.outcome===`QUEUED`)&&a()}catch(e){_([{tracker:``,outcome:`FAILED`,error:e instanceof Error?e.message:String(e)}])}finally{h(!1)}},b=(e,t)=>p(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),x=t=>e.find(e=>e.tracker.id===t)?.tracker.name??t,S=e.filter(e=>f.has(e.tracker.id)&&e.tracker.writeNotice);return I(`div`,{className:`editor`,role:`group`,"aria-label":`Edit on ${t.tracker.name}`,children:[I(`div`,{className:`fields`,children:[I(`label`,{children:[`Status`,L(`select`,{value:o,onChange:e=>s(e.currentTarget.value),children:Object.entries(sk).map(([e,t])=>L(`option`,{value:e,children:t},e))})]}),I(`label`,{children:[`Progress`,I(`span`,{className:`stepper`,children:[L(`button`,{type:`button`,"aria-label":`One episode less`,disabled:c<=0,onClick:()=>l(e=>Math.max(0,e-1)),children:L(Mc,{size:14})}),L(`input`,{type:`number`,name:`progress`,min:0,max:v,value:c,onInput:e=>l(Math.max(0,Math.floor(Number(e.currentTarget.value)||0)))}),L(`button`,{type:`button`,"aria-label":`One episode more`,disabled:v!=null&&c>=v,onClick:()=>l(e=>e+1),children:L(Ic,{size:14})}),v?I(`span`,{children:[`/ `,v]}):void 0]})]}),I(`label`,{children:[`Score`,L(`input`,{type:`number`,name:`score`,min:0,max:100,placeholder:`None`,value:u??``,onInput:e=>{let t=e.currentTarget.value;d(t===``?null:Math.min(100,Math.max(0,Math.round(Number(t)||0))))}})]})]}),I(`div`,{className:`targets`,children:[L(`span`,{children:`Save to`}),e.filter(Gk).map(e=>I(`label`,{children:[L(`input`,{type:`checkbox`,name:`target-${e.tracker.id}`,checked:f.has(e.tracker.id),onChange:t=>b(e.tracker.id,t.currentTarget.checked)}),e.tracker.name]},e.tracker.id))]}),S.map(e=>L(`div`,{className:`notice`,children:e.tracker.writeNotice},e.tracker.id)),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,className:`primary`,disabled:m||!f.size,onClick:()=>void y(()=>r([...f],{status:o,progress:c,score:u})),children:`Save`}),t.state===`LISTED`?L(`button`,{type:`button`,disabled:m||!f.size,onClick:()=>void y(()=>i([...f])),children:`Remove`}):void 0,L(`button`,{type:`button`,onClick:a,children:`Cancel`})]}),g.filter(e=>e.outcome!==`SAVED`).map(e=>I(`div`,{className:`outcome problem`,children:[e.tracker?`${x(e.tracker)}: `:``,e.error??e.outcome.toLowerCase()]},e.tracker))]})},Zk={blocked:()=>`The browser blocked the sign-in window. Allow pop-ups for this page and press Sign in again.`,unsupported:e=>`Sign in to ${e} in this browser, then press Sign in again.`},Qk=({tracking:e,episodeCount:t,onSave:n,onDelete:r,onSyncWrite:i,signIns:a={}})=>{let[o,s]=V(),[c,l]=V(new Set),[u,d]=V({});if(!e?.answers.length)return null;let f=e=>{let t=a[e.tracker.id];if(!t||c.has(e.tracker.id))return;let n=t(),r=e.tracker.id;l(e=>new Set(e).add(r)),d(({[r]:e,...t})=>t),n.then(t=>Zk[t]?.(e.tracker.name),e=>e instanceof Error?e.message:String(e)).then(e=>{e&&d(t=>({...t,[r]:e})),l(e=>{let t=new Set(e);return t.delete(r),t})})},{summary:p}=e,m=e.answers.find(e=>e.tracker.id===o);return I(`section`,{css:Kk,className:`tracking`,"aria-label":`Tracking`,children:[I(`div`,{className:`summary`,children:[L(`span`,{className:`label`,children:`Tracking`}),p?I(B,{children:[p.status?L(`span`,{className:`value`,children:sk[p.status]??p.status}):void 0,qk(p,t)?L(`span`,{className:`progress`,children:qk(p,t)}):void 0,p.score==null?void 0:L(Bk,{percent:p.score,size:16}),e.disagreements.length?L(`span`,{className:`muted`,children:`Trackers differ`}):void 0]}):L(`span`,{className:`muted`,children:`Not on any list`})]}),L(`div`,{className:`rows`,children:e.answers.flatMap(e=>{let{text:n,problem:r}=Yk(e,t),i=e.tracker.id,o=e.state===`SIGNED_OUT`,l=o?u[i]:void 0,d=I(`div`,{className:`row`,"data-tracker":i,children:[L(`span`,{className:`icon`,style:e.tracker.color?{color:e.tracker.color}:void 0,children:e.tracker.icon?L(`img`,{src:e.tracker.icon,alt:``}):e.tracker.name.slice(0,1)}),L(`span`,{className:`name`,children:e.tracker.name}),e.tracker.account?L(`span`,{className:`account`,children:e.tracker.account}):void 0,L(`span`,{className:`state${r?` problem`:``}`,children:n}),Gk(e)?L(`button`,{type:`button`,onClick:()=>s(i),children:`Edit`}):void 0,o&&a[i]?L(`button`,{type:`button`,disabled:c.has(i),onClick:()=>f(e),children:c.has(i)?`Signing in`:`Sign in`}):void 0]},i);return l?[d,L(`div`,{className:`row-note`,"data-note":i,children:l},`${i}-note`)]:[d]})}),Dk(e.answers).length?L(Uk,{answers:e.answers,page:{episodeCount:t},onWrite:i}):void 0,m&&Gk(m)?L(Xk,{answers:e.answers,edited:m,episodeCount:t,onSave:n,onDelete:r,onClose:()=>s(void 0)},m.tracker.id):void 0]})};H();var $k=l`
1581
1552
  margin-top: 2rem;
1582
1553
  display: flex;
1583
1554
  flex-direction: column;
@@ -1692,7 +1663,7 @@ transition: max-height 0.3s ease-in-out;
1692
1663
  .chip { gap: 0.4rem; padding: 0 0.4rem; }
1693
1664
  .chip .login-button { padding: 0 0.6rem; }
1694
1665
  }
1695
- `,$k={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10},eA=(e,t)=>{let n=t??`POINT_100`;return`${VO(e,n)} / ${$k[n]??100}`},tA=(e,t)=>{switch(e.state){case`LISTED`:{let n=e.entry,r=n.episodeCount??t;return[n.status?ok[n.status]??n.status:void 0,n.progress==null?void 0:r?`${n.progress} / ${r}`:`${n.progress} episodes`,BO(n.score)?eA(n.score,e.tracker.scoreScale):void 0].filter(Boolean).join(`, `)||`Listed`}case`NOT_LISTED`:return`Not listed`;case`PAUSED`:return e.error||`Paused for a while`;default:return e.error||`Could not answer`}},nA=e=>[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 `),rA=({answer:e})=>L(`span`,{className:`logo`,style:e.tracker.color?{color:e.tracker.color}:void 0,children:e.tracker.icon?L(`img`,{src:e.tracker.icon,alt:``}):e.tracker.name.slice(0,1)}),iA=({tracking:e,episodeCount:t,onSaveFields:n,signIns:r={},prefs:i,onPrefs:a})=>{let[,o]=V(0),[s,c]=V({}),[l,u]=V(),[d,f]=V(``),[p,m]=V(new Set),[h,g]=V({}),_=w(void 0),v=w(()=>{}),y=w({onSaveFields:n,tracking:e});y.current={onSaveFields:n,tracking:e};let b=D(()=>tk({send:async(e,t)=>{let n=await y.current.onSaveFields([e],t);return n.find(t=>t.tracker===e)??n[0]??{outcome:`FAILED`,error:`The write did not reach the trackers`}},onChange:e=>{if(o(e=>e+1),!e)return;let t=y.current.tracking?.answers.find(t=>t.tracker.id===e.tracker)?.tracker.name??e.tracker,n=e.outcome===`SAVED`||e.outcome===`QUEUED`;f(n?`Saved to ${t}`:`${t} did not save: ${e.error??e.outcome.toLowerCase()}`),!n&&b.idle()&&c({})}}),[]);N(()=>{let e=()=>{document.visibilityState===`hidden`&&b.flush()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),b.flush()}},[]);let x=JO(e,t);if(N(()=>{c(e=>{if(b.idle())return{};let t={...e};return t.status===x.status&&delete t.status,t.progress===x.progress&&delete t.progress,t.score!==void 0&&(t.score??null)===x.score&&delete t.score,t})},[e]),!e?.answers.length)return null;let S={...x,...s.status===void 0?{}:{status:s.status},...s.progress===void 0?{}:{progress:s.progress},...s.score===void 0?{}:{score:s.score}},C=e.answers,T=C.map(e=>({answer:e,target:YO(e,i.targets[e.tracker.id])})),E=T.filter(({target:e})=>e.kind===`check`&&e.sendable).map(({answer:e})=>e),O=!E.length,k=$O(E.map(e=>e.tracker.scoreScale)),A=C.some(e=>e.state===`LISTED`),j=S.total,M=(e,t)=>{c(t=>({...t,...e}));let n={...S,...e},r={};for(let{answer:t,target:i}of T){if(i.kind!==`check`||!i.checked)continue;let a=t.tracker.id;if(!qO(t)){b.fail(a,e,t.error||(t.state===`PAUSED`?`Paused for a while`:`Could not answer`));continue}let o=ZO(t,e,n);o&&(r[a]=o)}b.stage(r,t)},P=(e,t)=>{t||b.drop(e),a({...i,targets:{...i.targets,[e]:t}})},F=e=>{let t=r[e.tracker.id],n=e.tracker.id;if(!t||p.has(n))return;let i=t();m(e=>new Set(e).add(n)),g(({[n]:e,...t})=>t),i.then(t=>Xk[t]?.(e.tracker.name),e=>e instanceof Error?e.message:String(e)).then(e=>{e&&g(t=>({...t,[n]:e})),m(e=>{let t=new Set(e);return t.delete(n),t})})},ee=()=>{if(clearTimeout(_.current),l===void 0)return;let e=Number(l);if(u(void 0),l.trim()===``||!Number.isFinite(e))return;let t=Math.max(0,Math.min(j??1/0,Math.floor(e)));t!==S.progress&&M({progress:t},!0)};v.current=ee;let te=e=>`${C.filter(e=>e.state===`LISTED`).map(t=>`${t.tracker.name} ${e(t)??`none`}`).join(`, `)} (Advanced can sync them)`,R=(e,t)=>x.differs.includes(e)?L(`span`,{className:`differs`,"data-differs":e,title:te(t)}):void 0;return I(`section`,{css:Qk,className:`tracking-compact`,"aria-label":`Quick tracking`,children:[I(`div`,{className:`row`,children:[I(`div`,{className:`group edit`,children:[L(Pk,{score:S.score,scale:k?.scale??`POINT_100`,mixed:k?.mixed??!1,disabled:O||!A&&!S.status&&!S.progress,disabledTitle:O?`Check a list to save to`:`Pick a status or add an episode first`,onPick:e=>M({score:e},!0)}),R(`SCORE`,e=>BO(e.entry?.score)?eA(e.entry.score,e.tracker.scoreScale):void 0),I(`select`,{name:`compact-status`,"aria-label":`Status`,value:S.status??``,disabled:O,onChange:e=>M({status:e.currentTarget.value},!0),children:[S.status?void 0:L(`option`,{value:``,disabled:!0,children:`Add to list`}),Object.entries(ok).map(([e,t])=>L(`option`,{value:e,children:t},e))]}),R(`STATUS`,e=>e.entry?.status?ok[e.entry.status]:void 0),I(`span`,{className:`progress-field`,children:[L(`label`,{for:`compact-progress`,className:`word`,children:`Episodes`}),L(`input`,{id:`compact-progress`,type:`number`,inputMode:`numeric`,name:`compact-progress`,min:0,max:j??void 0,disabled:O,value:l??S.progress,onInput:e=>{u(e.currentTarget.value),clearTimeout(_.current),_.current=setTimeout(()=>v.current(),1e3)},onBlur:ee,onKeyDown:e=>{e.key===`Enter`&&ee(),e.key===`Escape`&&(clearTimeout(_.current),u(void 0),e.stopPropagation())}}),j?I(`span`,{className:`of`,children:[`/ `,j]}):void 0,R(`PROGRESS`,e=>e.entry?.progress==null?void 0:String(e.entry.progress)),L(`button`,{type:`button`,className:`more`,"aria-label":`One episode more`,disabled:O||j!=null&&S.progress>=j,onClick:()=>M({progress:S.progress+1},!1),children:L(Lc,{size:14,"aria-hidden":`true`})})]}),!O&&j&&S.progress===j&&S.status!==`COMPLETED`?L(`button`,{type:`button`,onClick:()=>M({status:`COMPLETED`},!0),children:`Mark completed`}):void 0,!O&&j&&S.status===`COMPLETED`&&S.progress<j?I(`button`,{type:`button`,onClick:()=>M({progress:j},!0),children:[`Set `,j,` / `,j]}):void 0]}),I(`div`,{className:`group platforms`,children:[T.map(({answer:e,target:t})=>{let n=e.tracker.id,i=e.tracker.name;if(t.kind===`login`)return I(`span`,{className:`chip login`,"data-chip":n,title:`${i}: Signed out`,children:[L(rA,{answer:e}),L(`button`,{type:`button`,className:`login-button`,"aria-label":`Log in to ${i}`,disabled:!r[n]||p.has(n),onClick:()=>F(e),children:p.has(n)?`Logging in`:`Log in`})]},n);if(t.kind===`cannot`){let r=`${i} cannot track this media: ${t.reason}`;return I(`span`,{className:`chip cannot`,"data-chip":n,role:`img`,"aria-label":r,title:r,children:[L(rA,{answer:e}),L(`span`,{className:`slot`,children:L(Nc,{size:14,"aria-hidden":`true`})})]},n)}let{busy:a,failed:o}=b.state(n),s=e.state===`PAUSED`||e.state===`ERROR`?tA(e,j):void 0,c=[`${i}${e.tracker.account?`, ${e.tracker.account}`:``}: ${tA(e,j)}`,XO(e,j)?`${i} counts ${e.entry.episodeCount} episodes, so progress is saved there from Advanced`:void 0].filter(Boolean).join(`. `);return I(`label`,{className:`chip${t.checked?``:` off`}`,"data-chip":n,title:c,"aria-busy":a?`true`:void 0,children:[L(`input`,{type:`checkbox`,className:`hidden`,name:`compact-target-${n}`,"aria-label":`Save to ${i}`,"aria-describedby":s?`compact-hint-${n}`:void 0,checked:t.checked,onChange:e=>P(n,e.currentTarget.checked)}),L(rA,{answer:e}),o||e.state===`ERROR`?L(`span`,{className:`badge red`,"data-badge":`red`}):e.state===`PAUSED`?L(`span`,{className:`badge amber`,"data-badge":`amber`}):void 0,L(`span`,{className:`slot`,children:a?L(kc,{size:14,className:`spin`,"aria-hidden":`true`}):t.checked?L(`span`,{className:`check`,children:L(yc,{size:11,"aria-hidden":`true`})}):L(`span`,{className:`ring`})}),s?L(`span`,{id:`compact-hint-${n}`,className:`hidden`,children:s}):void 0]},n)}),I(`button`,{type:`button`,className:`advanced`,"aria-label":`Advanced tracking`,"aria-expanded":i.advanced,"aria-controls":`tracking-advanced`,onClick:()=>a({...i,advanced:!i.advanced}),children:[L(Hc,{size:16,"aria-hidden":`true`}),L(`span`,{className:`word`,children:`Advanced`})]})]})]}),L(`div`,{className:`notes`,children:T.flatMap(({answer:e})=>{let t=e.tracker.id,n=e.tracker.name,{failed:r,refused:i}=b.state(t);return[h[t]&&e.state===`SIGNED_OUT`?L(`div`,{className:`note`,"data-note":t,children:h[t]},`${t}-sign-in`):void 0,r?I(`div`,{className:`note problem`,"data-note":t,children:[n,` did not save `,nA(r.fields),`: `,r.error,L(`button`,{type:`button`,disabled:!qO(e),onClick:()=>b.retry(t),children:`Retry`})]},`${t}-failed`):void 0,i?I(`div`,{className:`note problem`,"data-note":t,children:[n,` did not save: `,i,L(`button`,{type:`button`,onClick:()=>b.dismiss(t),children:`Dismiss`})]},`${t}-refused`):void 0].filter(Boolean)})}),L(`div`,{className:`hidden`,role:`status`,children:d})]})};H();var aA=_p(`
1666
+ `,eA={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10},tA=(e,t)=>{let n=t??`POINT_100`;return`${HO(e,n)} / ${eA[n]??100}`},nA=(e,t)=>{switch(e.state){case`LISTED`:{let n=e.entry,r=n.episodeCount??t;return[n.status?sk[n.status]??n.status:void 0,n.progress==null?void 0:r?`${n.progress} / ${r}`:`${n.progress} episodes`,VO(n.score)?tA(n.score,e.tracker.scoreScale):void 0].filter(Boolean).join(`, `)||`Listed`}case`NOT_LISTED`:return`Not listed`;case`PAUSED`:return e.error||`Paused for a while`;default:return e.error||`Could not answer`}},rA=e=>[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 `),iA=({answer:e})=>L(`span`,{className:`logo`,style:e.tracker.color?{color:e.tracker.color}:void 0,children:e.tracker.icon?L(`img`,{src:e.tracker.icon,alt:``}):e.tracker.name.slice(0,1)}),aA=({tracking:e,episodeCount:t,onSaveFields:n,signIns:r={},prefs:i,onPrefs:a})=>{let[,o]=V(0),[s,c]=V({}),[l,u]=V(),[d,f]=V(``),[p,m]=V(new Set),[h,g]=V({}),_=w(void 0),v=w(()=>{}),y=w({onSaveFields:n,tracking:e});y.current={onSaveFields:n,tracking:e};let b=D(()=>nk({send:async(e,t)=>{let n=await y.current.onSaveFields([e],t);return n.find(t=>t.tracker===e)??n[0]??{outcome:`FAILED`,error:`The write did not reach the trackers`}},onChange:e=>{if(o(e=>e+1),!e)return;let t=y.current.tracking?.answers.find(t=>t.tracker.id===e.tracker)?.tracker.name??e.tracker,n=e.outcome===`SAVED`||e.outcome===`QUEUED`;f(n?`Saved to ${t}`:`${t} did not save: ${e.error??e.outcome.toLowerCase()}`),!n&&b.idle()&&c({})}}),[]);N(()=>{let e=()=>{document.visibilityState===`hidden`&&b.flush()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),b.flush()}},[]);let x=YO(e,t);if(N(()=>{c(e=>{if(b.idle())return{};let t={...e};return t.status===x.status&&delete t.status,t.progress===x.progress&&delete t.progress,t.score!==void 0&&(t.score??null)===x.score&&delete t.score,t})},[e]),!e?.answers.length)return null;let S={...x,...s.status===void 0?{}:{status:s.status},...s.progress===void 0?{}:{progress:s.progress},...s.score===void 0?{}:{score:s.score}},C=e.answers,T=C.map(e=>({answer:e,target:XO(e,i.targets[e.tracker.id])})),E=T.filter(({target:e})=>e.kind===`check`&&e.sendable).map(({answer:e})=>e),O=!E.length,k=ek(E.map(e=>e.tracker.scoreScale)),A=C.some(e=>e.state===`LISTED`),j=S.total,M=(e,t)=>{c(t=>({...t,...e}));let n={...S,...e},r={};for(let{answer:t,target:i}of T){if(i.kind!==`check`||!i.checked)continue;let a=t.tracker.id;if(!JO(t)){b.fail(a,e,t.error||(t.state===`PAUSED`?`Paused for a while`:`Could not answer`));continue}let o=QO(t,e,n);o&&(r[a]=o)}b.stage(r,t)},P=(e,t)=>{t||b.drop(e),a({...i,targets:{...i.targets,[e]:t}})},F=e=>{let t=r[e.tracker.id],n=e.tracker.id;if(!t||p.has(n))return;let i=t();m(e=>new Set(e).add(n)),g(({[n]:e,...t})=>t),i.then(t=>Zk[t]?.(e.tracker.name),e=>e instanceof Error?e.message:String(e)).then(e=>{e&&g(t=>({...t,[n]:e})),m(e=>{let t=new Set(e);return t.delete(n),t})})},ee=()=>{if(clearTimeout(_.current),l===void 0)return;let e=Number(l);if(u(void 0),l.trim()===``||!Number.isFinite(e))return;let t=Math.max(0,Math.min(j??1/0,Math.floor(e)));t!==S.progress&&M({progress:t},!0)};v.current=ee;let te=e=>`${C.filter(e=>e.state===`LISTED`).map(t=>`${t.tracker.name} ${e(t)??`none`}`).join(`, `)} (Advanced can sync them)`,R=(e,t)=>x.differs.includes(e)?L(`span`,{className:`differs`,"data-differs":e,title:te(t)}):void 0;return I(`section`,{css:$k,className:`tracking-compact`,"aria-label":`Quick tracking`,children:[I(`div`,{className:`row`,children:[I(`div`,{className:`group edit`,children:[L(Fk,{score:S.score,scale:k?.scale??`POINT_100`,mixed:k?.mixed??!1,disabled:O||!A&&!S.status&&!S.progress,disabledTitle:O?`Check a list to save to`:`Pick a status or add an episode first`,onPick:e=>M({score:e},!0)}),R(`SCORE`,e=>VO(e.entry?.score)?tA(e.entry.score,e.tracker.scoreScale):void 0),I(`select`,{name:`compact-status`,"aria-label":`Status`,value:S.status??``,disabled:O,onChange:e=>M({status:e.currentTarget.value},!0),children:[S.status?void 0:L(`option`,{value:``,disabled:!0,children:`Add to list`}),Object.entries(sk).map(([e,t])=>L(`option`,{value:e,children:t},e))]}),R(`STATUS`,e=>e.entry?.status?sk[e.entry.status]:void 0),I(`span`,{className:`progress-field`,children:[L(`label`,{for:`compact-progress`,className:`word`,children:`Episodes`}),L(`input`,{id:`compact-progress`,type:`number`,inputMode:`numeric`,name:`compact-progress`,min:0,max:j??void 0,disabled:O,value:l??S.progress,onInput:e=>{u(e.currentTarget.value),clearTimeout(_.current),_.current=setTimeout(()=>v.current(),1e3)},onBlur:ee,onKeyDown:e=>{e.key===`Enter`&&ee(),e.key===`Escape`&&(clearTimeout(_.current),u(void 0),e.stopPropagation())}}),j?I(`span`,{className:`of`,children:[`/ `,j]}):void 0,R(`PROGRESS`,e=>e.entry?.progress==null?void 0:String(e.entry.progress)),L(`button`,{type:`button`,className:`more`,"aria-label":`One episode more`,disabled:O||j!=null&&S.progress>=j,onClick:()=>M({progress:S.progress+1},!1),children:L(Ic,{size:14,"aria-hidden":`true`})})]}),!O&&j&&S.progress===j&&S.status!==`COMPLETED`?L(`button`,{type:`button`,onClick:()=>M({status:`COMPLETED`},!0),children:`Mark completed`}):void 0,!O&&j&&S.status===`COMPLETED`&&S.progress<j?I(`button`,{type:`button`,onClick:()=>M({progress:j},!0),children:[`Set `,j,` / `,j]}):void 0]}),I(`div`,{className:`group platforms`,children:[T.map(({answer:e,target:t})=>{let n=e.tracker.id,i=e.tracker.name;if(t.kind===`login`)return I(`span`,{className:`chip login`,"data-chip":n,title:`${i}: Signed out`,children:[L(iA,{answer:e}),L(`button`,{type:`button`,className:`login-button`,"aria-label":`Log in to ${i}`,disabled:!r[n]||p.has(n),onClick:()=>F(e),children:p.has(n)?`Logging in`:`Log in`})]},n);if(t.kind===`cannot`){let r=`${i} cannot track this media: ${t.reason}`;return I(`span`,{className:`chip cannot`,"data-chip":n,role:`img`,"aria-label":r,title:r,children:[L(iA,{answer:e}),L(`span`,{className:`slot`,children:L(Mc,{size:14,"aria-hidden":`true`})})]},n)}let{busy:a,failed:o}=b.state(n),s=e.state===`PAUSED`||e.state===`ERROR`?nA(e,j):void 0,c=[`${i}${e.tracker.account?`, ${e.tracker.account}`:``}: ${nA(e,j)}`,ZO(e,j)?`${i} counts ${e.entry.episodeCount} episodes, so progress is saved there from Advanced`:void 0].filter(Boolean).join(`. `);return I(`label`,{className:`chip${t.checked?``:` off`}`,"data-chip":n,title:c,"aria-busy":a?`true`:void 0,children:[L(`input`,{type:`checkbox`,className:`hidden`,name:`compact-target-${n}`,"aria-label":`Save to ${i}`,"aria-describedby":s?`compact-hint-${n}`:void 0,checked:t.checked,onChange:e=>P(n,e.currentTarget.checked)}),L(iA,{answer:e}),o||e.state===`ERROR`?L(`span`,{className:`badge red`,"data-badge":`red`}):e.state===`PAUSED`?L(`span`,{className:`badge amber`,"data-badge":`amber`}):void 0,L(`span`,{className:`slot`,children:a?L(Oc,{size:14,className:`spin`,"aria-hidden":`true`}):t.checked?L(`span`,{className:`check`,children:L(vc,{size:11,"aria-hidden":`true`})}):L(`span`,{className:`ring`})}),s?L(`span`,{id:`compact-hint-${n}`,className:`hidden`,children:s}):void 0]},n)}),I(`button`,{type:`button`,className:`advanced`,"aria-label":`Advanced tracking`,"aria-expanded":i.advanced,"aria-controls":`tracking-advanced`,onClick:()=>a({...i,advanced:!i.advanced}),children:[L(Vc,{size:16,"aria-hidden":`true`}),L(`span`,{className:`word`,children:`Advanced`})]})]})]}),L(`div`,{className:`notes`,children:T.flatMap(({answer:e})=>{let t=e.tracker.id,n=e.tracker.name,{failed:r,refused:i}=b.state(t);return[h[t]&&e.state===`SIGNED_OUT`?L(`div`,{className:`note`,"data-note":t,children:h[t]},`${t}-sign-in`):void 0,r?I(`div`,{className:`note problem`,"data-note":t,children:[n,` did not save `,rA(r.fields),`: `,r.error,L(`button`,{type:`button`,disabled:!JO(e),onClick:()=>b.retry(t),children:`Retry`})]},`${t}-failed`):void 0,i?I(`div`,{className:`note problem`,"data-note":t,children:[n,` did not save: `,i,L(`button`,{type:`button`,onClick:()=>b.dismiss(t),children:`Dismiss`})]},`${t}-refused`):void 0].filter(Boolean)})}),L(`div`,{className:`hidden`,role:`status`,children:d})]})};H();var oA=gp(`
1696
1667
  subscription MediaTracking($input: TrackingInput!) {
1697
1668
  tracking(input: $input) {
1698
1669
  _id
@@ -1739,7 +1710,7 @@ transition: max-height 0.3s ease-in-out;
1739
1710
  }
1740
1711
  }
1741
1712
  }
1742
- `),oA=_p(`
1713
+ `),sA=gp(`
1743
1714
  mutation SaveListEntry($input: SaveListEntryInput!) {
1744
1715
  saveListEntry(input: $input) {
1745
1716
  tracker
@@ -1759,7 +1730,7 @@ transition: max-height 0.3s ease-in-out;
1759
1730
  }
1760
1731
  }
1761
1732
  }
1762
- `),sA=_p(`
1733
+ `),cA=gp(`
1763
1734
  mutation DeleteListEntry($input: DeleteListEntryInput!) {
1764
1735
  deleteListEntry(input: $input) {
1765
1736
  tracker
@@ -1767,7 +1738,7 @@ transition: max-height 0.3s ease-in-out;
1767
1738
  error
1768
1739
  }
1769
1740
  }
1770
- `),cA=_p(`
1741
+ `),lA=gp(`
1771
1742
  subscription StubTrackerStorage {
1772
1743
  stubTrackerStorage {
1773
1744
  location
@@ -1778,7 +1749,7 @@ transition: max-height 0.3s ease-in-out;
1778
1749
  error
1779
1750
  }
1780
1751
  }
1781
- `),lA=_p(`
1752
+ `),uA=gp(`
1782
1753
  mutation AddHeldStubEntries {
1783
1754
  addHeldStubEntries {
1784
1755
  location
@@ -1789,7 +1760,7 @@ transition: max-height 0.3s ease-in-out;
1789
1760
  error
1790
1761
  }
1791
1762
  }
1792
- `),uA=ZD(),dA=e=>[{tracker:``,outcome:`FAILED`,error:e??`The write did not reach the trackers`}],fA=({uri:e,title:t,cover:n,episodeCount:r,prefsStore:i=uA})=>{let[{data:a}]=sr({query:aA,variables:{input:{uri:e}},pause:!e}),[,o]=ar(oA),[,s]=ar(sA),[{data:c}]=sr({query:cA}),[,l]=ar(lA),[u,d]=V(i.read);return N(()=>{let e=e=>{e.key===`stub.tracking.compact`&&d(i.read())};return globalThis.addEventListener?.(`storage`,e),()=>globalThis.removeEventListener?.(`storage`,e)},[i]),I(B,{children:[L(iA,{tracking:a?.tracking,episodeCount:r,onSaveFields:async(i,a)=>{let s=await o({input:{uri:e,trackers:i,entry:a,title:t??null,cover:n??null,episodeCount:r??null}});return s.data?.saveListEntry??dA(s.error?.message)},signIns:Je,prefs:u,onPrefs:e=>{i.write(e),d(e)}}),u.advanced?L(`div`,{id:`tracking-advanced`,children:L(Zk,{tracking:a?.tracking,episodeCount:r,onSave:async(i,a)=>{let s=await o({input:{uri:e,trackers:i,entry:{status:a.status,progress:a.progress,score:a.score},title:t??null,cover:n??null,episodeCount:r??null}});return s.data?.saveListEntry??dA(s.error?.message)},onDelete:async t=>{let n=await s({input:{uri:e,trackers:t}});return n.data?.deleteListEntry??dA(n.error?.message)},onSyncWrite:async(i,a)=>{let s=await o({input:{uri:e,trackers:[i],entry:a,title:t??null,cover:n??null,episodeCount:r??null}});return s.data?.saveListEntry??dA(s.error?.message)},signIns:Je})}):void 0,L(IO,{storage:c?.stubTrackerStorage,onUnlock:async()=>{await NO()&&await Ue()},onAdd:()=>l({})})]})},pA=l`
1763
+ `),dA=QD(),fA=e=>[{tracker:``,outcome:`FAILED`,error:e??`The write did not reach the trackers`}],pA=({uri:e,title:t,cover:n,episodeCount:r,prefsStore:i=dA})=>{let[{data:a}]=sr({query:oA,variables:{input:{uri:e}},pause:!e}),[,o]=ar(sA),[,s]=ar(cA),[{data:c}]=sr({query:lA}),[,l]=ar(uA),[u,d]=V(i.read);return N(()=>{let e=e=>{e.key===`stub.tracking.compact`&&d(i.read())};return globalThis.addEventListener?.(`storage`,e),()=>globalThis.removeEventListener?.(`storage`,e)},[i]),I(B,{children:[L(aA,{tracking:a?.tracking,episodeCount:r,onSaveFields:async(i,a)=>{let s=await o({input:{uri:e,trackers:i,entry:a,title:t??null,cover:n??null,episodeCount:r??null}});return s.data?.saveListEntry??fA(s.error?.message)},signIns:Je,prefs:u,onPrefs:e=>{i.write(e),d(e)}}),u.advanced?L(`div`,{id:`tracking-advanced`,children:L(Qk,{tracking:a?.tracking,episodeCount:r,onSave:async(i,a)=>{let s=await o({input:{uri:e,trackers:i,entry:{status:a.status,progress:a.progress,score:a.score},title:t??null,cover:n??null,episodeCount:r??null}});return s.data?.saveListEntry??fA(s.error?.message)},onDelete:async t=>{let n=await s({input:{uri:e,trackers:t}});return n.data?.deleteListEntry??fA(n.error?.message)},onSyncWrite:async(i,a)=>{let s=await o({input:{uri:e,trackers:[i],entry:a,title:t??null,cover:n??null,episodeCount:r??null}});return s.data?.saveListEntry??fA(s.error?.message)},signIns:Je})}):void 0,L(LO,{storage:c?.stubTrackerStorage,onUnlock:async()=>{await PO()&&await Ue()},onAdd:()=>l({})})]})},mA=l`
1793
1764
  font-size: 1.2rem;
1794
1765
  padding: 0.15rem 0.6rem;
1795
1766
  border: 1px solid rgba(255, 255, 255, 0.25);
@@ -1797,10 +1768,10 @@ transition: max-height 0.3s ease-in-out;
1797
1768
  white-space: nowrap;
1798
1769
 
1799
1770
  &:hover { border-color: rgba(255, 255, 255, 0.5); }
1800
- `,mA=({uri:e})=>{let t=Nm(Oo());return!e||!je(`?${t}`,`http://d/`)?null:L(Fo,{css:pA,"data-trace-link":e,href:Dm({uri:e,search:t}),title:`what the graph holds for this uri`,children:`graph trace`})},hA=e=>e?pe(e)?k(e)?.handleUris??[]:j(e)?[e]:[]:[],gA=(e,t)=>{let n=hA(e);if(!n.length)return!1;let r=new Set(hA(t));return n.some(e=>r.has(e))},_A=(e,t)=>t?.find(t=>gA(t.uri,e)),vA=(e,t)=>e?.find(e=>!t.has(e.url))?.url,yA=/^\d{4}-\d{2}-\d{2}$/,bA=1900,xA=e=>{if(!e)return;let t=new Date(e);if(!Number.isNaN(t.getTime())&&!(t.getUTCFullYear()<bA))return t},SA=(e,{locale:t}={})=>{let n=xA(e);if(n)try{return new Intl.DateTimeFormat(t,{year:`numeric`,month:`short`,day:`numeric`,...yA.test(e)?{timeZone:`UTC`}:{}}).format(n)}catch{return}},CA=(e,t)=>t?Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()):Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),wA=864e5,TA=(e,{locale:t,now:n=new Date}={})=>{let r=xA(e);if(!r)return;let i=Math.round((CA(n,!1)-CA(r,yA.test(e)))/wA);return i===0?`today`:i===1?`yesterday`:i>1&&i<30?`${i} days ago`:SA(e,{locale:t})},EA=e=>{let t=xA(e);if(t)return yA.test(e)?e:t.toISOString()},DA=new Set([`cr`,`nf`]),OA=e=>DA.has(e);H();var kA=l`
1771
+ `,hA=({uri:e})=>{let t=Pm(Oo());return!e||!je(`?${t}`,`http://d/`)?null:L(Fo,{css:mA,"data-trace-link":e,href:Om({uri:e,search:t}),title:`what the graph holds for this uri`,children:`graph trace`})},gA=e=>e?pe(e)?k(e)?.handleUris??[]:j(e)?[e]:[]:[],_A=(e,t)=>{let n=gA(e);if(!n.length)return!1;let r=new Set(gA(t));return n.some(e=>r.has(e))},vA=(e,t)=>t?.find(t=>_A(t.uri,e)),yA=(e,t)=>e?.find(e=>!t.has(e.url))?.url,bA=/^\d{4}-\d{2}-\d{2}$/,xA=1900,SA=e=>{if(!e)return;let t=new Date(e);if(!Number.isNaN(t.getTime())&&!(t.getUTCFullYear()<xA))return t},CA=(e,{locale:t}={})=>{let n=SA(e);if(n)try{return new Intl.DateTimeFormat(t,{year:`numeric`,month:`short`,day:`numeric`,...bA.test(e)?{timeZone:`UTC`}:{}}).format(n)}catch{return}},wA=(e,t)=>t?Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()):Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),TA=864e5,EA=(e,{locale:t,now:n=new Date}={})=>{let r=SA(e);if(!r)return;let i=Math.round((wA(n,!1)-wA(r,bA.test(e)))/TA);return i===0?`today`:i===1?`yesterday`:i>1&&i<30?`${i} days ago`:CA(e,{locale:t})},DA=e=>{let t=SA(e);if(t)return bA.test(e)?e:t.toISOString()},OA=new Set([`cr`,`nf`]),kA=e=>OA.has(e);H();var AA=l`
1801
1772
  position: fixed;
1802
1773
  inset: 0;
1803
- z-index: ${ff.sourcePopup};
1774
+ z-index: ${df.sourcePopup};
1804
1775
  display: flex;
1805
1776
  align-items: center;
1806
1777
  justify-content: center;
@@ -1865,7 +1836,7 @@ transition: max-height 0.3s ease-in-out;
1865
1836
  color: rgba(255, 255, 255, 0.55);
1866
1837
  font-size: 1.4rem;
1867
1838
  }
1868
- `,AA=({pluginUri:e,origin:t,name:n,uris:r,onPick:i,onClose:a})=>{let o=w(null),[s,c]=V(``);return N(()=>{let n=o.current;if(!n)return;let s=!1,l;return(async()=>{try{l=await ye.show(e,{element:n})}catch(e){c(e instanceof Error?e.message:String(e));return}let o=await ze(t,r);s||(o?i(o):a())})(),()=>{s=!0,l?.hide(),ye.hide(e,{element:n}).catch(()=>{})}},[e,t,r.join(`,`)]),N(()=>{let e=e=>{e.key===`Escape`&&a()};return addEventListener(`keydown`,e),()=>removeEventListener(`keydown`,e)},[a]),L(`div`,{css:kA,role:`dialog`,"aria-modal":`true`,"aria-label":`Choose a source from ${n}`,onClick:a,children:I(`div`,{className:`wrap`,onClick:e=>e.stopPropagation(),children:[I(`div`,{className:`bar`,children:[L(`span`,{children:n}),L(`span`,{className:`spacer`}),L(`button`,{type:`button`,className:`close`,onClick:a,children:`Close`})]}),s?I(`div`,{className:`fallback`,children:[`This source could not open its picker. `,s]}):L(`div`,{className:`slot`,ref:o})]})})};H();var jA={cr:`#f47521`,nf:`#e50914`,jw:`#fcd53f`,disney:`#0063e5`,amazon:`#00a8e1`,appletv:`#e8e8ed`,hulu:`#1ce783`,hbo:`#7b5cff`,peacock:`#069de0`,paramount:`#0064ff`,fubo:`#fa4616`},MA=`#9aa0a6`,NA=e=>e.color||jA[e.id]||MA,PA=l`
1839
+ `,jA=({pluginUri:e,origin:t,name:n,uris:r,onPick:i,onClose:a})=>{let o=w(null),[s,c]=V(``);return N(()=>{let n=o.current;if(!n)return;let s=!1,l;return(async()=>{try{l=await ye.show(e,{element:n})}catch(e){c(e instanceof Error?e.message:String(e));return}let o=await ze(t,r);s||(o?i(o):a())})(),()=>{s=!0,l?.hide(),ye.hide(e,{element:n}).catch(()=>{})}},[e,t,r.join(`,`)]),N(()=>{let e=e=>{e.key===`Escape`&&a()};return addEventListener(`keydown`,e),()=>removeEventListener(`keydown`,e)},[a]),L(`div`,{css:AA,role:`dialog`,"aria-modal":`true`,"aria-label":`Choose a source from ${n}`,onClick:a,children:I(`div`,{className:`wrap`,onClick:e=>e.stopPropagation(),children:[I(`div`,{className:`bar`,children:[L(`span`,{children:n}),L(`span`,{className:`spacer`}),L(`button`,{type:`button`,className:`close`,onClick:a,children:`Close`})]}),s?I(`div`,{className:`fallback`,children:[`This source could not open its picker. `,s]}):L(`div`,{className:`slot`,ref:o})]})})};H();var MA={cr:`#f47521`,nf:`#e50914`,jw:`#fcd53f`,disney:`#0063e5`,amazon:`#00a8e1`,appletv:`#e8e8ed`,hulu:`#1ce783`,hbo:`#7b5cff`,peacock:`#069de0`,paramount:`#0064ff`,fubo:`#fa4616`},NA=`#9aa0a6`,PA=e=>e.color||MA[e.id]||NA,FA=l`
1869
1840
  display: flex;
1870
1841
  flex-direction: column;
1871
1842
  gap: 1.1rem;
@@ -1885,7 +1856,7 @@ transition: max-height 0.3s ease-in-out;
1885
1856
  }
1886
1857
 
1887
1858
  .source {
1888
- --brand: ${MA};
1859
+ --brand: ${NA};
1889
1860
  position: relative;
1890
1861
  display: flex;
1891
1862
  align-items: center;
@@ -2096,13 +2067,13 @@ transition: max-height 0.3s ease-in-out;
2096
2067
  0%, 100% { transform: scaleY(0.35); }
2097
2068
  50% { transform: scaleY(1); }
2098
2069
  }
2099
- `,FA=l`
2070
+ `,IA=l`
2100
2071
  display: flex;
2101
2072
  align-items: center;
2102
2073
  gap: 0.7rem;
2103
2074
 
2104
2075
  .src {
2105
- --brand: ${MA};
2076
+ --brand: ${NA};
2106
2077
  display: flex;
2107
2078
  text-decoration: none;
2108
2079
  border-radius: 0.6rem;
@@ -2142,8 +2113,8 @@ transition: max-height 0.3s ease-in-out;
2142
2113
  background: color-mix(in srgb, var(--brand) 30%, rgba(255, 255, 255, 0.05));
2143
2114
  }
2144
2115
  }
2145
- `,IA=({source:e})=>{let[t,n]=V(!1);return L(`span`,{className:`icon`,children:e.icon&&!t?L(`img`,{src:e.icon,alt:``,onError:()=>n(!0)}):e.name.charAt(0)})},LA=({sources:e,compact:t=!1,onPickRelease:n})=>{let[r,i]=V(null);return e.length?t?L(`div`,{css:FA,children:e.map(e=>L(`a`,{className:`src`,style:{"--brand":NA(e)},href:e.href,target:e.external?`_blank`:void 0,rel:e.external?`noreferrer`:void 0,title:`Watch on ${e.name}`,children:L(IA,{source:e})},e.id))}):I(`div`,{css:PA,children:[L(`div`,{className:`label`,children:`Watch on`}),L(`div`,{className:`list`,children:e.map(e=>e.releases&&e.releases.length>1?L(RA,{source:e,onOpenPicker:()=>i(e)},e.id):I(`a`,{className:`source${e.active?` active`:``}`,style:{"--brand":NA(e)},href:e.href,target:e.external?`_blank`:void 0,rel:e.external?`noreferrer`:void 0,title:e.name,children:[L(IA,{source:e}),L(`span`,{className:`name`,children:e.name}),e.active?I(`span`,{className:`playing`,children:[L(`i`,{}),L(`i`,{}),L(`i`,{})]}):e.external?L(`span`,{className:`ext`,children:`↗`}):L(`span`,{className:`play`,children:`▶`})]},e.id))}),r?.picker?L(AA,{pluginUri:r.picker.pluginUri,origin:r.id,name:r.name,uris:(r.releases??[]).map(e=>e.uri),onPick:e=>{i(null),n?.(e)},onClose:()=>i(null)}):void 0]}):null},RA=({source:e,onOpenPicker:t})=>{let n=e.releases??[],[r,i]=V(n.some(e=>e.active)),a=!!e.picker;return I(`div`,{className:`source-group`,style:{"--brand":NA(e)},children:[I(`button`,{type:`button`,className:`source${e.active?` active`:``}`,style:{"--brand":NA(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:[L(IA,{source:e}),L(`span`,{className:`name`,children:e.name}),L(`span`,{className:`count`,children:n.length}),L(`span`,{className:`chevron`,children:a?`›`:r?`▾`:`▸`})]}),!a&&r?L(`div`,{className:`releases`,children:n.map(e=>I(`a`,{className:`release${e.active?` active`:``}`,href:e.href,target:e.external?`_blank`:void 0,rel:e.external?`noreferrer`:void 0,title:e.label,children:[L(`span`,{className:`release-label`,children:e.label}),e.active?I(`span`,{className:`playing`,children:[L(`i`,{}),L(`i`,{}),L(`i`,{})]}):e.external?L(`span`,{className:`ext`,children:`↗`}):L(`span`,{className:`play`,children:`▶`})]},e.uri))}):void 0]})},zA=e=>[...new Set((e?.handles??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node.origin))];H();var BA=l`
2146
- z-index: ${ff.mediaModal};
2116
+ `,LA=({source:e})=>{let[t,n]=V(!1);return L(`span`,{className:`icon`,children:e.icon&&!t?L(`img`,{src:e.icon,alt:``,onError:()=>n(!0)}):e.name.charAt(0)})},RA=({sources:e,compact:t=!1,onPickRelease:n})=>{let[r,i]=V(null);return e.length?t?L(`div`,{css:IA,children:e.map(e=>L(`a`,{className:`src`,style:{"--brand":PA(e)},href:e.href,target:e.external?`_blank`:void 0,rel:e.external?`noreferrer`:void 0,title:`Watch on ${e.name}`,children:L(LA,{source:e})},e.id))}):I(`div`,{css:FA,children:[L(`div`,{className:`label`,children:`Watch on`}),L(`div`,{className:`list`,children:e.map(e=>e.releases&&e.releases.length>1?L(zA,{source:e,onOpenPicker:()=>i(e)},e.id):I(`a`,{className:`source${e.active?` active`:``}`,style:{"--brand":PA(e)},href:e.href,target:e.external?`_blank`:void 0,rel:e.external?`noreferrer`:void 0,title:e.name,children:[L(LA,{source:e}),L(`span`,{className:`name`,children:e.name}),e.active?I(`span`,{className:`playing`,children:[L(`i`,{}),L(`i`,{}),L(`i`,{})]}):e.external?L(`span`,{className:`ext`,children:`↗`}):L(`span`,{className:`play`,children:`▶`})]},e.id))}),r?.picker?L(jA,{pluginUri:r.picker.pluginUri,origin:r.id,name:r.name,uris:(r.releases??[]).map(e=>e.uri),onPick:e=>{i(null),n?.(e)},onClose:()=>i(null)}):void 0]}):null},zA=({source:e,onOpenPicker:t})=>{let n=e.releases??[],[r,i]=V(n.some(e=>e.active)),a=!!e.picker;return I(`div`,{className:`source-group`,style:{"--brand":PA(e)},children:[I(`button`,{type:`button`,className:`source${e.active?` active`:``}`,style:{"--brand":PA(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:[L(LA,{source:e}),L(`span`,{className:`name`,children:e.name}),L(`span`,{className:`count`,children:n.length}),L(`span`,{className:`chevron`,children:a?`›`:r?`▾`:`▸`})]}),!a&&r?L(`div`,{className:`releases`,children:n.map(e=>I(`a`,{className:`release${e.active?` active`:``}`,href:e.href,target:e.external?`_blank`:void 0,rel:e.external?`noreferrer`:void 0,title:e.label,children:[L(`span`,{className:`release-label`,children:e.label}),e.active?I(`span`,{className:`playing`,children:[L(`i`,{}),L(`i`,{}),L(`i`,{})]}):e.external?L(`span`,{className:`ext`,children:`↗`}):L(`span`,{className:`play`,children:`▶`})]},e.uri))}):void 0]})},BA=e=>[...new Set((e?.handles??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node.origin))];H();var VA=l`
2117
+ z-index: ${df.mediaModal};
2147
2118
  padding: 5rem 1rem;
2148
2119
  background-color: hsla(0, 0%, 0%, 0.439);
2149
2120
  animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
@@ -2424,7 +2395,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
2424
2395
  }
2425
2396
  }
2426
2397
  }
2427
- `,VA=_p(`
2398
+ `,HA=gp(`
2428
2399
  subscription GetMediaModal($input: MediaInput!, $descriptionInput: MediaDescriptionInput!) {
2429
2400
  media(input: $input) {
2430
2401
  ...MediaFragment
@@ -2546,7 +2517,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
2546
2517
  episodeCount
2547
2518
  }
2548
2519
  }
2549
- `),HA=_p(`
2520
+ `),UA=gp(`
2550
2521
  subscription GetMediaModalOrigins($input: OriginPageInput!) {
2551
2522
  originPage(input: $input) {
2552
2523
  nodes {
@@ -2554,7 +2525,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
2554
2525
  }
2555
2526
  }
2556
2527
  }
2557
- `),UA=({episode:e,index:t,mediaUri:n,isMovie:r})=>{let[i,a]=V(()=>new Set),o=vA(e.thumbnails,i),s=e.releaseDate??e.handles?.find(e=>e.node.releaseDate)?.node.releaseDate,c=TA(s),l=zA(e),[{data:u}]=sr({query:HA,variables:{input:{ids:l,filters:[Yo.IsNotApiOnly]}},pause:!l}),d=(u?.originPage?.nodes??[]).map(t=>{let r=(e?.handles??[]).filter(e=>e.relation===`SAME_AS`&&e.node.origin===t.id).map(e=>e.node),i=r.at(0),a=i?.uri,o=!!(OA(t.id)&&i?.url),s=e.uri?r.length>1?Ho(Y.WATCH,{mediaUri:n,episodeUri:e.uri}):a?Ho(Y.WATCH,{mediaUri:n,episodeUri:e.uri,sourceUri:a}):void 0:void 0,c=r.length>1;return{id:t.id,name:t.name??t.id,icon:t.icon,color:t.color,href:c||o?s:i?.url??void 0,external:!c&&!o,active:!1}}).filter(e=>e.href).sort((e,t)=>Number(e.external)-Number(t.external)).slice(0,5);return I(`div`,{className:`episode`,children:[e.uri?L(Fo,{className:`episode-link`,href:Ho(Y.WATCH,{mediaUri:n,episodeUri:e.uri})}):void 0,r?void 0:L(`div`,{className:`number`,children:e.episodeNumber}),o?L(`img`,{className:`thumbnail`,src:o,onError:()=>a(e=>new Set(e).add(o))}):L(`div`,{className:`thumbnail`}),r?L(`div`,{className:`content`,children:I(`div`,{className:`header`,children:[L(`div`,{className:`title`,children:`Play`}),L(`span`,{className:`origins`,children:L(LA,{compact:!0,sources:d})})]})}):e.titles?.length?I(`div`,{className:`content`,children:[I(`div`,{className:`header`,children:[L(`div`,{className:`title`,children:e.titles.at(0)?.title}),L(`span`,{className:`origins`,children:L(LA,{compact:!0,sources:d})})]}),e.shortDescriptions?.at(0)?L(`div`,{className:`description`,children:L(Mp,{className:`ellipsis`,children:e.shortDescriptions?.at(0)?.shortDescription})}):void 0]}):L(`div`,{className:`content`,children:L(`div`,{className:`header`,children:I(`div`,{className:`title`,children:[`Episode `,t+1]})})}),L(`div`,{className:`side`,children:c?L(`time`,{className:`date`,dateTime:EA(s),children:c}):void 0})]})},WA=({mediaNodes:e})=>{let t=To(),n={...t,uri:de(t.uri)},[,r]=Do(),i=_A(n.uri,e),[a,o]=V(n.uri);N(()=>{o(e=>e&&P(oe(e),oe(n.uri??``))?e:n.uri)},[n.uri]);let[{data:s}]=sr({query:VA,variables:{input:{uri:a},descriptionInput:{type:Wo.Html}},pause:!a}),c=s?.media??i,l=s?.media?.uri?k(s.media.uri)?.handleUrisValues:void 0,u=[...new Set([...l?.map(e=>e.origin)??[],...c?.handles?.map(e=>e.node.origin)??[]])],[{data:d}]=sr({query:HA,variables:{input:{ids:u,filters:[Yo.IsNotApiOnly]}},pause:!u}),f=D(()=>c?.titles?.at(0)?.title,[c]),p=D(()=>c&&`descriptions`in c&&c.descriptions.sort((e,t)=>t.description.length-e.description.length)?.at(0)?.description,[c]),m=um(c?.covers),[h,g]=V([]),[_,v]=V(),y=D(()=>{let e=(c?.trailers??[]).filter(e=>!h.includes(e.uri));return e.find(e=>e.uri===_)??e.at(0)},[c?.trailers,h,_]);N(()=>{y?.uri&&y.uri!==_&&v(y.uri)},[y?.uri,_]);let b=U(()=>{y&&g([...h,y.uri])},[y,h]),[x,S]=V(!0),{refs:C,context:w}=Kd({open:x,onOpenChange:(e,t)=>{t?.target===C.reference.current&&S(!1)}}),{getReferenceProps:T,getFloatingProps:E}=Jd([Bd(w)]),[O,A]=V(!1),[j,M]=V(!0),[F,ee]=V(.25);return N(()=>{se(c?.uri,n.uri)&&r(`${Ho(Y.MEDIA,{uri:c.uri})}${location.search}`,{replace:!0})},[c?.uri,n.uri]),x?L(bd,{children:L(Id,{lockScroll:!0,"data-party-scroll":!0,css:BA,ref:C.setReference,...T(),children:L(jd,{context:w,children:I(`div`,{className:`modal`,ref:C.setFloating,...E(),children:[I(`div`,{className:`trailer`,style:!y?.url&&m?{backgroundImage:`url(${m})`}:{},children:[y?.url?L(Dp,{url:y.url,className:`player`,onError:b,paused:O,volume:j?0:F},y.url):void 0,I(`div`,{className:`player-controls ${y?.url?``:`hidden`}`,children:[I(`span`,{className:`playback`,children:[O?L(Ic,{className:`icon-outline`,size:30,strokeWidth:3,color:`black`,onClick:()=>A(!1)}):L(Fc,{className:`icon-outline`,size:30,strokeWidth:3,color:`black`,onClick:()=>A(!0)}),O?L(Ic,{className:`icon-body`,size:30,onClick:()=>A(!1)}):L(Fc,{className:`icon-body`,size:30,onClick:()=>A(!0)})]}),L(Ap,{defaultMuted:j,onMutedUpdate:M,defaultVolume:F,onVolumeUpdate:e=>ee(e)})]})]}),I(`div`,{className:`content`,children:[I(`div`,{className:`header`,children:[L(`span`,{className:`title`,children:f}),L(mA,{uri:c?.uri}),L(`span`,{className:`origins`,children:d?.originPage?.nodes?.map(e=>{let t=c?.handles.filter(t=>t.node.origin===e.id&&t.node.url)??[],n=(t.find(e=>e.relation===`SAME_AS`)??t.at(0))?.node.url;if(e.icon)return n?L(`a`,{className:`origin`,href:n,target:`_blank`,rel:`noreferrer`,title:e.name,children:L(`img`,{src:e.icon})}):L(`div`,{className:`origin`,children:L(`img`,{src:e.icon})})}).filter(Boolean)})]}),L(fA,{uri:s?.media?.uri,title:f,cover:m,episodeCount:s?.media?.episodeCount}),p?L(xm,{collapsedHeight:200,className:`description`,children:L(`div`,{dangerouslySetInnerHTML:{__html:p}})}):void 0,L(ah,{relations:c&&`relations`in c?c.relations??[]:[],action:L(KD,{franchise:c&&`franchise`in c?c.franchise:void 0,currentUris:c?.handles?.map(e=>e.node.uri)??[]})}),L(`div`,{className:`episodes`,children:c&&`episodes`in c&&c.episodes?.map((e,t)=>L(UA,{episode:e,index:t,mediaUri:c.uri,isMovie:`categories`in c&&c.categories?.includes(Uo.Movie)},e.episodeNumber??e.uri??t))})]})]})})})}):L(Ro,{to:`/`})},GA=[{label:`All`,value:null},{label:`Anime`,value:Uo.Anime},{label:`Series`,value:Uo.Series},{label:`Movies`,value:Uo.Movie}],KA=l`
2528
+ `),WA=({episode:e,index:t,mediaUri:n,isMovie:r})=>{let[i,a]=V(()=>new Set),o=yA(e.thumbnails,i),s=e.releaseDate??e.handles?.find(e=>e.node.releaseDate)?.node.releaseDate,c=EA(s),l=BA(e),[{data:u}]=sr({query:UA,variables:{input:{ids:l,filters:[Yo.IsNotApiOnly]}},pause:!l}),d=(u?.originPage?.nodes??[]).map(t=>{let r=(e?.handles??[]).filter(e=>e.relation===`SAME_AS`&&e.node.origin===t.id).map(e=>e.node),i=r.at(0),a=i?.uri,o=!!(kA(t.id)&&i?.url),s=e.uri?r.length>1?Ho(Y.WATCH,{mediaUri:n,episodeUri:e.uri}):a?Ho(Y.WATCH,{mediaUri:n,episodeUri:e.uri,sourceUri:a}):void 0:void 0,c=r.length>1;return{id:t.id,name:t.name??t.id,icon:t.icon,color:t.color,href:c||o?s:i?.url??void 0,external:!c&&!o,active:!1}}).filter(e=>e.href).sort((e,t)=>Number(e.external)-Number(t.external)).slice(0,5);return I(`div`,{className:`episode`,children:[e.uri?L(Fo,{className:`episode-link`,href:Ho(Y.WATCH,{mediaUri:n,episodeUri:e.uri})}):void 0,r?void 0:L(`div`,{className:`number`,children:e.episodeNumber}),o?L(`img`,{className:`thumbnail`,src:o,onError:()=>a(e=>new Set(e).add(o))}):L(`div`,{className:`thumbnail`}),r?L(`div`,{className:`content`,children:I(`div`,{className:`header`,children:[L(`div`,{className:`title`,children:`Play`}),L(`span`,{className:`origins`,children:L(RA,{compact:!0,sources:d})})]})}):e.titles?.length?I(`div`,{className:`content`,children:[I(`div`,{className:`header`,children:[L(`div`,{className:`title`,children:e.titles.at(0)?.title}),L(`span`,{className:`origins`,children:L(RA,{compact:!0,sources:d})})]}),e.shortDescriptions?.at(0)?L(`div`,{className:`description`,children:L(jp,{className:`ellipsis`,children:e.shortDescriptions?.at(0)?.shortDescription})}):void 0]}):L(`div`,{className:`content`,children:L(`div`,{className:`header`,children:I(`div`,{className:`title`,children:[`Episode `,t+1]})})}),L(`div`,{className:`side`,children:c?L(`time`,{className:`date`,dateTime:DA(s),children:c}):void 0})]})},GA=({mediaNodes:e})=>{let t=To(),n={...t,uri:de(t.uri)},[,r]=Do(),i=vA(n.uri,e),[a,o]=V(n.uri);N(()=>{o(e=>e&&P(oe(e),oe(n.uri??``))?e:n.uri)},[n.uri]);let[{data:s}]=sr({query:HA,variables:{input:{uri:a},descriptionInput:{type:Wo.Html}},pause:!a}),c=s?.media??i,l=s?.media?.uri?k(s.media.uri)?.handleUrisValues:void 0,u=[...new Set([...l?.map(e=>e.origin)??[],...c?.handles?.map(e=>e.node.origin)??[]])],[{data:d}]=sr({query:UA,variables:{input:{ids:u,filters:[Yo.IsNotApiOnly]}},pause:!u}),f=D(()=>c?.titles?.at(0)?.title,[c]),p=D(()=>c&&`descriptions`in c&&c.descriptions.sort((e,t)=>t.description.length-e.description.length)?.at(0)?.description,[c]),m=Vp(c?.covers),[h,g]=V([]),[_,v]=V(),y=D(()=>{let e=(c?.trailers??[]).filter(e=>!h.includes(e.uri));return e.find(e=>e.uri===_)??e.at(0)},[c?.trailers,h,_]);N(()=>{y?.uri&&y.uri!==_&&v(y.uri)},[y?.uri,_]);let b=U(()=>{y&&g([...h,y.uri])},[y,h]),[x,S]=V(!0),{refs:C,context:w}=Gd({open:x,onOpenChange:(e,t)=>{t?.target===C.reference.current&&S(!1)}}),{getReferenceProps:T,getFloatingProps:E}=qd([zd(w)]),[O,A]=V(!1),[j,M]=V(!0),[F,ee]=V(.25);return N(()=>{se(c?.uri,n.uri)&&r(`${Ho(Y.MEDIA,{uri:c.uri})}${location.search}`,{replace:!0})},[c?.uri,n.uri]),x?L(yd,{children:L(Fd,{lockScroll:!0,"data-party-scroll":!0,css:VA,ref:C.setReference,...T(),children:L(Ad,{context:w,children:I(`div`,{className:`modal`,ref:C.setFloating,...E(),children:[I(`div`,{className:`trailer`,style:!y?.url&&m?{backgroundImage:`url(${m})`}:{},children:[y?.url?L(Ep,{url:y.url,className:`player`,onError:b,paused:O,volume:j?0:F},y.url):void 0,I(`div`,{className:`player-controls ${y?.url?``:`hidden`}`,children:[I(`span`,{className:`playback`,children:[O?L(Fc,{className:`icon-outline`,size:30,strokeWidth:3,color:`black`,onClick:()=>A(!1)}):L(Pc,{className:`icon-outline`,size:30,strokeWidth:3,color:`black`,onClick:()=>A(!0)}),O?L(Fc,{className:`icon-body`,size:30,onClick:()=>A(!1)}):L(Pc,{className:`icon-body`,size:30,onClick:()=>A(!0)})]}),L(kp,{defaultMuted:j,onMutedUpdate:M,defaultVolume:F,onVolumeUpdate:e=>ee(e)})]})]}),I(`div`,{className:`content`,children:[I(`div`,{className:`header`,children:[L(`span`,{className:`title`,children:f}),L(hA,{uri:c?.uri}),L(`span`,{className:`origins`,children:d?.originPage?.nodes?.map(e=>{let t=c?.handles.filter(t=>t.node.origin===e.id&&t.node.url)??[],n=(t.find(e=>e.relation===`SAME_AS`)??t.at(0))?.node.url;if(e.icon)return n?L(`a`,{className:`origin`,href:n,target:`_blank`,rel:`noreferrer`,title:e.name,children:L(`img`,{src:e.icon})}):L(`div`,{className:`origin`,children:L(`img`,{src:e.icon})})}).filter(Boolean)})]}),L(pA,{uri:s?.media?.uri,title:f,cover:m,episodeCount:s?.media?.episodeCount}),p?L(Sm,{collapsedHeight:200,className:`description`,children:L(`div`,{dangerouslySetInnerHTML:{__html:p}})}):void 0,L(oh,{relations:c&&`relations`in c?c.relations??[]:[],action:L(qD,{franchise:c&&`franchise`in c?c.franchise:void 0,currentUris:c?.handles?.map(e=>e.node.uri)??[]})}),L(`div`,{className:`episodes`,children:c&&`episodes`in c&&c.episodes?.map((e,t)=>L(WA,{episode:e,index:t,mediaUri:c.uri,isMovie:`categories`in c&&c.categories?.includes(Uo.Movie)},e.episodeNumber??e.uri??t))})]})]})})})}):L(Ro,{to:`/`})},KA=[{label:`All`,value:null},{label:`Anime`,value:Uo.Anime},{label:`Series`,value:Uo.Series},{label:`Movies`,value:Uo.Movie}],qA=l`
2558
2529
  display: flex;
2559
2530
  gap: 0.6rem;
2560
2531
 
@@ -2576,7 +2547,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
2576
2547
  color: #000;
2577
2548
  border-color: #fff;
2578
2549
  }
2579
- `,qA=({value:e,onChange:t})=>L(`div`,{css:KA,children:GA.map(n=>L(`button`,{className:e===n.value?`tab active`:`tab`,onClick:()=>t(n.value),children:n.label},n.label))}),JA=e=>e._id??e.uri??``,YA=(e,t)=>{let n=new Map(t.map((e,t)=>[e,t])),r=[],i=[];for(let t of e)(n.has(JA(t))?r:i).push(t);return r.sort((e,t)=>n.get(JA(e))-n.get(JA(t))),[...r,...i]},XA=e=>e.map(JA).filter(Boolean);H();var ZA=_p(`
2550
+ `,JA=({value:e,onChange:t})=>L(`div`,{css:qA,children:KA.map(n=>L(`button`,{className:e===n.value?`tab active`:`tab`,onClick:()=>t(n.value),children:n.label},n.label))}),YA=e=>e._id??e.uri??``,XA=(e,t)=>{let n=new Map(t.map((e,t)=>[e,t])),r=[],i=[];for(let t of e)(n.has(YA(t))?r:i).push(t);return r.sort((e,t)=>n.get(YA(e))-n.get(YA(t))),[...r,...i]},ZA=e=>e.map(YA).filter(Boolean);H();var QA=gp(`
2580
2551
  subscription GetReleasingMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
2581
2552
  mediaPage(input: $input) {
2582
2553
  nodes {
@@ -2611,13 +2582,13 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
2611
2582
  }
2612
2583
  }
2613
2584
  }
2614
- `),QA=l`
2585
+ `),$A=l`
2615
2586
  .category-bar {
2616
2587
  position: relative;
2617
- z-index: ${ff.categoryBar};
2588
+ z-index: ${df.categoryBar};
2618
2589
  padding: 1.5rem 3rem 0.5rem;
2619
2590
  }
2620
- `,$A=CO(),ej={season:xs($A.season),year:$A.year},tj=Ns(ej),nj=()=>{let[e]=Ao(Vo(Y.MEDIA)),[t,n]=V(null),[{data:r}]=sr({query:ZA,variables:{input:{season:ej.season,seasonYear:ej.year,sorts:[Ko.PopularityDesc],...t?{categories:[t]}:{}},shortDescriptionInput:{count:1}}}),i=r?.mediaPage?.nodes,a=w([]),o=D(()=>{if(!i?.length)return i||[];let e=YA(i,a.current);return a.current=XA(e),e},[i]);return I(`div`,{css:QA,children:[L(Rp,{mediaNodes:o}),L(`div`,{className:`category-bar`,children:L(qA,{value:t,onChange:n})}),L(ym,{title:`Current season`,titleTo:tj,mediaNodes:o}),e&&L(WA,{mediaNodes:o})]})},rj=(e,t)=>{let n=e.nextAiringEpisode?.airingAt;if(!n)return;let r=new Date(n).getTime();return Number.isFinite(r)?r-t:void 0},ij=e=>e==null?void 0:`${e} episode${e===1?``:`s`}`,aj=(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})`},oj=e=>({"--accent":aj(e,1)??`rgba(255, 255, 255, 0.75)`,"--accent-soft":aj(e,.18)??`rgba(255, 255, 255, 0.08)`,"--accent-wash":aj(e,.07)??`rgba(255, 255, 255, 0.03)`}),sj=(e,t=2)=>{if(!Number.isFinite(e)||e<=0)return;let n=[],r=e;for(let e of cj){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},cj=[{ms:864e5,singular:`day`,plural:`days`},{ms:36e5,singular:`hour`,plural:`hours`},{ms:6e4,singular:`min`,plural:`mins`},{ms:1e3,singular:`sec`,plural:`secs`}];H();var lj=3e4,uj=new Set,dj,fj=()=>{let[e,t]=V(()=>Date.now());return N(()=>(uj.add(t),dj??=setInterval(()=>{let e=Date.now();for(let t of uj)t(e)},lj),()=>{uj.delete(t),!uj.size&&dj&&(clearInterval(dj),dj=void 0)}),[]),e},pj=l`
2591
+ `,ej=wO(),tj={season:bs(ej.season),year:ej.year},nj=Ms(tj),rj=()=>{let[e]=Ao(Vo(Y.MEDIA)),[t,n]=V(null),[{data:r}]=sr({query:QA,variables:{input:{season:tj.season,seasonYear:tj.year,sorts:[Ko.PopularityDesc],...t?{categories:[t]}:{}},shortDescriptionInput:{count:1}}}),i=r?.mediaPage?.nodes,a=w([]),o=D(()=>{if(!i?.length)return i||[];let e=XA(i,a.current);return a.current=ZA(e),e},[i]);return I(`div`,{css:$A,children:[L(Up,{mediaNodes:o}),L(`div`,{className:`category-bar`,children:L(JA,{value:t,onChange:n})}),L(bm,{title:`Current season`,titleTo:nj,mediaNodes:o}),e&&L(GA,{mediaNodes:o})]})},ij=(e,t)=>{let n=e.nextAiringEpisode?.airingAt;if(!n)return;let r=new Date(n).getTime();return Number.isFinite(r)?r-t:void 0},aj=e=>e==null?void 0:`${e} episode${e===1?``:`s`}`,oj=(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})`},sj=e=>({"--accent":oj(e,1)??`rgba(255, 255, 255, 0.75)`,"--accent-soft":oj(e,.18)??`rgba(255, 255, 255, 0.08)`,"--accent-wash":oj(e,.07)??`rgba(255, 255, 255, 0.03)`}),cj=(e,t=2)=>{if(!Number.isFinite(e)||e<=0)return;let n=[],r=e;for(let e of lj){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},lj=[{ms:864e5,singular:`day`,plural:`days`},{ms:36e5,singular:`hour`,plural:`hours`},{ms:6e4,singular:`min`,plural:`mins`},{ms:1e3,singular:`sec`,plural:`secs`}];H();var uj=3e4,dj=new Set,fj,pj=()=>{let[e,t]=V(()=>Date.now());return N(()=>(dj.add(t),fj??=setInterval(()=>{let e=Date.now();for(let t of dj)t(e)},uj),()=>{dj.delete(t),!dj.size&&fj&&(clearInterval(fj),fj=void 0)}),[]),e},mj=l`
2621
2592
  display: grid;
2622
2593
  grid-template-columns: 15rem minmax(0, 1fr);
2623
2594
  height: 23rem;
@@ -2737,7 +2708,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
2737
2708
  .description { -webkit-line-clamp: 3; }
2738
2709
  .chips { display: none; }
2739
2710
  }
2740
- `,mj=({media:e,to:t})=>{let n=fj(),r=um(e.covers),i=e.covers?.find(e=>e.color)?.color,a=sj(rj(e,n)??0),o=e.nextAiringEpisode?.episodeNumber,s=Fs(e.type),c=Ls(e.season,e.seasonYear),l=[s,ij(e.episodeCount)].filter(Boolean).join(` • `);return I(Fo,{to:t,css:pj,style:oj(i),children:[L(`div`,{className:`cover`,style:r?{backgroundImage:`url(${r})`}:void 0,children:I(`div`,{className:`cover-text`,children:[L(`div`,{className:`title`,children:e.titles?.at(0)?.title}),c&&L(`div`,{className:`season`,children:c})]})}),I(`div`,{className:`detail`,children:[I(`div`,{className:`detail-top`,children:[L(`div`,{children:a&&o!=null?I(B,{children:[I(`div`,{className:`airing-label`,children:[`Ep `,o,` airing in`]}),L(`div`,{className:`airing-value airing`,children:a})]}):L(`div`,{className:`airing-value`,children:Is(e.status)??`Unknown status`})}),e.averageScore!=null&&L(zk,{percent:e.averageScore})]}),l&&L(`div`,{className:`meta`,children:l}),L(`div`,{className:`description`,children:e.shortDescriptions?.at(0)?.shortDescription}),L(`div`,{className:`chips`,children:e.genres?.slice(0,2).map(e=>L(`span`,{className:`chip`,children:e.toLowerCase()},e))})]})]})},hj=l`
2711
+ `,hj=({media:e,to:t})=>{let n=pj(),r=Vp(e.covers),i=e.covers?.find(e=>e.color)?.color,a=cj(ij(e,n)??0),o=e.nextAiringEpisode?.episodeNumber,s=Ps(e.type),c=Is(e.season,e.seasonYear),l=[s,aj(e.episodeCount)].filter(Boolean).join(` • `);return I(Fo,{to:t,css:mj,style:sj(i),children:[L(`div`,{className:`cover`,style:r?{backgroundImage:`url(${r})`}:void 0,children:I(`div`,{className:`cover-text`,children:[L(`div`,{className:`title`,children:e.titles?.at(0)?.title}),c&&L(`div`,{className:`season`,children:c})]})}),I(`div`,{className:`detail`,children:[I(`div`,{className:`detail-top`,children:[L(`div`,{children:a&&o!=null?I(B,{children:[I(`div`,{className:`airing-label`,children:[`Ep `,o,` airing in`]}),L(`div`,{className:`airing-value airing`,children:a})]}):L(`div`,{className:`airing-value`,children:Fs(e.status)??`Unknown status`})}),e.averageScore!=null&&L(Bk,{percent:e.averageScore})]}),l&&L(`div`,{className:`meta`,children:l}),L(`div`,{className:`description`,children:e.shortDescriptions?.at(0)?.shortDescription}),L(`div`,{className:`chips`,children:e.genres?.slice(0,2).map(e=>L(`span`,{className:`chip`,children:e.toLowerCase()},e))})]})]})},gj=l`
2741
2712
  display: grid;
2742
2713
  grid-template-columns: 5rem minmax(0, 1fr) 11rem 11rem 17rem;
2743
2714
  align-items: center;
@@ -2816,7 +2787,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
2816
2787
  .score { display: none; }
2817
2788
  .chips { display: none; }
2818
2789
  }
2819
- `,gj=({media:e,to:t})=>{let n=fj(),r=um(e.covers),i=e.covers?.find(e=>e.color)?.color,a=sj(rj(e,n)??0,1),o=e.nextAiringEpisode?.episodeNumber;return I(Fo,{to:t,css:hj,style:oj(i),children:[L(`div`,{className:`cover`,style:r?{backgroundImage:`url(${r})`}:void 0}),I(`div`,{className:`heading`,children:[L(`div`,{className:`title`,children:e.titles?.at(0)?.title}),L(`div`,{className:`chips`,children:e.genres?.slice(0,5).map(e=>L(`span`,{className:`chip`,children:e.toLowerCase()},e))})]}),I(`div`,{className:`column score`,children:[e.averageScore!=null&&L(zk,{percent:e.averageScore,size:17}),e.popularity!=null&&I(`span`,{className:`secondary`,children:[e.popularity.toLocaleString(),` users`]})]}),I(`div`,{className:`column format`,children:[L(`span`,{children:Fs(e.type)}),e.episodeCount!=null&&L(`span`,{className:`secondary`,children:ij(e.episodeCount)})]}),I(`div`,{className:`column`,children:[L(`span`,{children:Is(e.status)}),a&&o!=null&&I(`span`,{className:`secondary airing`,children:[`Ep `,o,` airing in `,a]})]})]})},_j=[{value:`grid`,label:`Covers`},{value:`card`,label:`Cards`},{value:`list`,label:`List`}],vj=`grid`,yj=`stub-search-display-mode`,bj=_j.map(e=>e.value),xj=e=>bj.includes(e)?e:vj,Sj=()=>{try{return globalThis.localStorage}catch{return}},Cj=(e=Sj())=>{try{return xj(e?.getItem(yj))}catch{return vj}},wj=(e,t=Sj())=>{try{t?.setItem(yj,e)}catch{}},Tj={grid:Dc,card:Ec,list:Oc},Ej=l`
2790
+ `,_j=({media:e,to:t})=>{let n=pj(),r=Vp(e.covers),i=e.covers?.find(e=>e.color)?.color,a=cj(ij(e,n)??0,1),o=e.nextAiringEpisode?.episodeNumber;return I(Fo,{to:t,css:gj,style:sj(i),children:[L(`div`,{className:`cover`,style:r?{backgroundImage:`url(${r})`}:void 0}),I(`div`,{className:`heading`,children:[L(`div`,{className:`title`,children:e.titles?.at(0)?.title}),L(`div`,{className:`chips`,children:e.genres?.slice(0,5).map(e=>L(`span`,{className:`chip`,children:e.toLowerCase()},e))})]}),I(`div`,{className:`column score`,children:[e.averageScore!=null&&L(Bk,{percent:e.averageScore,size:17}),e.popularity!=null&&I(`span`,{className:`secondary`,children:[e.popularity.toLocaleString(),` users`]})]}),I(`div`,{className:`column format`,children:[L(`span`,{children:Ps(e.type)}),e.episodeCount!=null&&L(`span`,{className:`secondary`,children:aj(e.episodeCount)})]}),I(`div`,{className:`column`,children:[L(`span`,{children:Fs(e.status)}),a&&o!=null&&I(`span`,{className:`secondary airing`,children:[`Ep `,o,` airing in `,a]})]})]})},vj=[{value:`grid`,label:`Covers`},{value:`card`,label:`Cards`},{value:`list`,label:`List`}],yj=`grid`,bj=`stub-search-display-mode`,xj=vj.map(e=>e.value),Sj=e=>xj.includes(e)?e:yj,Cj=()=>{try{return globalThis.localStorage}catch{return}},wj=(e=Cj())=>{try{return Sj(e?.getItem(bj))}catch{return yj}},Tj=(e,t=Cj())=>{try{t?.setItem(bj,e)}catch{}},Ej={grid:Ec,card:Tc,list:Dc},Dj=l`
2820
2791
  display: inline-flex;
2821
2792
  gap: 0.4rem;
2822
2793
  padding: 0.4rem;
@@ -2843,7 +2814,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
2843
2814
  background: rgba(255, 255, 255, 0.12);
2844
2815
  color: #fff;
2845
2816
  }
2846
- `,Dj=({mode:e,onChange:t})=>L(`div`,{css:Ej,role:`group`,"aria-label":`Result layout`,children:_j.map(n=>{let r=Tj[n.value];return L(`button`,{type:`button`,title:n.label,"aria-label":n.label,"aria-pressed":e===n.value,onClick:()=>t(n.value),children:L(r,{size:18})},n.value)})});H();var Oj=l`
2817
+ `,Oj=({mode:e,onChange:t})=>L(`div`,{css:Dj,role:`group`,"aria-label":`Result layout`,children:vj.map(n=>{let r=Ej[n.value];return L(`button`,{type:`button`,title:n.label,"aria-label":n.label,"aria-pressed":e===n.value,onClick:()=>t(n.value),children:L(r,{size:18})},n.value)})});H();var kj=l`
2847
2818
  display: flex;
2848
2819
  flex-direction: column;
2849
2820
  gap: 0.7rem;
@@ -2892,8 +2863,8 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
2892
2863
  }
2893
2864
 
2894
2865
  .control.open .chevron { transform: rotate(180deg); }
2895
- `,kj=l`
2896
- z-index: ${ff.filterMenu};
2866
+ `,Aj=l`
2867
+ z-index: ${df.filterMenu};
2897
2868
  width: max-content;
2898
2869
  min-width: 22rem;
2899
2870
  max-width: 34rem;
@@ -2966,7 +2937,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
2966
2937
  font-size: 1.4rem;
2967
2938
  color: rgba(255, 255, 255, 0.4);
2968
2939
  }
2969
- `,Aj=({label:e,placeholder:t=`Any`,options:n,selected:r,onChange:i,multiple:a=!1,searchable:o=!1,allowCustom:s=!1})=>{let[c,l]=V(!1),[u,d]=V(``),f=`filter-${e.toLowerCase().replace(/[^a-z]+/g,`-`)}`,{refs:p,floatingStyles:m,context:h}=Kd({open:c,onOpenChange:e=>{l(e),e||d(``)},placement:`bottom-start`,whileElementsMounted:he,middleware:[wu(6),Eu({padding:8}),Tu({padding:8}),Du({padding:8,apply:({availableHeight:e,elements:t})=>{t.floating.style.maxHeight=`${Math.max(160,e)}px`}})]}),{getReferenceProps:g,getFloatingProps:_}=Jd([Bd(h),Wd(h),Xd(h,{role:`listbox`})]),v=r.map(e=>n.find(t=>t.value===e)?.label??e).join(`, `),y=D(()=>{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=>{if(!a){i(r.includes(e)?[]:[e]),l(!1),d(``);return}i(r.includes(e)?r.filter(t=>t!==e):[...r,e])};return I(`div`,{css:Oj,children:[L(`span`,{className:`label`,id:f,children:e}),I(`button`,{ref:p.setReference,type:`button`,className:c?`control open`:`control`,"aria-labelledby":f,...g(),children:[L(`span`,{className:r.length?`value`:`value any`,children:r.length?v:t}),L(bc,{size:16,className:`chevron`})]}),c&&L(bd,{children:L(jd,{context:h,modal:!1,initialFocus:o?0:-1,children:I(`div`,{ref:p.setFloating,css:kj,style:m,..._(),children:[o&&I(`div`,{className:`filter`,children:[L(zc,{size:15}),L(`input`,{type:`text`,value:u,placeholder:`Filter ${e.toLowerCase()}`,"aria-label":`Filter ${e.toLowerCase()}`,onInput:e=>d(e.currentTarget.value)})]}),L(`div`,{className:`options`,children:y.length?y.map(e=>I(`button`,{type:`button`,role:`option`,"aria-selected":r.includes(e.value),className:r.includes(e.value)?`option selected`:`option`,onClick:()=>b(e.value),children:[L(yc,{size:16,className:r.includes(e.value)?`tick`:`tick hidden`}),L(`span`,{children:e.label})]},e.value)):I(`div`,{className:`empty`,children:[`Nothing matches “`,u,`”.`]})})]})})})]})},jj=({label:e,children:t})=>I(`div`,{css:Oj,children:[L(`span`,{className:`label`,children:e}),t]});H();var Mj=_p(`
2940
+ `,jj=({label:e,placeholder:t=`Any`,options:n,selected:r,onChange:i,multiple:a=!1,searchable:o=!1,allowCustom:s=!1})=>{let[c,l]=V(!1),[u,d]=V(``),f=`filter-${e.toLowerCase().replace(/[^a-z]+/g,`-`)}`,{refs:p,floatingStyles:m,context:h}=Gd({open:c,onOpenChange:e=>{l(e),e||d(``)},placement:`bottom-start`,whileElementsMounted:he,middleware:[Cu(6),Tu({padding:8}),wu({padding:8}),Eu({padding:8,apply:({availableHeight:e,elements:t})=>{t.floating.style.maxHeight=`${Math.max(160,e)}px`}})]}),{getReferenceProps:g,getFloatingProps:_}=qd([zd(h),Ud(h),Yd(h,{role:`listbox`})]),v=r.map(e=>n.find(t=>t.value===e)?.label??e).join(`, `),y=D(()=>{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=>{if(!a){i(r.includes(e)?[]:[e]),l(!1),d(``);return}i(r.includes(e)?r.filter(t=>t!==e):[...r,e])};return I(`div`,{css:kj,children:[L(`span`,{className:`label`,id:f,children:e}),I(`button`,{ref:p.setReference,type:`button`,className:c?`control open`:`control`,"aria-labelledby":f,...g(),children:[L(`span`,{className:r.length?`value`:`value any`,children:r.length?v:t}),L(yc,{size:16,className:`chevron`})]}),c&&L(yd,{children:L(Ad,{context:h,modal:!1,initialFocus:o?0:-1,children:I(`div`,{ref:p.setFloating,css:Aj,style:m,..._(),children:[o&&I(`div`,{className:`filter`,children:[L(Rc,{size:15}),L(`input`,{type:`text`,value:u,placeholder:`Filter ${e.toLowerCase()}`,"aria-label":`Filter ${e.toLowerCase()}`,onInput:e=>d(e.currentTarget.value)})]}),L(`div`,{className:`options`,children:y.length?y.map(e=>I(`button`,{type:`button`,role:`option`,"aria-selected":r.includes(e.value),className:r.includes(e.value)?`option selected`:`option`,onClick:()=>b(e.value),children:[L(vc,{size:16,className:r.includes(e.value)?`tick`:`tick hidden`}),L(`span`,{children:e.label})]},e.value)):I(`div`,{className:`empty`,children:[`Nothing matches “`,u,`”.`]})})]})})})]})},Mj=({label:e,children:t})=>I(`div`,{css:kj,children:[L(`span`,{className:`label`,children:e}),t]});H();var Nj=gp(`
2970
2941
  subscription SearchMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
2971
2942
  mediaPage(input: $input) {
2972
2943
  nodes {
@@ -3013,7 +2984,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3013
2984
  }
3014
2985
  }
3015
2986
  }
3016
- `),Nj=l`
2987
+ `),Pj=l`
3017
2988
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
3018
2989
  min-height: 100vh;
3019
2990
 
@@ -3150,7 +3121,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3150
3121
  gap: 1.2rem;
3151
3122
  }
3152
3123
  }
3153
- `,Pj=(()=>{let e=[];for(let t=Ds();t>=Es;t--)e.push({value:String(t),label:String(t)});return e})(),Fj=e=>({...e.query?{search:e.query}:{sorts:[Ko.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}:{}}),Ij=()=>{let e=Oo(),[,t]=Do(),n=D(()=>ks(e),[e]),r=Rs(n),i=zs(n),a=e=>t(Ns({...n,...e}),{replace:!0}),[o,s]=V(n.query),c=w(null);N(()=>{document.activeElement!==c.current&&s(e=>e.trim()===n.query?e:n.query)},[n.query]),N(()=>{if(o.trim()===n.query)return;let e=setTimeout(()=>a({query:o}),350);return()=>clearTimeout(e)},[o,e]);let l=D(()=>Fj(n),[n]),[{data:u}]=sr({query:Mj,variables:{input:l,shortDescriptionInput:{count:1}},pause:!i}),[d,f]=V(Cj),p=e=>{f(e),wj(e)},[m,h]=V(!1);N(()=>{h(!1);let e=setTimeout(()=>h(!0),5e3);return()=>clearTimeout(e)},[e]);let g=w(u),_=w(l);u!==g.current&&(g.current=u,_.current=l);let v=i&&_.current===l?u?.mediaPage?.nodes??[]:[],{genreOptions:y,tagOptions:b,genreKeys:x}=D(()=>{let e=new Map(gs.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);for(let n of v){for(let t of n.genres??[])e.has(t.toLowerCase())||e.set(t.toLowerCase(),t);for(let r of n.tags??[])!e.has(r.toLowerCase())&&!t.has(r.toLowerCase())&&t.set(r.toLowerCase(),r)}let r=(e,t)=>e.localeCompare(t);return{genreKeys:new Set(e.keys()),genreOptions:[...e.values()].sort(r).map(e=>({value:e,label:e})),tagOptions:[...t.values()].sort(r).map(e=>({value:e,label:e}))}},[v,n.genres,n.tags]),S=[...n.genres,...n.tags],C=e=>x.has(e.toLowerCase())||vs(e),T=e=>a({genres:e.filter(C),tags:e.filter(e=>!C(e))}),E={grid:{className:`grid`,item:e=>L(fm,{media:e,to:Ho(Y.MEDIA,{uri:e.uri}),ellipsis:!1},e._id)},card:{className:`cards`,item:e=>L(mj,{media:e,to:Ho(Y.MEDIA,{uri:e.uri})},e._id)},list:{className:`rows`,item:e=>L(gj,{media:e,to:Ho(Y.MEDIA,{uri:e.uri})},e._id)}}[d],O=[...n.year?[{key:`year`,label:String(n.year),clear:{year:null}}]:[],...n.season?[{key:`season`,label:ms.find(e=>e.value===n.season).label,clear:{season:null}}]:[],...n.status?[{key:`status`,label:ps.find(e=>e.value===n.status).label,clear:{status:null}}]:[],...n.category?[{key:`category`,label:hs.find(e=>e.value===n.category).label,clear:{category:null}}]:[],...n.formats.map(e=>({key:`format:${e}`,label:fs.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 I(`div`,{css:Nj,children:[I(`div`,{className:`heading-row`,children:[L(`div`,{className:`heading`,children:Ps(n)}),L(Dj,{mode:d,onChange:p})]}),I(`div`,{className:`filters`,children:[L(jj,{label:`Search`,children:I(`div`,{className:`text-field`,children:[L(zc,{size:17}),L(`input`,{ref:c,type:`text`,value:o,placeholder:`Any title`,"aria-label":`Search by title`,onInput:e=>s(e.currentTarget.value)})]})}),L(Aj,{label:`Genres & Tags`,options:[...y,...b],selected:S,onChange:T,multiple:!0,searchable:!0,allowCustom:!0}),L(Aj,{label:`Year`,options:Pj,selected:n.year?[String(n.year)]:[],onChange:e=>a({year:e.length?Number(e[0]):null}),searchable:!0}),L(Aj,{label:`Season`,options:ms,selected:n.season?[n.season]:[],onChange:e=>a({season:e[0]??null})}),L(Aj,{label:`Format`,options:fs,selected:n.formats,onChange:e=>a({formats:e}),multiple:!0}),L(Aj,{label:`Airing Status`,options:ps,selected:n.status?[n.status]:[],onChange:e=>a({status:e[0]??null})}),L(Aj,{label:`Category`,options:hs,selected:n.category?[n.category]:[],onChange:e=>a({category:e[0]??null})})]}),I(`div`,{className:`chips`,children:[O.map(e=>I(`button`,{type:`button`,className:`chip`,"aria-label":`Remove ${e.label}`,onClick:()=>a(e.clear),children:[e.label,L(Zc,{size:14})]},e.key)),O.length>1&&L(`button`,{type:`button`,className:`chip-clear`,onClick:()=>a({category:null,status:null,season:null,year:null,formats:[],genres:[],tags:[]}),children:`Clear filters`})]}),v.length?L(`div`,{className:E.className,children:v.map(E.item)}):i?L(`div`,{className:`status`,children:m?`No results found.`:`Searching…`}):r?L(`div`,{className:`status`,children:`Add a title, a season, a year, a format or a genre to browse.`}):L(`div`,{className:`status`,children:`Search by title, or pick a filter to browse.`})]})},Lj=l`
3124
+ `,Fj=(()=>{let e=[];for(let t=Es();t>=Ts;t--)e.push({value:String(t),label:String(t)});return e})(),Ij=e=>({...e.query?{search:e.query}:{sorts:[Ko.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}:{}}),Lj=()=>{let e=Oo(),[,t]=Do(),n=D(()=>Os(e),[e]),r=Ls(n),i=Rs(n),a=e=>t(Ms({...n,...e}),{replace:!0}),[o,s]=V(n.query),c=w(null);N(()=>{document.activeElement!==c.current&&s(e=>e.trim()===n.query?e:n.query)},[n.query]),N(()=>{if(o.trim()===n.query)return;let e=setTimeout(()=>a({query:o}),350);return()=>clearTimeout(e)},[o,e]);let l=D(()=>Ij(n),[n]),[{data:u}]=sr({query:Nj,variables:{input:l,shortDescriptionInput:{count:1}},pause:!i}),[d,f]=V(wj),p=e=>{f(e),Tj(e)},[m,h]=V(!1);N(()=>{h(!1);let e=setTimeout(()=>h(!0),5e3);return()=>clearTimeout(e)},[e]);let g=w(u),_=w(l);u!==g.current&&(g.current=u,_.current=l);let v=i&&_.current===l?u?.mediaPage?.nodes??[]:[],{genreOptions:y,tagOptions:b,genreKeys:x}=D(()=>{let e=new Map(hs.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);for(let n of v){for(let t of n.genres??[])e.has(t.toLowerCase())||e.set(t.toLowerCase(),t);for(let r of n.tags??[])!e.has(r.toLowerCase())&&!t.has(r.toLowerCase())&&t.set(r.toLowerCase(),r)}let r=(e,t)=>e.localeCompare(t);return{genreKeys:new Set(e.keys()),genreOptions:[...e.values()].sort(r).map(e=>({value:e,label:e})),tagOptions:[...t.values()].sort(r).map(e=>({value:e,label:e}))}},[v,n.genres,n.tags]),S=[...n.genres,...n.tags],C=e=>x.has(e.toLowerCase())||_s(e),T=e=>a({genres:e.filter(C),tags:e.filter(e=>!C(e))}),E={grid:{className:`grid`,item:e=>L(pm,{media:e,to:Ho(Y.MEDIA,{uri:e.uri}),ellipsis:!1},e._id)},card:{className:`cards`,item:e=>L(hj,{media:e,to:Ho(Y.MEDIA,{uri:e.uri})},e._id)},list:{className:`rows`,item:e=>L(_j,{media:e,to:Ho(Y.MEDIA,{uri:e.uri})},e._id)}}[d],O=[...n.year?[{key:`year`,label:String(n.year),clear:{year:null}}]:[],...n.season?[{key:`season`,label:ps.find(e=>e.value===n.season).label,clear:{season:null}}]:[],...n.status?[{key:`status`,label:fs.find(e=>e.value===n.status).label,clear:{status:null}}]:[],...n.category?[{key:`category`,label:ms.find(e=>e.value===n.category).label,clear:{category:null}}]:[],...n.formats.map(e=>({key:`format:${e}`,label:ds.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 I(`div`,{css:Pj,children:[I(`div`,{className:`heading-row`,children:[L(`div`,{className:`heading`,children:Ns(n)}),L(Oj,{mode:d,onChange:p})]}),I(`div`,{className:`filters`,children:[L(Mj,{label:`Search`,children:I(`div`,{className:`text-field`,children:[L(Rc,{size:17}),L(`input`,{ref:c,type:`text`,value:o,placeholder:`Any title`,"aria-label":`Search by title`,onInput:e=>s(e.currentTarget.value)})]})}),L(jj,{label:`Genres & Tags`,options:[...y,...b],selected:S,onChange:T,multiple:!0,searchable:!0,allowCustom:!0}),L(jj,{label:`Year`,options:Fj,selected:n.year?[String(n.year)]:[],onChange:e=>a({year:e.length?Number(e[0]):null}),searchable:!0}),L(jj,{label:`Season`,options:ps,selected:n.season?[n.season]:[],onChange:e=>a({season:e[0]??null})}),L(jj,{label:`Format`,options:ds,selected:n.formats,onChange:e=>a({formats:e}),multiple:!0}),L(jj,{label:`Airing Status`,options:fs,selected:n.status?[n.status]:[],onChange:e=>a({status:e[0]??null})}),L(jj,{label:`Category`,options:ms,selected:n.category?[n.category]:[],onChange:e=>a({category:e[0]??null})})]}),I(`div`,{className:`chips`,children:[O.map(e=>I(`button`,{type:`button`,className:`chip`,"aria-label":`Remove ${e.label}`,onClick:()=>a(e.clear),children:[e.label,L(Xc,{size:14})]},e.key)),O.length>1&&L(`button`,{type:`button`,className:`chip-clear`,onClick:()=>a({category:null,status:null,season:null,year:null,formats:[],genres:[],tags:[]}),children:`Clear filters`})]}),v.length?L(`div`,{className:E.className,children:v.map(E.item)}):i?L(`div`,{className:`status`,children:m?`No results found.`:`Searching…`}):r?L(`div`,{className:`status`,children:`Add a title, a season, a year, a format or a genre to browse.`}):L(`div`,{className:`status`,children:`Search by title, or pick a filter to browse.`})]})},Rj=l`
3154
3125
  max-width: 72rem;
3155
3126
  margin: 0 auto;
3156
3127
  padding: calc(var(--stub-header-height) + 3rem) 3rem 6rem;
@@ -3189,7 +3160,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3189
3160
  color: #ff8a3d;
3190
3161
  }
3191
3162
  }
3192
- `,Rj=({children:e})=>L(`div`,{css:Lj,children:e}),zj=()=>I(Rj,{children:[L(`h1`,{children:`Legal & Terms`}),L(`div`,{className:`updated`,children:`Last updated 1 June 2026`}),L(`p`,{children:`stub is an independent, non-commercial personal project, provided “as is” without warranties of any kind.`}),L(`h2`,{children:`No hosted content`}),L(`p`,{children:`stub hosts, stores, and distributes no media of its own. All titles, descriptions, artwork, ratings, and playback streams are retrieved on demand from third-party services (including AniList, MyAnimeList, Crunchyroll, JustWatch, and Netflix) and remain the property of their respective owners. You access those services with your own accounts and are responsible for complying with their terms.`}),L(`h2`,{children:`Personal use`}),L(`p`,{children:`stub is a technical showcase of in-browser media aggregation, intended for personal, non-commercial use. It is not a content provider.`}),L(`h2`,{children:`Privacy`}),I(`p`,{children:[`stub keeps no accounts and stores no personal data. See the`,` `,L(Fo,{href:Ho(Y.PRIVACY),children:`Privacy page`}),` for what is and isn’t handled when you use it.`]}),L(`h2`,{children:`Rights holders`}),I(`p`,{children:[`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`,` `,L(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]}),L(`h2`,{children:`Liability`}),L(`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.`})]}),Bj=`stub.apikeys`,Vj=[{origin:`omdb`,name:`OMDb`,label:`OMDb API key`,getUrl:`https://www.omdbapi.com/apikey.aspx`,help:`Free tier: 1,000 requests/day; choose the "FREE" account type on the form.`},{origin:`trakt`,name:`Trakt`,label:`Trakt Client ID`,getUrl:`https://trakt.tv/oauth/applications`,help:`Create an app at trakt.tv/oauth/applications, then copy its Client ID. Free; no OAuth needed for public metadata.`},{origin:`simkl`,name:`Simkl`,label:`Simkl Client ID`,getUrl:`https://simkl.com/settings/developer/new/`,help:`Create an app under Settings → Developer and paste its Client ID. Free for non-commercial use.`},{origin:`tvdb`,name:`TheTVDB`,label:`TheTVDB API key`,getUrl:`https://www.thetvdb.com/dashboard/account/apikey`,help:`Paid/subscriber v4 key. User-supported keys also need a PIN; enter it as apikey:pin (e.g. ab12cd34:5678).`},{origin:`watchmode`,name:`Watchmode`,label:`Watchmode API key`,getUrl:`https://api.watchmode.com/requestApiKey/`,help:`Free tier: ~1,000 requests/month. Request a key on the form and paste it here.`}],Hj=`This browser, in its storage for stub at this address`,Uj=`This tab, in its storage for stub`,Wj=[{id:`api-keys`,title:`API keys`,what:`The keys you pasted for the sources that need one. Each is sent only with the requests to its own source.`,where:Hj,lasts:`Until you clear them`,keys:{store:`local`,names:[Bj]},confirm:`Clear every API key? The sources that need one stop answering until you paste it again.`},{id:`added-sources`,title:`Added sources`,what:`The source packages you added from npm, installed for stub through FKN.`,where:Hj,lasts:`Until you remove them`,keys:{store:`local`,names:[ur]},confirm:`Remove every added source? FKN uninstalls them for stub too.`},{id:`search-layout`,title:`Search layout`,what:`Whether search shows covers, cards or a list.`,where:Hj,lasts:`Until you clear it`,keys:{store:`local`,names:[yj]},confirm:`Clear the search layout? Search goes back to covers.`},{id:`quick-tracking`,title:`Quick tracking choices`,what:`Whether the tracking row opens its advanced panel, and the trackers you chose not to save to.`,where:Hj,lasts:`Until you clear them`,keys:{store:`local`,names:[qD]},confirm:`Clear your quick tracking choices? The row saves to every tracker you are signed in to again.`},{id:`connected-sites`,title:`Connected tracking sites`,what:`Which of AniList and MyAnimeList you signed in to through stub on this device, so stub reaches only those.`,where:Hj,lasts:`Until you sign out of them`,keys:{store:`local`,names:[Pe]},clearedBy:{text:`Sign out of each under Accounts.`,section:`accounts`}},{id:`party-name`,title:`Party name`,what:`The name you gave yourself in a watch party.`,where:Uj,lasts:`Until you close the tab`,keys:{store:`session`,names:[Vf]},confirm:`Clear your party name?`},{id:`party-invite`,title:`Party you are in`,what:`The watch party this tab is in, so a reload rejoins it.`,where:Uj,lasts:`Until you leave the party or close the tab`,keys:{store:`session`,names:[Bf]},clearedBy:{text:`Leave the party to forget it.`}},{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`,clearedBy:{text:`Remove an entry from its title's tracking panel. The record that it was removed stays, so any other device using the list removes it too, and there is no way to clear these records yet. Signing out of FKN takes the account's list off this device.`}},{id:`site-sign-ins`,title:`Site sign-ins`,what:`Your Crunchyroll, 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`,clearedBy:{text:`Sign out under Accounts.`,section:`accounts`}},{id:`fkn-account`,title:`FKN account`,what:`Which FKN account you are signed in with.`,where:`FKN, not stub`,lasts:`Until you disconnect`,clearedBy:{text:`Disconnect under Accounts.`,section:`accounts`}},{id:`player`,title:`Player settings`,what:`Volume, speed and captions.`,where:`Nowhere`,lasts:`Not kept: every episode starts with the player defaults`,clearedBy:{text:`Nothing to clear.`}},{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`,clearedBy:{text:`Refresh the page to clear it.`}}],Gj={local:()=>globalThis.localStorage,session:()=>globalThis.sessionStorage},Kj=(e,t)=>{if(e.keys)try{return t[e.keys.store]()}catch{return}},qj=e=>!!e.keys&&!e.clearedBy,Jj=new Set([``,`[]`,`{}`,`null`]),Yj=(e,t)=>{let n=Kj(e,t);return!!n&&e.keys.names.some(e=>{try{let t=n.getItem(e);return t!==null&&!Jj.has(t.trim())}catch{return!1}})},Xj=(e,t)=>{if(!qj(e))return;let n=Kj(e,t);for(let t of e.keys.names)try{n?.removeItem(t)}catch{}},Zj=l`
3163
+ `,zj=({children:e})=>L(`div`,{css:Rj,children:e}),Bj=()=>I(zj,{children:[L(`h1`,{children:`Legal & Terms`}),L(`div`,{className:`updated`,children:`Last updated 1 June 2026`}),L(`p`,{children:`stub is an independent, non-commercial personal project, provided “as is” without warranties of any kind.`}),L(`h2`,{children:`No hosted content`}),L(`p`,{children:`stub hosts, stores, and distributes no media of its own. All titles, descriptions, artwork, ratings, and playback streams are retrieved on demand from third-party services (including AniList, MyAnimeList, Crunchyroll, JustWatch, and Netflix) and remain the property of their respective owners. You access those services with your own accounts and are responsible for complying with their terms.`}),L(`h2`,{children:`Personal use`}),L(`p`,{children:`stub is a technical showcase of in-browser media aggregation, intended for personal, non-commercial use. It is not a content provider.`}),L(`h2`,{children:`Privacy`}),I(`p`,{children:[`stub keeps no accounts and stores no personal data. See the`,` `,L(Fo,{href:Ho(Y.PRIVACY),children:`Privacy page`}),` for what is and isn’t handled when you use it.`]}),L(`h2`,{children:`Rights holders`}),I(`p`,{children:[`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`,` `,L(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]}),L(`h2`,{children:`Liability`}),L(`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.`})]}),Vj=`stub.apikeys`,Hj=[{origin:`omdb`,name:`OMDb`,label:`OMDb API key`,getUrl:`https://www.omdbapi.com/apikey.aspx`,help:`Free tier: 1,000 requests/day; choose the "FREE" account type on the form.`},{origin:`trakt`,name:`Trakt`,label:`Trakt Client ID`,getUrl:`https://trakt.tv/oauth/applications`,help:`Create an app at trakt.tv/oauth/applications, then copy its Client ID. Free; no OAuth needed for public metadata.`},{origin:`simkl`,name:`Simkl`,label:`Simkl Client ID`,getUrl:`https://simkl.com/settings/developer/new/`,help:`Create an app under Settings → Developer and paste its Client ID. Free for non-commercial use.`},{origin:`tvdb`,name:`TheTVDB`,label:`TheTVDB API key`,getUrl:`https://www.thetvdb.com/dashboard/account/apikey`,help:`Paid/subscriber v4 key. User-supported keys also need a PIN; enter it as apikey:pin (e.g. ab12cd34:5678).`},{origin:`watchmode`,name:`Watchmode`,label:`Watchmode API key`,getUrl:`https://api.watchmode.com/requestApiKey/`,help:`Free tier: ~1,000 requests/month. Request a key on the form and paste it here.`}],Uj=`This browser, in its storage for stub at this address`,Wj=`This tab, in its storage for stub`,Gj=[{id:`api-keys`,title:`API keys`,what:`The keys you pasted for the sources that need one. Each is sent only with the requests to its own source.`,where:Uj,lasts:`Until you clear them`,keys:{store:`local`,names:[Vj]},confirm:`Clear every API key? The sources that need one stop answering until you paste it again.`},{id:`added-sources`,title:`Added sources`,what:`The source packages you added from npm, installed for stub through FKN.`,where:Uj,lasts:`Until you remove them`,keys:{store:`local`,names:[ur]},confirm:`Remove every added source? FKN uninstalls them for stub too.`},{id:`search-layout`,title:`Search layout`,what:`Whether search shows covers, cards or a list.`,where:Uj,lasts:`Until you clear it`,keys:{store:`local`,names:[bj]},confirm:`Clear the search layout? Search goes back to covers.`},{id:`quick-tracking`,title:`Quick tracking choices`,what:`Whether the tracking row opens its advanced panel, and the trackers you chose not to save to.`,where:Uj,lasts:`Until you clear them`,keys:{store:`local`,names:[JD]},confirm:`Clear your quick tracking choices? The row saves to every tracker you are signed in to again.`},{id:`connected-sites`,title:`Connected tracking sites`,what:`Which of AniList and MyAnimeList you signed in to through stub on this device, so stub reaches only those.`,where:Uj,lasts:`Until you sign out of them`,keys:{store:`local`,names:[Pe]},clearedBy:{text:`Sign out of each under Accounts.`,section:`accounts`}},{id:`party-name`,title:`Party name`,what:`The name you gave yourself in a watch party.`,where:Wj,lasts:`Until you close the tab`,keys:{store:`session`,names:[Bf]},confirm:`Clear your party name?`},{id:`party-invite`,title:`Party you are in`,what:`The watch party this tab is in, so a reload rejoins it.`,where:Wj,lasts:`Until you leave the party or close the tab`,keys:{store:`session`,names:[zf]},clearedBy:{text:`Leave the party to forget it.`}},{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`,clearedBy:{text:`Remove an entry from its title's tracking panel. The record that it was removed stays, so any other device using the list removes it too, and there is no way to clear these records yet. Signing out of FKN takes the account's list off this device.`}},{id:`site-sign-ins`,title:`Site sign-ins`,what:`Your Crunchyroll, 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`,clearedBy:{text:`Sign out under Accounts.`,section:`accounts`}},{id:`fkn-account`,title:`FKN account`,what:`Which FKN account you are signed in with.`,where:`FKN, not stub`,lasts:`Until you disconnect`,clearedBy:{text:`Disconnect under Accounts.`,section:`accounts`}},{id:`player`,title:`Player settings`,what:`Volume, speed and captions.`,where:`Nowhere`,lasts:`Not kept: every episode starts with the player defaults`,clearedBy:{text:`Nothing to clear.`}},{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`,clearedBy:{text:`Refresh the page to clear it.`}}],Kj={local:()=>globalThis.localStorage,session:()=>globalThis.sessionStorage},qj=(e,t)=>{if(e.keys)try{return t[e.keys.store]()}catch{return}},Jj=e=>!!e.keys&&!e.clearedBy,Yj=new Set([``,`[]`,`{}`,`null`]),Xj=(e,t)=>{let n=qj(e,t);return!!n&&e.keys.names.some(e=>{try{let t=n.getItem(e);return t!==null&&!Yj.has(t.trim())}catch{return!1}})},Zj=(e,t)=>{if(!Jj(e))return;let n=qj(e,t);for(let t of e.keys.names)try{n?.removeItem(t)}catch{}},Qj=l`
3193
3164
  display: flex;
3194
3165
  flex-direction: column;
3195
3166
  gap: 1rem;
@@ -3204,7 +3175,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3204
3175
 
3205
3176
  strong { color: #fff; }
3206
3177
  .facts { color: rgba(255, 255, 255, 0.55); }
3207
- `,Qj=e=>e.endsWith(`.`)?e:`${e}.`,$j=()=>I(Rj,{children:[L(`h1`,{children:`Privacy`}),L(`div`,{className:`updated`,children:`Last updated 6 October 2026`}),L(`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.`}),L(`h2`,{children:`What stub keeps`}),I(`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. Each item is listed again, with how to clear it, in`,` `,L(Fo,{to:`/settings#data`,children:`Settings, under Data`}),`.`]}),L(`ul`,{css:Zj,children:Wj.map(e=>I(`li`,{children:[I(`strong`,{children:[e.title,`.`]}),` `,e.what,` `,I(`span`,{className:`facts`,children:[`Where: `,Qj(e.where),` How long: `,Qj(e.lasts)]})]},e.id))}),L(`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.`}),L(`h2`,{children:`Sign-ins to other sites`}),I(`p`,{children:[`stub plays Crunchyroll 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 `,L(Fo,{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.`]}),L(`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.`}),L(`h2`,{children:`Network requests & third parties`}),I(`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, JustWatch, and Netflix. 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`,` `,L(`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. An API key you add is sent only with the requests to its own source.`]}),L(`h2`,{children:`The optional browser extension`}),L(`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.`}),L(`h2`,{children:`Your control`}),L(`p`,{children:`Everything above is listed in Settings, under Data, with how to clear it. Signing out of FKN 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.`}),L(`h2`,{children:`Contact`}),I(`p`,{children:[`Questions about privacy can be raised through the project repository at`,` `,L(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]})]});H();var eM=({label:e,name:t=e,confirmLabel:n,busyLabel:r,question:i,onConfirm:a,home:o})=>{let[s,c]=V(!1),[l,u]=V(!1),d=w(null),f=w(null),p=w(null),m=w(!1),h=w(!0),_=g(),v=()=>{let e=document.activeElement;return!e||e===document.body||!!p.current?.contains(e)};return N(()=>()=>{h.current=!1,p.current&&v()&&o?.current?.focus()},[]),S(()=>{s?f.current?.focus():m.current&&d.current?.focus(),m.current=!1},[s]),s?I(`div`,{ref:p,className:`confirm`,role:`group`,"aria-label":t,children:[L(`p`,{id:_,children:i}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,className:`danger`,"aria-describedby":_,disabled:l,onClick:()=>{u(!0),Promise.resolve().then(a).catch(()=>{}).finally(()=>{if(!h.current)return;let e=v();u(!1),c(!1),e&&(o?.current?o.current.focus():m.current=!0)})},children:l?r:n}),L(`button`,{ref:f,type:`button`,className:`secondary`,"aria-describedby":_,disabled:l,onClick:()=>{m.current=!0,c(!1)},children:`Cancel`})]})]}):L(`button`,{ref:d,type:`button`,className:`secondary`,"aria-label":t===e?void 0:t,onClick:()=>c(!0),children:e})};H();var tM=`https://fkn.app/account`,nM=e=>e instanceof Error?e.message:String(e),rM=(e,t)=>{switch(t){case`authed`:return{text:`Signed in to ${e}.`};case`closed`:return{text:`The sign-in window closed. If you finished signing in there, stub reads it from now on.`};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 your browser's own ${e} session.`}}},iM=({id:e,title:t,state:n,on:r,heading:i,children:a})=>I(`div`,{className:`row account`,"data-account":e,children:[I(`div`,{className:`head`,children:[L(`h3`,{ref:i,tabIndex:-1,children:t}),n?L(`span`,{className:`state${r?` on`:``}`,children:n}):void 0]}),a]}),aM=({note:e})=>L(`p`,{className:`note${e?.error?` error`:``}`,role:`status`,children:e?.text}),oM=()=>{let e=w(!0);return N(()=>()=>{e.current=!1},[]),e},sM=({account:e,onChange:t})=>{let[n,r]=V(),i=oM(),a=w(null),{info:o,ready:s}=e;return I(iM,{id:`fkn`,title:`FKN account`,state:s?o?void 0:`Not connected`:`Checking...`,heading:a,children:[o?I(`p`,{children:[`Signed in as `,L(`strong`,{children:o.name||`your account`}),`, `,o.premium?`Premium`:`Free`,`. stub runs on FKN, and can keep its list in your account, encrypted in this browser first.`]}):L(`p`,{children:`stub runs on FKN. Connect with the button at the top of the page to keep stub's list in your FKN account.`}),o?I(`div`,{className:`actions`,children:[L(`a`,{className:`link`,href:tM,target:`_blank`,rel:`noreferrer`,children:`Manage on fkn.app`}),L(eM,{label:`Disconnect`,name:`Disconnect your FKN account`,home:a,confirmLabel:`Yes, disconnect`,busyLabel:`Disconnecting...`,question:`Disconnect your FKN account? If stub keeps its list in your account, that list leaves this device, and any list changes this device has not sent to the account yet are lost.`,onConfirm:()=>(r(void 0),e.logout().then(e=>{i.current&&(e===`timeout`&&r({text:`FKN did not answer, so stub cannot tell whether you were disconnected. Try again.`,error:!0}),t?.())}))})]}):void 0,L(aM,{note:n})]})},cM=`Without the FKN extension, the session is kept by FKN, in the cookie jar every fkn.app app shares, and not by stub.`,lM=e=>`${e} itself is not told, so the session stays valid there until it expires, held by nobody.`,uM=({backend:e,crunchyroll:t})=>{let[n,r]=V(!1),[i,a]=V(),o=oM(),s=w(null);return I(iM,{id:`crunchyroll`,title:`Crunchyroll`,heading:s,children:[L(`p`,{children:`Plays Crunchyroll episodes on your own Crunchyroll account.`}),e===`cloud`?I(B,{children:[I(`p`,{children:[cM,` stub does not check it here, since that loads a Crunchyroll page: the player says when you are signed out.`]}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,disabled:n,onClick:()=>{let e=t.signIn();r(!0),a(void 0),e.then(e=>{o.current&&a(rM(`Crunchyroll`,e))}).catch(e=>{o.current&&a({text:nM(e),error:!0})}).finally(()=>{o.current&&r(!1)})},children:n?`Signing in...`:`Sign in`}),L(eM,{label:`Sign out`,name:`Sign out of Crunchyroll`,home:s,confirmLabel:`Yes, sign out`,busyLabel:`Signing out...`,question:`Sign out of Crunchyroll? This removes its cookies from FKN's jar, which signs every fkn.app app out of Crunchyroll. ${lM(`Crunchyroll`)}`,onConfirm:()=>t.signOut().then(()=>{o.current&&a({text:`Signed out. FKN no longer holds a Crunchyroll session for fkn.app apps.`})},e=>{o.current&&a({text:`FKN could not remove the Crunchyroll cookies: ${nM(e)}. Try again.`,error:!0})})})]})]}):e===`extension`?I(B,{children:[L(`p`,{children:`With the FKN extension, stub plays it on your browser's own crunchyroll.com session and keeps nothing of it. Sign in and out on crunchyroll.com.`}),L(`div`,{className:`actions`,children:L(`a`,{className:`link`,href:`https://www.crunchyroll.com`,target:`_blank`,rel:`noreferrer`,children:`Open crunchyroll.com`})})]}):L(`p`,{children:`Checking whether the FKN extension runs here...`}),L(aM,{note:i})]})},dM=[{site:`anilist`,name:`AniList`,host:`anilist.co`},{site:`mal`,name:`MyAnimeList`,host:`myanimelist.net`}],fM=({site:e,name:t,host:n,backend:r,sites:i,onChange:a})=>{let[o,s]=V(()=>i.isConnected(e)),[c,l]=V(!1),[u,d]=V(),f=oM(),p=w(null);N(()=>(s(i.isConnected(e)),i.watch(e,()=>{f.current&&s(i.isConnected(e))})),[i,e]);let m=()=>{f.current&&(s(i.isConnected(e)),a?.())},h=()=>{let n=i.signIn(e);l(!0),d(void 0),n.then(e=>{f.current&&d(rM(t,e))}).catch(e=>{f.current&&d({text:nM(e),error:!0})}).finally(()=>{f.current&&l(!1),m()})},g=r=>i.signOut(e,r).then(()=>{f.current&&d({text:r===`cloud`?`Signed out. stub no longer uses ${t} on this device, and FKN no longer holds its session.`:`Disconnected. To sign out of ${t} itself, sign out on ${n}.`}),m()},e=>{f.current&&d({text:`Disconnected on this device, but FKN could not remove the ${t} cookies: ${nM(e)}. Sign in and out again to retry.`,error:!0}),m()});return I(iM,{id:e,title:t,state:o?`Connected on this device`:`Not connected`,on:o,heading:p,children:[I(`p`,{children:[`Tracks your `,t,` list with your own `,n,` session.`,` `,r===`cloud`?cM:r===`extension`?`With the FKN extension, stub uses your browser's own ${n} session.`:``]}),r?L(`div`,{className:`actions`,children:o?L(eM,{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}? stub stops using it on this device, and its cookies leave FKN's jar, which signs every fkn.app app out of ${t}. ${lM(t)}`:`Disconnect ${t}? stub stops using your ${n} session on this device. You stay signed in on ${n}.`,onConfirm:()=>g(r)}):L(`button`,{type:`button`,disabled:c,onClick:h,children:c?`Signing in...`:r===`cloud`?`Sign in`:`Connect`})}):void 0,L(aM,{note:u})]})},pM=({backend:e})=>L(iM,{id:`netflix`,title:`Netflix`,children:e===`extension`?I(B,{children:[L(`p`,{children:`stub plays Netflix on your browser's own netflix.com session, through the FKN extension, and keeps nothing of it. Sign in and out on netflix.com.`}),L(`div`,{className:`actions`,children:L(`a`,{className:`link`,href:`https://www.netflix.com`,target:`_blank`,rel:`noreferrer`,children:`Open netflix.com`})})]}):L(`p`,{children:`Netflix needs the FKN browser extension: stub plays it on your browser's own netflix.com session, and keeps nothing of it.`})}),mM=({account:e,backend:t,crunchyroll:n,sites:r,onChange:i})=>I(`div`,{className:`rows`,children:[L(sM,{account:e,onChange:i}),L(uM,{backend:t,crunchyroll:n}),dM.map(e=>L(fM,{...e,backend:t,sites:r,onChange:i},e.site)),L(pM,{backend:t})]}),hM=()=>{try{let e=localStorage.getItem(Bj);return e?JSON.parse(e):{}}catch{return{}}},gM=(e=hM())=>qe(e),_M=e=>{let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e));return localStorage.setItem(Bj,JSON.stringify(t)),gM(t)},vM=()=>{try{localStorage.removeItem(Bj)}catch{}return gM({})},yM={"api-keys":()=>{vM()},"added-sources":()=>{Mr()},"party-name":()=>Z.setName(void 0)},bM=[{id:`accounts`,title:`Accounts`},{id:`sources`,title:`Sources`},{id:`tracking`,title:`Tracking`},{id:`playback`,title:`Playback`},{id:`data`,title:`Data`}],xM=e=>bM.find(t=>`#${t.id}`===e)?.id;H();var SM=e=>bM.find(t=>t.id===e)?.title,CM=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e,wM=({item:e,stores:t,clearers:n,onCleared:r,onClear:i})=>{let a=Yj(e,t),o=w(null);return I(`div`,{className:`row`,"data-stored":e.id,children:[I(`div`,{className:`head`,children:[L(`h3`,{ref:o,tabIndex:-1,children:e.title}),e.keys&&!a?L(`span`,{className:`state`,children:`Nothing kept`}):void 0]}),L(`p`,{children:e.what}),I(`dl`,{className:`facts`,children:[L(`dt`,{children:`Where`}),L(`dd`,{children:e.where}),L(`dt`,{children:`How long`}),L(`dd`,{children:e.lasts})]}),qj(e)?a?L(`div`,{className:`actions`,children:L(eM,{label:`Clear`,name:`Clear ${CM(e.title)}`,confirmLabel:`Yes, clear`,busyLabel:`Clearing...`,question:e.confirm??`Clear ${CM(e.title)}?`,onConfirm:async()=>{let a=n?.[e.id];a?await a():Xj(e,t),r?.(e.id),i()},home:o})}):void 0:I(`p`,{className:`cleared-by`,children:[e.clearedBy?.text,e.clearedBy?.section?I(B,{children:[` `,I(`a`,{className:`link`,href:`#${e.clearedBy.section}`,children:[`Go to `,SM(e.clearedBy.section)]})]}):void 0]})]})},TM=({stores:e,clearers:t,onCleared:n})=>{let[,r]=V(0),i=()=>r(e=>e+1);return L(`div`,{className:`rows`,children:Wj.map(r=>L(wM,{item:r,stores:e,clearers:t,onCleared:n,onClear:i},r.id))})},EM=[{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:`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:`omdb`,name:`OMDb`,url:`https://www.omdbapi.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:`imdb`,name:`IMDb`,url:`https://www.imdb.com`},{origin:`watchmode`,name:`Watchmode`,url:`https://www.watchmode.com`}];H();var DM=l`
3178
+ `,$j=e=>e.endsWith(`.`)?e:`${e}.`,eM=()=>I(zj,{children:[L(`h1`,{children:`Privacy`}),L(`div`,{className:`updated`,children:`Last updated 6 October 2026`}),L(`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.`}),L(`h2`,{children:`What stub keeps`}),I(`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. Each item is listed again, with how to clear it, in`,` `,L(Fo,{to:`/settings#data`,children:`Settings, under Data`}),`.`]}),L(`ul`,{css:Qj,children:Gj.map(e=>I(`li`,{children:[I(`strong`,{children:[e.title,`.`]}),` `,e.what,` `,I(`span`,{className:`facts`,children:[`Where: `,$j(e.where),` How long: `,$j(e.lasts)]})]},e.id))}),L(`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.`}),L(`h2`,{children:`Sign-ins to other sites`}),I(`p`,{children:[`stub plays Crunchyroll 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 `,L(Fo,{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.`]}),L(`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.`}),L(`h2`,{children:`Network requests & third parties`}),I(`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, JustWatch, and Netflix. 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`,` `,L(`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. An API key you add is sent only with the requests to its own source.`]}),L(`h2`,{children:`The optional browser extension`}),L(`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.`}),L(`h2`,{children:`Your control`}),L(`p`,{children:`Everything above is listed in Settings, under Data, with how to clear it. Signing out of FKN 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.`}),L(`h2`,{children:`Contact`}),I(`p`,{children:[`Questions about privacy can be raised through the project repository at`,` `,L(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]})]});H();var tM=({label:e,name:t=e,confirmLabel:n,busyLabel:r,question:i,onConfirm:a,home:o})=>{let[s,c]=V(!1),[l,u]=V(!1),d=w(null),f=w(null),p=w(null),m=w(!1),h=w(!0),_=g(),v=()=>{let e=document.activeElement;return!e||e===document.body||!!p.current?.contains(e)};return N(()=>()=>{h.current=!1,p.current&&v()&&o?.current?.focus()},[]),S(()=>{s?f.current?.focus():m.current&&d.current?.focus(),m.current=!1},[s]),s?I(`div`,{ref:p,className:`confirm`,role:`group`,"aria-label":t,children:[L(`p`,{id:_,children:i}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,className:`danger`,"aria-describedby":_,disabled:l,onClick:()=>{u(!0),Promise.resolve().then(a).catch(()=>{}).finally(()=>{if(!h.current)return;let e=v();u(!1),c(!1),e&&(o?.current?o.current.focus():m.current=!0)})},children:l?r:n}),L(`button`,{ref:f,type:`button`,className:`secondary`,"aria-describedby":_,disabled:l,onClick:()=>{m.current=!0,c(!1)},children:`Cancel`})]})]}):L(`button`,{ref:d,type:`button`,className:`secondary`,"aria-label":t===e?void 0:t,onClick:()=>c(!0),children:e})};H();var nM=`https://fkn.app/account`,rM=e=>e instanceof Error?e.message:String(e),iM=(e,t)=>{switch(t){case`authed`:return{text:`Signed in to ${e}.`};case`closed`:return{text:`The sign-in window closed. If you finished signing in there, stub reads it from now on.`};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 your browser's own ${e} session.`}}},aM=({id:e,title:t,state:n,on:r,heading:i,children:a})=>I(`div`,{className:`row account`,"data-account":e,children:[I(`div`,{className:`head`,children:[L(`h3`,{ref:i,tabIndex:-1,children:t}),n?L(`span`,{className:`state${r?` on`:``}`,children:n}):void 0]}),a]}),oM=({note:e})=>L(`p`,{className:`note${e?.error?` error`:``}`,role:`status`,children:e?.text}),sM=()=>{let e=w(!0);return N(()=>()=>{e.current=!1},[]),e},cM=({account:e,onChange:t})=>{let[n,r]=V(),i=sM(),a=w(null),{info:o,ready:s}=e;return I(aM,{id:`fkn`,title:`FKN account`,state:s?o?void 0:`Not connected`:`Checking...`,heading:a,children:[o?I(`p`,{children:[`Signed in as `,L(`strong`,{children:o.name||`your account`}),`, `,o.premium?`Premium`:`Free`,`. stub runs on FKN, and can keep its list in your account, encrypted in this browser first.`]}):L(`p`,{children:`stub runs on FKN. Connect with the button at the top of the page to keep stub's list in your FKN account.`}),o?I(`div`,{className:`actions`,children:[L(`a`,{className:`link`,href:nM,target:`_blank`,rel:`noreferrer`,children:`Manage on fkn.app`}),L(tM,{label:`Disconnect`,name:`Disconnect your FKN account`,home:a,confirmLabel:`Yes, disconnect`,busyLabel:`Disconnecting...`,question:`Disconnect your FKN account? If stub keeps its list in your account, that list leaves this device, and any list changes this device has not sent to the account yet are lost.`,onConfirm:()=>(r(void 0),e.logout().then(e=>{i.current&&(e===`timeout`&&r({text:`FKN did not answer, so stub cannot tell whether you were disconnected. Try again.`,error:!0}),t?.())}))})]}):void 0,L(oM,{note:n})]})},lM=`Without the FKN extension, the session is kept by FKN, in the cookie jar every fkn.app app shares, and not by stub.`,uM=e=>`${e} itself is not told, so the session stays valid there until it expires, held by nobody.`,dM=({backend:e,crunchyroll:t})=>{let[n,r]=V(!1),[i,a]=V(),o=sM(),s=w(null);return I(aM,{id:`crunchyroll`,title:`Crunchyroll`,heading:s,children:[L(`p`,{children:`Plays Crunchyroll episodes on your own Crunchyroll account.`}),e===`cloud`?I(B,{children:[I(`p`,{children:[lM,` stub does not check it here, since that loads a Crunchyroll page: the player says when you are signed out.`]}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,disabled:n,onClick:()=>{let e=t.signIn();r(!0),a(void 0),e.then(e=>{o.current&&a(iM(`Crunchyroll`,e))}).catch(e=>{o.current&&a({text:rM(e),error:!0})}).finally(()=>{o.current&&r(!1)})},children:n?`Signing in...`:`Sign in`}),L(tM,{label:`Sign out`,name:`Sign out of Crunchyroll`,home:s,confirmLabel:`Yes, sign out`,busyLabel:`Signing out...`,question:`Sign out of Crunchyroll? This removes its cookies from FKN's jar, which signs every fkn.app app out of Crunchyroll. ${uM(`Crunchyroll`)}`,onConfirm:()=>t.signOut().then(()=>{o.current&&a({text:`Signed out. FKN no longer holds a Crunchyroll session for fkn.app apps.`})},e=>{o.current&&a({text:`FKN could not remove the Crunchyroll cookies: ${rM(e)}. Try again.`,error:!0})})})]})]}):e===`extension`?I(B,{children:[L(`p`,{children:`With the FKN extension, stub plays it on your browser's own crunchyroll.com session and keeps nothing of it. Sign in and out on crunchyroll.com.`}),L(`div`,{className:`actions`,children:L(`a`,{className:`link`,href:`https://www.crunchyroll.com`,target:`_blank`,rel:`noreferrer`,children:`Open crunchyroll.com`})})]}):L(`p`,{children:`Checking whether the FKN extension runs here...`}),L(oM,{note:i})]})},fM=[{site:`anilist`,name:`AniList`,host:`anilist.co`},{site:`mal`,name:`MyAnimeList`,host:`myanimelist.net`}],pM=({site:e,name:t,host:n,backend:r,sites:i,onChange:a})=>{let[o,s]=V(()=>i.isConnected(e)),[c,l]=V(!1),[u,d]=V(),f=sM(),p=w(null);N(()=>(s(i.isConnected(e)),i.watch(e,()=>{f.current&&s(i.isConnected(e))})),[i,e]);let m=()=>{f.current&&(s(i.isConnected(e)),a?.())},h=()=>{let n=i.signIn(e);l(!0),d(void 0),n.then(e=>{f.current&&d(iM(t,e))}).catch(e=>{f.current&&d({text:rM(e),error:!0})}).finally(()=>{f.current&&l(!1),m()})},g=r=>i.signOut(e,r).then(()=>{f.current&&d({text:r===`cloud`?`Signed out. stub no longer uses ${t} on this device, and FKN no longer holds its session.`:`Disconnected. To sign out of ${t} itself, sign out on ${n}.`}),m()},e=>{f.current&&d({text:`Disconnected on this device, but FKN could not remove the ${t} cookies: ${rM(e)}. Sign in and out again to retry.`,error:!0}),m()});return I(aM,{id:e,title:t,state:o?`Connected on this device`:`Not connected`,on:o,heading:p,children:[I(`p`,{children:[`Tracks your `,t,` list with your own `,n,` session.`,` `,r===`cloud`?lM:r===`extension`?`With the FKN extension, stub uses your browser's own ${n} session.`:``]}),r?L(`div`,{className:`actions`,children:o?L(tM,{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}? stub stops using it on this device, and its cookies leave FKN's jar, which signs every fkn.app app out of ${t}. ${uM(t)}`:`Disconnect ${t}? stub stops using your ${n} session on this device. You stay signed in on ${n}.`,onConfirm:()=>g(r)}):L(`button`,{type:`button`,disabled:c,onClick:h,children:c?`Signing in...`:r===`cloud`?`Sign in`:`Connect`})}):void 0,L(oM,{note:u})]})},mM=({backend:e})=>L(aM,{id:`netflix`,title:`Netflix`,children:e===`extension`?I(B,{children:[L(`p`,{children:`stub plays Netflix on your browser's own netflix.com session, through the FKN extension, and keeps nothing of it. Sign in and out on netflix.com.`}),L(`div`,{className:`actions`,children:L(`a`,{className:`link`,href:`https://www.netflix.com`,target:`_blank`,rel:`noreferrer`,children:`Open netflix.com`})})]}):L(`p`,{children:`Netflix needs the FKN browser extension: stub plays it on your browser's own netflix.com session, and keeps nothing of it.`})}),hM=({account:e,backend:t,crunchyroll:n,sites:r,onChange:i})=>I(`div`,{className:`rows`,children:[L(cM,{account:e,onChange:i}),L(dM,{backend:t,crunchyroll:n}),fM.map(e=>L(pM,{...e,backend:t,sites:r,onChange:i},e.site)),L(mM,{backend:t})]}),gM=()=>{try{let e=localStorage.getItem(Vj);return e?JSON.parse(e):{}}catch{return{}}},_M=(e=gM())=>qe(e),vM=e=>{let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e));return localStorage.setItem(Vj,JSON.stringify(t)),_M(t)},yM=()=>{try{localStorage.removeItem(Vj)}catch{}return _M({})},bM={"api-keys":()=>{yM()},"added-sources":()=>{Mr()},"party-name":()=>Z.setName(void 0)},xM=[{id:`accounts`,title:`Accounts`},{id:`sources`,title:`Sources`},{id:`tracking`,title:`Tracking`},{id:`playback`,title:`Playback`},{id:`data`,title:`Data`}],SM=e=>xM.find(t=>`#${t.id}`===e)?.id;H();var CM=e=>xM.find(t=>t.id===e)?.title,wM=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e,TM=({item:e,stores:t,clearers:n,onCleared:r,onClear:i})=>{let a=Xj(e,t),o=w(null);return I(`div`,{className:`row`,"data-stored":e.id,children:[I(`div`,{className:`head`,children:[L(`h3`,{ref:o,tabIndex:-1,children:e.title}),e.keys&&!a?L(`span`,{className:`state`,children:`Nothing kept`}):void 0]}),L(`p`,{children:e.what}),I(`dl`,{className:`facts`,children:[L(`dt`,{children:`Where`}),L(`dd`,{children:e.where}),L(`dt`,{children:`How long`}),L(`dd`,{children:e.lasts})]}),Jj(e)?a?L(`div`,{className:`actions`,children:L(tM,{label:`Clear`,name:`Clear ${wM(e.title)}`,confirmLabel:`Yes, clear`,busyLabel:`Clearing...`,question:e.confirm??`Clear ${wM(e.title)}?`,onConfirm:async()=>{let a=n?.[e.id];a?await a():Zj(e,t),r?.(e.id),i()},home:o})}):void 0:I(`p`,{className:`cleared-by`,children:[e.clearedBy?.text,e.clearedBy?.section?I(B,{children:[` `,I(`a`,{className:`link`,href:`#${e.clearedBy.section}`,children:[`Go to `,CM(e.clearedBy.section)]})]}):void 0]})]})},EM=({stores:e,clearers:t,onCleared:n})=>{let[,r]=V(0),i=()=>r(e=>e+1);return L(`div`,{className:`rows`,children:Gj.map(r=>L(TM,{item:r,stores:e,clearers:t,onCleared:n,onClear:i},r.id))})},DM=[{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:`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:`omdb`,name:`OMDb`,url:`https://www.omdbapi.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:`imdb`,name:`IMDb`,url:`https://www.imdb.com`},{origin:`watchmode`,name:`Watchmode`,url:`https://www.watchmode.com`}];H();var OM=l`
3208
3179
  .built-in {
3209
3180
  display: grid;
3210
3181
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
@@ -3262,7 +3233,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3262
3233
  .plugin .state { margin-left: auto; white-space: nowrap; }
3263
3234
  .plugin .state.error { color: #f87171; white-space: normal; }
3264
3235
  .plugins + .actions { margin-top: 1.2rem; }
3265
- `,OM=new Set(Vj.map(e=>e.origin)),kM=({keysCleared:e,onChange:t})=>{let[n,r]=V({}),[i,a]=V({}),[o,s]=V(!1),[c,l]=V(yr),[u,d]=V(``),[f,p]=V(``);return N(()=>{let e=hM();r(e),a(e)},[e]),N(()=>(l(yr()),vr(()=>{l(yr()),t()})),[t]),I(`div`,{css:DM,children:[L(`h3`,{className:`subheading`,children:`Built in`}),I(`p`,{className:`intro`,children:[`stub ships with these `,EM.length,` sources, always on. The ones that need your own key do nothing until you add it below.`]}),L(`ul`,{className:`built-in`,children:EM.map(e=>I(`li`,{"data-source":e.origin,children:[L(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:e.name}),OM.has(e.origin)?L(`span`,{className:`key${i[e.origin]?` saved`:``}`,children:i[e.origin]?`Key saved`:`Needs your key`}):void 0]},e.origin))}),L(`h3`,{className:`subheading`,children:`Your keys`}),L(`p`,{className:`intro`,children:`Keys are kept in this browser only and are sent only with the requests to their own source. Leave a field blank to keep its source off.`}),I(`form`,{className:`keys`,onSubmit:e=>{e.preventDefault(),_M(n),a(hM()),s(!0),t(),setTimeout(()=>s(!1),2e3)},children:[Vj.map(e=>I(`div`,{className:`key-field`,children:[L(`label`,{htmlFor:e.origin,children:e.label}),L(`input`,{id:e.origin,type:`password`,autoComplete:`off`,spellcheck:!1,placeholder:`Paste your ${e.name} key`,value:n[e.origin]??``,onInput:t=>r({...n,[e.origin]:t.target.value})}),I(`span`,{className:`help`,children:[e.help?`${e.help} `:``,L(`a`,{href:e.getUrl,target:`_blank`,rel:`noreferrer`,children:`Get a key →`})]})]},e.origin)),I(`div`,{className:`actions`,children:[L(`button`,{type:`submit`,children:`Save`}),o&&L(`span`,{className:`saved-note`,children:`Saved`})]})]}),L(`h3`,{className:`subheading`,children:`Added`}),L(`p`,{className:`intro`,children:`Community-made sources published on npm. They are installed through FKN, run isolated from stub, and only talk to it through a brokered connection.`}),c.length>0&&L(`div`,{className:`rows plugins`,children:c.map(e=>I(`div`,{className:`row plugin`,children:[I(`div`,{className:`info`,children:[L(`span`,{className:`name`,children:e.sources?.length?e.sources.map(e=>e.name).join(`, `):e.uri}),I(`span`,{className:`uri`,children:[e.uri,e.sources&&e.sources.length>1?` · ${e.sources.length} sources`:``,e.rejected?.length?` · ${e.rejected.length} unavailable`:``]})]}),L(`span`,{className:`state${e.state===`error`?` error`:``}`,children:e.state===`connected`?`connected`:e.state===`error`?e.error??`error`:`connecting…`}),L(`button`,{type:`button`,className:`secondary`,onClick:()=>{jr(e.uri).then(()=>l(yr()))},children:`Remove`})]},e.uri))}),L(`div`,{className:`actions`,children:L(`button`,{type:`button`,onClick:()=>{Nr().finally(()=>l(yr()))},children:`Add sources`})}),I(`form`,{className:`add-uri`,onSubmit:e=>{e.preventDefault();let t=u.trim();t&&(p(``),Ar(t).then(()=>d(``)).catch(e=>p(e instanceof Error?e.message:String(e))).finally(()=>l(yr())))},children:[L(`input`,{type:`text`,autoComplete:`off`,spellcheck:!1,"aria-label":`Add a source by address`,placeholder:`Or add one by address, e.g. npm:@banou/example or localhost:4599`,value:u,onInput:e=>d(e.target.value)}),L(`button`,{type:`submit`,children:`Add`})]}),f&&L(`p`,{className:`add-error`,children:f})]})},AM=l`
3236
+ `,kM=new Set(Hj.map(e=>e.origin)),AM=({keysCleared:e,onChange:t})=>{let[n,r]=V({}),[i,a]=V({}),[o,s]=V(!1),[c,l]=V(yr),[u,d]=V(``),[f,p]=V(``);return N(()=>{let e=gM();r(e),a(e)},[e]),N(()=>(l(yr()),vr(()=>{l(yr()),t()})),[t]),I(`div`,{css:OM,children:[L(`h3`,{className:`subheading`,children:`Built in`}),I(`p`,{className:`intro`,children:[`stub ships with these `,DM.length,` sources, always on. The ones that need your own key do nothing until you add it below.`]}),L(`ul`,{className:`built-in`,children:DM.map(e=>I(`li`,{"data-source":e.origin,children:[L(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:e.name}),kM.has(e.origin)?L(`span`,{className:`key${i[e.origin]?` saved`:``}`,children:i[e.origin]?`Key saved`:`Needs your key`}):void 0]},e.origin))}),L(`h3`,{className:`subheading`,children:`Your keys`}),L(`p`,{className:`intro`,children:`Keys are kept in this browser only and are sent only with the requests to their own source. Leave a field blank to keep its source off.`}),I(`form`,{className:`keys`,onSubmit:e=>{e.preventDefault(),vM(n),a(gM()),s(!0),t(),setTimeout(()=>s(!1),2e3)},children:[Hj.map(e=>I(`div`,{className:`key-field`,children:[L(`label`,{htmlFor:e.origin,children:e.label}),L(`input`,{id:e.origin,type:`password`,autoComplete:`off`,spellcheck:!1,placeholder:`Paste your ${e.name} key`,value:n[e.origin]??``,onInput:t=>r({...n,[e.origin]:t.target.value})}),I(`span`,{className:`help`,children:[e.help?`${e.help} `:``,L(`a`,{href:e.getUrl,target:`_blank`,rel:`noreferrer`,children:`Get a key →`})]})]},e.origin)),I(`div`,{className:`actions`,children:[L(`button`,{type:`submit`,children:`Save`}),o&&L(`span`,{className:`saved-note`,children:`Saved`})]})]}),L(`h3`,{className:`subheading`,children:`Added`}),L(`p`,{className:`intro`,children:`Community-made sources published on npm. They are installed through FKN, run isolated from stub, and only talk to it through a brokered connection.`}),c.length>0&&L(`div`,{className:`rows plugins`,children:c.map(e=>I(`div`,{className:`row plugin`,children:[I(`div`,{className:`info`,children:[L(`span`,{className:`name`,children:e.sources?.length?e.sources.map(e=>e.name).join(`, `):e.uri}),I(`span`,{className:`uri`,children:[e.uri,e.sources&&e.sources.length>1?` · ${e.sources.length} sources`:``,e.rejected?.length?` · ${e.rejected.length} unavailable`:``]})]}),L(`span`,{className:`state${e.state===`error`?` error`:``}`,children:e.state===`connected`?`connected`:e.state===`error`?e.error??`error`:`connecting…`}),L(`button`,{type:`button`,className:`secondary`,onClick:()=>{jr(e.uri).then(()=>l(yr()))},children:`Remove`})]},e.uri))}),L(`div`,{className:`actions`,children:L(`button`,{type:`button`,onClick:()=>{Nr().finally(()=>l(yr()))},children:`Add sources`})}),I(`form`,{className:`add-uri`,onSubmit:e=>{e.preventDefault();let t=u.trim();t&&(p(``),Ar(t).then(()=>d(``)).catch(e=>p(e instanceof Error?e.message:String(e))).finally(()=>l(yr())))},children:[L(`input`,{type:`text`,autoComplete:`off`,spellcheck:!1,"aria-label":`Add a source by address`,placeholder:`Or add one by address, e.g. npm:@banou/example or localhost:4599`,value:u,onInput:e=>d(e.target.value)}),L(`button`,{type:`submit`,children:`Add`})]}),f&&L(`p`,{className:`add-error`,children:f})]})},jM=l`
3266
3237
  scroll-margin-top: calc(var(--stub-header-height) + 2rem);
3267
3238
  padding-bottom: 3.2rem;
3268
3239
  margin-bottom: 3.2rem;
@@ -3417,7 +3388,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3417
3388
  }
3418
3389
 
3419
3390
  .confirm p { color: rgba(255, 255, 255, 0.9); }
3420
- `,jM={signIn:()=>Oe({url:te,domains:ue,isSignedIn:E}),signOut:()=>Xe(ue)},MM={isConnected:Ie,watch:Ze,signIn:e=>Je[e](),signOut:Me};H();var NM=l`
3391
+ `,MM={signIn:()=>Oe({url:te,domains:ue,isSignedIn:E}),signOut:()=>Xe(ue)},NM={isConnected:Ie,watch:Ze,signIn:e=>Je[e](),signOut:Me};H();var PM=l`
3421
3392
  display: grid;
3422
3393
  grid-template-columns: 17rem minmax(0, 1fr);
3423
3394
  column-gap: 4rem;
@@ -3477,7 +3448,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3477
3448
  font-size: 1.4rem;
3478
3449
  }
3479
3450
  }
3480
- `,PM=({id:e,children:t})=>I(`section`,{id:e,css:AM,"aria-labelledby":`${e}-title`,children:[L(`h2`,{id:`${e}-title`,children:bM.find(t=>t.id===e).title}),t]}),FM=()=>{let e=df(),[t,n]=V(),[r,i]=V(()=>xM(location.hash)),[a,o]=V(0),[,s]=V(0),c=U(()=>s(e=>e+1),[]);return N(()=>{let e=!1;return Ee().then(t=>{e||n(t)}),()=>{e=!0}},[]),N(()=>{let e=xM(location.hash);if(!e)return;let t=requestAnimationFrame(()=>document.getElementById(e)?.scrollIntoView({block:`start`}));return()=>cancelAnimationFrame(t)},[]),N(()=>{let e=()=>i(xM(location.hash));return addEventListener(`hashchange`,e),addEventListener(`storage`,c),()=>{removeEventListener(`hashchange`,e),removeEventListener(`storage`,c)}},[]),I(`div`,{css:NM,children:[L(`h1`,{children:`Settings`}),L(`nav`,{className:`index`,"aria-label":`Settings sections`,children:bM.map(e=>L(`a`,{href:`#${e.id}`,"aria-current":r===e.id?`true`:void 0,children:e.title},e.id))}),I(`div`,{className:`sections`,children:[I(PM,{id:`accounts`,children:[L(`p`,{className:`intro`,children:`Every account and sign-in stub uses, what it is for, and how to end it.`}),L(mM,{account:e,backend:t,crunchyroll:jM,sites:MM,onChange:c})]}),L(PM,{id:`sources`,children:L(kM,{keysCleared:a,onChange:c})}),L(PM,{id:`tracking`,children:I(`p`,{className:`intro`,children:[`Nothing to set here yet. You track a title from its own tracking panel. The AniList and MyAnimeList sign-ins are under `,L(`a`,{className:`link`,href:`#accounts`,children:`Accounts`}),`, and what stub's list keeps is under `,L(`a`,{className:`link`,href:`#data`,children:`Data`}),`.`]})}),L(PM,{id:`playback`,children:L(`p`,{className:`intro`,children:`stub does not remember the player's volume, speed or captions: every episode starts with the player's own defaults.`})}),I(PM,{id:`data`,children:[L(`p`,{className:`intro`,children:`What stub keeps about you, where and for how long. stub has no server of its own: everything here is in your browser, with FKN, or with the site it belongs to. stub at anime.fkn.app and stub inside fkn.app are two addresses, and each keeps its own copy of what is in this browser. The site sign-ins FKN keeps are one set for every fkn.app app.`}),L(TM,{stores:Gj,clearers:yM,onCleared:e=>{e===`api-keys`&&o(e=>e+1),c()}})]})]})]})},IM=e=>{let{onPlayback:t,applyPlayback:n}=e;if(!t||!n)return;let r=new Set,i=!1,a=e=>{if(!i&&kf(e))for(let t of r)t(e)},o=()=>{t(a).catch(()=>{})};return o(),{apply:e=>{n(e).catch(()=>{})},onReport:e=>(r.add(e),o(),()=>{r.delete(e)}),dispose:()=>{i=!0,r.clear()}}};H();var LM=l`
3451
+ `,FM=({id:e,children:t})=>I(`section`,{id:e,css:jM,"aria-labelledby":`${e}-title`,children:[L(`h2`,{id:`${e}-title`,children:xM.find(t=>t.id===e).title}),t]}),IM=()=>{let e=uf(),[t,n]=V(),[r,i]=V(()=>SM(location.hash)),[a,o]=V(0),[,s]=V(0),c=U(()=>s(e=>e+1),[]);return N(()=>{let e=!1;return Ee().then(t=>{e||n(t)}),()=>{e=!0}},[]),N(()=>{let e=SM(location.hash);if(!e)return;let t=requestAnimationFrame(()=>document.getElementById(e)?.scrollIntoView({block:`start`}));return()=>cancelAnimationFrame(t)},[]),N(()=>{let e=()=>i(SM(location.hash));return addEventListener(`hashchange`,e),addEventListener(`storage`,c),()=>{removeEventListener(`hashchange`,e),removeEventListener(`storage`,c)}},[]),I(`div`,{css:PM,children:[L(`h1`,{children:`Settings`}),L(`nav`,{className:`index`,"aria-label":`Settings sections`,children:xM.map(e=>L(`a`,{href:`#${e.id}`,"aria-current":r===e.id?`true`:void 0,children:e.title},e.id))}),I(`div`,{className:`sections`,children:[I(FM,{id:`accounts`,children:[L(`p`,{className:`intro`,children:`Every account and sign-in stub uses, what it is for, and how to end it.`}),L(hM,{account:e,backend:t,crunchyroll:MM,sites:NM,onChange:c})]}),L(FM,{id:`sources`,children:L(AM,{keysCleared:a,onChange:c})}),L(FM,{id:`tracking`,children:I(`p`,{className:`intro`,children:[`Nothing to set here yet. You track a title from its own tracking panel. The AniList and MyAnimeList sign-ins are under `,L(`a`,{className:`link`,href:`#accounts`,children:`Accounts`}),`, and what stub's list keeps is under `,L(`a`,{className:`link`,href:`#data`,children:`Data`}),`.`]})}),L(FM,{id:`playback`,children:L(`p`,{className:`intro`,children:`stub does not remember the player's volume, speed or captions: every episode starts with the player's own defaults.`})}),I(FM,{id:`data`,children:[L(`p`,{className:`intro`,children:`What stub keeps about you, where and for how long. stub has no server of its own: everything here is in your browser, with FKN, or with the site it belongs to. stub at anime.fkn.app and stub inside fkn.app are two addresses, and each keeps its own copy of what is in this browser. The site sign-ins FKN keeps are one set for every fkn.app app.`}),L(EM,{stores:Kj,clearers:bM,onCleared:e=>{e===`api-keys`&&o(e=>e+1),c()}})]})]})]})},LM=e=>{let{onPlayback:t,applyPlayback:n}=e;if(!t||!n)return;let r=new Set,i=!1,a=e=>{if(!i&&Of(e))for(let t of r)t(e)},o=()=>{t(a).catch(()=>{})};return o(),{apply:e=>{n(e).catch(()=>{})},onReport:e=>(r.add(e),o(),()=>{r.delete(e)}),dispose:()=>{i=!0,r.clear()}}};H();var RM=l`
3481
3452
  position: relative;
3482
3453
  width: 100%;
3483
3454
  flex: 1;
@@ -3503,7 +3474,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3503
3474
  color: rgba(255, 255, 255, 0.55);
3504
3475
  font-size: 1.4rem;
3505
3476
  }
3506
- `,RM=({pluginUri:e,release:t,onUnplayable:n,onPlayback:r})=>{let i=w(null),[a,o]=V(``),s=w({onUnplayable:n,onPlayback:r});return s.current={onUnplayable:n,onPlayback:r},N(()=>{let n=i.current;if(!n)return;let r=!1,a,c;return o(``),(async()=>{try{let i=await ye.mount(e,{iframe:n,protocol:lr});if(r){i.unmount();return}a=i;let{origin:o}=z(t.uri),l=i.remote,u=l.sources?.find(e=>e.origin===o)??l,d=await u.play?.({uri:t.uri,url:t.url});if(r)return;if(!d){i.unmount(),a=void 0,s.current.onUnplayable();return}c=IM(u),c&&s.current.onPlayback?.(c)}catch(e){if(r)return;o(e instanceof Error?e.message:String(e))}})(),()=>{r=!0,c&&(c.dispose(),s.current.onPlayback?.(void 0)),a?.unmount()}},[e,t.uri,t.url]),I(`div`,{css:LM,children:[L(`iframe`,{ref:i,sandbox:`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox`,allow:`fullscreen; autoplay; encrypted-media; cross-origin-isolated`}),a?I(`div`,{className:`failed`,children:[`This source could not start playback. `,a]}):null]})};H();var zM=({link:e})=>{let t=np(),n=t.status===`active`?t.role:void 0,r=w(void 0);return N(()=>{if(r.current=void 0,!e||!n)return;let t=e.onReport(t=>{n===`host`?(Z.setPlayback(t),Z.send({t:`playback`,s:t})):r.current&&e.apply(Ff(r.current.state,r.current.receivedAt,Date.now()),r.current.measured)});return()=>{t(),n===`host`&&Z.setPlayback(void 0)}},[n,e]),rp(t=>{if(n!==`guest`)return;let i=t.t===`playback`||t.t===`state`?t.s:void 0;if(!i)return;let a=location.pathname+location.search;if(Z.hostPath()!==a)return;let o=Z.hostClock(),s=o?{...i,at:Rf(i.at,o.offset)}:i;r.current={state:s,receivedAt:Date.now(),measured:!!o},e?.apply(s,!!o)}),null},BM=[`play`,`pause`,`seeked`,`ratechange`],VM=e=>({paused:e.paused,time:e.currentTime,rate:e.playbackRate??1,at:Date.now()}),HM=(e,t=()=>{})=>{let n=new Set,r=()=>{let t=VM(e);for(let e of n)e(t)};for(let t of BM)e.addEventListener(t,r);let i=setInterval(()=>{e.paused||r()},jf);return{apply:(t,n)=>{let r=Pf(VM(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)}),dispose:()=>{for(let t of BM)e.removeEventListener(t,r);clearInterval(i),n.clear(),t()}}},UM=e=>{let t=Qe(e,{origin:location.origin});return HM(t,()=>t.destroy())},WM=(e,t)=>t?`${e==null?``:`E${e} - `}${t}`:e==null?void 0:`Episode ${e}`;H();var GM=e=>(e??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node),KM=_p(`
3477
+ `,zM=({pluginUri:e,release:t,onUnplayable:n,onPlayback:r})=>{let i=w(null),[a,o]=V(``),s=w({onUnplayable:n,onPlayback:r});return s.current={onUnplayable:n,onPlayback:r},N(()=>{let n=i.current;if(!n)return;let r=!1,a,c;return o(``),(async()=>{try{let i=await ye.mount(e,{iframe:n,protocol:lr});if(r){i.unmount();return}a=i;let{origin:o}=z(t.uri),l=i.remote,u=l.sources?.find(e=>e.origin===o)??l,d=await u.play?.({uri:t.uri,url:t.url});if(r)return;if(!d){i.unmount(),a=void 0,s.current.onUnplayable();return}c=LM(u),c&&s.current.onPlayback?.(c)}catch(e){if(r)return;o(e instanceof Error?e.message:String(e))}})(),()=>{r=!0,c&&(c.dispose(),s.current.onPlayback?.(void 0)),a?.unmount()}},[e,t.uri,t.url]),I(`div`,{css:RM,children:[L(`iframe`,{ref:i,sandbox:`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox`,allow:`fullscreen; autoplay; encrypted-media; cross-origin-isolated`}),a?I(`div`,{className:`failed`,children:[`This source could not start playback. `,a]}):null]})};H();var BM=({link:e})=>{let t=tp(),n=t.status===`active`?t.role:void 0,r=w(void 0);return N(()=>{if(r.current=void 0,!e||!n)return;let t=e.onReport(t=>{n===`host`?(Z.setPlayback(t),Z.send({t:`playback`,s:t})):r.current&&e.apply(Pf(r.current.state,r.current.receivedAt,Date.now()),r.current.measured)});return()=>{t(),n===`host`&&Z.setPlayback(void 0)}},[n,e]),np(t=>{if(n!==`guest`)return;let i=t.t===`playback`||t.t===`state`?t.s:void 0;if(!i)return;let a=location.pathname+location.search;if(Z.hostPath()!==a)return;let o=Z.hostClock(),s=o?{...i,at:Lf(i.at,o.offset)}:i;r.current={state:s,receivedAt:Date.now(),measured:!!o},e?.apply(s,!!o)}),null},VM=[`play`,`pause`,`seeked`,`ratechange`],HM=e=>({paused:e.paused,time:e.currentTime,rate:e.playbackRate??1,at:Date.now()}),UM=(e,t=()=>{})=>{let n=new Set,r=()=>{let t=HM(e);for(let e of n)e(t)};for(let t of VM)e.addEventListener(t,r);let i=setInterval(()=>{e.paused||r()},Af);return{apply:(t,n)=>{let r=Nf(HM(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)}),dispose:()=>{for(let t of VM)e.removeEventListener(t,r);clearInterval(i),n.clear(),t()}}},WM=e=>{let t=Qe(e,{origin:location.origin});return UM(t,()=>t.destroy())},GM=(e,t)=>t?`${e==null?``:`E${e} - `}${t}`:e==null?void 0:`Episode ${e}`;H();var KM=e=>(e??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node),qM=gp(`
3507
3478
  subscription GetWatchMedia($input: MediaInput!) {
3508
3479
  media(input: $input) {
3509
3480
  _id
@@ -3564,7 +3535,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3564
3535
  }
3565
3536
  }
3566
3537
  }
3567
- `),qM=_p(`
3538
+ `),JM=gp(`
3568
3539
  subscription GetWatchOrigins($input: OriginPageInput!) {
3569
3540
  originPage(input: $input) {
3570
3541
  nodes {
@@ -3577,7 +3548,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3577
3548
  }
3578
3549
  }
3579
3550
  }
3580
- `),JM=l`
3551
+ `),YM=l`
3581
3552
  display: flex;
3582
3553
  flex-direction: column;
3583
3554
  height: 100vh;
@@ -3639,13 +3610,13 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3639
3610
  opacity: 0.6;
3640
3611
  }
3641
3612
  }
3642
- `,YM=()=>{let e=To(),t={...e,mediaUri:de(e.mediaUri),episodeUri:de(e.episodeUri),sourceUri:de(e.sourceUri)},[,n]=Do(),r=w(null),[i,a]=V(void 0),[{data:o}]=sr({query:KM,variables:{input:{uri:t.mediaUri}},pause:!t.mediaUri}),s=o?.media,c=D(()=>s?.episodes?.find(e=>e.uri&&t.episodeUri?P(oe(e.uri),oe(t.episodeUri)):!1),[s?.episodes,t.episodeUri]),u=D(()=>c?.uri?k(c.uri)?.handleUrisValues:void 0,[c?.uri]),d=D(()=>u&&[...new Set(u.map(e=>e.origin))],[u]),[{data:f}]=sr({query:qM,variables:{input:{ids:d,filters:[Yo.IsNotApiOnly]}},pause:!d}),p=t.sourceUri,m=s?.titles?.at(0)?.title,h=c?.titles?.at(0)?.title,g=c?.episodeNumber,_=WM(g,h),v=D(()=>{if(!p)return;let e=GM(c?.handles).find(e=>e.uri===p);if(!e)return;if(e.embedUrl)return e.embedUrl;let{origin:n}=z(p);if(!OA(n)||!e.url)return;let r=new URLSearchParams({mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:p,url:e.url});return`${new URL(`../embed.html`,import.meta.url).href}?${r}`},[p,c?.handles,t.mediaUri,t.episodeUri]),y=(f?.originPage?.nodes??[]).map(e=>e.id).join(`,`),[b,x]=V({}),[S,C]=V({});N(()=>{let e=!1,t=y?y.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(Ge),n(Fe)]).then(([t,n])=>{e||(x(t),C(n))}).catch(()=>{}),()=>{e=!0}},[y]);let T=D(()=>{if(!p)return;let{origin:e}=z(p),t=S[e];if(!t)return;let n=GM(c?.handles).find(e=>e.uri===p);return{pluginUri:t,release:{uri:p,url:n?.url??void 0}}},[p,S,c?.handles]),[E,O]=V();N(()=>{O(void 0)},[p]);let A=!!(T&&E!==p);N(()=>{let e=r.current;if(A||!v||!e)return;let t=UM(e);return a(t),()=>{t.dispose(),a(void 0)}},[A,v]),N(()=>{let e=r.current;if(!A&&v&&e&&_)return ae(e,_)},[A,v,_]);let j=D(()=>(f?.originPage?.nodes??[]).map(e=>{let n=GM(c?.handles).filter(t=>t.origin===e.id),r=!!S[e.id],i=t=>!!(t?.embedUrl||r||OA(e.id)&&t?.url),a=e=>Ho(Y.WATCH,{mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:e}),o=n.map(e=>({uri:e.uri,label:e.shortDescriptions?.at(0)?.shortDescription??e.titles?.at(0)?.title??z(e.uri).id,href:i(e)?a(e.uri):e.url??void 0,external:!i(e),active:p===e.uri})),s=n.at(0);return{id:e.id,name:e.name??e.id,icon:e.icon,color:e.color,href:s?o.at(0)?.href:void 0,external:!s||!i(s),active:o.some(e=>e.active),releases:o.length>1?o:void 0,picker:b[e.id]?{pluginUri:b[e.id]}:void 0}}),[f,c?.handles,t.mediaUri,t.episodeUri,p,b,S]);return L(`div`,{css:JM,children:I(`div`,{className:`watch-container`,children:[A&&T?L(RM,{pluginUri:T.pluginUri,release:T.release,onUnplayable:()=>O(p),onPlayback:a}):v?L(`iframe`,{ref:r,src:v,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`,css:l`
3613
+ `,XM=()=>{let e=To(),t={...e,mediaUri:de(e.mediaUri),episodeUri:de(e.episodeUri),sourceUri:de(e.sourceUri)},[,n]=Do(),r=w(null),[i,a]=V(void 0),[{data:o}]=sr({query:qM,variables:{input:{uri:t.mediaUri}},pause:!t.mediaUri}),s=o?.media,c=D(()=>s?.episodes?.find(e=>e.uri&&t.episodeUri?P(oe(e.uri),oe(t.episodeUri)):!1),[s?.episodes,t.episodeUri]),u=D(()=>c?.uri?k(c.uri)?.handleUrisValues:void 0,[c?.uri]),d=D(()=>u&&[...new Set(u.map(e=>e.origin))],[u]),[{data:f}]=sr({query:JM,variables:{input:{ids:d,filters:[Yo.IsNotApiOnly]}},pause:!d}),p=t.sourceUri,m=s?.titles?.at(0)?.title,h=c?.titles?.at(0)?.title,g=c?.episodeNumber,_=GM(g,h),v=D(()=>{if(!p)return;let e=KM(c?.handles).find(e=>e.uri===p);if(!e)return;if(e.embedUrl)return e.embedUrl;let{origin:n}=z(p);if(!kA(n)||!e.url)return;let r=new URLSearchParams({mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:p,url:e.url});return`${new URL(`../embed.html`,import.meta.url).href}?${r}`},[p,c?.handles,t.mediaUri,t.episodeUri]),y=(f?.originPage?.nodes??[]).map(e=>e.id).join(`,`),[b,x]=V({}),[S,C]=V({});N(()=>{let e=!1,t=y?y.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(Ge),n(Fe)]).then(([t,n])=>{e||(x(t),C(n))}).catch(()=>{}),()=>{e=!0}},[y]);let T=D(()=>{if(!p)return;let{origin:e}=z(p),t=S[e];if(!t)return;let n=KM(c?.handles).find(e=>e.uri===p);return{pluginUri:t,release:{uri:p,url:n?.url??void 0}}},[p,S,c?.handles]),[E,O]=V();N(()=>{O(void 0)},[p]);let A=!!(T&&E!==p);N(()=>{let e=r.current;if(A||!v||!e)return;let t=WM(e);return a(t),()=>{t.dispose(),a(void 0)}},[A,v]),N(()=>{let e=r.current;if(!A&&v&&e&&_)return ae(e,_)},[A,v,_]);let j=D(()=>(f?.originPage?.nodes??[]).map(e=>{let n=KM(c?.handles).filter(t=>t.origin===e.id),r=!!S[e.id],i=t=>!!(t?.embedUrl||r||kA(e.id)&&t?.url),a=e=>Ho(Y.WATCH,{mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:e}),o=n.map(e=>({uri:e.uri,label:e.shortDescriptions?.at(0)?.shortDescription??e.titles?.at(0)?.title??z(e.uri).id,href:i(e)?a(e.uri):e.url??void 0,external:!i(e),active:p===e.uri})),s=n.at(0);return{id:e.id,name:e.name??e.id,icon:e.icon,color:e.color,href:s?o.at(0)?.href:void 0,external:!s||!i(s),active:o.some(e=>e.active),releases:o.length>1?o:void 0,picker:b[e.id]?{pluginUri:b[e.id]}:void 0}}),[f,c?.handles,t.mediaUri,t.episodeUri,p,b,S]);return L(`div`,{css:YM,children:I(`div`,{className:`watch-container`,children:[A&&T?L(zM,{pluginUri:T.pluginUri,release:T.release,onUnplayable:()=>O(p),onPlayback:a}):v?L(`iframe`,{ref:r,src:v,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`,css:l`
3643
3614
  width: 100%;
3644
3615
  border: none;
3645
3616
  background: #000;
3646
3617
  flex: 1;
3647
3618
  min-height: 0;
3648
- `}):void 0,L(zM,{link:i}),I(`div`,{className:`watch-info`,children:[I(`div`,{className:`episode-info`,children:[L(`div`,{className:`episode-title`,children:_??t.episodeUri}),m?L(`div`,{className:`media-title`,children:m}):void 0]}),L(LA,{sources:j,onPickRelease:e=>n(Ho(Y.WATCH,{mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:e}))})]})]})})};H();var XM=l`
3619
+ `}):void 0,L(BM,{link:i}),I(`div`,{className:`watch-info`,children:[I(`div`,{className:`episode-info`,children:[L(`div`,{className:`episode-title`,children:_??t.episodeUri}),m?L(`div`,{className:`media-title`,children:m}):void 0]}),L(RA,{sources:j,onPickRelease:e=>n(Ho(Y.WATCH,{mediaUri:t.mediaUri,episodeUri:t.episodeUri,sourceUri:e}))})]})]})})};H();var ZM=l`
3649
3620
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
3650
3621
  min-height: 100vh;
3651
3622
  max-width: 72rem;
@@ -3759,10 +3730,10 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3759
3730
  }
3760
3731
 
3761
3732
  .field input:focus { border-color: rgba(255, 255, 255, 0.4); }
3762
- `,ZM={"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?`},QM=()=>{let e=np(),[t]=V(()=>Xf(location.hash,location.origin)),[n]=V(()=>location.hash.length>1&&!Xf(location.hash,location.origin)),[r,i]=V([]),[a,o]=V(()=>Z.name()??``),[s,c]=V(!1),l=e.status===`active`;N(()=>{if(!t)return;let e=Z.getState();(e.status!==`joining`&&e.status!==`active`||e.invite!==t)&&Z.join(t)},[t]);let u=l?e.members:0;N(()=>{if(!l){i([]);return}let e=!1;return Z.roster().then(t=>{e||i(t)}),()=>{e=!0}},[l,u]),rp(e=>{e.t===`name`&&Z.roster().then(i)}),N(()=>{if(!s)return;let e=setTimeout(()=>c(!1),1500);return()=>clearTimeout(e)},[s]);let d=l?Yf(location.origin,e.invite):void 0,f=async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0)}catch{}};return I(`div`,{css:XM,children:[L(`div`,{className:`heading`,children:`Watch together`}),I(`div`,{className:`status`,children:[n?L(B,{children:`This invite link is broken. Ask the host for a new one.`}):!t&&!l&&e.status!==`joining`?e.status===`failed`?I(B,{children:[`Could not join. `,ZM[e.code]??`Something went wrong.`]}):e.status===`ended`?L(B,{children:`The party ended.`}):L(B,{children:`You are not in a party. Start one from the header, or open an invite link.`}):!t&&e.status===`joining`?L(B,{children:`Joining the party…`}):t&&!l?e.status===`joining`?L(B,{children:`Joining the party…`}):e.status===`failed`?I(B,{children:[`Could not join. `,ZM[e.code]??`Something went wrong.`]}):e.status===`ended`?L(B,{children:`The party ended.`}):L(B,{children:`This invite link is broken. Ask the host for a new one.`}):l&&e.role===`guest`&&t?L(B,{children:`You are in. Waiting for the host…`}):l&&e.role===`guest`?I(B,{children:[`You are following the host. `,L(Fo,{to:Ho(Y.HOME),children:`Go home`}),` and Catch up from the header to rejoin them.`]}):L(B,{children:`You are hosting. Everyone here follows you, and you decide who stays.`}),!t&&!l&&e.status!==`joining`&&(e.status===`failed`||e.status===`ended`)?I(B,{children:[` `,L(`button`,{type:`button`,className:`action`,onClick:()=>Z.dismiss(),children:`OK`})]}):null]}),l&&I(B,{children:[I(`div`,{className:`section`,children:[L(`div`,{className:`label`,children:`Your name`}),I(`form`,{className:`field`,onSubmit:e=>{e.preventDefault(),Z.setName(Cf(a))},children:[L(`input`,{value:a,maxLength:32,placeholder:`What the party should call you`,"aria-label":`Your name`,onInput:e=>o(e.currentTarget.value)}),I(`button`,{type:`submit`,className:`action`,children:[L(yc,{size:14}),` Save`]})]})]}),I(`div`,{className:`section`,children:[L(`div`,{className:`label`,children:`Invite link`}),I(`div`,{className:`field`,children:[L(`input`,{readOnly:!0,value:d,"aria-label":`Invite link`,onFocus:e=>e.currentTarget.select()}),I(`button`,{type:`button`,className:`action`,onClick:()=>{f()},children:[L(s?yc:Cc,{size:14}),` Copy`]})]})]}),I(`div`,{className:`section`,children:[I(`div`,{className:`label`,children:[`In the party (`,r.length,`)`]}),r.map(t=>I(`div`,{className:`row`,"data-member":t.id,children:[t.name?L(`span`,{className:`name`,children:t.name}):null,L(`span`,{className:`id`,title:t.id,children:t.id}),t.host&&L(`span`,{className:`badge`,children:`host`}),t.self&&L(`span`,{className:`badge you`,children:`you`}),e.role===`host`&&!t.self&&I(B,{children:[I(`button`,{type:`button`,className:`action danger`,onClick:()=>{Z.kick(t.id)},children:[L(Gc,{size:14}),` Kick`]}),I(`button`,{type:`button`,className:`action danger`,onClick:()=>{Z.ban(t.id)},children:[L(vc,{size:14}),` Ban`]})]})]},t.id))]}),L(`div`,{className:`section`,children:I(`button`,{type:`button`,className:`action`,onClick:()=>{Z.leave()},children:[L(Ac,{size:14}),` `,e.role===`host`?`End party`:`Leave party`]})})]})]})},$M=e=>e.owned?`owned`:`placeholder`,eN=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:$M(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},tN=e=>{let t=eN(e),n=Km({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}},nN=(e,t)=>[e,t].sort().join(` `),rN=e=>{let t=new Map;for(let n of e){let e=nN(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},iN=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},aN=/^[0-9a-f]{64}$/,oN=(e,t)=>(t??[]).map(t=>{let n=e.get(t)??null;return{key:t,ref:n,gap:n?null:aN.test(t)?`missing`:`not-an-edge-key`}}),sN=(e,t)=>(e.answers??[]).find(e=>e.seq===t)??null,cN=e=>e===null?null:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e),lN=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:cN(t)}))}:{kind:`fields`,fields:[{field:Array.isArray(t)?`values`:`value`,value:cN(t)}]}},uN=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.`,dN=e=>e===`active`,fN=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(`
3733
+ `,QM={"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?`},$M=()=>{let e=tp(),[t]=V(()=>Yf(location.hash,location.origin)),[n]=V(()=>location.hash.length>1&&!Yf(location.hash,location.origin)),[r,i]=V([]),[a,o]=V(()=>Z.name()??``),[s,c]=V(!1),l=e.status===`active`;N(()=>{if(!t)return;let e=Z.getState();(e.status!==`joining`&&e.status!==`active`||e.invite!==t)&&Z.join(t)},[t]);let u=l?e.members:0;N(()=>{if(!l){i([]);return}let e=!1;return Z.roster().then(t=>{e||i(t)}),()=>{e=!0}},[l,u]),np(e=>{e.t===`name`&&Z.roster().then(i)}),N(()=>{if(!s)return;let e=setTimeout(()=>c(!1),1500);return()=>clearTimeout(e)},[s]);let d=l?Jf(location.origin,e.invite):void 0,f=async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0)}catch{}};return I(`div`,{css:ZM,children:[L(`div`,{className:`heading`,children:`Watch together`}),I(`div`,{className:`status`,children:[n?L(B,{children:`This invite link is broken. Ask the host for a new one.`}):!t&&!l&&e.status!==`joining`?e.status===`failed`?I(B,{children:[`Could not join. `,QM[e.code]??`Something went wrong.`]}):e.status===`ended`?L(B,{children:`The party ended.`}):L(B,{children:`You are not in a party. Start one from the header, or open an invite link.`}):!t&&e.status===`joining`?L(B,{children:`Joining the party…`}):t&&!l?e.status===`joining`?L(B,{children:`Joining the party…`}):e.status===`failed`?I(B,{children:[`Could not join. `,QM[e.code]??`Something went wrong.`]}):e.status===`ended`?L(B,{children:`The party ended.`}):L(B,{children:`This invite link is broken. Ask the host for a new one.`}):l&&e.role===`guest`&&t?L(B,{children:`You are in. Waiting for the host…`}):l&&e.role===`guest`?I(B,{children:[`You are following the host. `,L(Fo,{to:Ho(Y.HOME),children:`Go home`}),` and Catch up from the header to rejoin them.`]}):L(B,{children:`You are hosting. Everyone here follows you, and you decide who stays.`}),!t&&!l&&e.status!==`joining`&&(e.status===`failed`||e.status===`ended`)?I(B,{children:[` `,L(`button`,{type:`button`,className:`action`,onClick:()=>Z.dismiss(),children:`OK`})]}):null]}),l&&I(B,{children:[I(`div`,{className:`section`,children:[L(`div`,{className:`label`,children:`Your name`}),I(`form`,{className:`field`,onSubmit:e=>{e.preventDefault(),Z.setName(Sf(a))},children:[L(`input`,{value:a,maxLength:32,placeholder:`What the party should call you`,"aria-label":`Your name`,onInput:e=>o(e.currentTarget.value)}),I(`button`,{type:`submit`,className:`action`,children:[L(vc,{size:14}),` Save`]})]})]}),I(`div`,{className:`section`,children:[L(`div`,{className:`label`,children:`Invite link`}),I(`div`,{className:`field`,children:[L(`input`,{readOnly:!0,value:d,"aria-label":`Invite link`,onFocus:e=>e.currentTarget.select()}),I(`button`,{type:`button`,className:`action`,onClick:()=>{f()},children:[L(s?vc:Sc,{size:14}),` Copy`]})]})]}),I(`div`,{className:`section`,children:[I(`div`,{className:`label`,children:[`In the party (`,r.length,`)`]}),r.map(t=>I(`div`,{className:`row`,"data-member":t.id,children:[t.name?L(`span`,{className:`name`,children:t.name}):null,L(`span`,{className:`id`,title:t.id,children:t.id}),t.host&&L(`span`,{className:`badge`,children:`host`}),t.self&&L(`span`,{className:`badge you`,children:`you`}),e.role===`host`&&!t.self&&I(B,{children:[I(`button`,{type:`button`,className:`action danger`,onClick:()=>{Z.kick(t.id)},children:[L(Wc,{size:14}),` Kick`]}),I(`button`,{type:`button`,className:`action danger`,onClick:()=>{Z.ban(t.id)},children:[L(_c,{size:14}),` Ban`]})]})]},t.id))]}),L(`div`,{className:`section`,children:I(`button`,{type:`button`,className:`action`,onClick:()=>{Z.leave()},children:[L(kc,{size:14}),` `,e.role===`host`?`End party`:`Leave party`]})})]})]})},eN=e=>e.owned?`owned`:`placeholder`,tN=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:eN(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},nN=e=>{let t=tN(e),n=qm({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}},rN=(e,t)=>[e,t].sort().join(` `),iN=e=>{let t=new Map;for(let n of e){let e=rN(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},aN=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},oN=/^[0-9a-f]{64}$/,sN=(e,t)=>(t??[]).map(t=>{let n=e.get(t)??null;return{key:t,ref:n,gap:n?null:oN.test(t)?`missing`:`not-an-edge-key`}}),cN=(e,t)=>(e.answers??[]).find(e=>e.seq===t)??null,lN=e=>e===null?null:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e),uN=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:lN(t)}))}:{kind:`fields`,fields:[{field:Array.isArray(t)?`values`:`value`,value:lN(t)}]}},dN=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.`,fN=e=>e===`active`,pN=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(`
3763
3734
 
3764
3735
  `);l=t.pop()??``;for(let e of t){let t=e.split(`
3765
- `).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}},pN=`
3736
+ `).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}},mN=`
3766
3737
  subscription TraceWarm($input: MediaInput!) {
3767
3738
  media(input: $input) {
3768
3739
  _id
@@ -3796,12 +3767,12 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3796
3767
  }
3797
3768
  }
3798
3769
  }
3799
- `,mN=(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}},hN=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 Ce(()=>import(`./worker-BUw9_QQ0.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url);if(typeof i.handleRequest!=`function`)return r;await fN(i.handleRequest,pN,{input:{uri:e}},{settleMs:n,onPayload:(e,n)=>{r=mN(e,n),t?.(r)}})}catch(e){console.error(Error(`graph trace: the warm could not ask the sources`,{cause:e}))}return r},gN=l`
3770
+ `,hN=(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}},gN=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 Ce(()=>import(`./worker-BUw9_QQ0.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url);if(typeof i.handleRequest!=`function`)return r;await pN(i.handleRequest,mN,{input:{uri:e}},{settleMs:n,onPayload:(e,n)=>{r=hN(e,n),t?.(r)}})}catch(e){console.error(Error(`graph trace: the warm could not ask the sources`,{cause:e}))}return r},_N=l`
3800
3771
  &.nothing {
3801
3772
  color: rgb(250, 204, 21);
3802
3773
  font-style: italic;
3803
3774
  }
3804
- `,_N=({value:e})=>e===null?L(`span`,{css:gN,className:`nothing`,children:`null`}):e===void 0?L(`span`,{css:gN,className:`nothing`,children:`absent`}):e===``?L(`span`,{css:gN,className:`nothing`,children:`empty`}):L(`span`,{css:gN,children:String(e)}),vN=l`
3775
+ `,vN=({value:e})=>e===null?L(`span`,{css:_N,className:`nothing`,children:`null`}):e===void 0?L(`span`,{css:_N,className:`nothing`,children:`absent`}):e===``?L(`span`,{css:_N,className:`nothing`,children:`empty`}):L(`span`,{css:_N,children:String(e)}),yN=l`
3805
3776
  .fields {
3806
3777
  width: 100%;
3807
3778
  border-collapse: collapse;
@@ -3834,7 +3805,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3834
3805
  white-space: pre-wrap;
3835
3806
  overflow-wrap: anywhere;
3836
3807
  }
3837
- `,yN=({blob:e,label:t})=>I(`div`,{css:vN,className:`blob`,"data-blob":t,children:[e.kind===`absent`&&L(`div`,{className:`absent`,children:L(_N,{value:null})}),e.kind===`raw`&&I(B,{children:[L(`div`,{className:`note`,children:`not JSON, shown as it is stored`}),L(`pre`,{className:`raw`,children:e.raw})]}),e.kind===`fields`&&L(`table`,{className:`fields`,children:L(`tbody`,{children:e.fields.map(e=>I(`tr`,{"data-field":e.field,children:[L(`th`,{scope:`row`,children:e.field}),L(`td`,{children:L(_N,{value:e.value})})]},e.field))})})]}),bN=88,xN=20,SN=36,CN=266,wN=76,TN=e=>[e.member?`${e.kind} ${e.member.via===`member`?`member`:`claimed`}`:`named by an edge`,e.origin??`no origin`,e.scope??`no scope`].join(` · `),EN=(e,t)=>{let n=e.find(e=>e.key===t);return new Set(n?[n.fromUri,n.toUri]:[])},DN=(e,t)=>{let n=tN(e),r=e.links??[],i=rN(r),a=EN(r,t),o=new Set(n.nodes.map(e=>e.uri));return{nodes:n.nodes.map(e=>({id:e.uri,type:`trace`,position:{x:SN+e.column*CN,y:SN+e.row*wN},width:178,height:56,draggable:!1,selectable:!1,data:{uri:e.uri,kind:e.kind,title:e.title,meta:TN(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:dN(e.status),status:e.status,label:e.kind,tooltip:`${e.kind} ${e.status} by ${e.by}: ${e.reason}`}}}),width:Math.max(1,n.columns)*CN-bN+72,height:Math.max(1,n.rows)*wN-xN+72}};H();var ON=l`
3808
+ `,bN=({blob:e,label:t})=>I(`div`,{css:yN,className:`blob`,"data-blob":t,children:[e.kind===`absent`&&L(`div`,{className:`absent`,children:L(vN,{value:null})}),e.kind===`raw`&&I(B,{children:[L(`div`,{className:`note`,children:`not JSON, shown as it is stored`}),L(`pre`,{className:`raw`,children:e.raw})]}),e.kind===`fields`&&L(`table`,{className:`fields`,children:L(`tbody`,{children:e.fields.map(e=>I(`tr`,{"data-field":e.field,children:[L(`th`,{scope:`row`,children:e.field}),L(`td`,{children:L(vN,{value:e.value})})]},e.field))})})]}),xN=88,SN=20,CN=36,wN=266,TN=76,EN=e=>[e.member?`${e.kind} ${e.member.via===`member`?`member`:`claimed`}`:`named by an edge`,e.origin??`no origin`,e.scope??`no scope`].join(` · `),DN=(e,t)=>{let n=e.find(e=>e.key===t);return new Set(n?[n.fromUri,n.toUri]:[])},ON=(e,t)=>{let n=nN(e),r=e.links??[],i=iN(r),a=DN(r,t),o=new Set(n.nodes.map(e=>e.uri));return{nodes:n.nodes.map(e=>({id:e.uri,type:`trace`,position:{x:CN+e.column*wN,y:CN+e.row*TN},width:178,height:56,draggable:!1,selectable:!1,data:{uri:e.uri,kind:e.kind,title:e.title,meta:EN(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:fN(e.status),status:e.status,label:e.kind,tooltip:`${e.kind} ${e.status} by ${e.by}: ${e.reason}`}}}),width:Math.max(1,n.columns)*wN-xN+72,height:Math.max(1,n.rows)*TN-SN+72}};H();var kN=l`
3838
3809
  position: relative;
3839
3810
  height: 46rem;
3840
3811
  border: 1px solid rgba(255, 255, 255, 0.12);
@@ -3906,7 +3877,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
3906
3877
  .edge-label.active { fill: rgb(134, 239, 172); }
3907
3878
  .edge-label.refused { fill: rgb(252, 165, 165); }
3908
3879
  .cross { stroke: rgb(248, 113, 113); stroke-width: 1.5; }
3909
- `,kN=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e,AN=({data:e})=>I(`div`,{className:`trace-node ${e.kind}${e.lit?` lit`:``}`,"data-node":e.uri,"data-kind":e.kind,title:`${e.uri} (${e.kind})`,children:[L(hT,{type:`target`,position:Q.Left}),L(`div`,{className:`uri`,children:kN(e.uri,26)}),L(`div`,{children:e.title===null?`no title`:kN(e.title,28)}),L(`div`,{className:`meta`,children:kN(e.meta,34)}),L(hT,{type:`source`,position:Q.Right})]}),jN=({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 I(B,{children:[L(`path`,{className:`edge ${s}${t?` selected`:``}`,d:u}),L(`path`,{className:`edge-hit`,d:u,children:L(`title`,{children:e?.tooltip})}),s===`refused`?I(`g`,{className:`cross-mark`,children:[L(`path`,{className:`cross`,d:`M ${d-5} ${f-5} L ${d+5} ${f+5}`}),L(`path`,{className:`cross`,d:`M ${d+5} ${f-5} L ${d-5} ${f+5}`})]}):null,L(`text`,{className:`edge-label ${s}`,x:d,y:f-9,textAnchor:`middle`,children:kN(e?.label??``,22)})]})},MN={trace:AN},NN={trace:jN},PN=({bundle:e,selected:t,onSelect:n})=>{let{nodes:r,edges:i}=D(()=>DN(e,t),[e,t]),a=U((e,t)=>n(t.id),[n]);return I(`div`,{css:ON,"data-trace-graph":!0,children:[I(`div`,{className:`legend`,children:[I(`div`,{children:[L(`b`,{children:`solid`}),` owned: its origin described it`]}),I(`div`,{children:[L(`b`,{children:`dashed yellow`}),` placeholder: no origin has`]}),I(`div`,{children:[L(`b`,{children:`dotted`}),` named by an edge only`]}),I(`div`,{children:[L(`b`,{children:`green line`}),` active link`]}),I(`div`,{children:[L(`b`,{children:`red dashed, crossed`}),` refused link`]})]}),L(JE,{nodes:r,edges:i,nodeTypes:MN,edgeTypes:NN,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:L(tD,{variant:ZE.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.12)`})})]})};H();var FN=l`
3880
+ `,AN=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e,jN=({data:e})=>I(`div`,{className:`trace-node ${e.kind}${e.lit?` lit`:``}`,"data-node":e.uri,"data-kind":e.kind,title:`${e.uri} (${e.kind})`,children:[L(gT,{type:`target`,position:Q.Left}),L(`div`,{className:`uri`,children:AN(e.uri,26)}),L(`div`,{children:e.title===null?`no title`:AN(e.title,28)}),L(`div`,{className:`meta`,children:AN(e.meta,34)}),L(gT,{type:`source`,position:Q.Right})]}),MN=({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 I(B,{children:[L(`path`,{className:`edge ${s}${t?` selected`:``}`,d:u}),L(`path`,{className:`edge-hit`,d:u,children:L(`title`,{children:e?.tooltip})}),s===`refused`?I(`g`,{className:`cross-mark`,children:[L(`path`,{className:`cross`,d:`M ${d-5} ${f-5} L ${d+5} ${f+5}`}),L(`path`,{className:`cross`,d:`M ${d+5} ${f-5} L ${d-5} ${f+5}`})]}):null,L(`text`,{className:`edge-label ${s}`,x:d,y:f-9,textAnchor:`middle`,children:AN(e?.label??``,22)})]})},NN={trace:jN},PN={trace:MN},FN=({bundle:e,selected:t,onSelect:n})=>{let{nodes:r,edges:i}=D(()=>ON(e,t),[e,t]),a=U((e,t)=>n(t.id),[n]);return I(`div`,{css:kN,"data-trace-graph":!0,children:[I(`div`,{className:`legend`,children:[I(`div`,{children:[L(`b`,{children:`solid`}),` owned: its origin described it`]}),I(`div`,{children:[L(`b`,{children:`dashed yellow`}),` placeholder: no origin has`]}),I(`div`,{children:[L(`b`,{children:`dotted`}),` named by an edge only`]}),I(`div`,{children:[L(`b`,{children:`green line`}),` active link`]}),I(`div`,{children:[L(`b`,{children:`red dashed, crossed`}),` refused link`]})]}),L(YE,{nodes:r,edges:i,nodeTypes:NN,edgeTypes:PN,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:L(nD,{variant:QE.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.12)`})})]})};H();var IN=l`
3910
3881
  border: 1px solid rgba(255, 255, 255, 0.12);
3911
3882
  border-radius: 0.5rem;
3912
3883
  padding: 1rem 1.2rem;
@@ -4006,7 +3977,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4006
3977
  }
4007
3978
 
4008
3979
  .empty { color: rgba(255, 255, 255, 0.5); }
4009
- `,IN=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}`,LN=e=>e===`not-an-edge-key`?`not an edge key`:`not in this bundle`,RN=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)}},zN=({rows:e})=>L(`table`,{className:`facts`,children:L(`tbody`,{children:e.map(([e,t])=>I(`tr`,{"data-fact":e,children:[L(`th`,{scope:`row`,children:e}),L(`td`,{children:L(_N,{value:t})})]},e))})}),BN=({bundle:e,seq:t,answer:n,onLoad:r})=>{let i=sN(e,t);return I(B,{children:[I(`h4`,{children:[`answer `,t]}),i?L(zN,{rows:[[`uri`,i.uri],[`origin`,i.origin],[`operation`,i.operation],[`bytes`,i.bytes]]}):L(`p`,{className:`empty`,"data-no-answer-row":!0,children:`The bundle lists no answer with that sequence.`}),L(`button`,{type:`button`,className:`load`,onClick:()=>r(t),children:`Load answer bytes`}),n?.seq===t&&I(`div`,{className:`answer`,"data-answer":!0,children:[n.state===`loading`&&L(`p`,{className:`empty`,children:`loading…`}),n.state===`failed`&&L(`p`,{className:`failed`,children:n.text}),n.state===`done`&&(n.text===``?L(`p`,{className:`empty`,children:`nothing came back for that sequence.`}):L(`pre`,{children:n.text}))]})]})},VN=({bundle:e,index:t,trail:n,onFollow:r,onTrailTo:i,loadAnswerBytes:a})=>{let[o,s]=V(void 0),c=n[n.length-1],l=c===void 0?void 0:t.get(c),u=oN(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:RN(t)})).catch(t=>s({seq:e,state:`failed`,text:t instanceof Error?t.message:String(t)}))};return I(`div`,{css:FN,"data-inspector":!0,children:[L(`h3`,{children:`Edge inspector`}),c===void 0?L(`p`,{className:`empty`,children:`Select a link in the graph, or any row in the tables below.`}):I(B,{children:[I(`div`,{className:`trail`,children:[n.slice(0,-1).map((e,n)=>L(`button`,{type:`button`,onClick:()=>i(n),children:t.get(e)?IN(t.get(e)):e},e)),L(`span`,{className:`here`,children:l?IN(l):c})]}),l===void 0?I(`p`,{className:`empty`,"data-unknown-row":!0,children:[`The bundle carries no row with the key `,L(`code`,{children:c}),`.`]}):I(B,{children:[(l.kind===`link`||l.kind===`episode-link`)&&I(B,{children:[L(zN,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`written by`,l.row.by],[`rule`,l.row.reason]]}),I(`p`,{children:[`status`,` `,L(`span`,{className:`status ${dN(l.row.status)?`active`:`refused`}`,children:l.row.status})]}),L(zN,{rows:l.kind===`link`?[[`confidence`,l.row.confidence],[`version`,l.row.version]]:[[`from number`,l.row.fromNumber],[`to number`,l.row.toNumber]]}),L(`h4`,{children:`evidence`}),L(yN,{blob:lN(l.row.evidence),label:`evidence`}),l.kind===`link`&&I(B,{children:[L(`h4`,{children:`gates`}),L(yN,{blob:lN(l.row.gates),label:`gates`})]})]}),(l.kind===`claim`||l.kind===`episode-claim`)&&I(B,{children:[L(zN,{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]]:[]]}),L(BN,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),l.kind===`episode-source`&&I(B,{children:[L(zN,{rows:[[`media`,l.row.fromUri],[`episode`,l.row.toUri],[`listed by`,l.row.claimer],[`answer seq`,l.row.answerSeq]]}),L(BN,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),L(`h4`,{children:`supports`}),l.kind===`claim`||l.kind===`episode-claim`||l.kind===`episode-source`?L(`p`,{className:`empty`,children:`This row is source truth: it is derived from nothing.`}):u.length===0?L(`p`,{className:`empty`,children:`This row names no supports.`}):L(`div`,{className:`supports`,children:u.map(e=>I(`div`,{className:`support`,"data-gap":e.gap??void 0,children:[e.ref?L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Follow`}):L(`span`,{className:`unresolved`,children:LN(e.gap)}),L(`span`,{className:`what`,children:e.ref?IN(e.ref):`unresolved`}),L(`span`,{className:`key`,children:e.key})]},e.key))})]})]})]})},HN=l`
3980
+ `,LN=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}`,RN=e=>e===`not-an-edge-key`?`not an edge key`:`not in this bundle`,zN=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)}},BN=({rows:e})=>L(`table`,{className:`facts`,children:L(`tbody`,{children:e.map(([e,t])=>I(`tr`,{"data-fact":e,children:[L(`th`,{scope:`row`,children:e}),L(`td`,{children:L(vN,{value:t})})]},e))})}),VN=({bundle:e,seq:t,answer:n,onLoad:r})=>{let i=cN(e,t);return I(B,{children:[I(`h4`,{children:[`answer `,t]}),i?L(BN,{rows:[[`uri`,i.uri],[`origin`,i.origin],[`operation`,i.operation],[`bytes`,i.bytes]]}):L(`p`,{className:`empty`,"data-no-answer-row":!0,children:`The bundle lists no answer with that sequence.`}),L(`button`,{type:`button`,className:`load`,onClick:()=>r(t),children:`Load answer bytes`}),n?.seq===t&&I(`div`,{className:`answer`,"data-answer":!0,children:[n.state===`loading`&&L(`p`,{className:`empty`,children:`loading…`}),n.state===`failed`&&L(`p`,{className:`failed`,children:n.text}),n.state===`done`&&(n.text===``?L(`p`,{className:`empty`,children:`nothing came back for that sequence.`}):L(`pre`,{children:n.text}))]})]})},HN=({bundle:e,index:t,trail:n,onFollow:r,onTrailTo:i,loadAnswerBytes:a})=>{let[o,s]=V(void 0),c=n[n.length-1],l=c===void 0?void 0:t.get(c),u=sN(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:zN(t)})).catch(t=>s({seq:e,state:`failed`,text:t instanceof Error?t.message:String(t)}))};return I(`div`,{css:IN,"data-inspector":!0,children:[L(`h3`,{children:`Edge inspector`}),c===void 0?L(`p`,{className:`empty`,children:`Select a link in the graph, or any row in the tables below.`}):I(B,{children:[I(`div`,{className:`trail`,children:[n.slice(0,-1).map((e,n)=>L(`button`,{type:`button`,onClick:()=>i(n),children:t.get(e)?LN(t.get(e)):e},e)),L(`span`,{className:`here`,children:l?LN(l):c})]}),l===void 0?I(`p`,{className:`empty`,"data-unknown-row":!0,children:[`The bundle carries no row with the key `,L(`code`,{children:c}),`.`]}):I(B,{children:[(l.kind===`link`||l.kind===`episode-link`)&&I(B,{children:[L(BN,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`written by`,l.row.by],[`rule`,l.row.reason]]}),I(`p`,{children:[`status`,` `,L(`span`,{className:`status ${fN(l.row.status)?`active`:`refused`}`,children:l.row.status})]}),L(BN,{rows:l.kind===`link`?[[`confidence`,l.row.confidence],[`version`,l.row.version]]:[[`from number`,l.row.fromNumber],[`to number`,l.row.toNumber]]}),L(`h4`,{children:`evidence`}),L(bN,{blob:uN(l.row.evidence),label:`evidence`}),l.kind===`link`&&I(B,{children:[L(`h4`,{children:`gates`}),L(bN,{blob:uN(l.row.gates),label:`gates`})]})]}),(l.kind===`claim`||l.kind===`episode-claim`)&&I(B,{children:[L(BN,{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]]:[]]}),L(VN,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),l.kind===`episode-source`&&I(B,{children:[L(BN,{rows:[[`media`,l.row.fromUri],[`episode`,l.row.toUri],[`listed by`,l.row.claimer],[`answer seq`,l.row.answerSeq]]}),L(VN,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),L(`h4`,{children:`supports`}),l.kind===`claim`||l.kind===`episode-claim`||l.kind===`episode-source`?L(`p`,{className:`empty`,children:`This row is source truth: it is derived from nothing.`}):u.length===0?L(`p`,{className:`empty`,children:`This row names no supports.`}):L(`div`,{className:`supports`,children:u.map(e=>I(`div`,{className:`support`,"data-gap":e.gap??void 0,children:[e.ref?L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Follow`}):L(`span`,{className:`unresolved`,children:RN(e.gap)}),L(`span`,{className:`what`,children:e.ref?LN(e.ref):`unresolved`}),L(`span`,{className:`key`,children:e.key})]},e.key))})]})]})]})},UN=l`
4010
3981
  table {
4011
3982
  width: 100%;
4012
3983
  border-collapse: collapse;
@@ -4059,7 +4030,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4059
4030
  .status.active { color: rgb(74, 222, 128); }
4060
4031
  .status.refused { color: rgb(248, 113, 113); }
4061
4032
  .empty { color: rgba(255, 255, 255, 0.5); font-size: 1.2rem; }
4062
- `,UN=({fill:e,index:t,onSelect:n})=>{let r=oN(t,e.supports);return r.length===0?L(`div`,{className:`proof`,children:L(`span`,{className:`missing`,"data-no-proof":!0,children:`${e.via} names no proving pair`})}):L(B,{children:r.map(e=>{let t=e.ref?.kind===`episode-link`?e.ref.row:void 0;return I(`div`,{className:`proof`,children:[L(`button`,{type:`button`,onClick:()=>n(e.key),children:`Inspect`}),t?L(`span`,{className:`pair`,children:`${t.fromUri} #${t.fromNumber??`null`} to ${t.toUri} #${t.toNumber??`null`}`}):L(`span`,{className:`pair`,children:e.ref?`${IN(e.ref)} ${e.key}`:L(`span`,{className:`missing`,children:`${e.key}: ${LN(e.gap)}`})}),t&&L(`span`,{className:`status ${dN(t.status)?`active`:`refused`}`,children:t.status})]},e.key)})})},WN=({bundle:e,index:t,selected:n,onSelect:r})=>I(`div`,{css:HN,"data-episodes":!0,children:[(e.episodes??[]).length===0?L(`p`,{className:`empty`,children:`This cluster holds no slots.`}):I(`table`,{"data-slots":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`slot`}),L(`th`,{children:`number`}),L(`th`,{children:`title`}),L(`th`,{children:`fills`})]})}),L(`tbody`,{children:e.episodes.map(e=>I(`tr`,{"data-slot":e.slotId,children:[L(`td`,{className:`slot`,children:e.slotId}),L(`td`,{children:L(_N,{value:e.number})}),L(`td`,{children:L(_N,{value:e.title})}),L(`td`,{children:e.fills.length===0?L(`span`,{className:`empty`,children:`nothing fills this slot`}):e.fills.map(e=>I(`div`,{"data-fill":e.episodeUri,children:[I(`div`,{className:`fill`,children:[L(`span`,{className:`uri`,children:e.episodeUri}),I(`span`,{children:[`#`,L(_N,{value:e.number})]}),L(`span`,{children:e.origin}),L(`span`,{className:`via`,children:e.via}),L(`span`,{className:`by`,children:e.by})]}),L(UN,{fill:e,index:t,onSelect:r})]},`${e.episodeUri}\u0000${e.via}`))})]},e.slotId))})]}),L(`h3`,{children:`Episode edges`}),(e.episodeLinks??[]).length===0?L(`p`,{className:`empty`,children:`No episode links, refused or otherwise.`}):I(`table`,{"data-episode-links":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`from`}),L(`th`,{children:`to`}),L(`th`,{children:`kind`}),L(`th`,{children:`status`}),L(`th`,{children:`by`}),L(`th`,{children:`rule`}),L(`th`,{})]})}),L(`tbody`,{children:e.episodeLinks.map(e=>I(`tr`,{"data-episode-link":e.key,"data-status":e.status,className:n===e.key?`selected`:void 0,children:[L(`td`,{className:`uri`,children:`${e.fromUri} #${e.fromNumber??`null`}`}),L(`td`,{className:`uri`,children:`${e.toUri} #${e.toNumber??`null`}`}),L(`td`,{children:e.kind}),L(`td`,{children:L(`span`,{className:`status ${dN(e.status)?`active`:`refused`}`,children:e.status})}),L(`td`,{children:e.by}),L(`td`,{children:e.reason}),L(`td`,{children:L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]}),L(`h3`,{children:`Episode claims`}),(e.episodeClaims??[]).length===0?L(`p`,{className:`empty`,children:`no episode level claims`}):I(`table`,{"data-episode-claims":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`from`}),L(`th`,{children:`to`}),L(`th`,{children:`kind`}),L(`th`,{children:`claimer`}),L(`th`,{children:`provenance`}),L(`th`,{children:`answer`}),L(`th`,{})]})}),L(`tbody`,{children:e.episodeClaims.map(e=>I(`tr`,{"data-episode-claim":e.key,className:n===e.key?`selected`:void 0,children:[L(`td`,{className:`uri`,children:e.fromUri}),L(`td`,{className:`uri`,children:e.toUri}),L(`td`,{children:e.kind}),L(`td`,{children:e.claimer}),L(`td`,{children:e.provenance}),L(`td`,{children:e.answerSeq}),L(`td`,{children:L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]})]});H();var GN=l`
4033
+ `,WN=({fill:e,index:t,onSelect:n})=>{let r=sN(t,e.supports);return r.length===0?L(`div`,{className:`proof`,children:L(`span`,{className:`missing`,"data-no-proof":!0,children:`${e.via} names no proving pair`})}):L(B,{children:r.map(e=>{let t=e.ref?.kind===`episode-link`?e.ref.row:void 0;return I(`div`,{className:`proof`,children:[L(`button`,{type:`button`,onClick:()=>n(e.key),children:`Inspect`}),t?L(`span`,{className:`pair`,children:`${t.fromUri} #${t.fromNumber??`null`} to ${t.toUri} #${t.toNumber??`null`}`}):L(`span`,{className:`pair`,children:e.ref?`${LN(e.ref)} ${e.key}`:L(`span`,{className:`missing`,children:`${e.key}: ${RN(e.gap)}`})}),t&&L(`span`,{className:`status ${fN(t.status)?`active`:`refused`}`,children:t.status})]},e.key)})})},GN=({bundle:e,index:t,selected:n,onSelect:r})=>I(`div`,{css:UN,"data-episodes":!0,children:[(e.episodes??[]).length===0?L(`p`,{className:`empty`,children:`This cluster holds no slots.`}):I(`table`,{"data-slots":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`slot`}),L(`th`,{children:`number`}),L(`th`,{children:`title`}),L(`th`,{children:`fills`})]})}),L(`tbody`,{children:e.episodes.map(e=>I(`tr`,{"data-slot":e.slotId,children:[L(`td`,{className:`slot`,children:e.slotId}),L(`td`,{children:L(vN,{value:e.number})}),L(`td`,{children:L(vN,{value:e.title})}),L(`td`,{children:e.fills.length===0?L(`span`,{className:`empty`,children:`nothing fills this slot`}):e.fills.map(e=>I(`div`,{"data-fill":e.episodeUri,children:[I(`div`,{className:`fill`,children:[L(`span`,{className:`uri`,children:e.episodeUri}),I(`span`,{children:[`#`,L(vN,{value:e.number})]}),L(`span`,{children:e.origin}),L(`span`,{className:`via`,children:e.via}),L(`span`,{className:`by`,children:e.by})]}),L(WN,{fill:e,index:t,onSelect:r})]},`${e.episodeUri}\u0000${e.via}`))})]},e.slotId))})]}),L(`h3`,{children:`Episode edges`}),(e.episodeLinks??[]).length===0?L(`p`,{className:`empty`,children:`No episode links, refused or otherwise.`}):I(`table`,{"data-episode-links":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`from`}),L(`th`,{children:`to`}),L(`th`,{children:`kind`}),L(`th`,{children:`status`}),L(`th`,{children:`by`}),L(`th`,{children:`rule`}),L(`th`,{})]})}),L(`tbody`,{children:e.episodeLinks.map(e=>I(`tr`,{"data-episode-link":e.key,"data-status":e.status,className:n===e.key?`selected`:void 0,children:[L(`td`,{className:`uri`,children:`${e.fromUri} #${e.fromNumber??`null`}`}),L(`td`,{className:`uri`,children:`${e.toUri} #${e.toNumber??`null`}`}),L(`td`,{children:e.kind}),L(`td`,{children:L(`span`,{className:`status ${fN(e.status)?`active`:`refused`}`,children:e.status})}),L(`td`,{children:e.by}),L(`td`,{children:e.reason}),L(`td`,{children:L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]}),L(`h3`,{children:`Episode claims`}),(e.episodeClaims??[]).length===0?L(`p`,{className:`empty`,children:`no episode level claims`}):I(`table`,{"data-episode-claims":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`from`}),L(`th`,{children:`to`}),L(`th`,{children:`kind`}),L(`th`,{children:`claimer`}),L(`th`,{children:`provenance`}),L(`th`,{children:`answer`}),L(`th`,{})]})}),L(`tbody`,{children:e.episodeClaims.map(e=>I(`tr`,{"data-episode-claim":e.key,className:n===e.key?`selected`:void 0,children:[L(`td`,{className:`uri`,children:e.fromUri}),L(`td`,{className:`uri`,children:e.toUri}),L(`td`,{children:e.kind}),L(`td`,{children:e.claimer}),L(`td`,{children:e.provenance}),L(`td`,{children:e.answerSeq}),L(`td`,{children:L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]})]});H();var KN=l`
4063
4034
  max-width: 150rem;
4064
4035
  margin: calc(var(--stub-header-height) + 2rem) auto 6rem;
4065
4036
  padding: 0 1.5rem;
@@ -4169,11 +4140,11 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4169
4140
 
4170
4141
  .columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
4171
4142
  @media (max-width: 900px) { .columns { grid-template-columns: 1fr; } }
4172
- `,KN=1500,qN=({label:e,value:t})=>I(`div`,{children:[L(`span`,{className:`label`,children:e}),L(`code`,{children:L(_N,{value:t})})]}),JN=({reason:e})=>e===`null`?L(`code`,{className:`token`,"data-token-reason":!0,children:`"null"`}):L(_N,{value:e}),YN=({load:e=wm,loadAnswerBytes:t=Tm,warm:n=hN})=>{let r=Oo(),[,i]=Do(),a=Pm(r),[o,s]=V(a),[c,l]=V({kind:`idle`}),[u,d]=V(0),[f,p]=V({kind:`off`}),[m,h]=V([]),g=w(``),_=w(void 0);N(()=>{s(a),h([]),p({kind:`off`}),g.current=``,_.current!==void 0&&clearTimeout(_.current),_.current=void 0},[a]),N(()=>{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=D(()=>v?iN(v):new Map,[v]),b=m[m.length-1],x=!(!v||v.resolved||v.reason===`not-enabled`);return N(()=>{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)},KN))};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]),N(()=>()=>{g.current=``,_.current!==void 0&&clearTimeout(_.current)},[]),I(`div`,{css:GN,"data-debug-trace":!0,children:[L(`h1`,{children:`Graph trace`}),L(`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.`}),I(`form`,{className:`ask`,onSubmit:e=>{e.preventDefault();let t=o.trim();t&&(d(e=>e+1),i(Dm({uri:t})))},children:[L(`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)}),L(`button`,{type:`submit`,children:`Trace`})]}),c.kind===`idle`&&L(`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`&&L(`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). All 24 sources are 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}. All 24 sources were 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`&&I(`p`,{className:`empty`,"data-loading":!0,children:[`tracing `,a,`…`]}),c.kind===`failed`&&L(`p`,{className:`failed`,"data-failed":!0,children:c.error}),v&&I(B,{children:[v.resolved?I(`div`,{className:`resolved`,"data-resolved":!0,children:[I(`div`,{className:`pairs`,children:[L(qN,{label:`asked`,value:v.asked}),L(qN,{label:`cluster`,value:v.resolved.clusterId}),L(qN,{label:`aggregate`,value:v.resolved.aggUri}),L(qN,{label:`scope`,value:v.resolved.scope}),L(qN,{label:`kind`,value:v.resolved.kind})]}),(v.resolved.otherClusters??[]).length>0&&I(`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=>L(`a`,{href:Dm({uri:e,search:r}),children:L(`code`,{children:e})},e))]})]}):I(`div`,{className:`unresolved`,"data-unresolved":!0,"data-reason":v.reason??`none`,children:[L(`div`,{className:`why`,children:uN(v.reason)}),v.reason===`not-enabled`&&I(`div`,{className:`advice`,children:[L(`a`,{"data-reload-graph":!0,href:km(r),children:`Reload with ?graph=1`}),` or `,L(`a`,{"data-reload-store":!0,href:Am(r),children:`drop ?store=legacy`}),`, keeping this uri.`]}),I(`div`,{className:`pairs`,children:[L(qN,{label:`asked`,value:v.asked}),L(qN,{label:`reason`,value:v.reason??null})]})]}),I(`div`,{className:`pairs`,"data-run-length":!0,children:[L(qN,{label:`run length`,value:v.runLength?.value??null}),L(qN,{label:`from`,value:v.runLength?.from??null}),L(qN,{label:`tier`,value:v.runLength?.tier??null}),L(qN,{label:`witnesses`,value:v.runLength?.witnesses??null})]}),I(`div`,{className:`pairs`,"data-cost":!0,children:[L(qN,{label:`statements`,value:v.cost?.statements??null}),L(qN,{label:`ms to build`,value:v.cost?.ms??null})]}),L(`h3`,{children:`Graph counts`}),L(`div`,{className:`chips`,"data-counts":!0,children:Object.entries(v.counts??{}).length===0?L(`span`,{className:`empty`,children:`the bundle carries no counts`}):Object.entries(v.counts).map(([e,t])=>L(`span`,{className:`chip`,children:`${e} ${t}`},e))}),I(`div`,{className:`columns`,children:[I(`div`,{children:[L(`h3`,{children:`Anomalies`}),(v.anomalies??[]).length===0?L(`p`,{className:`empty`,children:`no rule complained`}):L(`table`,{"data-anomalies":!0,children:L(`tbody`,{children:v.anomalies.map((e,t)=>I(`tr`,{children:[L(`td`,{children:e.rule}),L(`td`,{children:e.detail})]},`${e.rule} ${e.detail} ${t}`))})})]}),I(`div`,{children:[L(`h3`,{children:`Asks`}),(v.asks??[]).length===0?L(`p`,{className:`empty`,children:`nothing was asked of any origin`}):I(`table`,{"data-asks":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`seq`}),L(`th`,{children:`origin`}),L(`th`,{children:`outcome`}),L(`th`,{children:`reason`})]})}),L(`tbody`,{children:v.asks.map((e,t)=>I(`tr`,{"data-ask":e.origin,children:[L(`td`,{children:L(_N,{value:e.seq??null})}),L(`td`,{children:e.origin}),L(`td`,{children:e.outcome}),L(`td`,{children:L(JN,{reason:e.reason})})]},`${e.origin} ${e.seq??t}`))})]})]})]}),L(`h2`,{children:`Media graph`}),L(PN,{bundle:v,selected:b,onSelect:e=>h([e])}),L(`h3`,{children:`Links`}),(v.links??[]).length===0?L(`p`,{className:`empty`,children:`no links, refused or otherwise`}):I(`table`,{"data-links":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`from`}),L(`th`,{children:`to`}),L(`th`,{children:`kind`}),L(`th`,{children:`status`}),L(`th`,{children:`by`}),L(`th`,{children:`rule`}),L(`th`,{children:`confidence`}),L(`th`,{})]})}),L(`tbody`,{children:v.links.map(e=>I(`tr`,{"data-link":e.key,"data-status":e.status,className:b===e.key?`selected`:void 0,children:[L(`td`,{className:`uri`,children:e.fromUri}),L(`td`,{className:`uri`,children:e.toUri}),L(`td`,{children:e.kind}),L(`td`,{children:L(`span`,{className:`status ${dN(e.status)?`active`:`refused`}`,children:e.status})}),L(`td`,{children:e.by}),L(`td`,{children:e.reason}),L(`td`,{children:L(_N,{value:e.confidence})}),L(`td`,{children:L(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),L(`h3`,{children:`Claims`}),(v.claims??[]).length===0?L(`p`,{className:`empty`,children:`no claims between the uris this bundle names`}):I(`table`,{"data-claims":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`from`}),L(`th`,{children:`to`}),L(`th`,{children:`kind`}),L(`th`,{children:`claimer`}),L(`th`,{children:`provenance`}),L(`th`,{children:`answer`}),L(`th`,{children:`target scope`}),L(`th`,{})]})}),L(`tbody`,{children:v.claims.map(e=>I(`tr`,{"data-claim":e.key,className:b===e.key?`selected`:void 0,children:[L(`td`,{className:`uri`,children:e.fromUri}),L(`td`,{className:`uri`,children:e.toUri}),L(`td`,{children:e.kind}),L(`td`,{children:e.claimer}),L(`td`,{children:e.provenance}),L(`td`,{children:e.answerSeq}),L(`td`,{children:L(_N,{value:e.targetScope})}),L(`td`,{children:L(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),L(`h3`,{children:`Attachments`}),(v.attachments??[]).length===0?L(`p`,{className:`empty`,children:`no run is attached to a container here`}):I(`table`,{"data-attachments":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`run`}),L(`th`,{children:`container`}),L(`th`,{children:`via`}),L(`th`,{children:`by`}),L(`th`,{children:`evidence`}),L(`th`,{children:`supports`})]})}),L(`tbody`,{children:v.attachments.map(e=>I(`tr`,{children:[L(`td`,{className:`uri`,children:e.runUri}),L(`td`,{className:`uri`,children:e.containerUri}),L(`td`,{children:e.via}),L(`td`,{children:e.by}),L(`td`,{className:`uri`,children:L(_N,{value:e.evidence})}),L(`td`,{children:(e.supports??[]).length===0?L(_N,{value:null}):e.supports.map(e=>L(`button`,{type:`button`,className:`inspect`,"data-attachment-support":e,onClick:()=>h([e]),children:e},e))})]},`${e.runUri} ${e.containerUri} ${e.via} ${e.by}`))})]}),L(`h2`,{children:`Episodes`}),L(WN,{bundle:v,index:y,selected:b,onSelect:e=>h([e])}),L(`h2`,{children:`Inspector`}),L(VN,{bundle:v,index:y,trail:m,onFollow:e=>h(t=>[...t,e]),onTrailTo:e=>h(t=>t.slice(0,e+1)),loadAnswerBytes:t})]})]})},XN=`[data-party-scroll]`,ZN=()=>{let e=document.querySelectorAll(XN);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.scrollHeight-n.clientHeight>0)return n}},QN=(e,t)=>t>0?Math.min(1,Math.max(0,e/t)):0,$N=()=>{let e=ZN();return e?Math.max(0,e.scrollHeight-e.clientHeight):Math.max(0,document.documentElement.scrollHeight-window.innerHeight)},eP=()=>{let e=ZN();return e?QN(e.scrollTop,e.scrollHeight-e.clientHeight):QN(window.scrollY,document.documentElement.scrollHeight-window.innerHeight)},tP=()=>{try{return window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0}catch{return!1}},nP=(e,t,n)=>!e||tP()?`instant`:t<=n*2?`smooth`:`instant`,rP=(e,{smooth:t}={})=>{let n=ZN();if(n){let r=n.scrollHeight-n.clientHeight,i=r>0?e*r:0;n.scrollTo({top:i,behavior:nP(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:nP(t,Math.abs(i-window.scrollY),window.innerHeight)})};H();var iP=2,aP=8e3,oP=[`wheel`,`touchstart`,`keydown`,`pointerdown`],sP=60,cP=()=>{let e=np(),[t,n]=Do(),r=Oo(),i=r?`${t}?${r}`:t,a=e.status===`active`?e.role:void 0,o=t===Jf;N(()=>{a!==`host`||o||(Z.setLocation(i,eP()),Z.send({t:`nav`,path:i}))},[a,i,o]),N(()=>{if(a!==`host`||o)return;let e=0,t,n=()=>{t=void 0,e=Date.now();let n=eP();Z.setLocation(i,n),Z.send({t:`scroll`,y:n})},r=()=>{if(t)return;let r=Math.max(0,1e3/iP-(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 s=w(void 0),c=w(0);N(()=>{if(s.current===void 0)return;let e=s.current;s.current=void 0;let t=0,n=-1,r=0,i=!1,a=c.current,o=Date.now()+aP,l=()=>{i=!0};for(let e of oP)document.addEventListener(e,l,{passive:!0});let u=()=>{cancelAnimationFrame(t);for(let e of oP)document.removeEventListener(e,l)};if(rl(),e===0)return rP(0),u;let d=()=>{let s=$N();s===n?r+=1:(r=0,n=s);let l=s>0&&r>=sP;if(i||c.current!==a||l||Date.now()>o)return u();rP(e),t=requestAnimationFrame(d)};return t=requestAnimationFrame(d),u},[i]);let l=w(!1),u=e.status===`active`?e.invite:void 0;N(()=>{l.current=!1},[u]);let d=(e,t)=>{l.current=!0,e===i?(rl(),c.current+=1,rP(t,{smooth:!0})):(s.current=t,n(e))};return rp((e,{replayed:t})=>{if(a===`guest`)switch(e.t){case`nav`:l.current=!0,e.path!==i&&n(e.path);return;case`scroll`:Z.hostPath()===i&&(rl(),c.current+=1,rP(e.y,{smooth:!0}));return;case`state`:(!l.current||t)&&d(e.path,e.y);return}}),null};H();var lP=4,uP=2500,dP=l`
4143
+ `,qN=1500,JN=({label:e,value:t})=>I(`div`,{children:[L(`span`,{className:`label`,children:e}),L(`code`,{children:L(vN,{value:t})})]}),YN=({reason:e})=>e===`null`?L(`code`,{className:`token`,"data-token-reason":!0,children:`"null"`}):L(vN,{value:e}),XN=({load:e=Tm,loadAnswerBytes:t=Em,warm:n=gN})=>{let r=Oo(),[,i]=Do(),a=Fm(r),[o,s]=V(a),[c,l]=V({kind:`idle`}),[u,d]=V(0),[f,p]=V({kind:`off`}),[m,h]=V([]),g=w(``),_=w(void 0);N(()=>{s(a),h([]),p({kind:`off`}),g.current=``,_.current!==void 0&&clearTimeout(_.current),_.current=void 0},[a]),N(()=>{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=D(()=>v?aN(v):new Map,[v]),b=m[m.length-1],x=!(!v||v.resolved||v.reason===`not-enabled`);return N(()=>{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)},qN))};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]),N(()=>()=>{g.current=``,_.current!==void 0&&clearTimeout(_.current)},[]),I(`div`,{css:KN,"data-debug-trace":!0,children:[L(`h1`,{children:`Graph trace`}),L(`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.`}),I(`form`,{className:`ask`,onSubmit:e=>{e.preventDefault();let t=o.trim();t&&(d(e=>e+1),i(Om({uri:t})))},children:[L(`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)}),L(`button`,{type:`submit`,children:`Trace`})]}),c.kind===`idle`&&L(`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`&&L(`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). All 24 sources are 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}. All 24 sources were 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`&&I(`p`,{className:`empty`,"data-loading":!0,children:[`tracing `,a,`…`]}),c.kind===`failed`&&L(`p`,{className:`failed`,"data-failed":!0,children:c.error}),v&&I(B,{children:[v.resolved?I(`div`,{className:`resolved`,"data-resolved":!0,children:[I(`div`,{className:`pairs`,children:[L(JN,{label:`asked`,value:v.asked}),L(JN,{label:`cluster`,value:v.resolved.clusterId}),L(JN,{label:`aggregate`,value:v.resolved.aggUri}),L(JN,{label:`scope`,value:v.resolved.scope}),L(JN,{label:`kind`,value:v.resolved.kind})]}),(v.resolved.otherClusters??[]).length>0&&I(`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=>L(`a`,{href:Om({uri:e,search:r}),children:L(`code`,{children:e})},e))]})]}):I(`div`,{className:`unresolved`,"data-unresolved":!0,"data-reason":v.reason??`none`,children:[L(`div`,{className:`why`,children:dN(v.reason)}),v.reason===`not-enabled`&&I(`div`,{className:`advice`,children:[L(`a`,{"data-reload-graph":!0,href:Am(r),children:`Reload with ?graph=1`}),` or `,L(`a`,{"data-reload-store":!0,href:jm(r),children:`drop ?store=legacy`}),`, keeping this uri.`]}),I(`div`,{className:`pairs`,children:[L(JN,{label:`asked`,value:v.asked}),L(JN,{label:`reason`,value:v.reason??null})]})]}),I(`div`,{className:`pairs`,"data-run-length":!0,children:[L(JN,{label:`run length`,value:v.runLength?.value??null}),L(JN,{label:`from`,value:v.runLength?.from??null}),L(JN,{label:`tier`,value:v.runLength?.tier??null}),L(JN,{label:`witnesses`,value:v.runLength?.witnesses??null})]}),I(`div`,{className:`pairs`,"data-cost":!0,children:[L(JN,{label:`statements`,value:v.cost?.statements??null}),L(JN,{label:`ms to build`,value:v.cost?.ms??null})]}),L(`h3`,{children:`Graph counts`}),L(`div`,{className:`chips`,"data-counts":!0,children:Object.entries(v.counts??{}).length===0?L(`span`,{className:`empty`,children:`the bundle carries no counts`}):Object.entries(v.counts).map(([e,t])=>L(`span`,{className:`chip`,children:`${e} ${t}`},e))}),I(`div`,{className:`columns`,children:[I(`div`,{children:[L(`h3`,{children:`Anomalies`}),(v.anomalies??[]).length===0?L(`p`,{className:`empty`,children:`no rule complained`}):L(`table`,{"data-anomalies":!0,children:L(`tbody`,{children:v.anomalies.map((e,t)=>I(`tr`,{children:[L(`td`,{children:e.rule}),L(`td`,{children:e.detail})]},`${e.rule} ${e.detail} ${t}`))})})]}),I(`div`,{children:[L(`h3`,{children:`Asks`}),(v.asks??[]).length===0?L(`p`,{className:`empty`,children:`nothing was asked of any origin`}):I(`table`,{"data-asks":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`seq`}),L(`th`,{children:`origin`}),L(`th`,{children:`outcome`}),L(`th`,{children:`reason`})]})}),L(`tbody`,{children:v.asks.map((e,t)=>I(`tr`,{"data-ask":e.origin,children:[L(`td`,{children:L(vN,{value:e.seq??null})}),L(`td`,{children:e.origin}),L(`td`,{children:e.outcome}),L(`td`,{children:L(YN,{reason:e.reason})})]},`${e.origin} ${e.seq??t}`))})]})]})]}),L(`h2`,{children:`Media graph`}),L(FN,{bundle:v,selected:b,onSelect:e=>h([e])}),L(`h3`,{children:`Links`}),(v.links??[]).length===0?L(`p`,{className:`empty`,children:`no links, refused or otherwise`}):I(`table`,{"data-links":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`from`}),L(`th`,{children:`to`}),L(`th`,{children:`kind`}),L(`th`,{children:`status`}),L(`th`,{children:`by`}),L(`th`,{children:`rule`}),L(`th`,{children:`confidence`}),L(`th`,{})]})}),L(`tbody`,{children:v.links.map(e=>I(`tr`,{"data-link":e.key,"data-status":e.status,className:b===e.key?`selected`:void 0,children:[L(`td`,{className:`uri`,children:e.fromUri}),L(`td`,{className:`uri`,children:e.toUri}),L(`td`,{children:e.kind}),L(`td`,{children:L(`span`,{className:`status ${fN(e.status)?`active`:`refused`}`,children:e.status})}),L(`td`,{children:e.by}),L(`td`,{children:e.reason}),L(`td`,{children:L(vN,{value:e.confidence})}),L(`td`,{children:L(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),L(`h3`,{children:`Claims`}),(v.claims??[]).length===0?L(`p`,{className:`empty`,children:`no claims between the uris this bundle names`}):I(`table`,{"data-claims":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`from`}),L(`th`,{children:`to`}),L(`th`,{children:`kind`}),L(`th`,{children:`claimer`}),L(`th`,{children:`provenance`}),L(`th`,{children:`answer`}),L(`th`,{children:`target scope`}),L(`th`,{})]})}),L(`tbody`,{children:v.claims.map(e=>I(`tr`,{"data-claim":e.key,className:b===e.key?`selected`:void 0,children:[L(`td`,{className:`uri`,children:e.fromUri}),L(`td`,{className:`uri`,children:e.toUri}),L(`td`,{children:e.kind}),L(`td`,{children:e.claimer}),L(`td`,{children:e.provenance}),L(`td`,{children:e.answerSeq}),L(`td`,{children:L(vN,{value:e.targetScope})}),L(`td`,{children:L(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),L(`h3`,{children:`Attachments`}),(v.attachments??[]).length===0?L(`p`,{className:`empty`,children:`no run is attached to a container here`}):I(`table`,{"data-attachments":!0,children:[L(`thead`,{children:I(`tr`,{children:[L(`th`,{children:`run`}),L(`th`,{children:`container`}),L(`th`,{children:`via`}),L(`th`,{children:`by`}),L(`th`,{children:`evidence`}),L(`th`,{children:`supports`})]})}),L(`tbody`,{children:v.attachments.map(e=>I(`tr`,{children:[L(`td`,{className:`uri`,children:e.runUri}),L(`td`,{className:`uri`,children:e.containerUri}),L(`td`,{children:e.via}),L(`td`,{children:e.by}),L(`td`,{className:`uri`,children:L(vN,{value:e.evidence})}),L(`td`,{children:(e.supports??[]).length===0?L(vN,{value:null}):e.supports.map(e=>L(`button`,{type:`button`,className:`inspect`,"data-attachment-support":e,onClick:()=>h([e]),children:e},e))})]},`${e.runUri} ${e.containerUri} ${e.via} ${e.by}`))})]}),L(`h2`,{children:`Episodes`}),L(GN,{bundle:v,index:y,selected:b,onSelect:e=>h([e])}),L(`h2`,{children:`Inspector`}),L(HN,{bundle:v,index:y,trail:m,onFollow:e=>h(t=>[...t,e]),onTrailTo:e=>h(t=>t.slice(0,e+1)),loadAnswerBytes:t})]})]})},ZN=`[data-party-scroll]`,QN=()=>{let e=document.querySelectorAll(ZN);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.scrollHeight-n.clientHeight>0)return n}},$N=(e,t)=>t>0?Math.min(1,Math.max(0,e/t)):0,eP=()=>{let e=QN();return e?Math.max(0,e.scrollHeight-e.clientHeight):Math.max(0,document.documentElement.scrollHeight-window.innerHeight)},tP=()=>{let e=QN();return e?$N(e.scrollTop,e.scrollHeight-e.clientHeight):$N(window.scrollY,document.documentElement.scrollHeight-window.innerHeight)},nP=()=>{try{return window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0}catch{return!1}},rP=(e,t,n)=>!e||nP()?`instant`:t<=n*2?`smooth`:`instant`,iP=(e,{smooth:t}={})=>{let n=QN();if(n){let r=n.scrollHeight-n.clientHeight,i=r>0?e*r:0;n.scrollTo({top:i,behavior:rP(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:rP(t,Math.abs(i-window.scrollY),window.innerHeight)})};H();var aP=2,oP=8e3,sP=[`wheel`,`touchstart`,`keydown`,`pointerdown`],cP=60,lP=()=>{let e=tp(),[t,n]=Do(),r=Oo(),i=r?`${t}?${r}`:t,a=e.status===`active`?e.role:void 0,o=t===qf;N(()=>{a!==`host`||o||(Z.setLocation(i,tP()),Z.send({t:`nav`,path:i}))},[a,i,o]),N(()=>{if(a!==`host`||o)return;let e=0,t,n=()=>{t=void 0,e=Date.now();let n=tP();Z.setLocation(i,n),Z.send({t:`scroll`,y:n})},r=()=>{if(t)return;let r=Math.max(0,1e3/aP-(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 s=w(void 0),c=w(0);N(()=>{if(s.current===void 0)return;let e=s.current;s.current=void 0;let t=0,n=-1,r=0,i=!1,a=c.current,o=Date.now()+oP,l=()=>{i=!0};for(let e of sP)document.addEventListener(e,l,{passive:!0});let u=()=>{cancelAnimationFrame(t);for(let e of sP)document.removeEventListener(e,l)};if(nl(),e===0)return iP(0),u;let d=()=>{let s=eP();s===n?r+=1:(r=0,n=s);let l=s>0&&r>=cP;if(i||c.current!==a||l||Date.now()>o)return u();iP(e),t=requestAnimationFrame(d)};return t=requestAnimationFrame(d),u},[i]);let l=w(!1),u=e.status===`active`?e.invite:void 0;N(()=>{l.current=!1},[u]);let d=(e,t)=>{l.current=!0,e===i?(nl(),c.current+=1,iP(t,{smooth:!0})):(s.current=t,n(e))};return np((e,{replayed:t})=>{if(a===`guest`)switch(e.t){case`nav`:l.current=!0,e.path!==i&&n(e.path);return;case`scroll`:Z.hostPath()===i&&(nl(),c.current+=1,iP(e.y,{smooth:!0}));return;case`state`:(!l.current||t)&&d(e.path,e.y);return}}),null};H();var uP=4,dP=2500,fP=l`
4173
4144
  position: fixed;
4174
4145
  left: 0;
4175
4146
  top: 0;
4176
- z-index: ${ff.partyCursor};
4147
+ z-index: ${df.partyCursor};
4177
4148
  pointer-events: none;
4178
4149
  display: flex;
4179
4150
  align-items: flex-start;
@@ -4196,11 +4167,11 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4196
4167
  font-weight: 600;
4197
4168
  white-space: nowrap;
4198
4169
  }
4199
- `,fP=()=>{let e=np(),t=e.status===`active`?e.role:void 0,[n]=Do(),r=Oo(),i=r?`${n}?${r}`:n;N(()=>{if(t!==`host`)return;let e=0,n,r,i=()=>{n=void 0,r&&!Z.playing()&&(e=Date.now(),Z.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/lP-(Date.now()-e))))};return window.addEventListener(`pointermove`,a,{passive:!0}),()=>{window.removeEventListener(`pointermove`,a),n&&clearTimeout(n)}},[t]);let[a,o]=V(void 0),[s,c]=V(()=>Date.now()),l=w(!1);if(rp(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);return}e.t!==`cursor`||l.current||Z.hostPath()===i&&o({x:e.x,y:e.y,at:Date.now()})}}),N(()=>{if(!a)return;let e=setInterval(()=>c(Date.now()),500);return()=>clearInterval(e)},[a]),t!==`guest`||!a||s-a.at>uP)return null;let u=e.status===`active`?Z.nameOf(e.owner):void 0;return I(`div`,{css:dP,style:{"--x":`${a.x*100}vw`,"--y":`${a.y*100}vh`},"aria-hidden":`true`,children:[L(`svg`,{width:`18`,height:`22`,viewBox:`0 0 18 22`,fill:`none`,children:L(`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`})}),L(`span`,{className:`tag`,children:u??`host`})]})};H();var pP=l`
4170
+ `,pP=()=>{let e=tp(),t=e.status===`active`?e.role:void 0,[n]=Do(),r=Oo(),i=r?`${n}?${r}`:n;N(()=>{if(t!==`host`)return;let e=0,n,r,i=()=>{n=void 0,r&&!Z.playing()&&(e=Date.now(),Z.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/uP-(Date.now()-e))))};return window.addEventListener(`pointermove`,a,{passive:!0}),()=>{window.removeEventListener(`pointermove`,a),n&&clearTimeout(n)}},[t]);let[a,o]=V(void 0),[s,c]=V(()=>Date.now()),l=w(!1);if(np(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);return}e.t!==`cursor`||l.current||Z.hostPath()===i&&o({x:e.x,y:e.y,at:Date.now()})}}),N(()=>{if(!a)return;let e=setInterval(()=>c(Date.now()),500);return()=>clearInterval(e)},[a]),t!==`guest`||!a||s-a.at>dP)return null;let u=e.status===`active`?Z.nameOf(e.owner):void 0;return I(`div`,{css:fP,style:{"--x":`${a.x*100}vw`,"--y":`${a.y*100}vh`},"aria-hidden":`true`,children:[L(`svg`,{width:`18`,height:`22`,viewBox:`0 0 18 22`,fill:`none`,children:L(`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`})}),L(`span`,{className:`tag`,children:u??`host`})]})};H();var mP=l`
4200
4171
  position: fixed;
4201
4172
  right: 2rem;
4202
4173
  bottom: 2rem;
4203
- z-index: ${ff.headerPopup};
4174
+ z-index: ${df.headerPopup};
4204
4175
  display: flex;
4205
4176
  flex-direction: column;
4206
4177
  align-items: flex-end;
@@ -4323,7 +4294,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4323
4294
  color: #fff;
4324
4295
  cursor: pointer;
4325
4296
  }
4326
- `,mP=(e,t)=>e.self?`you`:e.name??(e.from===t?`host`:e.from.slice(0,6)),hP=()=>{let e=np(),t=e.status===`active`,[n,r]=V(!1),[i,a]=V(()=>Z.chat()),[o,s]=V(0),[c,l]=V(``),u=w(null);if(rp((e,t)=>{(e.t===`chat`||e.t===`name`)&&(a(Z.chat()),e.t===`chat`&&!n&&!t.self&&s(e=>e+1))}),N(()=>{n&&s(0)},[n]),N(()=>{t||(a([]),s(0),r(!1))},[t]),N(()=>{u.current?.scrollTo({top:u.current.scrollHeight})},[i,n]),!t)return null;let d=e.owner;return I(`div`,{css:pP,children:[n&&I(`div`,{className:`panel`,role:`dialog`,"aria-label":`Party chat`,children:[I(`div`,{className:`head`,children:[L(`span`,{children:`Party chat`}),L(`button`,{type:`button`,"aria-label":`Close chat`,onClick:()=>r(!1),children:L(Zc,{size:16})})]}),I(`div`,{className:`lines`,ref:u,children:[i.length===0&&L(`div`,{className:`empty`,children:`Nothing said yet.`}),i.map(e=>I(`div`,{className:`line${e.self?` self`:``}`,children:[L(`span`,{className:`who`,children:mP(e,d)}),L(`span`,{className:`text`,children:e.text})]},e.seq))]}),I(`form`,{onSubmit:e=>{e.preventDefault();let t=Sf(c);t&&(Z.send({t:`chat`,text:t}),l(``))},children:[L(`input`,{value:c,placeholder:`Say something`,"aria-label":`Chat message`,maxLength:500,onInput:e=>l(e.currentTarget.value)}),L(`button`,{type:`submit`,"aria-label":`Send`,children:L(Bc,{size:16})})]})]}),I(`button`,{type:`button`,className:`toggle`,"aria-label":n?`Hide chat`:`Show chat`,onClick:()=>r(e=>!e),children:[L(Mc,{size:20}),o>0&&L(`span`,{className:`unread`,children:o})]})]})};H();var gP=()=>({pathname:location.pathname,search:location.search}),_P=[[`pushState`,`push`],[`replaceState`,`replace`],[`popstate`,`pop`]],vP=()=>{let e=w(gP());return N(()=>{let t=_P.map(([t,n])=>{let r=()=>{let t={from:e.current,to:gP(),kind:n,asked:ol()};e.current=t.to,$c(t)&&nl()};return addEventListener(t,r),()=>removeEventListener(t,r)});return()=>{rl();for(let e of t)e()}},[]),null};H();var yP=()=>{let{query:e}=To();return L(Ro,{to:Ns({query:Ms(e)}),replace:!0})},bP=()=>(N(()=>{globalThis.close()},[]),L(`div`,{children:`Logging in... this window will close automatically.`})),xP=l`
4297
+ `,hP=(e,t)=>e.self?`you`:e.name??(e.from===t?`host`:e.from.slice(0,6)),gP=()=>{let e=tp(),t=e.status===`active`,[n,r]=V(!1),[i,a]=V(()=>Z.chat()),[o,s]=V(0),[c,l]=V(``),u=w(null);if(np((e,t)=>{(e.t===`chat`||e.t===`name`)&&(a(Z.chat()),e.t===`chat`&&!n&&!t.self&&s(e=>e+1))}),N(()=>{n&&s(0)},[n]),N(()=>{t||(a([]),s(0),r(!1))},[t]),N(()=>{u.current?.scrollTo({top:u.current.scrollHeight})},[i,n]),!t)return null;let d=e.owner;return I(`div`,{css:mP,children:[n&&I(`div`,{className:`panel`,role:`dialog`,"aria-label":`Party chat`,children:[I(`div`,{className:`head`,children:[L(`span`,{children:`Party chat`}),L(`button`,{type:`button`,"aria-label":`Close chat`,onClick:()=>r(!1),children:L(Xc,{size:16})})]}),I(`div`,{className:`lines`,ref:u,children:[i.length===0&&L(`div`,{className:`empty`,children:`Nothing said yet.`}),i.map(e=>I(`div`,{className:`line${e.self?` self`:``}`,children:[L(`span`,{className:`who`,children:hP(e,d)}),L(`span`,{className:`text`,children:e.text})]},e.seq))]}),I(`form`,{onSubmit:e=>{e.preventDefault();let t=xf(c);t&&(Z.send({t:`chat`,text:t}),l(``))},children:[L(`input`,{value:c,placeholder:`Say something`,"aria-label":`Chat message`,maxLength:500,onInput:e=>l(e.currentTarget.value)}),L(`button`,{type:`submit`,"aria-label":`Send`,children:L(zc,{size:16})})]})]}),I(`button`,{type:`button`,className:`toggle`,"aria-label":n?`Hide chat`:`Show chat`,onClick:()=>r(e=>!e),children:[L(jc,{size:20}),o>0&&L(`span`,{className:`unread`,children:o})]})]})};H();var _P=()=>({pathname:location.pathname,search:location.search}),vP=[[`pushState`,`push`],[`replaceState`,`replace`],[`popstate`,`pop`]],yP=()=>{let e=w(_P());return N(()=>{let t=vP.map(([t,n])=>{let r=()=>{let t={from:e.current,to:_P(),kind:n,asked:al()};e.current=t.to,Qc(t)&&tl()};return addEventListener(t,r),()=>removeEventListener(t,r)});return()=>{nl();for(let e of t)e()}},[]),null};H();var bP=()=>{let{query:e}=To();return L(Ro,{to:Ms({query:js(e)}),replace:!0})},xP=()=>(N(()=>{globalThis.close()},[]),L(`div`,{children:`Logging in... this window will close automatically.`})),SP=l`
4327
4298
  display: flex;
4328
4299
  flex-direction: column;
4329
4300
  min-height: 100vh;
@@ -4331,9 +4302,9 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4331
4302
  & > .content {
4332
4303
  flex: 1;
4333
4304
  }
4334
- `,SP=l`
4305
+ `,CP=l`
4335
4306
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
4336
- `,CP=()=>L(jo,{hrefs:cc,children:I(`div`,{css:xP,children:[L(up,{}),L(`div`,{className:`content`,children:I(Lo,{children:[L(Po,{path:Vo(Y.HOME),component:nj}),L(Po,{path:Vo(Y.MEDIA),component:nj}),L(Po,{path:Vo(Y.SEARCH),component:Ij}),L(Po,{path:Vo(Y.SEARCH_LEGACY),component:yP}),L(Po,{path:Vo(Y.LEGAL),component:zj}),L(Po,{path:Vo(Y.PRIVACY),component:$j}),L(Po,{path:Vo(Y.SETTINGS),component:FM}),L(Po,{path:Vo(Y.WATCH),component:YM}),L(Po,{path:Vo(Y.PARTY),component:QM}),L(Po,{path:Vo(Y.DEBUG_TRACE),component:YN}),L(Po,{path:Vo(Y.LOGIN_CALLBACK),component:bP}),L(Po,{component:()=>L(`div`,{css:SP,children:`404 No page found`})})]})}),L(fp,{}),L(hp,{}),L(cP,{}),L(fP,{}),L(hP,{}),L(vP,{})]})});me(),H();var wP=l`
4307
+ `,wP=()=>L(jo,{hrefs:sc,children:I(`div`,{css:SP,children:[L(lp,{}),L(`div`,{className:`content`,children:I(Lo,{children:[L(Po,{path:Vo(Y.HOME),component:rj}),L(Po,{path:Vo(Y.MEDIA),component:rj}),L(Po,{path:Vo(Y.SEARCH),component:Lj}),L(Po,{path:Vo(Y.SEARCH_LEGACY),component:bP}),L(Po,{path:Vo(Y.LEGAL),component:Bj}),L(Po,{path:Vo(Y.PRIVACY),component:eM}),L(Po,{path:Vo(Y.SETTINGS),component:IM}),L(Po,{path:Vo(Y.WATCH),component:XM}),L(Po,{path:Vo(Y.PARTY),component:$M}),L(Po,{path:Vo(Y.DEBUG_TRACE),component:XN}),L(Po,{path:Vo(Y.LOGIN_CALLBACK),component:xP}),L(Po,{component:()=>L(`div`,{css:CP,children:`404 No page found`})})]})}),L(dp,{}),L(mp,{}),L(lP,{}),L(pP,{}),L(gP,{}),L(yP,{})]})});me(),H();var TP=l`
4337
4308
  display: flex;
4338
4309
  align-items: center;
4339
4310
  justify-content: center;
@@ -4382,7 +4353,7 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4382
4353
  background: rgba(255, 255, 255, 0.08);
4383
4354
  }
4384
4355
  }
4385
- `,TP=(e,t)=>`route: ${t}\nmessage: ${e.message}\nstack: ${e.stack??`(no stack)`}`,EP=({error:e,route:t})=>{let[n,r]=V(!1);return L(`div`,{css:wP,children:I(`div`,{className:`panel`,children:[L(`h2`,{children:`This page failed to render`}),L(`p`,{className:`message`,children:e.message||`No message was given.`}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,onClick:()=>globalThis.location?.reload(),children:`Reload`}),L(`button`,{type:`button`,onClick:()=>{let n=navigator.clipboard?.writeText(TP(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`})]})]})})},DP=class extends F{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?L(EP,{error:this.state.error,route:this.props.route}):this.props.children}},OP=({children:e})=>{let[t]=Do();return L(DP,{route:t,children:e})};ke(location.href)&&(window.__stubExportStore=e=>We(e??{excludeOrigins:[]}));var kP=async(e,t={},n={})=>fN(Ne,e,t,{settleMs:n.settleMs});Ae(location.href)&&(window.__stubExportAnswers=()=>Ke(),window.__stubExportAsks=()=>Ve(),window.__stubGraphCounts=()=>Re()),Ye(location.href)&&(window.__stubGraphQL=(e,t,n)=>kP(e,t,n)),me(),gM(),(({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)})({check:Ue,focused:Be});var AP=l`
4356
+ `,EP=(e,t)=>`route: ${t}\nmessage: ${e.message}\nstack: ${e.stack??`(no stack)`}`,DP=({error:e,route:t})=>{let[n,r]=V(!1);return L(`div`,{css:TP,children:I(`div`,{className:`panel`,children:[L(`h2`,{children:`This page failed to render`}),L(`p`,{className:`message`,children:e.message||`No message was given.`}),I(`div`,{className:`actions`,children:[L(`button`,{type:`button`,onClick:()=>globalThis.location?.reload(),children:`Reload`}),L(`button`,{type:`button`,onClick:()=>{let n=navigator.clipboard?.writeText(EP(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`})]})]})})},OP=class extends F{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?L(DP,{error:this.state.error,route:this.props.route}):this.props.children}},kP=({children:e})=>{let[t]=Do();return L(OP,{route:t,children:e})};ke(location.href)&&(window.__stubExportStore=e=>We(e??{excludeOrigins:[]}));var AP=async(e,t={},n={})=>pN(Ne,e,t,{settleMs:n.settleMs});Ae(location.href)&&(window.__stubExportAnswers=()=>Ke(),window.__stubExportAsks=()=>Ve(),window.__stubGraphCounts=()=>Re()),Ye(location.href)&&(window.__stubGraphQL=(e,t,n)=>AP(e,t,n)),me(),_M(),(({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)})({check:Ue,focused:Be});var jP=l`
4386
4357
  @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');
4387
4358
 
4388
4359
  :root {
@@ -4442,4 +4413,4 @@ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
4442
4413
  .hidden {
4443
4414
  display: none !important;
4444
4415
  }
4445
- `;Z.resume();var jP=document.createElement(`div`);jP.id=`stub-root`,fe(I(Qn,{value:Wa,children:[L(o,{styles:AP}),L(OP,{children:L(CP,{})})]}),document.body.appendChild(jP));
4416
+ `;Z.resume();var MP=document.createElement(`div`);MP.id=`stub-root`,fe(I(Qn,{value:Wa,children:[L(o,{styles:jP}),L(kP,{children:L(wP,{})})]}),document.body.appendChild(MP));