@banou/ripple 0.0.80 → 0.0.81
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.
- package/assets/ar-CnUKoSP-.js +1 -0
- package/assets/cs-Be9L4VBV.js +1 -0
- package/assets/el-jYB89Eok.js +1 -0
- package/assets/he-B7Hli7a4.js +1 -0
- package/assets/hi-DM2t-_zN.js +1 -0
- package/assets/hu-Bhbq6QWM.js +1 -0
- package/assets/id-BBHACgWu.js +1 -0
- package/assets/ms-liouKvNc.js +1 -0
- package/assets/nl-W_PeOM2E.js +1 -0
- package/assets/{remote-BbPTmC4r.js → remote-Chj4n8pS.js} +1 -1
- package/assets/ro-C7lLdGLO.js +1 -0
- package/assets/sv-DGLnNJYk.js +1 -0
- package/assets/th-B45mx1J2.js +1 -0
- package/assets/uk-bpXwThGf.js +1 -0
- package/assets/vi-BvcwHbPM.js +1 -0
- package/fkn.json +1 -1
- package/{index-Djn-X7aw.js → index-UA1Ev7OI.js} +6 -6
- package/index.html +1 -1
- package/package.json +2 -2
- package/sw.js +2 -2
- package/assets/ar-D8VXhJpi.js +0 -1
- package/assets/he-BkHHgAv1.js +0 -1
|
@@ -33,7 +33,7 @@ Please consider using "@formatjs/cli" to pre-compile your messages for performan
|
|
|
33
33
|
For more details see https://formatjs.github.io/docs/getting-started/message-distribution`)}function Wr(e,t){let n=cr(t),r={...ar,...e},{locale:i,defaultLocale:a,onError:o}=r;return i?!Intl.NumberFormat.supportedLocalesOf(i).length&&o?o(new $n(`Missing locale data for locale: "${i}" in Intl.NumberFormat. Using default locale: "${a}" as fallback. See https://formatjs.github.io/docs/react-intl#runtime-requirements for more details`)):!Intl.DateTimeFormat.supportedLocalesOf(i).length&&o&&o(new $n(`Missing locale data for locale: "${i}" in Intl.DateTimeFormat. Using default locale: "${a}" as fallback. See https://formatjs.github.io/docs/react-intl#runtime-requirements for more details`)):(o&&o(new Qn(`"locale" was not configured, using "${a}" as fallback. See https://formatjs.github.io/docs/react-intl/api#intlshape for more details`)),r.locale=r.defaultLocale||`en`),Ur(r),{...r,formatters:n,formatNumber:Br.bind(null,r,n.getNumberFormat),formatNumberToParts:Vr.bind(null,r,n.getNumberFormat),formatDuration:wr.bind(null,r,n.getDurationFormat),formatDurationToParts:Tr.bind(null,r,n.getDurationFormat),formatRelativeTime:Lr.bind(null,r,n.getRelativeTimeFormat),formatDate:_r.bind(null,r,n.getDateTimeFormat),formatDateToParts:br.bind(null,r,n.getDateTimeFormat),formatTime:vr.bind(null,r,n.getDateTimeFormat),formatDateTimeRange:yr.bind(null,r,n.getDateTimeFormat),formatTimeToParts:xr.bind(null,r,n.getDateTimeFormat),formatPlural:Pr.bind(null,r,n.getPluralRules),formatMessage:mr.bind(null,r,n),$t:mr.bind(null,r,n),formatList:jr.bind(null,r,n.getListFormat),formatListToParts:Mr.bind(null,r,n.getListFormat),formatDisplayName:Dr.bind(null,r,n.getDisplayNames)}}var Gr=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Kr=l(o(((e,t)=>{t.exports=Gr()}))(),1);function qr(e,t,n=Error){if(!e)throw new n(t)}function Jr(e){qr(e,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}var Yr={...ar,textComponent:p.Fragment},Xr=e=>p.Children.toArray(e).map((e,t)=>p.isValidElement(e)?(0,Kr.jsx)(p.Fragment,{children:e},t):e);function Zr(e){return function(t){return e(Xr(t))}}function Qr(e,t){if(e===t)return!0;if(!e||!t)return!1;var n=Object.keys(e),r=Object.keys(t),i=n.length;if(r.length!==i)return!1;for(var a=0;a<i;a++){var o=n[a];if(e[o]!==t[o]||!Object.prototype.hasOwnProperty.call(t,o))return!1}return!0}var $r=p.createContext(null),ei=$r.Provider;function ti(){let e=p.useContext($r);return Jr(e),e}var ni=function(e){return e.formatDate=`FormattedDate`,e.formatTime=`FormattedTime`,e.formatNumber=`FormattedNumber`,e.formatList=`FormattedList`,e.formatDuration=`FormattedDuration`,e.formatDisplayName=`FormattedDisplayName`,e}(ni||{}),ri=function(e){return e.formatDate=`FormattedDateParts`,e.formatTime=`FormattedTimeParts`,e.formatNumber=`FormattedNumberParts`,e.formatList=`FormattedListParts`,e}(ri||{});function ii(e){let t=t=>{let n=ti(),{value:r,children:i,...a}=t,o=typeof r==`string`?new Date(r||0):r;return i(e===`formatDate`?n.formatDateToParts(o,a):n.formatTimeToParts(o,a))};return t.displayName=ri[e],t}function ai(e){let t=t=>{let n=ti(),{value:r,children:i,...a}=t,o=n[e](r,a);if(typeof i==`function`)return i(o);let s=n.textComponent||p.Fragment;return(0,Kr.jsx)(s,{children:o})};return t.displayName=ni[e],t}function oi(e){return e&&Object.keys(e).reduce((t,n)=>{let r=e[n];return t[n]=zn(r)?Zr(r):r,t},{})}var si=(e,t,n,r,...i)=>{let a=mr(e,t,n,oi(r),...i);return Array.isArray(a)?Xr(a):a},ci=({defaultRichTextElements:e,...t},n)=>{let r=oi(e),i=Wr({...Yr,...t,defaultRichTextElements:r},n),a={locale:i.locale,timeZone:i.timeZone,fallbackOnEmptyString:i.fallbackOnEmptyString,formats:i.formats,defaultLocale:i.defaultLocale,defaultFormats:i.defaultFormats,messages:i.messages,onError:i.onError,defaultRichTextElements:r};return{...i,formatMessage:si.bind(null,a,i.formatters),$t:si.bind(null,a,i.formatters)}};function li(e,t){let{values:n,...r}=e,{values:i,...a}=t;return Qr(i,n)&&Qr(r,a)}function ui(e){let{formatMessage:t,textComponent:n=p.Fragment}=ti(),{id:r,description:i,defaultMessage:a,values:o,children:s,tagName:c=n,ignoreTag:l}=e,u=t({id:r,description:i,defaultMessage:a},o,{ignoreTag:l});return typeof s==`function`?s(Array.isArray(u)?u:[u]):c?(0,Kr.jsx)(c,{children:u}):(0,Kr.jsx)(Kr.Fragment,{children:u})}ui.displayName=`FormattedMessage`;var di=p.memo(ui,li);di.displayName=`MemoizedFormattedMessage`;function fi(e,t){return e}ai(`formatDate`),ai(`formatTime`),ai(`formatNumber`),ai(`formatDuration`),ai(`formatList`),ai(`formatDisplayName`),ii(`formatDate`),ii(`formatTime`);var pi=`modulepreload`,mi=function(e){return`/`+e},hi={},gi=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=mi(t,n),t=s(t),t in hi)return;hi[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:pi,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},_i=e=>{throw TypeError(e)},vi=(e,t,n)=>t.has(e)||_i(`Cannot `+n),yi=(e,t,n)=>(vi(e,t,`read from private field`),n?n.call(e):t.get(e)),bi=(e,t,n)=>t.has(e)?_i(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),xi=`popstate`;function Si(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return Di(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:Oi(t)}return Ai(t,n,null,e)}function Ci(e,t){if(e===!1||e==null)throw Error(t)}function wi(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Ti(){return Math.random().toString(36).substring(2,10)}function Ei(e,t){return{usr:e.state,key:e.key,idx:t}}function Di(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?ki(t):t,state:n,key:t&&t.key||r||Ti()}}function Oi({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function ki(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Ai(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Di(h.location,e,t);n&&n(r,e),l=u()+1;let d=Ei(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Di(h.location,e,t);n&&n(r,e),l=u();let i=Ei(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ji(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(xi,d),c=e,()=>{i.removeEventListener(xi,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function ji(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),Ci(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:Oi(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}var Mi,Ni=class{constructor(e){if(bi(this,Mi,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(yi(this,Mi).has(e))return yi(this,Mi).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){yi(this,Mi).set(e,t)}};Mi=new WeakMap;var Pi=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function Fi(e){return Pi.has(e)}var Ii=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function Li(e){return Ii.has(e)}function Ri(e){return e.index===!0}function zi(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(Ci(e.index!==!0||!e.children,`Cannot specify children on an index route`),Ci(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),Ri(e)){let n={...e,...t(e),id:s};return r[s]=n,n}{let n={...e,...t(e),id:s,children:void 0};return r[s]=n,e.children&&(n.children=zi(e.children,t,o,r,i)),n}})}function Bi(e,t,n=`/`){return Vi(e,t,n,!1)}function Vi(e,t,n,r){let i=aa((typeof t==`string`?ki(t):t).pathname||`/`,n);if(i==null)return null;let a=Ui(e);Gi(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=ia(i);o=ta(a[e],t,r)}return o}function Hi(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Ui(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;Ci(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=pa([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(Ci(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Ui(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:$i(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Wi(e.path))a(e,t,!0,n)}),t}function Wi(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Wi(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Gi(e){e.sort((e,t)=>e.score===t.score?ea(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Ki=/^:[\w-]+$/,qi=3,Ji=2,Yi=1,Xi=10,Zi=-2,Qi=e=>e===`*`;function $i(e,t){let n=e.split(`/`),r=n.length;return n.some(Qi)&&(r+=Zi),t&&(r+=Ji),n.filter(e=>!Qi(e)).reduce((e,t)=>e+(Ki.test(t)?qi:t===``?Yi:Xi),r)}function ea(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ta(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=na({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=na({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:pa([a,u.pathname]),pathnameBase:ma(pa([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=pa([a,u.pathnameBase]))}return o}function na(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=ra(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function ra(e,t=!1,n=!0){wi(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ia(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return wi(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function aa(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function oa({basename:e,pathname:t}){return t===`/`?e:pa([e,t])}function sa(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?ki(e):e;return{pathname:n?n.startsWith(`/`)?n:ca(n,t):t,search:ha(r),hash:ga(i)}}function ca(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function la(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ua(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function da(e){let t=ua(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function fa(e,t,n,r=!1){let i;typeof e==`string`?i=ki(e):(i={...e},Ci(!i.pathname||!i.pathname.includes(`?`),la(`?`,`pathname`,`search`,i)),Ci(!i.pathname||!i.pathname.includes(`#`),la(`#`,`pathname`,`hash`,i)),Ci(!i.search||!i.search.includes(`#`),la(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=sa(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var pa=e=>e.join(`/`).replace(/\/\/+/g,`/`),ma=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),ha=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,ga=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,_a=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function va(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}var ya=[`POST`,`PUT`,`PATCH`,`DELETE`],ba=new Set(ya),xa=[`GET`,...ya],Sa=new Set(xa),Ca=new Set([301,302,303,307,308]),wa=new Set([307,308]),Ta={state:`idle`,location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ea={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Da={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},Oa=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ka=e=>Oa.test(e),Aa=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),ja=`remix-router-transitions`,Ma=Symbol(`ResetLoaderData`);function Na(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;Ci(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||Aa,a={},o=zi(e.routes,i,void 0,a),s,c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||Xa,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=e.hydrationData!=null,_=Bi(o,e.history.location,c),v=!1,y=null,b;if(_==null&&!e.patchRoutesOnNavigation){let t=yo(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=vo(o);b=!0,_=n,y={[r.id]:t}}else if(_&&!e.hydrationData&&Pe(_,o,e.history.location.pathname).active&&(_=null),!_){b=!1,_=[];let t=Pe(null,o,e.history.location.pathname);t.active&&t.matches&&(v=!0,_=t.matches)}else if(_.some(e=>e.route.lazy))b=!1;else if(!_.some(e=>Ra(e.route)))b=!0;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null;if(n){let e=_.findIndex(e=>n[e.route.id]!==void 0);b=_.slice(0,e+1).every(e=>!za(e.route,t,n))}else b=_.every(e=>!za(e.route,t,n))}let x,S={historyAction:e.history.action,location:e.history.location,matches:_,initialized:b,navigation:Ta,restoreScrollPosition:e.hydrationData==null&&null,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||y,fetchers:new Map,blockers:new Map},C=`POP`,w=!1,T,E=!1,D=new Map,O=null,k=!1,A=!1,j=new Set,M=new Map,N=0,P=-1,F=new Map,I=new Set,L=new Map,R=new Map,ee=new Set,z=new Map,B,V=null;function H(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(B){B(),B=void 0;return}wi(z.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=Oe({currentLocation:S.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{B=e});e.history.go(r*-1),De(i,{state:`blocked`,location:n,proceed(){De(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(S.blockers);e.set(i,Da),te({blockers:e})}});return}return ie(t,n)}),n){Bo(t,D);let e=()=>Vo(t,D);t.addEventListener(`pagehide`,e),O=()=>t.removeEventListener(`pagehide`,e)}return S.initialized||ie(`POP`,S.location,{initialHydration:!0}),x}function U(){d&&d(),O&&O(),f.clear(),T&&T.abort(),S.fetchers.forEach((e,t)=>ye(t)),S.blockers.forEach((e,t)=>Ee(t))}function W(e){return f.add(e),()=>f.delete(e)}function te(e,t={}){e.matches&&=e.matches.map(e=>{let t=a[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),S={...S,...e};let n=[],r=[];S.fetchers.forEach((e,t)=>{e.state===`idle`&&(ee.has(t)?n.push(t):r.push(t))}),ee.forEach(e=>{!S.fetchers.has(e)&&!M.has(e)&&n.push(e)}),[...f].forEach(e=>e(S,{deletedFetchers:n,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>ye(e)),r.forEach(e=>S.fetchers.delete(e))}function G(t,n,{flushSync:r}={}){let i=S.actionData!=null&&S.navigation.formMethod!=null&&jo(S.navigation.formMethod)&&S.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?S.actionData:null;let c=n.loaderData?ho(S.loaderData,n.loaderData,n.matches||[],n.errors):S.loaderData,l=S.blockers;l.size>0&&(l=new Map(l),l.forEach((e,t)=>l.set(t,Da)));let u=!k&&Ne(t,n.matches||S.matches),d=w===!0||S.navigation.formMethod!=null&&jo(S.navigation.formMethod)&&t.state?._isRedirect!==!0;s&&=(o=s,void 0),k||C===`POP`||(C===`PUSH`?e.history.push(t,t.state):C===`REPLACE`&&e.history.replace(t,t.state));let f;if(C===`POP`){let e=D.get(S.location.pathname);e&&e.has(t.pathname)?f={currentLocation:S.location,nextLocation:t}:D.has(t.pathname)&&(f={currentLocation:t,nextLocation:S.location})}else if(E){let e=D.get(S.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),D.set(S.location.pathname,e)),f={currentLocation:S.location,nextLocation:t}}te({...n,actionData:a,loaderData:c,historyAction:C,location:t,initialized:!0,navigation:Ta,revalidation:`idle`,restoreScrollPosition:u,preventScrollReset:d,blockers:l},{viewTransitionOpts:f,flushSync:r===!0}),C=`POP`,w=!1,E=!1,k=!1,A=!1,V?.resolve(),V=null}async function ne(t,n){if(typeof t==`number`){e.history.go(t);return}let{path:r,submission:i,error:a}=Ia(!1,Fa(S.location,S.matches,c,t,n?.fromRouteId,n?.relative),n),o=S.location,s=Di(S.location,r,n&&n.state);s={...s,...e.history.encodeLocation(s)};let l=n&&n.replace!=null?n.replace:void 0,u=`PUSH`;l===!0?u=`REPLACE`:l===!1||i!=null&&jo(i.formMethod)&&i.formAction===S.location.pathname+S.location.search&&(u=`REPLACE`);let d=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,f=(n&&n.flushSync)===!0,p=Oe({currentLocation:o,nextLocation:s,historyAction:u});if(p){De(p,{state:`blocked`,location:s,proceed(){De(p,{state:`proceeding`,proceed:void 0,reset:void 0,location:s}),ne(t,n)},reset(){let e=new Map(S.blockers);e.set(p,Da),te({blockers:e})}});return}await ie(u,s,{submission:i,pendingError:a,preventScrollReset:d,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:f})}function re(){V||=Ho(),me(),te({revalidation:`loading`});let e=V.promise;return S.navigation.state===`submitting`?e:S.navigation.state===`idle`?(ie(S.historyAction,S.location,{startUninterruptedRevalidation:!0}),e):(ie(C||S.historyAction,S.navigation.location,{overrideNavigation:S.navigation,enableViewTransition:E===!0}),e)}async function ie(t,n,r){T&&T.abort(),T=null,C=t,k=(r&&r.startUninterruptedRevalidation)===!0,Me(S.location,S.matches),w=(r&&r.preventScrollReset)===!0,E=(r&&r.enableViewTransition)===!0;let i=s||o,a=r&&r.overrideNavigation,l=r?.initialHydration&&S.matches&&S.matches.length>0&&!v?S.matches:Bi(i,n,c),u=(r&&r.flushSync)===!0;if(l&&S.initialized&&!A&&So(S.location,n)&&!(r&&r.submission&&jo(r.submission.formMethod))){G(n,{matches:l},{flushSync:u});return}let d=Pe(l,i,n.pathname);if(d.active&&d.matches&&(l=d.matches),!l){let{error:e,notFoundMatches:t,route:r}=ke(n.pathname);G(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u});return}T=new AbortController;let f=lo(e.history,n,T.signal,r&&r.submission),p=e.getContext?await e.getContext():new Ni,m;if(r&&r.pendingError)m=[_o(l).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&jo(r.submission.formMethod)){let t=await ae(f,n,r.submission,l,p,d.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:u});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if(Eo(r)&&va(r.error)&&r.error.status===404){T=null,G(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}});return}}l=t.matches||l,m=t.pendingActionResult,a=Fo(n,r.submission),u=!1,d.active=!1,f=lo(e.history,f.url,f.signal)}let{shortCircuited:h,matches:g,loaderData:_,errors:y}=await oe(f,n,l,p,d.active,a,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,u,m);h||(T=null,G(n,{matches:g||l,...go(m),loaderData:_,errors:y}))}async function ae(e,t,n,s,l,u,d,f={}){if(me(),te({navigation:Io(t,n)},{flushSync:f.flushSync===!0}),u){let n=await Fe(s,t.pathname,e.signal);if(n.type===`aborted`)return{shortCircuited:!0};if(n.type===`error`){if(n.partialMatches.length===0){let{matches:e,route:t}=vo(o);return{matches:e,pendingActionResult:[t.id,{type:`error`,error:n.error}]}}let e=_o(n.partialMatches).route.id;return{matches:n.partialMatches,pendingActionResult:[e,{type:`error`,error:n.error}]}}if(n.matches)s=n.matches;else{let{notFoundMatches:e,error:n,route:r}=ke(t.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:n}]}}}let p,m=No(s,t);if(!m.route.action&&!m.route.lazy)p={type:`error`,error:yo(405,{method:e.method,pathname:t.pathname,routeId:m.route.id})};else{let t=await fe(e,no(i,a,e,s,m,d?[]:r,l),l,null);if(p=t[m.route.id],!p){for(let e of s)if(t[e.route.id]){p=t[e.route.id];break}}if(e.signal.aborted)return{shortCircuited:!0}}if(Do(p)){let t;return t=f&&f.replace!=null?f.replace:co(p.response.headers.get(`Location`),new URL(e.url),c)===S.location.pathname+S.location.search,await de(e,p,!0,{submission:n,replace:t}),{shortCircuited:!0}}if(Eo(p)){let e=_o(s,m.route.id);return(f&&f.replace)!==!0&&(C=`PUSH`),{matches:s,pendingActionResult:[e.route.id,p,m.route.id]}}return{matches:s,pendingActionResult:[m.route.id,p]}}async function oe(t,n,l,u,d,f,p,m,h,g,_,v){let y=f||Fo(n,p),b=p||m||Po(y),x=!k&&!g;if(d){if(x){let e=se(v);te({navigation:y,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await Fe(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=vo(o);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=_o(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)l=e.matches;else{let{error:e,notFoundMatches:t,route:r}=ke(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s||o,{dsMatches:w,revalidatingFetchers:E}=La(t,u,i,a,e.history,S,l,b,n,g?[]:r,g===!0,A,j,ee,L,I,C,c,e.patchRoutesOnNavigation!=null,v);if(P=++N,!e.dataStrategy&&!w.some(e=>e.shouldLoad)&&!w.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=Ce();return G(n,{matches:l,loaderData:{},errors:v&&Eo(v[1])?{[v[0]]:v[1].error}:null,...go(v),...e?{fetchers:new Map(S.fetchers)}:{}},{flushSync:_}),{shortCircuited:!0}}if(x){let e={};if(!d){e.navigation=y;let t=se(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=K(E)),te(e,{flushSync:_})}E.forEach(e=>{xe(e.key),e.controller&&M.set(e.key,e.controller)});let D=()=>E.forEach(e=>xe(e.key));T&&T.signal.addEventListener(`abort`,D);let{loaderResults:O,fetcherResults:F}=await pe(w,E,t,u);if(t.signal.aborted)return{shortCircuited:!0};T&&T.signal.removeEventListener(`abort`,D),E.forEach(e=>M.delete(e.key));let R=bo(O);if(R)return await de(t,R.result,!0,{replace:h}),{shortCircuited:!0};if(R=bo(F),R)return I.add(R.key),await de(t,R.result,!0,{replace:h}),{shortCircuited:!0};let{loaderData:z,errors:B}=mo(S,l,O,v,E,F);g&&S.errors&&(B={...S.errors,...B});let V=Ce(),H=we(P),U=V||H||E.length>0;return{matches:l,loaderData:z,errors:B,...U?{fetchers:new Map(S.fetchers)}:{}}}function se(e){if(e&&!Eo(e[1]))return{[e[0]]:e[1].data};if(S.actionData)return Object.keys(S.actionData).length===0?null:S.actionData}function K(e){return e.forEach(e=>{let t=S.fetchers.get(e.key),n=Lo(void 0,t?t.data:void 0);S.fetchers.set(e.key,n)}),new Map(S.fetchers)}async function ce(t,n,r,i){xe(t);let a=(i&&i.flushSync)===!0,l=s||o,u=Fa(S.location,S.matches,c,r,n,i?.relative),d=Bi(l,u,c),f=Pe(d,l,u);if(f.active&&f.matches&&(d=f.matches),!d){ge(t,n,yo(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=Ia(!0,u,i);if(h){ge(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new Ni,_=(i&&i.preventScrollReset)===!0;if(m&&jo(m.formMethod)){await le(t,n,p,d,g,f.active,a,_,m);return}L.set(t,{routeId:n,path:p}),await ue(t,n,p,d,g,f.active,a,_,m)}async function le(t,n,l,u,d,f,p,m,h){me(),L.delete(t),he(t,Ro(h,S.fetchers.get(t)),{flushSync:p});let g=new AbortController,_=lo(e.history,l,g.signal,h);if(f){let e=await Fe(u,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){ge(t,n,e.error,{flushSync:p});return}if(e.matches)u=e.matches;else{ge(t,n,yo(404,{pathname:l}),{flushSync:p});return}}let v=No(u,l);if(!v.route.action&&!v.route.lazy){ge(t,n,yo(405,{method:h.formMethod,pathname:l,routeId:n}),{flushSync:p});return}M.set(t,g);let y=N,b=(await fe(_,no(i,a,_,u,v,r,d),d,t))[v.route.id];if(_.signal.aborted){M.get(t)===g&&M.delete(t);return}if(ee.has(t)){if(Do(b)||Eo(b)){he(t,zo(void 0));return}}else{if(Do(b)){if(M.delete(t),P>y){he(t,zo(void 0));return}return I.add(t),he(t,Lo(h)),de(_,b,!1,{fetcherSubmission:h,preventScrollReset:m})}if(Eo(b)){ge(t,n,b.error);return}}let x=S.navigation.location||S.location,w=lo(e.history,x,g.signal),E=s||o,D=S.navigation.state===`idle`?S.matches:Bi(E,S.navigation.location,c);Ci(D,`Didn't find any matches after fetcher action`);let O=++N;F.set(t,O);let k=Lo(h,b.data);S.fetchers.set(t,k);let{dsMatches:R,revalidatingFetchers:z}=La(w,d,i,a,e.history,S,D,h,x,r,!1,A,j,ee,L,I,E,c,e.patchRoutesOnNavigation!=null,[v.route.id,b]);z.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=S.fetchers.get(t),r=Lo(void 0,n?n.data:void 0);S.fetchers.set(t,r),xe(t),e.controller&&M.set(t,e.controller)}),te({fetchers:new Map(S.fetchers)});let B=()=>z.forEach(e=>xe(e.key));g.signal.addEventListener(`abort`,B);let{loaderResults:V,fetcherResults:H}=await pe(R,z,w,d);if(g.signal.aborted)return;if(g.signal.removeEventListener(`abort`,B),F.delete(t),M.delete(t),z.forEach(e=>M.delete(e.key)),S.fetchers.has(t)){let e=zo(b.data);S.fetchers.set(t,e)}let U=bo(V);if(U)return de(w,U.result,!1,{preventScrollReset:m});if(U=bo(H),U)return I.add(U.key),de(w,U.result,!1,{preventScrollReset:m});let{loaderData:W,errors:ne}=mo(S,D,V,void 0,z,H);we(O),S.navigation.state===`loading`&&O>P?(Ci(C,`Expected pending action`),T&&T.abort(),G(S.navigation.location,{matches:D,loaderData:W,errors:ne,fetchers:new Map(S.fetchers)})):(te({errors:ne,loaderData:ho(S.loaderData,W,D,ne),fetchers:new Map(S.fetchers)}),A=!1)}async function ue(t,n,o,s,c,l,u,d,f){let p=S.fetchers.get(t);he(t,Lo(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=lo(e.history,o,m.signal);if(l){let e=await Fe(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){ge(t,n,e.error,{flushSync:u});return}if(e.matches)s=e.matches;else{ge(t,n,yo(404,{pathname:o}),{flushSync:u});return}}let g=No(s,o);M.set(t,m);let _=N,v=(await fe(h,no(i,a,h,s,g,r,c),c,t))[g.route.id];if(M.get(t)===m&&M.delete(t),!h.signal.aborted){if(ee.has(t)){he(t,zo(void 0));return}if(Do(v)){if(P>_){he(t,zo(void 0));return}I.add(t),await de(h,v,!1,{preventScrollReset:d});return}if(Eo(v)){ge(t,n,v.error);return}he(t,zo(v.data))}}async function de(e,r,i,{submission:a,fetcherSubmission:o,preventScrollReset:s,replace:l}={}){r.response.headers.has(`X-Remix-Revalidate`)&&(A=!0);let u=r.response.headers.get(`Location`);Ci(u,`Expected a Location header on the redirect Response`),u=co(u,new URL(e.url),c);let d=Di(S.location,u,{_isRedirect:!0});if(n){let e=!1;if(r.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(ka(u)){let n=ji(u,!0);e=n.origin!==t.location.origin||aa(n.pathname,c)==null}if(e){l?t.location.replace(u):t.location.assign(u);return}}T=null;let f=l===!0||r.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:p,formAction:m,formEncType:h}=S.navigation;!a&&!o&&p&&m&&h&&(a=Po(S.navigation));let g=a||o;wa.has(r.response.status)&&g&&jo(g.formMethod)?await ie(f,d,{submission:{...g,formAction:u},preventScrollReset:s||w,enableViewTransition:i?E:void 0}):await ie(f,d,{overrideNavigation:Fo(d,a),fetcherSubmission:o,preventScrollReset:s||w,enableViewTransition:i?E:void 0})}async function fe(e,t,n,r){let i,a={};try{i=await ro(l,e,t,r,n,!1)}catch(e){return t.filter(e=>e.shouldLoad).forEach(t=>{a[t.route.id]={type:`error`,error:e}}),a}if(e.signal.aborted)return a;for(let[n,r]of Object.entries(i))if(To(r)){let i=r.result;a[n]={type:`redirect`,response:so(i,e,n,t,c)}}else a[n]=await oo(r);return a}async function pe(e,t,n,r){let i=fe(n,e,r,null),a=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await fe(e.request,e.matches,r,e.key))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:`error`,error:yo(404,{pathname:e.path})}})}));return{loaderResults:await i,fetcherResults:(await a).reduce((e,t)=>Object.assign(e,t),{})}}function me(){A=!0,L.forEach((e,t)=>{M.has(t)&&j.add(t),xe(t)})}function he(e,t,n={}){S.fetchers.set(e,t),te({fetchers:new Map(S.fetchers)},{flushSync:(n&&n.flushSync)===!0})}function ge(e,t,n,r={}){let i=_o(S.matches,t);ye(e),te({errors:{[i.route.id]:n},fetchers:new Map(S.fetchers)},{flushSync:(r&&r.flushSync)===!0})}function _e(e){return R.set(e,(R.get(e)||0)+1),ee.has(e)&&ee.delete(e),S.fetchers.get(e)||Ea}function ve(e,t){xe(e,t?.reason),he(e,zo(null))}function ye(e){let t=S.fetchers.get(e);M.has(e)&&!(t&&t.state===`loading`&&F.has(e))&&xe(e),L.delete(e),F.delete(e),I.delete(e),ee.delete(e),j.delete(e),S.fetchers.delete(e)}function be(e){let t=(R.get(e)||0)-1;t<=0?(R.delete(e),ee.add(e)):R.set(e,t),te({fetchers:new Map(S.fetchers)})}function xe(e,t){let n=M.get(e);n&&(n.abort(t),M.delete(e))}function Se(e){for(let t of e){let e=zo(_e(t).data);S.fetchers.set(t,e)}}function Ce(){let e=[],t=!1;for(let n of I){let r=S.fetchers.get(n);Ci(r,`Expected fetcher: ${n}`),r.state===`loading`&&(I.delete(n),e.push(n),t=!0)}return Se(e),t}function we(e){let t=[];for(let[n,r]of F)if(r<e){let e=S.fetchers.get(n);Ci(e,`Expected fetcher: ${n}`),e.state===`loading`&&(xe(n),F.delete(n),t.push(n))}return Se(t),t.length>0}function Te(e,t){let n=S.blockers.get(e)||Da;return z.get(e)!==t&&z.set(e,t),n}function Ee(e){S.blockers.delete(e),z.delete(e)}function De(e,t){let n=S.blockers.get(e)||Da;Ci(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(S.blockers);r.set(e,t),te({blockers:r})}function Oe({currentLocation:e,nextLocation:t,historyAction:n}){if(z.size===0)return;z.size>1&&wi(!1,`A router only supports one blocker at a time`);let r=Array.from(z.entries()),[i,a]=r[r.length-1],o=S.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function ke(e){let t=yo(404,{pathname:e}),{matches:n,route:r}=vo(s||o);return{notFoundMatches:n,route:r,error:t}}function Ae(e,t,n){if(p=e,h=t,m=n||null,!g&&S.navigation===Ta){g=!0;let e=Ne(S.location,S.matches);e!=null&&te({restoreScrollPosition:e})}return()=>{p=null,h=null,m=null}}function je(e,t){return m&&m(e,t.map(e=>Hi(e,S.loaderData)))||e.key}function Me(e,t){if(p&&h){let n=je(e,t);p[n]=h()}}function Ne(e,t){if(p){let n=je(e,t),r=p[n];if(typeof r==`number`)return r}return null}function Pe(t,n,r){if(e.patchRoutesOnNavigation){if(!t)return{active:!0,matches:Vi(n,r,c,!0)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:Vi(n,r,c,!0)}}return{active:!1,matches:null}}async function Fe(t,n,r,l){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let u=t;for(;;){let t=s==null,d=s||o,f=a;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:u,fetcherKey:l,patch:(e,t)=>{r.aborted||Ua(e,t,d,f,i,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:u}}finally{t&&!r.aborted&&(o=[...o])}if(r.aborted)return{type:`aborted`};let p=Bi(d,n,c);if(p)return{type:`success`,matches:p};let m=Vi(d,n,c,!0);if(!m||u.length===m.length&&u.every((e,t)=>e.route.id===m[t].route.id))return{type:`success`,matches:null};u=m}}function Ie(e){a={},s=zi(e,i,void 0,a)}function Le(e,t,n=!1){let r=s==null;Ua(e,t,s||o,a,i,n),r&&(o=[...o],te({}))}return x={get basename(){return c},get future(){return u},get state(){return S},get routes(){return o},get window(){return t},initialize:H,subscribe:W,enableScrollRestoration:Ae,navigate:ne,fetch:ce,revalidate:re,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:_e,resetFetcher:ve,deleteFetcher:be,dispose:U,getBlocker:Te,deleteBlocker:Ee,patchRoutes:Le,_internalFetchControllers:M,_internalSetRoutes:Ie,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){te(e)}},x}function Pa(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function Fa(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=fa(r||`.`,da(o),aa(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=Mo(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=oa({basename:n,pathname:c.pathname})),Oi(c)}function Ia(e,t,n){if(!n||!Pa(n))return{path:t};if(n.formMethod&&!Ao(n.formMethod))return{path:t,error:yo(405,{method:n.formMethod})};let r=()=>({path:t,error:yo(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=xo(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!jo(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
|
|
34
34
|
`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if(n.formEncType===`application/json`){if(!jo(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}Ci(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=uo(n.formData),s=n.formData;else if(n.body instanceof FormData)o=uo(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=fo(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=fo(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(jo(c.formMethod))return{path:t,submission:c};let l=ki(t);return e&&l.search&&Mo(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:Oi(l),submission:c}}function La(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y){let b=y?Eo(y[1])?y[1].error:y[1].data:void 0,x=i.createURL(a.location),S=i.createURL(c),C;if(u&&a.errors){let e=Object.keys(a.errors)[0];C=o.findIndex(t=>t.route.id===e)}else if(y&&Eo(y[1])){let e=y[0];C=o.findIndex(t=>t.route.id===e)-1}let w=y?y[1].statusCode:void 0,T=w&&w>=400,E={currentUrl:x,currentParams:a.matches[0]?.params||{},nextUrl:S,nextParams:o[0].params,...s,actionResult:b,actionStatus:w},D=o.map((i,o)=>{let{route:s}=i,c=null;if(C!=null&&o>C?c=!1:s.lazy?c=!0:Ra(s)?u?c=za(s,a.loaderData,a.errors):Ba(a.loaderData,a.matches[o],i)&&(c=!0):c=!1,c!==null)return to(n,r,e,i,l,t,c);let f=T?!1:d||x.pathname+x.search===S.pathname+S.search||x.search!==S.search||Va(a.matches[o],i),p={...E,defaultShouldRevalidate:f};return to(n,r,e,i,l,t,Ha(i,p),p)}),O=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,y=Bi(g,e.path,_);if(!y){if(v&&m)return;O.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let b=No(y,e.path),x=new AbortController,S=lo(i,e.path,x.signal),C=null;if(f.has(s))f.delete(s),C=no(n,r,S,y,b,l,t);else if(m)d&&(C=no(n,r,S,y,b,l,t));else{let e={...E,defaultShouldRevalidate:!T&&d};Ha(b,e)&&(C=no(n,r,S,y,b,l,t,e))}C&&O.push({key:s,routeId:e.routeId,path:e.path,matches:C,match:b,request:S,controller:x})}),{dsMatches:D,revalidatingFetchers:O}}function Ra(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function za(e,t,n){if(e.lazy)return!0;if(!Ra(e))return!1;let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;return!r&&i?!1:typeof e.loader==`function`&&e.loader.hydrate===!0||!r&&!i}function Ba(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function Va(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function Ha(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function Ua(e,t,n,r,i,a){let o;if(e){let t=r[e];Ci(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>Wa(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=zi(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=zi([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}}function Wa(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index!==t.index||e.path!==t.path||e.caseSensitive!==t.caseSensitive?!1:(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)||e.children.every((e,n)=>t.children?.some(t=>Wa(e,t)))}var Ga=new WeakMap,Ka=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(Ci(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=Ga.get(i);o||(o={},Ga.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=Fi(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)wi(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)wi(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},qa=new WeakMap;function Ja(e,t,n,r,i){let a=n[e.id];if(Ci(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=qa.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{Ci(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=Li(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?wi(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?wi(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return qa.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=Ka({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function Ya(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function Xa(e){return e.matches.some(e=>e.route.middleware)?Za(e,()=>Ya(e)):Ya(e)}function Za(e,t){return Qa(e,t,e=>e,Co,n);function n(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:`error`,result:t}}));{let{matches:r}=e,i=_o(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.unstable_shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function Qa(e,t,n,r,i){let{matches:a,request:o,params:s,context:c}=e,l=a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]);return await $a({request:o,params:s,context:c},l,t,n,r,i)}async function $a(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await $a(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function eo(e,t,n,r,i){let a=Ka({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=Ja(r.route,jo(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function to(e,t,n,r,i,a,o,s=null){let c=!1,l=eo(e,t,n,r,i);return{...r,_lazyPromises:l,shouldLoad:o,unstable_shouldRevalidateArgs:s,unstable_shouldCallHandler(e){return c=!0,s?typeof e==`boolean`?Ha(r,{...s,defaultShouldRevalidate:e}):Ha(r,s):o},resolve(e){let{lazy:t,loader:i,middleware:s}=r.route,u=c||o||e&&!jo(n.method)&&(t||i),d=s&&s.length>0&&!i&&!t;return u&&!d?io({request:n,match:r,lazyHandlerPromise:l?.handler,lazyRoutePromise:l?.route,handlerOverride:e,scopedContext:a}):Promise.resolve({type:`data`,result:void 0})}}}function no(e,t,n,r,i,a,o,s=null){return r.map(r=>r.route.id===i.route.id?to(e,t,n,r,a,o,!0,s):{...r,shouldLoad:!1,unstable_shouldRevalidateArgs:s,unstable_shouldCallHandler:()=>!1,_lazyPromises:eo(e,t,n,r,a),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function ro(e,t,n,r,i,a){n.some(e=>e._lazyPromises?.middleware)&&await Promise.all(n.map(e=>e._lazyPromises?.middleware));let o={request:t,params:n[0].params,context:i,matches:n},s=a?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=o;return Za(t,()=>e({...t,fetcherKey:r,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},c=await e({...o,fetcherKey:r,runClientMiddleware:s});try{await Promise.all(n.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return c}async function io({request:e,match:t,lazyHandlerPromise:n,lazyRoutePromise:r,handlerOverride:i,scopedContext:a}){let o,s,c=jo(e.method),l=c?`action`:`loader`,u=n=>{let r,o=new Promise((e,t)=>r=t);s=()=>r(),e.signal.addEventListener(`abort`,s);let c=r=>typeof n==`function`?n({request:e,params:t.params,context:a},...r===void 0?[]:[r]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${l}" [routeId: ${t.route.id}]`)),u=(async()=>{try{return{type:`data`,result:await(i?i(e=>c(e)):c())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([u,o])};try{let i=c?t.route.action:t.route.loader;if(n||r){if(i){let e,[t]=await Promise.all([u(i).catch(t=>{e=t}),n,r]);if(e!==void 0)throw e;o=t}else{await n;let i=c?t.route.action:t.route.loader;if(i)[o]=await Promise.all([u(i),r]);else if(l===`action`){let n=new URL(e.url),r=n.pathname+n.search;throw yo(405,{method:e.method,pathname:r,routeId:t.route.id})}else return{type:`data`,result:void 0}}}else if(i)o=await u(i);else{let t=new URL(e.url);throw yo(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{s&&e.signal.removeEventListener(`abort`,s)}return o}async function ao(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function oo(e){let{result:t,type:n}=e;if(ko(t)){let e;try{e=await ao(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new _a(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?Oo(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:new _a(t.init?.status||500,void 0,t.data),statusCode:va(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:va(t)?t.status:void 0}:Oo(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function so(e,t,n,r,i){let a=e.headers.get(`Location`);if(Ci(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!ka(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=Fa(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}function co(e,t,n){if(ka(e)){let r=e,i=r.startsWith(`//`)?new URL(t.protocol+r):new URL(r),a=aa(i.pathname,n)!=null;if(i.origin===t.origin&&a)return i.pathname+i.search+i.hash}return e}function lo(e,t,n,r){let i=e.createURL(xo(t)).toString(),a={signal:n};if(r&&jo(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):a.body=t===`text/plain`?r.text:t===`application/x-www-form-urlencoded`&&r.formData?uo(r.formData):r.formData}return new Request(i,a)}function uo(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function fo(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function po(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&Eo(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(Ci(!Do(f),`Cannot handle redirect results in processLoaderData`),Eo(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=_o(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=Ma),c||(c=!0,s=va(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function mo(e,t,n,r,i,a){let{loaderData:o,errors:s}=po(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let o=a[n];if(Ci(o,`Did not find corresponding fetcher result`),Eo(o)){let t=_o(e.matches,r?.route.id);s&&s[t.route.id]||(s={...s,[t.route.id]:o.error}),e.fetchers.delete(n)}else if(Do(o))Ci(!1,`Unhandled fetcher revalidation redirect`);else{let t=zo(o.data);e.fetchers.set(n,t)}}),{loaderData:o,errors:s}}function ho(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==Ma).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function go(e){return e?Eo(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function _o(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function vo(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function yo(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new _a(e||500,o,Error(s),!0)}function bo(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(Do(r))return{key:n,result:r}}}function xo(e){return Oi({...typeof e==`string`?ki(e):e,hash:``})}function So(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash||t.hash!==``}function Co(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&wo(t))}function wo(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function To(e){return ko(e.result)&&Ca.has(e.result.status)}function Eo(e){return e.type===`error`}function Do(e){return(e&&e.type)===`redirect`}function Oo(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function ko(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function Ao(e){return Sa.has(e.toUpperCase())}function jo(e){return ba.has(e.toUpperCase())}function Mo(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function No(e,t){let n=typeof t==`string`?ki(t).search:t.search;if(e[e.length-1].route.index&&Mo(n||``))return e[e.length-1];let r=ua(e);return r[r.length-1]}function Po(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(t&&n&&r){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function Fo(e,t){return t?{state:`loading`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:`loading`,location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Io(e,t){return{state:`submitting`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Lo(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Ro(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function zo(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Bo(e,t){try{let n=e.sessionStorage.getItem(ja);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function Vo(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(ja,JSON.stringify(n))}catch(e){wi(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function Ho(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var Uo=p.createContext(null);Uo.displayName=`DataRouter`;var Wo=p.createContext(null);Wo.displayName=`DataRouterState`,p.createContext(!1);var Go=p.createContext({isTransitioning:!1});Go.displayName=`ViewTransition`;var Ko=p.createContext(new Map);Ko.displayName=`Fetchers`;var qo=p.createContext(null);qo.displayName=`Await`;var Jo=p.createContext(null);Jo.displayName=`Navigation`;var Yo=p.createContext(null);Yo.displayName=`Location`;var Xo=p.createContext({outlet:null,matches:[],isDataRoute:!1});Xo.displayName=`Route`;var Zo=p.createContext(null);Zo.displayName=`RouteError`;function Qo(e,{relative:t}={}){Ci($o(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=p.useContext(Jo),{hash:i,pathname:a,search:o}=ss(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:pa([n,a])),r.createHref({pathname:s,search:o,hash:i})}function $o(){return p.useContext(Yo)!=null}function es(){return Ci($o(),`useLocation() may be used only in the context of a <Router> component.`),p.useContext(Yo).location}var ts=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function ns(e){p.useContext(Jo).static||p.useLayoutEffect(e)}function rs(){let{isDataRoute:e}=p.useContext(Xo);return e?xs():is()}function is(){Ci($o(),`useNavigate() may be used only in the context of a <Router> component.`);let e=p.useContext(Uo),{basename:t,navigator:n}=p.useContext(Jo),{matches:r}=p.useContext(Xo),{pathname:i}=es(),a=JSON.stringify(da(r)),o=p.useRef(!1);return ns(()=>{o.current=!0}),p.useCallback((r,s={})=>{if(wi(o.current,ts),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=fa(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:pa([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var as=p.createContext(null);function os(e){let t=p.useContext(Xo).outlet;return p.useMemo(()=>t&&p.createElement(as.Provider,{value:e},t),[t,e])}function ss(e,{relative:t}={}){let{matches:n}=p.useContext(Xo),{pathname:r}=es(),i=JSON.stringify(da(n));return p.useMemo(()=>fa(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function cs(e,t,n,r,i){Ci($o(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=p.useContext(Jo),{matches:o}=p.useContext(Xo),s=o[o.length-1],c=s?s.params:{},l=s?s.pathname:`/`,u=s?s.pathnameBase:`/`,d=s&&s.route;{let e=d&&d.path||``;Cs(l,!d||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
35
35
|
|
|
36
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let f=es(),m;if(t){let e=typeof t==`string`?ki(t):t;Ci(u===`/`||e.pathname?.startsWith(u),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${e.pathname}" was given in the \`location\` prop.`),m=e}else m=f;let h=m.pathname||`/`,g=h;if(u!==`/`){let e=u.replace(/^\//,``).split(`/`);g=`/`+h.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let _=Bi(e,{pathname:g});wi(d||_!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),wi(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=ps(_&&_.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:pa([u,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?u:pa([u,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&v?p.createElement(Yo.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...m},navigationType:`POP`}},v):v}function ls(){let e=bs(),t=va(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=p.createElement(p.Fragment,null,p.createElement(`p`,null,`💿 Hey developer 👋`),p.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,p.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,p.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),p.createElement(p.Fragment,null,p.createElement(`h2`,null,`Unexpected Application Error!`),p.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?p.createElement(`pre`,{style:i},n):null,o)}var us=p.createElement(ls,null),ds=class extends p.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.unstable_onError?this.props.unstable_onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){return this.state.error===void 0?this.props.children:p.createElement(Xo.Provider,{value:this.props.routeContext},p.createElement(Zo.Provider,{value:this.state.error,children:this.props.component}))}};function fs({routeContext:e,match:t,children:n}){let r=p.useContext(Uo);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),p.createElement(Xo.Provider,{value:e},n)}function ps(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);Ci(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){s=!0,a=c>=0?a.slice(0,c+1):[a[0]];break}}}return a.reduceRight((e,i,l)=>{let u,d=!1,f=null,m=null;n&&(u=o&&i.route.id?o[i.route.id]:void 0,f=i.route.errorElement||us,s&&(c<0&&l===0?(Cs(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,m=null):c===l&&(d=!0,m=i.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,l+1)),g=()=>{let t;return t=u?f:d?m:i.route.Component?p.createElement(i.route.Component,null):i.route.element?i.route.element:e,p.createElement(fs,{match:i,routeContext:{outlet:e,matches:h,isDataRoute:n!=null},children:t})};return n&&(i.route.ErrorBoundary||i.route.errorElement||l===0)?p.createElement(ds,{location:n.location,revalidation:n.revalidation,component:f,error:u,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},unstable_onError:r}):g()},null)}function ms(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hs(e){let t=p.useContext(Uo);return Ci(t,ms(e)),t}function gs(e){let t=p.useContext(Wo);return Ci(t,ms(e)),t}function _s(e){let t=p.useContext(Xo);return Ci(t,ms(e)),t}function vs(e){let t=_s(e),n=t.matches[t.matches.length-1];return Ci(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ys(){return vs(`useRouteId`)}function bs(){let e=p.useContext(Zo),t=gs(`useRouteError`),n=vs(`useRouteError`);return e===void 0?t.errors?.[n]:e}function xs(){let{router:e}=hs(`useNavigate`),t=vs(`useNavigate`),n=p.useRef(!1);return ns(()=>{n.current=!0}),p.useCallback(async(r,i={})=>{wi(n.current,ts),n.current&&(typeof r==`number`?e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Ss={};function Cs(e,t,n){!t&&!Ss[e]&&(Ss[e]=!0,wi(!1,n))}var ws={};function Ts(e,t){!e&&!ws[t]&&(ws[t]=!0,console.warn(t))}function Es(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&wi(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:p.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&wi(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:p.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&wi(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:p.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Ds=[`HydrateFallback`,`hydrateFallbackElement`],Os=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function ks({router:e,flushSync:t,unstable_onError:n}){let[r,i]=p.useState(e.state),[a,o]=p.useState(),[s,c]=p.useState({isTransitioning:!1}),[l,u]=p.useState(),[d,f]=p.useState(),[m,h]=p.useState(),g=p.useRef(new Map),_=p.useCallback(e=>{i(t=>(e.errors&&n&&Object.entries(e.errors).forEach(([e,r])=>{t.errors?.[e]!==r&&n(r)}),e))},[n]),v=p.useCallback((n,{deletedFetchers:r,flushSync:i,viewTransitionOpts:a})=>{n.fetchers.forEach((e,t)=>{e.data!==void 0&&g.current.set(t,e.data)}),r.forEach(e=>g.current.delete(e)),Ts(i===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let s=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(Ts(a==null||s,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!a||!s){t&&i?t(()=>_(n)):p.startTransition(()=>_(n));return}if(t&&i){t(()=>{d&&(l&&l.resolve(),d.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:a.currentLocation,nextLocation:a.nextLocation})});let r=e.window.document.startViewTransition(()=>{t(()=>_(n))});r.finished.finally(()=>{t(()=>{u(void 0),f(void 0),o(void 0),c({isTransitioning:!1})})}),t(()=>f(r));return}d?(l&&l.resolve(),d.skipTransition(),h({state:n,currentLocation:a.currentLocation,nextLocation:a.nextLocation})):(o(n),c({isTransitioning:!0,flushSync:!1,currentLocation:a.currentLocation,nextLocation:a.nextLocation}))},[e.window,t,d,l,_]);p.useLayoutEffect(()=>e.subscribe(v),[e,v]),p.useEffect(()=>{s.isTransitioning&&!s.flushSync&&u(new Os)},[s]),p.useEffect(()=>{if(l&&a&&e.window){let t=a,n=l.promise,r=e.window.document.startViewTransition(async()=>{p.startTransition(()=>_(t)),await n});r.finished.finally(()=>{u(void 0),f(void 0),o(void 0),c({isTransitioning:!1})}),f(r)}},[a,l,e.window,_]),p.useEffect(()=>{l&&a&&r.location.key===a.location.key&&l.resolve()},[l,d,r.location,a]),p.useEffect(()=>{!s.isTransitioning&&m&&(o(m.state),c({isTransitioning:!0,flushSync:!1,currentLocation:m.currentLocation,nextLocation:m.nextLocation}),h(void 0))},[s.isTransitioning,m]);let y=p.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),b=e.basename||`/`,x=p.useMemo(()=>({router:e,navigator:y,static:!1,basename:b,unstable_onError:n}),[e,y,b,n]);return p.createElement(p.Fragment,null,p.createElement(Uo.Provider,{value:x},p.createElement(Wo.Provider,{value:r},p.createElement(Ko.Provider,{value:g.current},p.createElement(Go.Provider,{value:s},p.createElement(Ps,{basename:b,location:r.location,navigationType:r.historyAction,navigator:y},p.createElement(As,{routes:e.routes,future:e.future,state:r,unstable_onError:n})))))),null)}var As=p.memo(js);function js({routes:e,future:t,state:n,unstable_onError:r}){return cs(e,void 0,n,r,t)}function Ms({to:e,replace:t,state:n,relative:r}){Ci($o(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=p.useContext(Jo);wi(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=p.useContext(Xo),{pathname:o}=es(),s=rs(),c=fa(e,da(a),o,r===`path`),l=JSON.stringify(c);return p.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Ns(e){return os(e.context)}function Ps({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1}){Ci(!$o(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let o=e.replace(/^\/*/,`/`),s=p.useMemo(()=>({basename:o,navigator:i,static:a,future:{}}),[o,i,a]);typeof n==`string`&&(n=ki(n));let{pathname:c=`/`,search:l=``,hash:u=``,state:d=null,key:f=`default`}=n,m=p.useMemo(()=>{let e=aa(c,o);return e==null?null:{location:{pathname:e,search:l,hash:u,state:d,key:f},navigationType:r}},[o,c,l,u,d,f,r]);return wi(m!=null,`<Router basename="${o}"> is not able to match the URL "${c}${l}${u}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:p.createElement(Jo.Provider,{value:s},p.createElement(Yo.Provider,{children:t,value:m}))}p.Component;var Fs=`get`,Is=`application/x-www-form-urlencoded`;function Ls(e){return e!=null&&typeof e.tagName==`string`}function Rs(e){return Ls(e)&&e.tagName.toLowerCase()===`button`}function zs(e){return Ls(e)&&e.tagName.toLowerCase()===`form`}function Bs(e){return Ls(e)&&e.tagName.toLowerCase()===`input`}function Vs(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Hs(e,t){return e.button===0&&(!t||t===`_self`)&&!Vs(e)}function Us(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Ws(e,t){let n=Us(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Gs=null;function Ks(){if(Gs===null)try{new FormData(document.createElement(`form`),0),Gs=!1}catch{Gs=!0}return Gs}var qs=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Js(e){return e!=null&&!qs.has(e)?(wi(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Is}"`),null):e}function Ys(e,t){let n,r,i,a,o;if(zs(e)){let o=e.getAttribute(`action`);r=o?aa(o,t):null,n=e.getAttribute(`method`)||Fs,i=Js(e.getAttribute(`enctype`))||Is,a=new FormData(e)}else if(Rs(e)||Bs(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?aa(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Fs,i=Js(e.getAttribute(`formenctype`))||Js(o.getAttribute(`enctype`))||Is,a=new FormData(o,e),!Ks()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Ls(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Fs,r=null,i=Is,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Xs(e,t){if(e===!1||e==null)throw Error(t)}function Zs(e,t,n){let r=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return r.pathname=r.pathname===`/`?`_root.${n}`:t&&aa(r.pathname,t)===`/`?`${t.replace(/\/$/,``)}/_root.${n}`:`${r.pathname.replace(/\/$/,``)}.${n}`,r}async function Qs(e,t){if(e.id in t)return t[e.id];try{let n=await gi(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function $s(e){return e!=null&&typeof e.page==`string`}function ec(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function tc(e,t,n){return oc((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Qs(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(ec).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function nc(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function rc(e,t,{includeHydrateFallback:n}={}){return ic(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function ic(e){return[...new Set(e)]}function ac(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function oc(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!$s(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ac(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function sc(){let e=p.useContext(Uo);return Xs(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function cc(){let e=p.useContext(Wo);return Xs(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var lc=p.createContext(void 0);lc.displayName=`FrameworkContext`;function uc(){let e=p.useContext(lc);return Xs(e,`You must render this element inside a <HydratedRouter> element`),e}function dc(e,t){let n=p.useContext(lc),[r,i]=p.useState(!1),[a,o]=p.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=p.useRef(null);p.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),p.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:fc(s,m),onBlur:fc(c,h),onMouseEnter:fc(l,m),onMouseLeave:fc(u,h),onTouchStart:fc(d,m)}]:[a,f,{}]:[!1,f,{}]}function fc(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function pc({page:e,...t}){let{router:n}=sc(),r=p.useMemo(()=>Bi(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?p.createElement(hc,{page:e,matches:r,...t}):null}function mc(e){let{manifest:t,routeModules:n}=uc(),[r,i]=p.useState([]);return p.useEffect(()=>{let r=!1;return tc(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function hc({page:e,matches:t,...n}){let r=es(),{manifest:i,routeModules:a}=uc(),{basename:o}=sc(),{loaderData:s,matches:c}=cc(),l=p.useMemo(()=>nc(e,t,c,i,r,`data`),[e,t,c,i,r]),u=p.useMemo(()=>nc(e,t,c,i,r,`assets`),[e,t,c,i,r]),d=p.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,c=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!l.some(t=>t.route.id===e.route.id)&&e.route.id in s&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?c=!0:n.add(e.route.id))}),n.size===0)return[];let u=Zs(e,o,`data`);return c&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[o,s,r,i,l,t,e,a]),f=p.useMemo(()=>rc(u,i),[u,i]),m=mc(u);return p.createElement(p.Fragment,null,d.map(e=>p.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),f.map(e=>p.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>p.createElement(`link`,{key:e,nonce:n.nonce,...t})))}function gc(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}p.Component;var _c=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{_c&&(window.__reactRouterVersion=`7.9.3`)}catch{}function vc(e,t){return Na({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:Si({window:t?.window}),hydrationData:t?.hydrationData||yc(),routes:e,mapRouteProperties:Es,hydrationRouteProperties:Ds,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function yc(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:bc(e.errors)}),e}function bc(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new _a(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(r.__subType){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var xc=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Sc=p.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:o,target:s,to:c,preventScrollReset:l,viewTransition:u,...d},f){let{basename:m}=p.useContext(Jo),h=typeof c==`string`&&xc.test(c),g,_=!1;if(typeof c==`string`&&h&&(g=c,_c))try{let e=new URL(window.location.href),t=c.startsWith(`//`)?new URL(e.protocol+c):new URL(c),n=aa(t.pathname,m);t.origin===e.origin&&n!=null?c=n+t.search+t.hash:_=!0}catch{wi(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let v=Qo(c,{relative:r}),[y,b,x]=dc(n,d),S=Dc(c,{replace:a,state:o,target:s,preventScrollReset:l,relative:r,viewTransition:u});function C(t){e&&e(t),t.defaultPrevented||S(t)}let w=p.createElement(`a`,{...d,...x,href:g||v,onClick:_||i?e:C,ref:gc(f,b),target:s,"data-discover":!h&&t===`render`?`true`:void 0});return y&&!h?p.createElement(p.Fragment,null,w,p.createElement(pc,{page:v})):w});Sc.displayName=`Link`;var Cc=p.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=ss(a,{relative:c.relative}),d=es(),f=p.useContext(Wo),{navigator:m,basename:h}=p.useContext(Jo),g=f!=null&&Nc(u)&&o===!0,_=m.encodeLocation?m.encodeLocation(u).pathname:u.pathname,v=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=aa(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return p.createElement(Sc,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Cc.displayName=`NavLink`;var wc=p.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Fs,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,...f},m)=>{let h=jc(),g=Mc(s,{relative:l}),_=o.toLowerCase()===`get`?`get`:`post`,v=typeof s==`string`&&xc.test(s);return p.createElement(`form`,{ref:m,method:_,action:g,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o;h(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d})},...f,"data-discover":!v&&e===`render`?`true`:void 0})});wc.displayName=`Form`;function Tc(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ec(e){let t=p.useContext(Uo);return Ci(t,Tc(e)),t}function Dc(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o}={}){let s=rs(),c=es(),l=ss(e,{relative:a});return p.useCallback(u=>{if(Hs(u,t)){u.preventDefault();let t=n===void 0?Oi(c)===Oi(l):n;s(e,{replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o})}},[c,s,l,n,r,t,e,i,a,o])}function Oc(e){wi(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=p.useRef(Us(e)),n=p.useRef(!1),r=es(),i=p.useMemo(()=>Ws(r.search,n.current?null:t.current),[r.search]),a=rs();return[i,p.useCallback((e,t)=>{let r=Us(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var kc=0,Ac=()=>`__${String(++kc)}__`;function jc(){let{router:e}=Ec(`useSubmit`),{basename:t}=p.useContext(Jo),n=ys();return p.useCallback(async(r,i={})=>{let{action:a,method:o,encType:s,formData:c,body:l}=Ys(r,t);if(i.navigate===!1){let t=i.fetcherKey||Ac();await e.fetch(t,n,i.action||a,{preventScrollReset:i.preventScrollReset,formData:c,body:l,formMethod:i.method||o,formEncType:i.encType||s,flushSync:i.flushSync})}else await e.navigate(i.action||a,{preventScrollReset:i.preventScrollReset,formData:c,body:l,formMethod:i.method||o,formEncType:i.encType||s,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[e,t,n])}function Mc(e,{relative:t}={}){let{basename:n}=p.useContext(Jo),r=p.useContext(Xo);Ci(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...ss(e||`.`,{relative:t})},o=es();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:pa([n,a.pathname])),Oi(a)}function Nc(e,{relative:t}={}){let n=p.useContext(Go);Ci(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ec(`useViewTransitionState`),i=ss(e,{relative:t});if(!n.isTransitioning)return!1;let a=aa(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=aa(n.nextLocation.pathname,r)||n.nextLocation.pathname;return na(i.pathname,o)!=null||na(i.pathname,a)!=null}var Pc=[`en`,`es-419`,`pt-BR`,`fr`,`de`,`it`,`ru`,`ja`,`ko`,`zh-Hans`,`zh-Hant`,`tr`,`pl`,`ar`,`he`],Fc=`ripple:language`,Ic=Pc,Lc=new Set([`ar`,`ckb`,`dv`,`fa`,`he`,`ps`,`sd`,`ug`,`ur`,`yi`]),Rc=()=>globalThis.navigator?.languages??[],zc=e=>{try{return new Intl.Locale(e)}catch{return}},Bc=e=>Lc.has(zc(e)?.language??``),Vc=(e,t)=>{let n=t.flatMap(e=>{let t=zc(e);if(!t)return[];let{language:n,script:r}=t.maximize();return[{tag:e,exact:t.baseName,language:n,script:r}]});for(let t of e){let e=zc(t);if(!e)continue;let{language:r,script:i}=e.maximize(),a=n.find(t=>t.exact===e.baseName)??n.find(e=>e.language===r&&e.script===i)??n.find(e=>e.language===r);if(a)return a.tag}},Hc,Uc=()=>{let e=Hc;if(e===void 0)try{e=globalThis.localStorage?.getItem(Fc)}catch{}return e&&Ic.includes(e)?e:void 0},Wc=e=>{try{e?localStorage.setItem(Fc,e):localStorage.removeItem(Fc),Hc=void 0}catch{Hc=e??null}},Gc=`en-US`,Kc=()=>Gc,qc=e=>{Gc=zc(e)?.language===`en`?`en-US`:e},Jc=(e=Rc(),t=Ic)=>Vc(e,t)??`en`,Yc=()=>{let{pathname:e,search:t,hash:n}=globalThis.location??{pathname:``,search:``,hash:``};return/^\/(?:watch|download)\/?$/.test(e)?new URLSearchParams(n.slice(1)).get(`language`)??new URLSearchParams(t).get(`language`):null},Xc=(e=Rc(),t=Ic,n=Yc())=>(n?Vc([n],t):void 0)??Uc()??Jc(e,t),Zc=(e=Xc(),t=Rc())=>{let{language:n,script:r}=zc(e)?.maximize()??{};return t.find(e=>{let t=zc(e)?.maximize();return!!t&&t.language===n&&t.script===r})??e},Qc=or(),$c=3e3,el=e=>e.flatMap(e=>e.type===Yt.argument?[{type:Yt.literal,value:``},e,{type:Yt.literal,value:``}]:e.type===Yt.tag?[{...e,children:el(e.children)}]:e.type===Yt.select||e.type===Yt.plural?[{...e,options:Object.fromEntries(Object.entries(e.options).map(([e,t])=>[e,{...t,value:el(t.value)}]))}]:[e]),tl=e=>{try{return el(Mn(e))}catch{return e}},nl=(e,t,n)=>ci({locale:t,defaultLocale:e===`en`?t:`en`,messages:n},Qc),q=nl(`en`,`en`,{}),rl=`en`,il=0,al=()=>rl,ol=new Set,sl=e=>(ol.add(e),()=>{ol.delete(e)}),cl=({children:e})=>(0,p.createElement)(ei,{value:(0,p.useSyncExternalStore)(sl,()=>q)},e),ll=e=>{if(typeof e==`string`)return e;let t={id:e.message,defaultMessage:e.message};return q.formatMessage(t,e.values)},ul=Object.assign({"../locales/ar.json":()=>gi(()=>import(`./assets/ar-D8VXhJpi.js`).then(e=>e.default),[]),"../locales/de.json":()=>gi(()=>import(`./assets/de-BsSeEGSU.js`).then(e=>e.default),[]),"../locales/es-419.json":()=>gi(()=>import(`./assets/es-419-BCvLqLTT.js`).then(e=>e.default),[]),"../locales/fr.json":()=>gi(()=>import(`./assets/fr-BpklDC1Z.js`).then(e=>e.default),[]),"../locales/he.json":()=>gi(()=>import(`./assets/he-BkHHgAv1.js`).then(e=>e.default),[]),"../locales/it.json":()=>gi(()=>import(`./assets/it-CkMR8wbx.js`).then(e=>e.default),[]),"../locales/ja.json":()=>gi(()=>import(`./assets/ja-C3JB3FWD.js`).then(e=>e.default),[]),"../locales/ko.json":()=>gi(()=>import(`./assets/ko-DloJnipq.js`).then(e=>e.default),[]),"../locales/pl.json":()=>gi(()=>import(`./assets/pl-DLBfSk2F.js`).then(e=>e.default),[]),"../locales/pt-BR.json":()=>gi(()=>import(`./assets/pt-BR-D-z17RQ-.js`).then(e=>e.default),[]),"../locales/ru.json":()=>gi(()=>import(`./assets/ru-8WfNTygd.js`).then(e=>e.default),[]),"../locales/tr.json":()=>gi(()=>import(`./assets/tr-BcKw28qa.js`).then(e=>e.default),[]),"../locales/zh-Hans.json":()=>gi(()=>import(`./assets/zh-Hans-BD-UCl7V.js`).then(e=>e.default),[]),"../locales/zh-Hant.json":()=>gi(()=>import(`./assets/zh-Hant-BF48qh7h.js`).then(e=>e.default),[])}),dl=async({language:e=Xc(),languages:t,catalogues:n=ul,html:r=globalThis.document?.documentElement}={})=>{let i=++il,a=e===`en`?{}:await Promise.race([n[`../locales/${e}.json`]?.().catch(()=>void 0),new Promise(e=>setTimeout(e,$c))]);if(i!==il)return q;rl=a?e:`en`;let o=a&&Bc(rl)?Object.fromEntries(Object.entries(a).map(([e,t])=>[e,tl(t)])):a??{};q=nl(rl,Zc(rl,t),o),qc(q.locale),r&&(r.lang=rl,Bc(rl)?r.dir=`rtl`:r.removeAttribute(`dir`));for(let e of ol)e();return q},fl=e=>(Wc(e),dl()),pl=e=>{let t=[],n=[],r=!1;for(let i of e.slice(e.indexOf(`?`)+1).split(`&`)){let e=i.indexOf(`=`);if(r||e<0){r=e<0;continue}if(!/^xt(\.\d*)?$/i.test(i.slice(0,e)))continue;let a=i.slice(e+1);try{a=decodeURIComponent(a)}catch{}let o=a.match(/^urn:btih:([0-9a-zA-Z]+)/)?.[1];if(o){t.push(o.toLowerCase());continue}let s=a.match(/^urn:btmh:([0-9a-fA-F]+)/)?.[1]?.toLowerCase();s&&n.push(s.startsWith(`1220`)&&s.length===68?s.slice(4):s)}return new Set(t.map(gl)).size>1||new Set(n).size>1?null:t[0]??n[0]??null},ml=e=>{let t=pl(e);return e.startsWith(`magnet:?`)&&t!==null&&/^([0-9a-f]{40}|[0-9a-f]{64})$/.test(gl(t))},hl=`abcdefghijklmnopqrstuvwxyz234567`,gl=e=>{let t=e.toLowerCase();if(!/^[a-z2-7]{32}$/.test(t))return t;let n=``;for(let e of t)n+=hl.indexOf(e).toString(2).padStart(5,`0`);let r=``;for(let e=0;e<n.length;e+=4)r+=parseInt(n.slice(e,e+4),2).toString(16);return r},_l=(e,t)=>!!e&&!!t&&gl(e)===gl(t),vl=e=>{let t=new Map;for(let n of e.split(/\s+|(?=magnet:\?)/i)){let e=/^magnet:\?/i.test(n)?n:/^([0-9a-f]{40}|[a-z2-7]{32})$/i.test(n)?`magnet:?xt=urn:btih:${n}`:/^[0-9a-f]{64}$/i.test(n)?`magnet:?xt=urn:btmh:1220${n}`:null;if(!e)continue;let r=gl(pl(e)??e);t.has(r)||t.set(r,e)}return[...t.values()]},yl=(e,t)=>{let n=[];for(let r of e.matchAll(RegExp(`[?&]`+t+`=([^&]+)`,`g`))){let e=r[1];try{n.push(decodeURIComponent(e.replace(/\+/g,` `)))}catch{n.push(e)}}return[...new Set(n)]},bl=(e,t)=>{let n=e.match(RegExp(`[?&]`+t+`=([^&]+)`));if(n)try{return decodeURIComponent(n[1].replace(/\+/g,` `))}catch{return n[1]}},xl=/^[0-9a-f]{40}$/,Sl=/^[0-9a-f]{64}$/,Cl=300,wl=e=>{let t=bl(e,`xl`);if(!t)return;let n=Number(t);return Number.isSafeInteger(n)&&n>0?n:void 0},Tl=e=>(e.match(/[?&]tr=/g)??[]).length,El=e=>{if(!e)return;let t=e.replace(/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2066-\u2069]/g,``).trim();if(t)return t.length>Cl?t.slice(0,Cl)+`…`:t},Dl=(e,t)=>{let n=e.startsWith(`magnet:?`)&&!bl(e,`dn`)?El(t):void 0;return n?`${e}&dn=${encodeURIComponent(n)}`:e},Ol=({magnet:e})=>{if(!e)return{ok:!1,problem:q.formatMessage({id:`This link has no torrent in it.`,defaultMessage:`This link has no torrent in it.`})};if(!e.startsWith(`magnet:`))return{ok:!1,problem:q.formatMessage({id:`This is not a magnet link.`,defaultMessage:`This is not a magnet link.`})};let t=pl(e);return t?!xl.test(gl(t))&&!Sl.test(t)?{ok:!1,problem:q.formatMessage({id:`This magnet link's info hash is malformed.`,defaultMessage:`This magnet link's info hash is malformed.`})}:{ok:!0,magnet:e,infoHash:t,name:El(bl(e,`dn`))??t,trackers:Tl(e),sizeBytes:wl(e)}:{ok:!1,problem:q.formatMessage({id:`This magnet link has no info hash.`,defaultMessage:`This magnet link has no info hash.`})}},kl=function(e){return e.HOME=`HOME`,e.ADD=`ADD`,e.WATCH=`WATCH`,e.DOWNLOAD=`DOWNLOAD`,e.LEGAL=`LEGAL`,e.PRIVACY=`PRIVACY`,e.SETTINGS=`SETTINGS`,e}({}),Al={HOME:e=>{let t=new URLSearchParams(e?.torrent?{torrent:e.torrent}:{});return e?.magnet&&t.set(e.magnet.key,e.magnet.value),t.toString()?`/?${t.toString()}`:`/`},ADD:e=>`/add?${new URLSearchParams(e).toString()}`,WATCH:e=>Ml(`WATCH`,new URLSearchParams(e)),DOWNLOAD:e=>Ml(`DOWNLOAD`,new URLSearchParams(e)),LEGAL:()=>`/legal`,PRIVACY:()=>`/privacy`,SETTINGS:()=>`/settings`},jl={HOME:`/`,ADD:`/add`,WATCH:`/watch`,DOWNLOAD:`/download`,LEGAL:`/legal`,PRIVACY:`/privacy`,SETTINGS:`/settings`},Ml=(e,t)=>`${jl[e]}#${t}`,Nl=({search:e,hash:t})=>new URLSearchParams([...new URLSearchParams(t.slice(1)),...new URLSearchParams(e)]),Pl=e=>jl[e],Fl=(e,t)=>Al[e](t),Il=Kr.Fragment,J=function(e,t,n){return st.call(t,`css`)?Kr.jsx(dt,lt(e,t),n):Kr.jsx(e,t,n)},Y=function(e,t,n){return st.call(t,`css`)?Kr.jsxs(dt,lt(e,t),n):Kr.jsxs(e,t,n)},Ll=()=>{let[e]=Oc(),{hash:t}=es();if(t&&!e.has(`magnet`))return J(Ms,{to:`${Fl(kl.HOME)}?group${t}`,replace:!0});let n=new URLSearchParams({add:Dl(e.get(`magnet`)??``,e.get(`name`))});return J(Ms,{to:`${Fl(kl.HOME)}?${n.toString()}`,replace:!0})},Rl=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),zl=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Bl=e=>{let t=zl(e);return t.charAt(0).toUpperCase()+t.slice(1)},Vl=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Hl=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},Ul={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`},Wl=(0,p.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,p.createElement)(`svg`,{ref:c,...Ul,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Vl(`lucide`,i),...!a&&!Hl(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,p.createElement)(e,t)),...Array.isArray(a)?a:[a]])),X=(e,t)=>{let n=(0,p.forwardRef)(({className:n,...r},i)=>(0,p.createElement)(Wl,{ref:i,iconNode:t,className:Vl(`lucide-${Rl(Bl(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Bl(e),n},Gl=X(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Kl=X(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),ql=X(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Jl=X(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Yl=X(`arrow-up-narrow-wide`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}],[`path`,{d:`M11 16h7`,key:`uosisv`}],[`path`,{d:`M11 20h10`,key:`jvxblo`}]]),Xl=X(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Zl=X(`captions-off`,[[`path`,{d:`M10.5 5H19a2 2 0 0 1 2 2v8.5`,key:`jqtk4d`}],[`path`,{d:`M17 11h-.5`,key:`1961ue`}],[`path`,{d:`M19 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2`,key:`1keqsi`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M7 11h4`,key:`1o1z6v`}],[`path`,{d:`M7 15h2.5`,key:`1ina1g`}]]),Ql=X(`captions`,[[`rect`,{width:`18`,height:`14`,x:`3`,y:`5`,rx:`2`,ry:`2`,key:`12ruh7`}],[`path`,{d:`M7 15h4M15 15h2M7 11h2M13 11h4`,key:`1ueiar`}]]),$l=X(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),eu=X(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),tu=X(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),nu=X(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ru=X(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),iu=X(`clock`,[[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),au=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`}]]),ou=X(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),su=X(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),cu=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`}]]),lu=X(`file-play`,[[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`,key:`1mlx9k`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),uu=X(`file-plus`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),du=X(`file`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),fu=X(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),pu=X(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),mu=X(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),hu=X(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),gu=X(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),_u=X(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),vu=X(`list`,[[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 18h.01`,key:`1tta3j`}],[`path`,{d:`M3 6h.01`,key:`1rqtza`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 18h13`,key:`1lx6n3`}],[`path`,{d:`M8 6h13`,key:`ik3vkj`}]]),yu=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`}]]),bu=X(`magnet`,[[`path`,{d:`m12 15 4 4`,key:`lnac28`}],[`path`,{d:`M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z`,key:`nlhkjb`}],[`path`,{d:`m5 8 4 4`,key:`j6kj7e`}]]),xu=X(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),Su=X(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),Cu=X(`monitor-down`,[[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`m15 10-3 3-3-3`,key:`lzhmyn`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]),wu=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`}]]),Tu=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`}]]),Eu=X(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Du=X(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Ou=X(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ku=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`}]]),Au=X(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),ju=X(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Mu=X(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Nu=X(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Pu=X(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Fu=X(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Iu=X(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Lu=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`}]]),Ru=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`}]]),zu=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`}]]),Bu=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`}]]),Vu=X(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Hu={};(function(e){var t=Object.prototype.hasOwnProperty,n=`~`;function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if(typeof r!=`function`)throw TypeError(`The listener must be a function`);var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){--e._eventsCount===0?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)t.call(r,i)&&e.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,i),!0;case 5:return c.fn.call(c.context,t,r,i,a),!0;case 6:return c.fn.call(c.context,t,r,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,r);break;case 4:c[d].fn.call(c[d].context,t,r,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn===t&&(!i||s.once)&&(!r||s.context===r)&&o(this,a);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&l.push(s[c]);l.length?this._events[a]=l.length===1?l[0]:l:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})({get exports(){return Hu},set exports(e){Hu=e}});var Uu=Hu,Wu=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}},Gu=class extends Error{constructor(e){super(),this.name=`AbortError`,this.message=e}},Ku=e=>globalThis.DOMException===void 0?new Gu(e):new DOMException(e),qu=e=>{let t=e.reason===void 0?Ku(`This operation was aborted.`):e.reason;return t instanceof Error?t:Ku(t)};function Ju(e,t,n,r){let i,a=new Promise((a,o)=>{if(typeof t!=`number`||Math.sign(t)!==1)throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t===1/0){a(e);return}if(r={customTimers:{setTimeout,clearTimeout},...r},r.signal){let{signal:e}=r;e.aborted&&o(qu(e)),e.addEventListener(`abort`,()=>{o(qu(e))})}i=r.customTimers.setTimeout.call(void 0,()=>{if(typeof n==`function`){try{a(n())}catch(e){o(e)}return}let r=typeof n==`string`?n:`Promise timed out after ${t} milliseconds`,i=n instanceof Error?n:new Wu(r);typeof e.cancel==`function`&&e.cancel(),o(i)},t),(async()=>{try{a(await e)}catch(e){o(e)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()});return a.clear=()=>{clearTimeout(i),i=void 0},a}function Yu(e,t,n){let r=0,i=e.length;for(;i>0;){let a=Math.trunc(i/2),o=r+a;n(e[o],t)<=0?(r=++o,i-=a+1):i=a}return r}var Xu=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},Zu,Qu=class{constructor(){Zu.set(this,[])}enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&Xu(this,Zu,`f`)[this.size-1].priority>=t.priority){Xu(this,Zu,`f`).push(n);return}let r=Yu(Xu(this,Zu,`f`),n,(e,t)=>t.priority-e.priority);Xu(this,Zu,`f`).splice(r,0,n)}dequeue(){return Xu(this,Zu,`f`).shift()?.run}filter(e){return Xu(this,Zu,`f`).filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return Xu(this,Zu,`f`).length}};Zu=new WeakMap;var $u=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},ed=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed,Dd=new Wu,Od=class extends Error{},kd=class extends Uu{constructor(e){if(super(),td.add(this),nd.set(this,void 0),rd.set(this,void 0),id.set(this,0),ad.set(this,void 0),od.set(this,void 0),sd.set(this,0),cd.set(this,void 0),ld.set(this,void 0),ud.set(this,void 0),dd.set(this,void 0),fd.set(this,0),pd.set(this,void 0),md.set(this,void 0),hd.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:Qu,...e},!(typeof e.intervalCap==`number`&&e.intervalCap>=1))throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??``}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??``}\` (${typeof e.interval})`);$u(this,nd,e.carryoverConcurrencyCount,`f`),$u(this,rd,e.intervalCap===1/0||e.interval===0,`f`),$u(this,ad,e.intervalCap,`f`),$u(this,od,e.interval,`f`),$u(this,ud,new e.queueClass,`f`),$u(this,dd,e.queueClass,`f`),this.concurrency=e.concurrency,this.timeout=e.timeout,$u(this,hd,e.throwOnTimeout===!0,`f`),$u(this,md,e.autoStart===!1,`f`)}get concurrency(){return ed(this,pd,`f`)}set concurrency(e){if(!(typeof e==`number`&&e>=1))throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);$u(this,pd,e,`f`),ed(this,td,`m`,Td).call(this)}async add(e,t={}){return new Promise((n,r)=>{ed(this,ud,`f`).enqueue(async()=>{var i,a;$u(this,fd,(i=ed(this,fd,`f`),i++,i),`f`),$u(this,id,(a=ed(this,id,`f`),a++,a),`f`);try{if(t.signal?.aborted){r(new Od(`The task was aborted.`));return}let i=await(this.timeout===void 0&&t.timeout===void 0?e({signal:t.signal}):Ju(Promise.resolve(e({signal:t.signal})),t.timeout===void 0?this.timeout:t.timeout,()=>{(t.throwOnTimeout===void 0?ed(this,hd,`f`):t.throwOnTimeout)&&r(Dd)}));n(i),this.emit(`completed`,i)}catch(e){r(e),this.emit(`error`,e)}ed(this,td,`m`,vd).call(this)},t),ed(this,td,`m`,Sd).call(this),this.emit(`add`)})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return ed(this,md,`f`)?($u(this,md,!1,`f`),ed(this,td,`m`,Td).call(this),this):this}pause(){$u(this,md,!0,`f`)}clear(){$u(this,ud,new(ed(this,dd,`f`)),`f`)}async onEmpty(){ed(this,ud,`f`).size!==0&&await ed(this,td,`m`,Ed).call(this,`empty`)}async onSizeLessThan(e){ed(this,ud,`f`).size<e||await ed(this,td,`m`,Ed).call(this,`next`,()=>ed(this,ud,`f`).size<e)}async onIdle(){(ed(this,fd,`f`)!==0||ed(this,ud,`f`).size!==0)&&await ed(this,td,`m`,Ed).call(this,`idle`)}get size(){return ed(this,ud,`f`).size}sizeBy(e){return ed(this,ud,`f`).filter(e).length}get pending(){return ed(this,fd,`f`)}get isPaused(){return ed(this,md,`f`)}};nd=new WeakMap,rd=new WeakMap,id=new WeakMap,ad=new WeakMap,od=new WeakMap,sd=new WeakMap,cd=new WeakMap,ld=new WeakMap,ud=new WeakMap,dd=new WeakMap,fd=new WeakMap,pd=new WeakMap,md=new WeakMap,hd=new WeakMap,td=new WeakSet,gd=function(){return ed(this,rd,`f`)||ed(this,id,`f`)<ed(this,ad,`f`)},_d=function(){return ed(this,fd,`f`)<ed(this,pd,`f`)},vd=function(){var e;$u(this,fd,(e=ed(this,fd,`f`),e--,e),`f`),ed(this,td,`m`,Sd).call(this),this.emit(`next`)},yd=function(){this.emit(`empty`),ed(this,fd,`f`)===0&&this.emit(`idle`)},bd=function(){ed(this,td,`m`,wd).call(this),ed(this,td,`m`,Cd).call(this),$u(this,ld,void 0,`f`)},xd=function(){let e=Date.now();if(ed(this,cd,`f`)===void 0){let t=ed(this,sd,`f`)-e;if(t<0)$u(this,id,ed(this,nd,`f`)?ed(this,fd,`f`):0,`f`);else return ed(this,ld,`f`)===void 0&&$u(this,ld,setTimeout(()=>{ed(this,td,`m`,bd).call(this)},t),`f`),!0}return!1},Sd=function(){if(ed(this,ud,`f`).size===0)return ed(this,cd,`f`)&&clearInterval(ed(this,cd,`f`)),$u(this,cd,void 0,`f`),ed(this,td,`m`,yd).call(this),!1;if(!ed(this,md,`f`)){let e=!ed(this,td,`a`,xd);if(ed(this,td,`a`,gd)&&ed(this,td,`a`,_d)){let t=ed(this,ud,`f`).dequeue();return t?(this.emit(`active`),t(),e&&ed(this,td,`m`,Cd).call(this),!0):!1}}return!1},Cd=function(){ed(this,rd,`f`)||ed(this,cd,`f`)!==void 0||($u(this,cd,setInterval(()=>{ed(this,td,`m`,wd).call(this)},ed(this,od,`f`)),`f`),$u(this,sd,Date.now()+ed(this,od,`f`),`f`))},wd=function(){ed(this,id,`f`)===0&&ed(this,fd,`f`)===0&&ed(this,cd,`f`)&&(clearInterval(ed(this,cd,`f`)),$u(this,cd,void 0,`f`)),$u(this,id,ed(this,nd,`f`)?ed(this,fd,`f`):0,`f`),ed(this,td,`m`,Td).call(this)},Td=function(){for(;ed(this,td,`m`,Sd).call(this););},Ed=async function(e,t){return new Promise(n=>{let r=()=>{(!t||t())&&(this.off(e,r),n())};this.on(e,r)})};var Ad=Object.defineProperty,jd=(e,t)=>{let n={};for(var r in e)Ad(n,r,{get:e[r],enumerable:!0});return t||Ad(n,Symbol.toStringTag,{value:`Module`}),n},Md=`__OSRA_KEY__`,Nd=`__OSRA_DEFAULT_KEY__`,Pd=`__OSRA_BOX__`,Fd=()=>globalThis.browser??globalThis.chrome,Id=()=>Fd()?.runtime,Ld=(e,t)=>nf(e)&&e.__OSRA_KEY__===t,Rd=(e,t)=>{if(e){if(e.aborted){t();return}e.addEventListener(`abort`,t,{once:!0})}},zd=({listener:e,transport:t,remoteName:n,key:r=Nd,origin:i=`*`,unregisterSignal:a})=>{if(a?.aborted)return;let o=xf(t)?t.receive:t;if(typeof o==`function`){let t=o((t,i)=>{a?.aborted||Ld(t,r)&&(n&&t.name!==n||e(t,i))});typeof t==`function`&&Rd(a,t);return}if(sf(o)||cf(o)||uf(o)||df(o)){let t=(t,i)=>{let o=(t,a)=>{Ld(t,r)&&(n&&t.name!==n||e(t,{port:i,sender:a}))};t.addListener(o),Rd(a,()=>t.removeListener(o))};if(sf(o))t(o.onMessage);else if(uf(o)){let e=e=>t(e.onMessage,e);o.addListener(e),Rd(a,()=>o.removeListener(e))}else df(o)?t(o):t(o.onMessage);return}let s=ef(o)?o.port:o,c=i!==`*`&&ff(o),l=t=>{let a=t.data;if(typeof a==`string`)try{a=JSON.parse(a)}catch{return}Ld(a,r)&&(n&&a.name!==n||c&&t.origin&&t.origin!==i||e(a,{receiveTransport:o,source:t.source,origin:t.origin}))};s.addEventListener(`message`,l),s instanceof MessagePort&&s.start(),Rd(a,()=>s.removeEventListener(`message`,l))},Bd=new WeakSet,Vd=e=>String(e?.message??e).includes(`disconnected port`),Hd=(e,t,n=`*`,r=[])=>{let i=xf(e)?e.emit:e;if(typeof i==`function`)i(t,r);else if(ff(i))i.postMessage(t,n,r);else if(cf(i)){if(Bd.has(i))return;try{i.postMessage(t)}catch(e){if(!Vd(e))throw e;Bd.add(i)}}else if(sf(i))i.sendMessage(t)?.catch?.(e=>{if(!String(e?.message).includes(`Receiving end does not exist`))throw e});else if(Yd(i)){let e=JSON.stringify(t);i.readyState===WebSocket.CONNECTING?i.addEventListener(`open`,()=>i.send(e),{once:!0}):i.send(e)}else ef(i)?i.port.postMessage(t,r):i.postMessage(t,r)},Ud=globalThis.Float16Array,Wd={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float16Array:Ud,Float32Array,Float64Array,BigInt64Array,BigUint64Array},Gd=Object.values(Wd),Kd=e=>{let t=e.constructor.name;if(t in Wd)return t;for(let[t,n]of Object.entries(Wd))if(n&&e instanceof n)return t;throw Error(`Unknown typed array type`)},qd=e=>{let t=Wd[e];if(!t)throw Error(`Unknown typed array type`);return t},Jd=e=>rf(e,Gd),Yd=e=>e instanceof WebSocket,Xd=e=>!!globalThis.ServiceWorkerContainer&&e instanceof ServiceWorkerContainer,Zd=e=>!!globalThis.ServiceWorker&&e instanceof ServiceWorker,Qd=e=>!!globalThis.Worker&&e instanceof Worker,$d=e=>{let t=globalThis.DedicatedWorkerGlobalScope;return!!t&&e instanceof t},ef=e=>!!globalThis.SharedWorker&&e instanceof SharedWorker,tf=e=>e instanceof MessagePort,nf=e=>!!e&&typeof e==`object`&&`__OSRA_KEY__`in e&&!!e.__OSRA_KEY__,rf=(e,t)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return!1;for(let n of t)if(n&&e instanceof n)return!0;return!1},af=e=>rf(e,[globalThis.SharedArrayBuffer]),of=e=>rf(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),sf=e=>{let t=Id();return t?e===t:!1},cf=(e,t=!1)=>!e||typeof e!=`object`||ff(e)||!(`name`in e)||!(`disconnect`in e)||!(`postMessage`in e)?!1:!t||`sender`in e&&`onMessage`in e&&`onDisconnect`in e,lf=e=>!!e&&typeof e==`object`&&!ff(e)&&`addListener`in e&&`hasListener`in e&&`removeListener`in e,uf=e=>{let t=Id();return t?e===t.onConnect||e===t.onConnectExternal:!1},df=e=>lf(e),ff=e=>{if(!e||typeof e!=`object`)return!1;try{return`window`in e&&e.window===e}catch{try{return`closed`in e&&typeof e.closed==`boolean`&&`close`in e&&typeof e.close==`function`}catch{return!1}}},pf=e=>Yd(e)||cf(e)||sf(e),mf=e=>Yd(e)||cf(e)||uf(e)||df(e)||sf(e),hf=e=>!!e&&typeof e==`object`&&!ff(e)&&`isJson`in e&&e.isJson===!0||pf(e)||mf(e),gf=e=>ff(e)||pf(e)||Zd(e)||Qd(e)||$d(e)||ef(e)||tf(e)||yf(e),_f=e=>ff(e)||mf(e)||Xd(e)||Qd(e)||$d(e)||ef(e)||tf(e)||bf(e),vf=e=>{if(!e||typeof e!=`object`||ff(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},yf=e=>!vf(e)||!(`emit`in e)?!1:gf(e.emit)||typeof e.emit==`function`,bf=e=>!vf(e)||!(`receive`in e)?!1:_f(e.receive)||typeof e.receive==`function`,xf=e=>yf(e)||bf(e),Sf=()=>globalThis.Buffer,Cf=32768,wf=e=>{let t=e.toBase64;if(typeof t==`function`)return t.call(e);let n=Sf();if(n)return n.from(e).toString(`base64`);let r=``;for(let t=0;t<e.length;t+=Cf)r+=String.fromCharCode(...e.subarray(t,t+Cf));return btoa(r)},Tf=e=>{let t=Uint8Array.fromBase64;if(typeof t==`function`)return t(e);let n=Sf();if(n)return new Uint8Array(n.from(e,`base64`));let r=atob(e),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return i},Ef={[Pd]:`revivable`},Df=e=>!!e&&typeof e==`object`&&`__OSRA_BOX__`in e&&e.__OSRA_BOX__===`revivable`,Of=(e,t)=>hf(t.transport)?{base64Buffer:wf(new Uint8Array(e))}:{arrayBuffer:e},kf=e=>`arrayBuffer`in e?e.arrayBuffer:Tf(e.base64Buffer).buffer,Af=jd({box:()=>Nf,isType:()=>Mf,objectsOnly:()=>!0,revive:()=>Pf,type:()=>jf}),jf=`arrayBuffer`,Mf=e=>e instanceof ArrayBuffer,Nf=(e,t)=>({...Ef,type:jf,...Of(e,t)}),Pf=(e,t)=>kf(e),Ff=jd({box:()=>Rf,isType:()=>Lf,objectsOnly:()=>!0,revive:()=>zf,type:()=>If}),If=`date`,Lf=e=>e instanceof Date,Rf=(e,t)=>({...Ef,type:If,ISOString:e.toISOString()}),zf=(e,t)=>new Date(e.ISOString),Bf=jd({box:()=>Uf,isType:()=>Hf,objectsOnly:()=>!0,revive:()=>Wf,type:()=>Vf}),Vf=`headers`,Hf=e=>e instanceof Headers,Uf=(e,t)=>({...Ef,type:Vf,entries:[...e.entries()]}),Wf=(e,t)=>new Headers(e.entries),Gf=jd({box:()=>Yf,isType:()=>Jf,objectsOnly:()=>!0,revive:()=>Xf,type:()=>Kf}),Kf=`error`,qf={Error,TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError},Jf=e=>e instanceof Error,Yf=(e,t)=>{let n=`cause`in e&&e.cause!==void 0,r=typeof AggregateError<`u`&&e instanceof AggregateError,i=typeof DOMException<`u`&&e instanceof DOMException;return{...Ef,type:Kf,name:e.name,message:e.message,stack:e.stack||e.toString(),...n?{cause:lg(e.cause,t)}:{},...r?{errors:lg(e.errors,t)}:{},...i?{isDOMException:!0}:{}}},Xf=(e,t)=>{let n=e.cause===void 0?void 0:dg(e.cause,t),r=n===void 0?void 0:{cause:n};if(e.isDOMException&&typeof DOMException<`u`){let t=new DOMException(e.message,e.name);if(e.stack)try{Object.defineProperty(t,"stack",{value:e.stack,configurable:!0})}catch{}return t}let i;if(e.errors!==void 0&&typeof AggregateError<`u`)i=AggregateError(dg(e.errors,t),e.message,r);else{let t=qf[e.name]??Error;i=r===void 0?new t(e.message):new t(e.message,r)}return e.name&&i.name!==e.name&&(i.name=e.name),e.stack&&(i.stack=e.stack),i},Zf=jd({box:()=>ep,isType:()=>$f,objectsOnly:()=>!0,revive:()=>tp,type:()=>Qf}),Qf=`typedArray`,$f=Jd,ep=(e,t)=>{let n=e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return{...Ef,type:Qf,typedArrayType:Kd(e),...Of(n,t)}},tp=(e,t)=>new(qd(e.typedArrayType))(kf(e)),np=new WeakMap,rp=new WeakSet,ip=(e,t)=>{if(rp.has(e))return t(),()=>{};let n=np.get(e);return n||np.set(e,n=new Set),n.add(t),()=>n.delete(t)},ap=e=>rp.has(e),op=e=>{if(rp.has(e))return;rp.add(e);let t=np.get(e);if(t){np.delete(e);for(let e of t)try{e()}catch{}}},sp=jd({box:()=>yp,forceTransfer:()=>gp,isInTransfer:()=>hp,isType:()=>vp,objectsOnly:()=>!0,outsideTransfer:()=>_p,revive:()=>bp,transfer:()=>pp,type:()=>cp}),cp=`transfer`,lp=Symbol.for(`osra.transfer`),up=e=>typeof e==`object`&&!!e,dp=e=>up(e)&&lp in e&&e[lp]===!0,fp=e=>up(e)?ArrayBuffer.isView(e)?!0:rf(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.Request,globalThis.Response,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.VideoFrame,globalThis.AudioData]):!1,pp=e=>fp(e)?{[lp]:!0,value:e}:e,mp=0,hp=()=>mp>0,gp=e=>up(e)&&!dp(e)?{[lp]:!0,value:e}:e,_p=e=>{let t=mp;mp=0;try{return e()}finally{mp=t}},vp=e=>dp(e),yp=(e,t)=>{mp++;try{return{...Ef,type:cp,inner:lg(e.value,t),degraded:hf(t.transport)}}finally{mp--}},bp=(e,t)=>dg(e.inner,t),xp=e=>rf(e,[globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.OffscreenCanvas,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),Sp=e=>Df(e)&&e.type===`transfer`,Cp=e=>{let t=[],n=new WeakSet,r=(e,i)=>{if(e&&typeof e==`object`&&!n.has(e)&&(n.add(e),!af(e))){if(Sp(e)){r(e.inner,i||!e.degraded);return}if(xp(e)){t.push(e);return}if(of(e)){i&&t.push(e);return}if(ArrayBuffer.isView(e)){i&&e instanceof DataView&&!af(e.buffer)&&!n.has(e.buffer)&&(n.add(e.buffer),t.push(e.buffer));return}if(Array.isArray(e)){for(let t of e)r(t,i);return}for(let t of Object.values(e))r(t,i)}};return r(e,!1),t},wp=class{_listeners=new Map;addEventListener(e,t,n){if(!t)return;let r=this._listeners.get(e);r||(r=new Map,this._listeners.set(e,r)),r.has(t)||r.set(t,typeof n==`object`&&!!n?.once)}removeEventListener(e,t,n){t&&this._listeners.get(e)?.delete(t)}_peer;_queue=[];_started=!1;_closed=!1;_onClose;_onmessage=null;get onmessage(){return this._onmessage}set onmessage(e){this._onmessage=e,e!==null&&this.start()}onmessageerror=null;dispatchEvent(e){e.type===`message`?this._onmessage?.call(this,e):e.type===`messageerror`&&this.onmessageerror?.call(this,e);let t=this._listeners.get(e.type);if(t)for(let[n,r]of[...t])r&&t.delete(n),typeof n==`function`?n.call(this,e):n.handleEvent(e);return!0}postMessage(e,t){let n=this._peer;!n||n._closed||queueMicrotask(()=>{if(n._closed)return;let t=new MessageEvent(`message`,{data:e});n._started?n.dispatchEvent(t):n._queue.push(t)})}start(){if(!this._started){this._started=!0;for(let e of this._queue.splice(0))this.dispatchEvent(e)}}close(){if(this._closed)return;this._closed=!0,this._queue.length=0,this._onClose?.();let e=this._peer;e&&!e._closed&&queueMicrotask(()=>{e._closed||e.dispatchEvent(new Event(`close`))})}},Tp=class{port1;port2;constructor(){let e=new wp,t=new wp;e._peer=t,t._peer=e,this.port1=e,this.port2=t}},Ep=new FinalizationRegistry(e=>{try{e()}catch{}}),Dp=(e,t)=>{let n={};return Ep.register(e,t,n),()=>Ep.unregister(n)},Op=jd({box:()=>Xp,createRevivableChannel:()=>tm,init:()=>Bp,isType:()=>Vp,markPortsShipped:()=>$p,objectsOnly:()=>!0,postPreBoxed:()=>Jp,revive:()=>Zp,type:()=>kp}),kp=`messagePort`,Ap=2048,jp=128,Mp=1024,Np=new WeakMap,Pp=e=>{let t=Np.get(e);if(!t)throw Error(`osra message-port: connection state missing; did init() run?`);return t},Fp=(e,t)=>{let n=e.ports.get(t);return n||(n={nextSeq:0,buffer:new Map,outSeq:0},e.ports.set(t,n),e.pendingPorts++),n},Ip=(e,t)=>{let n=e.ports.get(t);if(n&&!n.handler&&e.pendingPorts--,e.ports.delete(t),e.tombstones.size>=jp){let t=e.tombstones.values().next().value;t!==void 0&&e.tombstones.delete(t)}e.tombstones.add(t)},Lp=e=>{if(e.handler)for(let t=e.buffer.get(e.nextSeq);t!==void 0;t=e.buffer.get(e.nextSeq))e.buffer.delete(e.nextSeq),e.nextSeq++,e.handler(t)},Rp=(e,t)=>Fp(Pp(e),t).outSeq++,zp=(e,t,n)=>{let r=Pp(e);if(r.tombstones.has(t)){setTimeout(()=>n({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t}));return}let i=Fp(r,t);i.handler||r.pendingPorts--,i.handler=n,Lp(i)},Bp=e=>{let t={ports:new Map,tombstones:new Set,pendingPorts:0};Np.set(e,t),e.eventTarget.addEventListener(`message`,({detail:n})=>{if(n.type!==`message`&&n.type!==`message-port-close`||t.tombstones.has(n.portId))return;let r=t.ports.get(n.portId);if(n.seq===void 0){r?.handler?.(n);return}if(!r){if(t.pendingPorts>=Mp)return;r=Fp(t,n.portId)}if(!(n.seq<r.nextSeq)){if(r.buffer.size>=Ap&&!(n.seq===r.nextSeq&&r.handler)){r.buffer.clear(),Ip(t,n.portId),r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n.portId});return}r.buffer.set(n.seq,n),Lp(r)}}),ip(e,()=>{for(let[n,r]of[...t.ports])r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n});t.ports.clear(),t.tombstones.clear(),t.pendingPorts=0})},Vp=e=>e instanceof MessagePort||e instanceof wp,Hp=(e,t)=>{try{let n=Pp(e).ports.get(t);e.sendMessage({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t,seq:n?n.outSeq++:0})}catch{}},Up=(e,t,n)=>{if(n){e.postMessage(t);return}let r=Cp(t);e.postMessage(t,r),$p(r)},Wp=(e,t,n,r)=>{let i;try{i=dg(e,t)}catch(e){r(),globalThis.reportError?.(e);return}n(i)},Gp=(e,t,n)=>()=>{let r=e.deref();r&&Hp(r,n);let i=t.deref();i&&Ip(i,n)},Kp=new WeakSet,qp=e=>e!==null&&(typeof e==`object`||typeof e==`function`),Jp=(e,t,n)=>{qp(t)&&Kp.add(t),e.postMessage(t,n??[])},Yp=(e,t)=>qp(e)&&Kp.delete(e)?e:_p(()=>lg(e,t)),Xp=(e,t,n)=>{let r=e instanceof wp;if(!r&&!hf(t.transport))return{...Ef,type:kp,port:e,...n?.autoBox?{autoBox:!0}:{}};let i=Pp(t),a=e,o=globalThis.crypto.randomUUID(),s=new WeakRef(a),c=new WeakRef(t),l=new WeakRef(i),u=!1,d=()=>{if(u)return;u=!0;let e=l.deref();e&&Ip(e,o),m?.();let t=s.deref();t?.removeEventListener(`message`,p),t instanceof wp&&(t._onClose=void 0)},f=e=>{if(e.type===`message-port-close`){d(),a.dispatchEvent(new Event(`close`)),a.close();return}Wp(e.data,t,e=>Up(a,e,!1),()=>{})};function p({data:e}){t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:Yp(e,t),portId:o,seq:Rp(t,o)})}let m=Dp(a,Gp(c,l,o));return a.addEventListener(`message`,p),a.start(),a instanceof wp&&(a._onClose=()=>{u||(Hp(t,o),d())}),zp(t,o,f),{...Ef,type:kp,portId:o,synthetic:r}},Zp=(e,t)=>`port`in e?($p([e.port]),e.autoBox?em(e.port,t):e.port):nm(e.portId,t,e.synthetic),Qp=new WeakMap,$p=e=>{for(let t of e){let e=Qp.get(t);if(e){Qp.delete(t),e.shipped=!0;for(let t of e.pending.splice(0))t()}}},em=(e,t,n)=>{let r=new EventTarget,i=({data:e})=>{Wp(e,t,e=>r.dispatchEvent(new MessageEvent(`message`,{data:e})),()=>r.dispatchEvent(new Event(`messageerror`)))},a=()=>{r.dispatchEvent(new Event(`messageerror`))},o=()=>{r.dispatchEvent(new Event(`close`))};e.addEventListener(`message`,i),e.addEventListener(`messageerror`,a),e.addEventListener(`close`,o),r.postMessage=(r,i)=>{let a=_p(()=>lg(r,t)),o=Cp(a),s=Array.isArray(i)?i:[],c=s.length?[...o,...s]:o,l=()=>{e.postMessage(a,c),$p(c)};if(n&&!n.shipped){n.pending.push(l);return}l()},r.start=()=>e.start();let s=()=>{e.removeEventListener(`message`,i),e.removeEventListener(`messageerror`,a),e.removeEventListener(`close`,o),e.close()};return r.close=()=>{if(n&&!n.shipped){n.pending.push(s);return}s()},r},tm=e=>{if(hf(e.transport)){let{port1:t,port2:n}=new Tp;return{localPort:t,boxedRemote:Xp(n,e)}}let{port1:t,port2:n}=new MessageChannel,r={shipped:!1,pending:[]};return Qp.set(n,r),{localPort:em(t,e,r),boxedRemote:Xp(n,e,{autoBox:!0})}},nm=(e,t,n)=>{let r=Pp(t),{port1:i,port2:a}=n?new Tp:new MessageChannel,o=new WeakRef(i),s=new WeakRef(a),c=!1,l=!1;i instanceof wp||i.addEventListener(`close`,e=>{l&&e.stopImmediatePropagation()});let u=()=>{if(c)return;c=!0,Ip(r,e);let t=s.deref();t?.removeEventListener(`message`,f),t?.close(),p?.()},d=e=>{if(e.type===`message-port-close`){u();let e=o.deref();e?.dispatchEvent(new Event(`close`)),l=!0,e?.close();return}if(!o.deref()){u();return}let r=s.deref();r&&Wp(e.data,t,e=>Up(r,e,n),()=>o.deref()?.dispatchEvent(new Event(`messageerror`)))},f=({data:n})=>{t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:Yp(n,t),portId:e,seq:Rp(t,e)})},p=Dp(i,()=>{Hp(t,e),u()});return i instanceof wp&&(i._onClose=()=>{c||(Hp(t,e),u())}),a.addEventListener(`message`,f),a.start(),zp(t,e,d),i},rm=jd({box:()=>cm,isType:()=>sm,objectsOnly:()=>!0,revive:()=>lm,type:()=>im}),im=`promise`,am=e=>e instanceof Promise,om=new Set,sm=e=>e instanceof Promise,cm=(e,t)=>{if(!am(e))throw TypeError(`Expected Promise`);let{localPort:n,boxedRemote:r}=tm(t),i=e=>{n.postMessage(e),n.close()};return e.then(e=>i({type:`resolve`,data:e})).catch(e=>i({type:`reject`,error:e})),{...Ef,type:im,port:r}},lm=(e,t)=>{let n=Zp(e.port,t);om.add(n);let r=`portId`in e.port;return new Promise((e,i)=>{let a,o=()=>{n.close(),om.delete(n),a?.()};if(r&&ap(t)){i(Error(`osra: connection closed`)),o();return}a=r?ip(t,()=>{i(Error(`osra: connection closed`)),o()}):void 0,n.addEventListener(`message`,({data:t})=>{t.type===`resolve`?e(t.data):i(t.error),o()},{once:!0}),n.start()})},um=jd({box:()=>hm,isType:()=>mm,objectsOnly:()=>!0,revive:()=>gm,type:()=>dm}),dm=`function`,fm=new Set,pm=e=>{e instanceof ReadableStream?e.locked||e.cancel(Error(`osra: connection closed`)).catch(()=>{}):typeof WritableStream<`u`&&e instanceof WritableStream&&(e.locked||e.abort(Error(`osra: connection closed`)).catch(()=>{}))},mm=e=>typeof e==`function`,hm=(e,t)=>{let{port1:n,port2:r}=new Tp;return n.addEventListener(`message`,({data:n})=>{let[r,i]=n;(async()=>{let n;try{n={type:`return`,value:await e(...i)}}catch(e){n={type:`throw`,error:e}}if(ap(t)){n.type===`return`&&pm(n.value);try{r.close()}catch{}return}let a=(()=>{try{return lg(n,t)}catch(e){return lg({type:`throw`,error:e},t)}})();Jp(r,a),queueMicrotask(()=>{try{r.close()}catch{}})})()}),n.start(),{...Ef,type:dm,port:Xp(r,t)}},gm=(e,t)=>{let n=Zp(e.port,t);return((...e)=>new Promise((r,i)=>{if(ap(t)){i(Error(`osra: connection closed`));return}let{port1:a,port2:o}=new Tp;fm.add(a);let s,c=()=>{a.close(),fm.delete(a),s?.()};s=ip(t,()=>{i(Error(`osra: connection closed`)),c()}),a.addEventListener(`message`,({data:e})=>{let t=e;t.type===`return`?r(t.value):i(t.error),c()},{once:!0}),a.start();let l=_p(()=>lg([o,e],t));Jp(n,l)}))},_m=jd({MAX_CREDIT_WINDOW:()=>64,box:()=>Cm,isType:()=>ym,objectsOnly:()=>!0,revive:()=>Dm,type:()=>vm}),vm=`readableStream`,ym=e=>e instanceof ReadableStream,bm=2,xm=8,Sm=4194304,Cm=(e,t)=>{let{localPort:n,boxedRemote:r}=tm(t),i=e.getReader(),a=hp(),o=0,s=!1,c=!1,l=e=>{c=!0;try{n.postMessage(e)}catch{}n.close()},u=async()=>{if(!(s||c)){for(s=!0;o>0;){let e;try{e=await i.read()}catch(e){c||l({type:`error`,error:e});return}if(c)return;if(e.done){l({type:`end`});return}o--;let t=a?gp(e.value):e.value;try{n.postMessage({type:`chunk`,value:t})}catch(e){l({type:`error`,error:e}),i.cancel(e).catch(()=>{});return}}s=!1}};return n.addEventListener(`message`,({data:e})=>{e instanceof Promise||!(`type`in e)||(e.type===`pull`?n.postMessage(i.read()):e.type===`credit`?(o+=e.n,u()):e.type===`cancel`&&(c=!0,i.cancel(e.reason).catch(()=>{}),n.close()))}),n.addEventListener(`close`,()=>{c||(c=!0,i.cancel(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...Ef,type:vm,credit:!0,port:r}},wm=e=>ArrayBuffer.isView(e)||e instanceof ArrayBuffer?e.byteLength:typeof e==`string`?e.length*2:typeof Blob<`u`&&e instanceof Blob?e.size:void 0,Tm=e=>{let t=!1,n=0,r,i=[],a=!1,o=!1,s,c,l=()=>r===void 0?xm:Math.max(bm,Math.min(64,Math.floor(Sm/r))),u=()=>{let t=l(),r=n+i.length;if(r>t/2)return;let a=t-r;n+=a,e.postMessage({type:`credit`,n:a})},d=()=>{t=!0,queueMicrotask(()=>e.close())},f=e=>{if(o=!0,s=e,!c||i.length)return;let t=c;c=void 0,d(),t.reject(e)};return new ReadableStream({start:()=>{e.addEventListener(`message`,({data:o})=>{if(!(o instanceof Promise||!(`type`in o))){if(o.type===`chunk`){if(t)return;if(n<=0){i.length=0,f(Error(`osra: stream exceeded its credit window`)),queueMicrotask(()=>e.close());return}n--;let a=wm(o.value);if(a!==void 0&&(r=r===void 0?a:r*.875+a*.125),c){let e=c;c=void 0,e.controller.enqueue(o.value),e.resolve()}else i.push(o.value)}else if(o.type===`end`){if(t||(a=!0,!c||i.length))return;let e=c;c=void 0,d(),e.controller.close(),e.resolve()}else if(o.type===`error`){if(t)return;f(o.error)}}}),e.addEventListener(`messageerror`,()=>{t||f(Error(`osra: a chunk failed to deserialize on this platform`))}),e.addEventListener(`close`,()=>{t||a||o||f(Error(`osra: connection closed`))},{once:!0})},pull:e=>{if(!t){if(i.length){e.enqueue(i.shift()),!a&&!o&&u();return}if(o)return d(),Promise.reject(s);if(a){d(),e.close();return}return u(),new Promise((t,n)=>{c={controller:e,resolve:t,reject:n}})}},cancel:n=>{t=!0,i.length=0;let r=c;c=void 0,r?.resolve(),e.postMessage({type:`cancel`,reason:n}),queueMicrotask(()=>e.close())}})},Em=e=>{let t=!1;return new ReadableStream({start:n=>{e.addEventListener(`messageerror`,()=>{if(!t){t=!0;try{n.error(Error(`osra: a chunk failed to deserialize on this platform`))}catch{}queueMicrotask(()=>e.close())}}),e.addEventListener(`close`,()=>{if(!t){t=!0;try{n.error(Error(`osra: connection closed`))}catch{}}},{once:!0})},pull:n=>new Promise((r,i)=>{e.addEventListener(`message`,({data:a})=>{a instanceof Promise&&a.then(i=>{i.done?(t=!0,n.close(),e.postMessage({type:`cancel`}),queueMicrotask(()=>e.close())):n.enqueue(i.value),r()}).catch(e=>{t=!0,i(e)})},{once:!0}),e.postMessage({type:`pull`})}),cancel:n=>{t=!0,e.postMessage({type:`cancel`,reason:n}),queueMicrotask(()=>e.close())}})},Dm=(e,t)=>{let n=Zp(e.port,t);return n.start(),e.credit?Tm(n):Em(n)},Om=jd({box:()=>jm,isType:()=>Am,objectsOnly:()=>!0,revive:()=>Mm,type:()=>km}),km=`writableStream`,Am=e=>e instanceof WritableStream,jm=(e,t)=>{let{localPort:n,boxedRemote:r}=tm(t),i=e.getWriter(),a=!1,o=(e,t)=>e.then(()=>n.postMessage({type:`ack`})).catch(e=>n.postMessage({type:`err`,error:e?.message??String(e)})).then(()=>{t&&(a=!0,queueMicrotask(()=>n.close()))});return n.addEventListener(`message`,({data:e})=>{!e||typeof e!=`object`||!(`type`in e)||(e.type===`write`?o(i.write(e.chunk),!1):e.type===`close`?o(i.close(),!0):e.type===`abort`&&o(i.abort(e.reason),!0))}),n.addEventListener(`messageerror`,()=>{n.postMessage({type:`err`,error:`osra: a chunk failed to deserialize on this platform`})}),n.addEventListener(`close`,()=>{a||(a=!0,i.abort(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...Ef,type:km,port:r,...hp()?{transferChunks:!0}:{}}},Mm=(e,t)=>{let n=Zp(e.port,t);n.start();let r=new Set,i=!1;n.addEventListener(`close`,()=>{i=!0;let e=Error(`osra: connection closed`);for(let t of[...r])t(e);r.clear()},{once:!0});let a=Promise.resolve(),o=e=>{let t=a.then(()=>new Promise((t,a)=>{if(i){a(Error(`osra: connection closed`));return}let o=e=>{r.delete(a),e()};r.add(a),n.addEventListener(`message`,({data:e})=>{!e||typeof e!=`object`||!(`type`in e)||(e.type===`ack`?o(t):e.type===`err`&&o(()=>a(Error(e.error))))},{once:!0}),n.postMessage(e)}));return a=t.catch(()=>{}),t},s=e.transferChunks===!0;return new WritableStream({write:e=>o({type:`write`,chunk:s?gp(e):e}),close:()=>o({type:`close`}),abort:e=>o({type:`abort`,reason:e})})},Nm=jd({box:()=>Lm,isType:()=>Fm,objectsOnly:()=>!0,revive:()=>Rm,type:()=>Pm}),Pm=`abortSignal`,Fm=e=>e instanceof AbortSignal,Im=new WeakMap,Lm=(e,t)=>{if(e.aborted)return{...Ef,type:Pm,aborted:!0,reason:lg(e.reason,t)};let{localPort:n,boxedRemote:r}=tm(t),i=()=>{n.postMessage({type:`abort`,reason:e.reason}),n.close(),a()},a=ip(t,()=>{e.removeEventListener(`abort`,i),n.close()});return e.addEventListener(`abort`,i,{once:!0}),{...Ef,type:Pm,aborted:!1,reason:void 0,port:r}},Rm=(e,t)=>{let n=new AbortController;if(e.aborted||e.port===void 0)return n.abort(dg(e.reason,t)),n.signal;let r=Zp(e.port,t);return Im.set(n.signal,r),r.start(),r.addEventListener(`message`,({data:e})=>{e.type===`abort`&&(n.abort(dg(e.reason,t)),Im.delete(n.signal),r.close())}),n.signal},zm=jd({box:()=>Hm,isType:()=>Vm,objectsOnly:()=>!0,revive:()=>Um,type:()=>Bm}),Bm=`response`,Vm=e=>e instanceof Response,Hm=(e,t)=>({...Ef,type:Bm,status:e.status,statusText:e.statusText,headers:Uf(e.headers,t),body:e.body?Cm(e.body,t):null,url:e.url,redirected:e.redirected}),Um=(e,t)=>{if(e.status===0)return Response.error();let n=Wf(e.headers,t),r=e.body?Dm(e.body,t):null,i=e.status===101||e.status===204||e.status===205||e.status===304;r&&i&&r.cancel().catch(()=>{});let a=new Response(i?null:r,{status:e.status,statusText:e.statusText,headers:n});return e.url&&Object.defineProperty(a,"url",{value:e.url,configurable:!0}),e.redirected&&Object.defineProperty(a,"redirected",{value:!0,configurable:!0}),a},Wm=jd({box:()=>qm,isType:()=>Km,objectsOnly:()=>!0,revive:()=>Jm,type:()=>Gm}),Gm=`request`,Km=e=>e instanceof Request,qm=(e,t)=>({...Ef,type:Gm,method:e.method,url:e.url,headers:Uf(e.headers,t),body:e.body?Cm(e.body,t):null,credentials:e.credentials,cache:e.cache,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,integrity:e.integrity,keepalive:e.keepalive,signal:Lm(e.signal,t)}),Jm=(e,t)=>{let n=Wf(e.headers,t),r={method:e.method,headers:n,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,integrity:e.integrity,keepalive:e.keepalive,signal:Rm(e.signal,t)};return e.mode!==`navigate`&&(r.mode=e.mode),e.body&&(r.body=Dm(e.body,t),r.duplex=`half`),new Request(e.url,r)},Ym=jd({box:()=>sh,boxByReference:()=>ch,identity:()=>th,isType:()=>ih,objectsOnly:()=>!0,revive:()=>lh,type:()=>Xm}),Xm=`identity`,Zm=e=>e!==null&&(typeof e==`object`||typeof e==`function`),Qm=e=>{if(e===null)return!1;let t=typeof e;return t===`object`||t===`function`||t===`symbol`&&Symbol.keyFor(e)===void 0},$m=new WeakMap,eh=e=>{let t=$m.get(e);if(t!==void 0)return t;let n=globalThis.crypto.randomUUID();return $m.set(e,n),n},th=e=>(Zm(e)&&eh(e),e),nh=new WeakMap,rh=e=>{let t=nh.get(e);if(t)return t;let n=new Map,r={idToLocal:n,pins:new Map,aliasIds:new WeakMap,disposeRegistry:new FinalizationRegistry(t=>{if(n.delete(t),!ap(e))try{e.sendMessage({type:`identity-dispose`,remoteUuid:e.remoteUuid,id:t})}catch{}})};return nh.set(e,r),e.eventTarget.addEventListener(`message`,({detail:e})=>{e?.type===`identity-dispose`&&(r.pins.delete(e.id),r.idToLocal.delete(e.id))}),ip(e,()=>{r.pins.clear(),r.idToLocal.clear()}),r},ih=e=>Zm(e)&&$m.has(e),ah=(e,t)=>{let n=t.aliasIds.get(e);if(n!==void 0)return n;let r=eh(e),i=t.idToLocal.get(r);if(i===void 0||i.deref()===e)return r;let a=globalThis.crypto.randomUUID();return t.aliasIds.set(e,a),a},oh=(e,t,n)=>{let r=ah(e,n);if(n.idToLocal.has(r))return{...Ef,type:Xm,id:r};let i=t();return n.idToLocal.set(r,new WeakRef(e)),n.disposeRegistry.register(e,r,e),rg(()=>{},()=>{n.idToLocal.delete(r),n.disposeRegistry.unregister(e)}),{...Ef,type:Xm,id:r,inner:i}},sh=(e,t)=>{let n=rh(t),r=()=>ug(e,t,Xm);return Qm(e)?oh(e,r,n):{...Ef,type:Xm,id:globalThis.crypto.randomUUID(),inner:r()}},ch=(e,t,n)=>oh(e,()=>t,rh(n)),lh=(e,t)=>{let n=rh(t);if(n.pins.has(e.id))return n.pins.get(e.id);let r=n.idToLocal.get(e.id)?.deref();if(r!==void 0)return r;if(!(`inner`in e)||e.inner===void 0){try{t.sendMessage({type:`identity-dispose`,remoteUuid:t.remoteUuid,id:e.id})}catch{}throw Error(`osra identity: received id=${e.id} with no inner payload and nothing local to resolve it to`)}let i=dg(e.inner,t);return n.pins.set(e.id,i),Qm(i)&&($m.has(i)||$m.set(i,e.id),n.idToLocal.set(e.id,new WeakRef(i))),i},uh=jd({box:()=>fh,isType:()=>dh,objectsOnly:()=>!0,revive:()=>ph,type:()=>`map`}),dh=e=>e instanceof Map,fh=(e,t)=>({...Ef,type:`map`,entries:Array.from(e,([e,n])=>[lg(e,t),lg(n,t)])}),ph=(e,t)=>new Map(e.entries.map(([e,n])=>[dg(e,t),dg(n,t)])),mh=jd({box:()=>gh,isType:()=>hh,objectsOnly:()=>!0,revive:()=>_h,type:()=>`set`}),hh=e=>e instanceof Set,gh=(e,t)=>({...Ef,type:`set`,values:Array.from(e,e=>lg(e,t))}),_h=(e,t)=>new Set(e.values.map(e=>dg(e,t))),vh=jd({box:()=>xh,isType:()=>bh,revive:()=>Sh,type:()=>yh}),yh=`bigint`,bh=e=>typeof e==`bigint`,xh=(e,t)=>({...Ef,type:yh,value:e.toString()}),Sh=(e,t)=>BigInt(e.value),Ch=jd({box:()=>Eh,isType:()=>Th,objectsOnly:()=>!0,revive:()=>Dh,type:()=>wh}),wh=`event`,Th=e=>e instanceof Event,Eh=(e,t)=>({...Ef,type:wh,eventType:e.type,bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed,...e instanceof CustomEvent?{detail:lg(e.detail,t)}:{}}),Dh=(e,t)=>{let n={bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed};return`detail`in e?new CustomEvent(e.eventType,{...n,detail:dg(e.detail,t)}):new Event(e.eventType,n)},Oh=jd({box:()=>jh,isType:()=>Ah,objectsOnly:()=>!0,revive:()=>Fh,type:()=>kh}),kh=`eventTarget`,Ah=e=>e instanceof EventTarget,jh=(e,t)=>{let n=[],r=e=>typeof e==`boolean`?e:!!e?.capture;return{...Ef,type:kh,addListener:hm((t,i,a)=>{n.push({eventType:t,listener:i,capture:r(a)}),e.addEventListener(t,i,a)},t),removeListener:hm((t,i,a)=>{let o=r(a),s=n.findIndex(e=>e.eventType===t&&e.listener===i&&e.capture===o);s!==-1&&n.splice(s,1),e.removeEventListener(t,i,a)},t),removeAllListeners:hm(()=>{for(let{eventType:t,listener:r,capture:i}of n.splice(0))e.removeEventListener(t,r,{capture:i})},t)}},Mh=new WeakMap,Nh=e=>{if(typeof e==`function`)return e;let t=Mh.get(e);return t||Mh.set(e,t=t=>e.handleEvent(t)),t},Ph=(e,t,n,r)=>e.find(e=>e.eventType===t&&e.listener===n&&e.capture===r),Fh=(e,t)=>{let n=gm(e.addListener,t),r=gm(e.removeListener,t),i=gm(e.removeAllListeners,t),a=new EventTarget,o=[],s=e=>{let t=o.indexOf(e);t!==-1&&o.splice(t,1)};return Object.defineProperty(a,"addEventListener",{value:(e,t,r)=>{if(t===null)return;let i=Nh(t),a=typeof r==`boolean`?r:!!r?.capture;if(Ph(o,e,i,a))return;let c=typeof r==`object`&&r?.once?e=>(s(l),i(e)):i,l={eventType:e,listener:i,capture:a,wire:c};o.push(l),(typeof r==`object`?r?.signal:void 0)?.addEventListener(`abort`,()=>s(l),{once:!0}),n(e,th(c),r).catch(()=>{})}}),Object.defineProperty(a,"removeEventListener",{value:(e,t,n)=>{if(t===null)return;let i=Nh(t),a=typeof n==`boolean`?n:!!n?.capture,c=Ph(o,e,i,a);c&&(s(c),r(e,th(c.wire),{capture:a}).catch(()=>{}))}}),Dp(a,()=>{i().catch(()=>{})}),a},Ih=jd({box:()=>eee,isType:()=>Rh,revive:()=>tee,type:()=>Lh}),Lh=`symbol`,Rh=e=>typeof e==`symbol`,eee=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?ch(e,{...Ef,type:Lh,description:e.description},t):{...Ef,type:Lh,registryKey:n}},tee=(e,t)=>`registryKey`in e?Symbol.for(e.registryKey):Symbol(e.description),nee=jd({box:()=>Bh,isType:()=>ree,objectsOnly:()=>!0,revive:()=>iee,type:()=>zh}),zh=`asyncIterator`,ree=e=>!e||typeof e!=`object`||typeof ReadableStream<`u`&&e instanceof ReadableStream?!1:typeof e[Symbol.asyncIterator]==`function`,Bh=(e,t)=>{let n=e[Symbol.asyncIterator]();return{...Ef,type:zh,next:hm((e=>n.next(e)),t),return:hm((e=>n.return?.(e)??Promise.resolve({done:!0,value:e})),t),throw:hm((e=>n.throw?.(e)??Promise.reject(e)),t)}},iee=(e,t)=>{let n=gm(e.next,t),r=gm(e.return,t),i=gm(e.throw,t),a={next:(...e)=>n(...e),return:e=>r(e),throw:e=>i(e),[Symbol.asyncIterator]:()=>a};return a},Vh=[globalThis.File,globalThis.FileList,globalThis.RegExp,globalThis.DataView,globalThis.ImageData,globalThis.FormData,globalThis.DOMException,globalThis.DOMMatrix,globalThis.DOMMatrixReadOnly,globalThis.DOMPoint,globalThis.DOMPointReadOnly,globalThis.DOMQuad,globalThis.DOMRect,globalThis.DOMRectReadOnly,globalThis.CryptoKey,globalThis.FileSystemHandle,globalThis.FileSystemFileHandle,globalThis.FileSystemDirectoryHandle,globalThis.RTCCertificate],Hh=[globalThis.CropTarget,globalThis.EncodedAudioChunk,globalThis.EncodedVideoChunk,globalThis.FencedFrameConfig,globalThis.GPUCompilationInfo,globalThis.GPUCompilationMessage,globalThis.GPUPipelineError,globalThis.RTCEncodedAudioFrame,globalThis.RTCEncodedVideoFrame,globalThis.WebTransportError],Uh={type:`clonable`,capableOnly:!0,objectsOnly:!0,isType:e=>rf(e,Vh)||rf(e,Hh),box:(e,t)=>e,revive:(e,t)=>e},Wh=[globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.WritableStream,globalThis.TransformStream,globalThis.MediaStreamTrack,globalThis.RTCDataChannel],Gh=[globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MIDIAccess,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream],Kh={type:`transferable`,capableOnly:!0,objectsOnly:!0,isType:e=>rf(e,Wh)||rf(e,Gh),box:(e,t)=>e,revive:(e,t)=>e},qh={type:`blob`,capableOnly:!0,objectsOnly:!0,isType:e=>typeof Blob<`u`&&e instanceof Blob,box:(e,t)=>{if(hf(t.transport))throw TypeError(`osra: Blob is only supported on structured-clone transports, send an ArrayBuffer or Uint8Array instead`);return e},revive:(e,t)=>e},Jh=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Yh=[sp,Ym,Af,Ff,Bf,Gf,Zf,rm,um,Op,_m,Om,Nm,zm,Wm,uh,mh,vh,Ih,Ch,nee,{type:`nonFiniteNumber`,isType:e=>typeof e==`number`&&!Number.isFinite(e),box:(e,t)=>hf(t.transport)?{...Ef,type:`nonFiniteNumber`,value:String(e)}:e,revive:(e,t)=>Number(e.value)},{type:`undefined`,isType:e=>e===void 0,box:(e,t)=>hf(t.transport)?{...Ef,type:`undefined`}:e,revive:(e,t)=>void 0},Uh,Kh,qh,Oh,{type:`unclonable`,objectsOnly:!0,isType:e=>{if(typeof e!=`object`||!e||Array.isArray(e)||Jh(e))return!1;try{return structuredClone(e),!1}catch{return!0}},box:(e,t)=>({...Ef,type:`unclonable`}),revive:(e,t)=>({})}],Xh=(e,t)=>t.find(t=>t.type===e.type),Zh=e=>!!e&&typeof e==`object`&&Object.getPrototypeOf(e)===Object.prototype,Qh=(e,t)=>Array.isArray(e)?e.map(e=>t(e)):Zh(e)?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)])):e,$h=new WeakSet,eg=new WeakSet,tg=0,ng=[],rg=(e,t)=>{if(tg===0){e();return}ng.push({commit:e,rollback:t})},ig=e=>{let t=ng;ng=[];for(let n of t)try{e?n.rollback():n.commit()}catch{}},ag=e=>e!==null&&(typeof e==`object`||typeof e==`function`),og=new WeakMap,sg=e=>{let t=og.get(e);if(t)return t;let n=e.filter(e=>!e.objectsOnly);return og.set(e,n),n},cg=(e,t,n)=>{let r=(e===null||typeof e!=`object`&&typeof e!=`function`?sg(t.revivableModules):t.revivableModules).find(t=>t.type!==n&&t.isType(e));return r?r.box(e,t):Qh(e,e=>lg(e,t))},lg=(e,t)=>{if(Df(e))return e;let n=ag(e);if(n){if($h.has(e))throw TypeError(`osra: cannot serialize a circular structure - break the cycle or send the container by reference`);$h.add(e)}tg++;let r=!0;try{let n=cg(e,t);return r=!1,n}finally{n&&$h.delete(e),tg--,tg===0&&ig(r)}},ug=(e,t,n)=>cg(e,t,n),dg=(e,t)=>{let n=ag(e);if(n){if(eg.has(e))throw TypeError(`osra: cannot revive a circular structure`);eg.add(e)}try{if(Df(e)){let n=Xh(e,t.revivableModules);if(n)return n.revive(e,t)}return Qh(e,e=>dg(e,t))}finally{n&&eg.delete(e)}},fg=jd({init:()=>hg,startBidirectionalConnection:()=>mg,type:()=>pg}),pg=`bidirectional`,mg=({transport:e,value:t,remoteUuid:n,eventTarget:r,send:i,revivableModules:a})=>{let o={transport:e,remoteUuid:n,sendMessage:i,eventTarget:r,revivableModules:a};for(let e of a)e.init?.(o);let{promise:s,resolve:c}=Promise.withResolvers();return r.addEventListener(`message`,function e({detail:t}){t.type===`init`&&(c(t.data),r.removeEventListener(`message`,e))}),i({type:`init`,remoteUuid:n,data:lg(t,o)}),{revivableContext:o,remoteValue:s.then(e=>dg(e,o))}},hg=e=>{if(!(gf(e.transport)&&_f(e.transport)))return;if(e.protocolEventTarget.addEventListener(`message`,({detail:{message:t,peer:n}})=>{if(t.type===`announce`){if(!t.remoteUuid){e.sendMessage({type:`announce`,remoteUuid:t.uuid});return}if(t.remoteUuid!==e.getUuid()||e.connectionContexts.has(t.uuid))return;e.sendMessage({type:`announce`,remoteUuid:t.uuid});let r=e.createConnectionEventTarget(),i={...n(),abort:()=>e.abortConnection(t.uuid)},a;try{let n=e.valueFor(i);if(e.claimPendingAbort(t.uuid)){e.sendMessage({type:`close`,remoteUuid:t.uuid});return}a=mg({transport:e.transport,value:n,remoteUuid:t.uuid,eventTarget:r,send:t=>e.sendMessage(t),revivableModules:e.revivableModules})}catch(n){e.sendMessage({type:`close`,remoteUuid:t.uuid}),e.rejectRemoteValue(n);return}let o={type:`bidirectional`,eventTarget:r,connection:a};e.connectionContexts.set(t.uuid,o),o.connection.remoteValue.then(t=>e.addConnection(i,t),t=>e.rejectRemoteValue(t));return}if(t.type===`close`){if(t.remoteUuid!==e.getUuid())return;let n=e.connectionContexts.get(t.uuid);if(!n)return;e.connectionContexts.delete(t.uuid),op(n.connection.revivableContext),e.rejectRemoteValue(Error(`osra: peer closed the connection`));return}if(t.remoteUuid!==e.getUuid())return;let r=e.connectionContexts.get(t.uuid);r&&r.eventTarget.dispatchEvent(new CustomEvent(`message`,{detail:t}))}),e.presetRemoteUuid!==void 0){let t=e.presetRemoteUuid,n=e.createConnectionEventTarget(),r,i;try{i={abort:()=>e.abortConnection(t)};let a=e.valueFor(i);if(e.claimPendingAbort(t)){e.sendMessage({type:`close`,remoteUuid:t});return}r=mg({transport:e.transport,value:a,remoteUuid:e.presetRemoteUuid,eventTarget:n,send:t=>e.sendMessage(t),revivableModules:e.revivableModules})}catch(n){e.sendMessage({type:`close`,remoteUuid:t}),e.rejectRemoteValue(n);return}let a={type:`bidirectional`,eventTarget:n,connection:r};e.connectionContexts.set(e.presetRemoteUuid,a),a.connection.remoteValue.then(t=>e.addConnection(i,t),t=>e.rejectRemoteValue(t));return}let t=50,n,r=()=>{if(!(e.unregisterSignal?.aborted||e.connectionContexts.size>0)){try{e.sendMessage({type:`announce`},`*`)}catch{}n=setTimeout(r,t),t=Math.min(t*2,1e3)}};e.unregisterSignal?.addEventListener(`abort`,()=>clearTimeout(n),{once:!0}),r()},gg=()=>new EventTarget,aee=e=>{let t=xf(e),n=t?e.emit:e,r=t?e.receive:e;return{isJson:t&&`isJson`in e&&e.isJson!==void 0?e.isJson:n!==void 0&&hf(n)||r!==void 0&&hf(r),...n===void 0?{}:{emit:n},...r===void 0?{}:{receive:r}}},oee=e=>e?e(Yh):Yh,see=32,_g=()=>{let e=[],t=new Set,n=!1,r=()=>({value:void 0,done:!0});return{push:r=>{if(!n){if(t.size===0){e.push(r),e.length>see&&e.shift();return}for(let e of t){let t=e.wake;if(t){e.wake=void 0,t({value:r,done:!1});continue}e.buffered.push(r)}}},close:()=>{n=!0;for(let e of t){let t=e.wake;e.wake=void 0,t?.(r())}},iterate:()=>{let i={buffered:[...e]};t.add(i);let a=!1;return{[Symbol.asyncIterator](){return this},next:()=>{if(a)return Promise.resolve(r());let e=i.buffered.shift();return e?Promise.resolve({value:e,done:!1}):n?Promise.resolve(r()):new Promise(e=>{i.wake=e})},return:()=>{a=!0,t.delete(i);let e=i.wake;return i.wake=void 0,e?.(r()),Promise.resolve(r())}}}}},vg=(e,t,n)=>{let r=e.then(n);r.catch(()=>{});let i=()=>{let e=t.iterate();return{[Symbol.asyncIterator](){return this},next:()=>e.next().then(e=>e.done?{value:void 0,done:!0}:{value:n(e.value),done:!1}),return:()=>e.return?.()??Promise.resolve({value:void 0,done:!0})}};return Object.assign(r,{[Symbol.asyncIterator]:i})},yg=Symbol.for(`osra.context`),bg=e=>typeof e==`object`&&!!e&&yg in e,xg=[fg],Sg=(e,{transport:t,name:n,remoteName:r,key:i=Nd,origin:a=`*`,unregisterSignal:o,revivableModules:s,uuid:c,remoteUuid:l,connection:u=({value:e})=>e})=>{let d=u,f=aee(t);if(!(gf(f)&&_f(f))){let e=_g();e.close();let t=Promise.reject(Error(`osra: transport must be able to both emit and receive to establish a connection; pass a bidirectional platform transport or a custom { emit, receive } pair`));return t.catch(()=>{}),vg(t,e,d)}let p=oee(s),m=new Map,h=new Set,g=_g(),{promise:_,resolve:v,reject:y}=Promise.withResolvers();_.catch(()=>{});let b=c??globalThis.crypto.randomUUID(),x=(e,t=a)=>{let r={[Md]:i,name:n,uuid:b,...e},o=Cp(r);Hd(f,r,t,o),$p(o)},S=(e,t)=>{o?.aborted||x(e,t)},C=gg(),w={transport:f,valueFor:t=>bg(e)?e[yg](t):e,revivableModules:p,connectionContexts:m,getUuid:()=>b,presetRemoteUuid:l,sendMessage:S,protocolEventTarget:C,rejectRemoteValue:y,abortConnection:e=>{let t=m.get(e);if(!t){h.add(e);return}m.delete(e),x({type:`close`,remoteUuid:e}),op(t.connection.revivableContext),y(Error(`osra: connection aborted`))},claimPendingAbort:e=>h.delete(e),addConnection:(e,t)=>{let n={value:t,context:e};v(n),g.push(n)},createConnectionEventTarget:gg,unregisterSignal:o};if(zd({listener:(e,t)=>{e.uuid!==b&&C.dispatchEvent(new CustomEvent(`message`,{detail:{message:e,peer:()=>({...t.origin?{origin:t.origin}:{},...t.source?{source:t.source}:{},...t.port?{port:t.port}:{},...t.sender?{sender:t.sender}:{}})}}))},transport:f,remoteName:r,key:i,origin:a,unregisterSignal:o}),o?.aborted)return y(o.reason),g.close(),vg(_,g,d);o?.addEventListener(`abort`,()=>{for(let[e,t]of m)x({type:`close`,remoteUuid:e}),op(t.connection.revivableContext);m.clear(),g.close(),y(o.reason)},{once:!0});for(let e of xg)e.init(w);return vg(_,g,d)},Cg=(e,t)=>Sg(e,t),wg=[[`aac`,`audio/mp4; codecs="mp4a.40.2"`],[`opus`,`audio/mp4; codecs="opus"`],[`flac`,`audio/mp4; codecs="flac"`],[`ac3`,`audio/mp4; codecs="ac-3"`],[`eac3`,`audio/mp4; codecs="ec-3"`]],Tg=[`aac`,`opus`,`flac`],Eg=()=>{let e=globalThis.MediaSource;if(typeof e?.isTypeSupported!=`function`)return[...Tg];let t=wg.filter(([,t])=>{try{return e.isTypeSupported(t)}catch{return!1}}).map(([e])=>e);return t.includes(`aac`)?t:[...Tg]},Dg=e=>new Promise((t,n)=>{if(e.aborted)return n();e.addEventListener(`abort`,()=>{n()})}),Og=async({publicPath:e,workerUrl:t,workerOptions:n,read:r,length:i,bufferSize:a,audioStreamIndex:o,audioCodecs:s,transferReads:c=!0})=>{let l=new Worker(t,n),{makeRemuxer:u}=await Cg({},{transport:l}),d=await u({publicPath:e,length:i,bufferSize:a,audioStreamIndex:o,audioCodecs:s??Eg()}),f=new kd({concurrency:1}),p=!1,m=(e,t)=>{p||!c||e.byteLength>0||t>=i||(p=!0,console.warn(`libav-wasm: read(${t}) returned 0 bytes, ${i-t} bytes before the end of the file. Reads are transferred, so the buffer read() returns is detached in the caller and handing back bytes you keep returns that same detached buffer. Return a copy, or pass transferReads: false.`))},h=e=>(t,n)=>e.signal.aborted?Promise.resolve({resolved:new Uint8Array().buffer,rejected:!0}):Promise.race([r(Number(t),Number(n)).then(e=>{m(e,Number(t));let n=new Uint8Array(e).buffer;return{resolved:c?pp(n):n,rejected:!1}},()=>({resolved:new Uint8Array().buffer,rejected:!0})),Dg(e.signal).then(()=>({resolved:new Uint8Array().buffer,rejected:!0}),()=>({resolved:new Uint8Array().buffer,rejected:!0}))]),g=[];return{worker:l,remuxer:d,wasmRead:h,addTask:e=>{let t=[...g];g=[],f.clear(),t.forEach(e=>e.abort());let n=new AbortController;return g=[...g,n],Promise.race([f.add(async()=>e(n),{signal:n.signal}),Dg(n.signal).then(()=>Promise.reject(Error(`Cancelled`)),()=>Promise.reject(Error(`Cancelled`)))])},destroy:async()=>{let e=[...g];g=[],f.clear(),e.forEach(e=>e.abort()),await d.destroy(),l.terminate()}}},kg=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await Og({...e,bufferSize:e.bufferSize??25e5});return{worker:t,init:()=>i(e=>n.init(r(e))),destroy:a,seek:e=>i(t=>n.seek(r(t),e)),read:()=>i(e=>n.read(r(e))),readKeyframe:e=>i(t=>n.readKeyframe(r(t),e)),setAudioStreamIndex:e=>n.setAudioStreamIndex(e)}},Ag=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await Og({...e,bufferSize:e.bufferSize??1e6});return{worker:t,init:()=>i(e=>n.initThumbnail(r(e))),readKeyframe:e=>i(t=>n.readKeyframe(r(t),e)),destroy:a}},jg=typeof HTMLVideoElement<`u`?HTMLVideoElement.prototype:{},Mg=`getVideoPlaybackQuality`in jg||`webkitDecodedFrameCount`in jg||`mozPresentedFrames`in jg||`mozPaintedFrames`in jg;if(!(`requestVideoFrameCallback`in jg)&&Mg&&typeof requestAnimationFrame==`function`){jg._rvfcpolyfillmap={};let e=`getVideoPlaybackQuality`in jg?e=>{let{totalFrameDelay:t,totalVideoFrames:n,droppedVideoFrames:r}=e.getVideoPlaybackQuality();return{presentedFrames:n-r,totalFrameDelay:t}}:e=>({presentedFrames:e.mozPresentedFrames||e.mozPaintedFrames||e.webkitDecodedFrameCount-(e.webkitDroppedFrameCount||0),totalFrameDelay:e.mozFrameDelay||0});jg.requestVideoFrameCallback=function(t){let n=performance.now(),r=e(this),i=r.presentedFrames,a=(o,s)=>{let c=e(this),l=c.presentedFrames;if(l>i){let e=c.totalFrameDelay-r.totalFrameDelay||0,i=s-o;t(s,{presentationTime:s+e*1e3,expectedDisplayTime:s+i,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+i/1e3,presentedFrames:l,processingDuration:e}),delete this._rvfcpolyfillmap[n]}else this._rvfcpolyfillmap[n]=requestAnimationFrame(e=>a(s,e))};return this._rvfcpolyfillmap[n]=requestAnimationFrame(e=>a(n,e)),n},jg.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]}}var Ng={RAW:`RAW`,PROXY:`PROXY`,THROW:`THROW`,HANDLER:`HANDLER`},Pg={GET:`GET`,SET:`SET`,APPLY:`APPLY`,CONSTRUCT:`CONSTRUCT`,RELEASE:`RELEASE`},Fg=Symbol(`Abslink.proxy`),Ig=Symbol(`Abslink.releaseProxy`),Lg=Symbol(`Abslink.finalizer`),Rg=Symbol(`Abslink.thrown`),zg=e=>typeof e==`object`&&!!e||typeof e==`function`,Bg=new Map([[`proxy`,{canHandle:e=>zg(e)&&Fg in e,serialize(e,t){let n=e[Fg];return Hg(e,t,n),[n,[]]},deserialize(e,t){return Ug(t,e)}}],[`throw`,{canHandle:e=>zg(e)&&Rg in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function Vg(e,t){let n=t,r=e.slice(0,-1);for(let e of r)Object.prototype.hasOwnProperty.call(n,e)&&(n=n[e]);let i=e[e.length-1],a=i?n[i]:n;return{parent:n,RawValue:a,lastSegment:i}}function Hg(e,t,n){return t.on(`message`,function r(i){if(!i)return;let{id:a,type:o,path:s,markerID:c}={path:[],...i};if(c!==n)return;let l=(i.argumentList??[]).map(e=>n_(e,t)),u;try{let{parent:n,RawValue:r,lastSegment:a}=Vg(s,e);switch(o){case Pg.GET:u=r;break;case Pg.SET:n[a]=n_(i.value,t),u=!0;break;case Pg.APPLY:u=r.apply(n,l);break;case Pg.CONSTRUCT:u=new r(...l);break;case Pg.RELEASE:u=void 0;break;default:return}}catch(e){u={value:e,[Rg]:0}}Promise.resolve(u).catch(e=>({value:e,[Rg]:0})).then(i=>{o===Pg.CONSTRUCT&&!(zg(i)&&Rg in i)&&(i=e_(i));let[s,c]=t_(i,t);t.postMessage({...s,id:a,markerID:n},c),o===Pg.RELEASE&&(t.off(`message`,r),e[Lg]?.())}).catch(e=>{let[r,i]=t_({value:TypeError(`Unserializable return value`),[Rg]:0},t);t.postMessage({...r,id:a,markerID:n},i)})}),e}function Ug(e,t){let n=new Map;return e.on(`message`,e=>{if(!e?.id)return;let t=n.get(e.id);if(t)try{t(e)}finally{n.delete(e.id)}}),Xg({endpoint:e,pendingListeners:n,rootMarkerID:t})}function Wg(e){if(e)throw Error(`Proxy has been released and is not useable`)}async function Gg(e){await r_(e,{type:Pg.RELEASE})}var Kg=new WeakMap,qg=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(Kg.get(e)??0)-1;Kg.set(e,t),t===0&&Gg(e).finally(()=>{e.pendingListeners.clear()})});function Jg(e,t){let n=(Kg.get(t)??0)+1;Kg.set(t,n),qg&&qg.register(e,t,e)}function Yg(e){qg&&qg.unregister(e)}function Xg(e,t=[]){let n=!1,r=new Map,i=new Proxy(function(){},{get(a,o){if(Wg(n),o===Ig)return async()=>{for(let e of r.values())e[Ig]();r.clear(),Yg(i),Gg(e).finally(()=>{e.pendingListeners.clear()}),n=!0};if(o===`then`){if(t.length===0)return{then:()=>i};let n=r_(e,{type:Pg.GET,path:t.map(e=>e.toString())}).then(t=>n_(t,e.endpoint));return n.then.bind(n)}let s=r.get(o);if(s)return s;let c=Xg(e,[...t,o]);return r.set(o,c),c},set(r,i,a){Wg(n);let[o,s]=t_(a,e.endpoint);return r_(e,{type:Pg.SET,path:[...t,i].map(e=>e.toString()),value:o},s).then(t=>n_(t,e.endpoint))},apply(r,i,a){if(Wg(n),t[t.length-1]===`bind`)return Xg(e,t.slice(0,-1));let[o,s]=$g(a,e);return r_(e,{type:Pg.APPLY,path:t.map(e=>e.toString()),argumentList:o},s).then(t=>n_(t,e.endpoint))},construct(r,i){Wg(n);let[a,o]=$g(i,e);return r_(e,{type:Pg.CONSTRUCT,path:t.map(e=>e.toString()),argumentList:a},o).then(t=>n_(t,e.endpoint))}});return Jg(i,e),i}var Zg=new WeakMap;function Qg(e,t){return Zg.set(e,t),e}function $g(e,t){let n=[],r=[];for(let i of e){let[e,a]=t_(i,t.endpoint);n.push(e),r.push(...a)}return[n,r]}function e_(e){return Object.assign(e,{[Fg]:c_()})}function t_(e,t){for(let[n,r]of Bg)if(r.canHandle(e)){let[i,a]=r.serialize(e,t);return[{type:Ng.HANDLER,name:n,value:i},a]}return[{type:Ng.RAW,value:e},Zg.get(e)??[]]}function n_(e,t){switch(e.type){case Ng.HANDLER:return Bg.get(e.name).deserialize(e.value,t);case Ng.RAW:return e.value}}function r_(e,t,n=[]){return new Promise(r=>{let i=c_();e.pendingListeners.set(i,r),e.endpoint.postMessage({id:i,...t,markerID:e.rootMarkerID},n)})}var i_=[],a_=`0123456789abcdef`;for(let e=0;e<256;e++)i_[e]=a_[e>>4&15]+a_[e&15];var o_=0,s_=``;function c_(){let e=0;if(!s_||o_+16>512)for(s_=``,o_=0;e<256;++e)s_+=i_[Math.random()*256|0];return s_.substring(o_,++o_+16)}function l_(e,t){let n=new WeakMap;return e.start?.(),t.start?.(),{on(t,r){let i=e=>r(e.data);`addEventListener`in e?e.addEventListener(t,i):`addListener`in e?e.addListener(t,i):e.on(t,i),n.set(r,i)},off(t,r){let i=n.get(r);`removeEventListener`in e?e.removeEventListener(t,i):`removeListener`in e?e.removeListener(t,i):e.off(t,i),n.delete(r)},postMessage(e,n=[]){t.postMessage(e,n)}}}function u_(e,t=e){return Ug(l_(e,t))}var d_=l(o(((e,t)=>{var n=typeof process<`u`&&!!process.hrtime,r=65535,i=10,a=n?1e9/i:1e3/i,o=n?()=>{let[e,t]=process.hrtime();return e*1e9+t}:()=>performance.now();function s(e){return(o()-e)/a&r}t.exports=function(e){let t=o(),n=i*(e||5),a=[0],c=1,l=s(t)-1&r;return function(e){let o=s(t),u=o-l&r;for(u>n&&(u=n),l=o;u--;)c===n&&(c=0),a[c]=a[c===0?n-1:c-1],c++;e&&(a[c-1]+=e);let d=a[c-1],f=a.length<n?0:a[c===n?0:c];return a.length<i?d:(d-f)*i/a.length}}}))(),1),f_=class{fps=(0,d_.default)(5);processingDuration=(0,d_.default)(5);droppedFrames=0;presentedFrames=0;mistimedFrames=0;_drop(){++this.droppedFrames}_startTime=0;_startFrame(){this._startTime=performance.now()}onsubtitleFrameCallback=(e,{fps:t,processingDuration:n,droppedFrames:r})=>console.info(`%cFPS: %c%f %c| Frame Time: %c%d ms %c| Dropped Frames: %c%d %c| 5s Avg`,`color: #888`,`color: #0f0; font-weight: bold`,t.toFixed(1),`color: #888`,`color: #0ff; font-weight: bold`,n,`color: #888`,`color: #f00; font-weight: bold`,r,`color: #888`);_endFrame(e){++this.presentedFrames;let t=this.fps(1),n=performance.now(),r=this.processingDuration((n-this._startTime)/t),i=Math.max(0,n-e.expectedDisplayTime);i&&++this.mistimedFrames,this.onsubtitleFrameCallback?.(n,{fps:t,processingDuration:r,droppedFrames:this.droppedFrames,presentedFrames:this.presentedFrames,mistimedFrames:this.mistimedFrames,presentationTime:n,expectedDisplayTime:e.expectedDisplayTime+(i>0?t/1e3:0),frameDelay:i,width:e.width,height:e.height,mediaTime:e.mediaTime})}},p_=class e{timeOffset;prescaleFactor;prescaleHeightLimit;maxRenderHeight;debug;renderer;ready;busy=!1;_video;_videoWidth=0;_videoHeight=0;_videoColorSpace=null;_canvas;_ro=new ResizeObserver(async()=>{try{await this.ready,this.resize()}catch{}});_destroyed=!1;_lastDemandTime;_skipped=!1;_worker;constructor(t){if(!globalThis.Worker)throw Error(`Worker not supported`);if(!t)throw Error(`No options provided`);if(!t.video&&!t.canvas)throw Error(`You should give video or canvas in options.`);e._test(),this.timeOffset=t.timeOffset??0,this._video=t.video,this._canvas=t.canvas??document.createElement(`canvas`),this._video&&!t.canvas&&(this._canvas.className=`JASSUB`,this._canvas.style.position=`absolute`,this._canvas.style.pointerEvents=`none`,this._video.insertAdjacentElement(`afterend`,this._canvas));let n=this._canvas.transferControlToOffscreen();this.debug=t.debug?new f_:null,this.prescaleFactor=t.prescaleFactor??1,this.prescaleHeightLimit=t.prescaleHeightLimit??1080,this.maxRenderHeight=t.maxRenderHeight??2160,this._worker=t.workerUrl?new Worker(t.workerUrl,{name:`jassub-worker`,type:`module`}):(()=>{throw Error(`jassub's bundled worker is not built into this app; pass the url explicitly`)})();let r=u_(this._worker),i=t.modernWasmUrl??(()=>{throw Error(`jassub's bundled simd wasm is not built into this app; pass the url explicitly`)})(),a=t.wasmUrl??(()=>{throw Error(`jassub's bundled fallback wasm is not built into this app; pass the url explicitly`)})(),o=t.modernWasmWorkerUrl??(()=>{throw Error(`jassub's bundled simd wasm script is not built into this app; pass the url explicitly`)})(),s=t.wasmWorkerUrl??(()=>{throw Error(`jassub's bundled fallback wasm script is not built into this app; pass the url explicitly`)})(),c=!!e._supportsSIMD&&(navigator.deviceMemory??1/0)>2,l={...t.availableFonts};!l[`liberation sans`]&&!t.defaultFont&&(l[`liberation sans`]=(()=>{throw Error(`jassub's bundled fallback font is not built into this app; pass the url explicitly`)})()),this.ready=new r({wasmUrl:c?i:a,wasmWorkerUrl:c?o:s,width:n.width,height:n.height,subUrl:t.subUrl,subContent:t.subContent??null,fonts:t.fonts??[],availableFonts:l,defaultFont:t.defaultFont??`liberation sans`,debug:!!t.debug,libassMemoryLimit:t.libassMemoryLimit??((navigator.deviceMemory??1/0)<=2?32:128),libassGlyphLimit:t.libassGlyphLimit??((navigator.deviceMemory??1/0)<=2?1e3:3e3),queryFonts:t.queryFonts??`local`},e_(e=>this._getLocalFont(e)),Qg(n,[n])).then(e=>{this.renderer=e}),this._video?this.setVideo(this._video):this._ro.observe(this._canvas)}static _supportsSIMD;static _test(){if(e._supportsSIMD!=null)return;try{e._supportsSIMD=WebAssembly.validate(Uint8Array.of(0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,43,1,41,0,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,128,2,11))}catch{e._supportsSIMD=!1}let t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(t instanceof WebAssembly.Module)||!(new WebAssembly.Instance(t)instanceof WebAssembly.Instance))throw Error(`WASM not supported`)}async resize(e=!!this._video?.paused,t=0,n=0){let r=this._video?.videoWidth??this._videoWidth,i=this._video?.videoHeight??this._videoHeight,a=this._getElementBoundingBox(this._video??this._canvas,r,i);if(!t||!n){let e=this._videoWidth/r||1,o=this._videoHeight/i||1,{width:s,height:c}=this._computeRenderSize(a.width*e,a.height*o);t=Math.round(s),n=Math.round(c)}this._video&&(this._canvas.style.width=Math.round(a.width)+`px`,this._canvas.style.height=Math.round(a.height)+`px`,this._canvas.style.top=a.y+`px`,this._canvas.style.left=a.x+`px`),await this.renderer._resizeCanvas(t,n,this._video?this._videoWidth||t:0,this._video?this._videoHeight||n:0),this._lastDemandTime&&await this._demandRender(e)}_getElementBoundingBox(e,t,n){let{clientWidth:r,clientHeight:i,offsetLeft:a,offsetTop:o}=e,s=t/n;return r/i>s?(n=i,t=i*s):(n=r/s,t=r),{x:a+(r-t)/2,y:o+(i-n)/2,width:t,height:n}}_computeRenderSize(e=0,t=0){if(t<=0||e<=0)return{width:0,height:0};let n=this.prescaleFactor<=0?1:this.prescaleFactor,r=self.devicePixelRatio||1,i=n<1?-1:1,a=t*r;return i*a*n<=i*this.prescaleHeightLimit?a*=n:i*a<i*this.prescaleHeightLimit&&(a=this.prescaleHeightLimit),this.maxRenderHeight>0&&a>this.maxRenderHeight&&(a=this.maxRenderHeight),e*=a/t,t=a,{width:e,height:t}}async setVideo(e){this._removeListeners(),this._video=e,this._ro.observe(e),typeof VideoFrame<`u`&&(e.addEventListener(`loadedmetadata`,this._boundUpdateColorSpace),this._updateColorSpace({target:e}));let t=++this._rvfcLoop;await this.ready,t===this._rvfcLoop&&e.requestVideoFrameCallback((e,n)=>this._handleRVFC(t,n))}async _getLocalFont(e,t=`regular`){if(navigator.permissions?.query){let{state:e}=await navigator.permissions.query({name:`local-fonts`});if(e!==`granted`)return}for(let n of await self.queryLocalFonts()){let r=n.family.toLowerCase(),i=n.style.toLowerCase();if(r===e&&i===t){let e=await n.blob();return new Uint8Array(await e.arrayBuffer())}}}_rvfcLoop=0;_handleRVFC(e,t){this._destroyed||e!==this._rvfcLoop||(this.manualRender(t).catch(console.error),this._video.requestVideoFrameCallback((t,n)=>this._handleRVFC(e,n)))}manualRender(e,t=!1){return this._lastDemandTime=e,this._demandRender(t)}async _demandRender(e=!1){let{mediaTime:t,width:n,height:r}=this._lastDemandTime;if(n!==this._videoWidth||r!==this._videoHeight)return this._videoWidth=n,this._videoHeight=r,await this.resize(e);if(this.busy){this._skipped=!0,this.debug?._drop();return}this.busy=!0,this._skipped=!1;try{this.debug?._startFrame(),await this.renderer._draw(t+this.timeOffset,e),this.debug?._endFrame(this._lastDemandTime)}catch(e){console.error(e)}finally{this.busy=!1}this._skipped&&await this._demandRender()}_boundUpdateColorSpace=this._updateColorSpace.bind(this);_updateColorSpace({target:e}){this._video.requestVideoFrameCallback(async()=>{if(!(this._destroyed||this._video!==e))try{let e=new VideoFrame(this._video),{matrix:t,fullRange:n}=e.colorSpace;e.close(),await this.ready,await this.renderer._setColorSpace(t,n)}catch(e){console.warn(e)}})}_removeListeners(){this._ro.disconnect(),this._video?.removeEventListener(`loadedmetadata`,this._boundUpdateColorSpace)}async destroy(){if(!this._destroyed){this._destroyed=!0,this._canvas.remove(),this._removeListeners();try{await this.ready,await this.renderer?.[Ig]()}finally{this._worker.terminate()}}}};function m_(e){var t=e.toLowerCase().trim().split(/\s*;\s*/);return t[0]===`banner`?{name:t[0],delay:t[1]*1||0,leftToRight:t[2]*1||0,fadeAwayWidth:t[3]*1||0}:/^scroll\s/.test(t[0])?{name:t[0],y1:Math.min(t[1]*1,t[2]*1),y2:Math.max(t[1]*1,t[2]*1),delay:t[3]*1||0,fadeAwayHeight:t[4]*1||0}:e===``?null:{name:e}}function h_(e){return e?e.toLowerCase().replace(/([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)/g,` $1 `).replace(/([mnlbspc])/g,` $1 `).trim().replace(/\s+/g,` `).split(/\s(?=[mnlbspc])/).map(function(e){return e.split(` `).filter(function(e,t){return!(t&&isNaN(e*1))})}):[]}var g_=`b.i.u.s.fsp.k.K.kf.ko.kt.fe.q.p.pbo.a.an.fscx.fscy.fax.fay.frx.fry.frz.fr.be.blur.bord.xbord.ybord.shad.xshad.yshad`.split(`.`).map(function(e){return{name:e,regex:RegExp(`^`+e+`-?\\d`)}});function __(e){for(var t,n={},r=0;r<g_.length;r++){var i=g_[r],a=i.name;if(i.regex.test(e))return n[a]=e.slice(a.length)*1,n}if(/^fn/.test(e))n.fn=e.slice(2);else if(/^r/.test(e))n.r=e.slice(1);else if(/^fs[\d+-]/.test(e))n.fs=e.slice(2);else if(/^\d?c&?H?[0-9a-fA-F]+|^\d?c$/.test(e)){var o=e.match(/^(\d?)c&?H?(\w*)/),s=o[1],c=o[2];n[`c`+(s||1)]=c&&(`000000`+c).slice(-6)}else if(/^\da&?H?[0-9a-fA-F]+/.test(e)){var l=e.match(/^(\d)a&?H?([0-9a-f]+)/i),u=l[1],d=l[2];n[`a`+u]=(`00`+d).slice(-2)}else if(/^alpha&?H?[0-9a-fA-F]+/.test(e))t=e.match(/^alpha&?H?([0-9a-f]+)/i),n.alpha=t[1],n.alpha=(`00`+n.alpha).slice(-2);else if(/^(?:pos|org|move|fad|fade)\([^)]+/.test(e)){var f=e.match(/^(\w+)\((.*?)\)?$/),p=f[1];n[p]=f[2].trim().split(/\s*,\s*/).map(Number)}else if(/^i?clip\([^)]+/.test(e)){var m=e.match(/^i?clip\((.*?)\)?$/)[1].trim().split(/\s*,\s*/);n.clip={inverse:/iclip/.test(e),scale:1,drawing:null,dots:null},m.length===1&&(n.clip.drawing=h_(m[0])),m.length===2&&(n.clip.scale=m[0]*1,n.clip.drawing=h_(m[1])),m.length===4&&(n.clip.dots=m.map(Number))}else if(/^t\(/.test(e)){var h=e.match(/^t\((.*?)\)?$/)[1].trim().replace(/\\.*/,function(e){return e.replace(/,/g,`
|
|
36
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let f=es(),m;if(t){let e=typeof t==`string`?ki(t):t;Ci(u===`/`||e.pathname?.startsWith(u),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${e.pathname}" was given in the \`location\` prop.`),m=e}else m=f;let h=m.pathname||`/`,g=h;if(u!==`/`){let e=u.replace(/^\//,``).split(`/`);g=`/`+h.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let _=Bi(e,{pathname:g});wi(d||_!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),wi(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=ps(_&&_.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:pa([u,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?u:pa([u,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&v?p.createElement(Yo.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...m},navigationType:`POP`}},v):v}function ls(){let e=bs(),t=va(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=p.createElement(p.Fragment,null,p.createElement(`p`,null,`💿 Hey developer 👋`),p.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,p.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,p.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),p.createElement(p.Fragment,null,p.createElement(`h2`,null,`Unexpected Application Error!`),p.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?p.createElement(`pre`,{style:i},n):null,o)}var us=p.createElement(ls,null),ds=class extends p.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.unstable_onError?this.props.unstable_onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){return this.state.error===void 0?this.props.children:p.createElement(Xo.Provider,{value:this.props.routeContext},p.createElement(Zo.Provider,{value:this.state.error,children:this.props.component}))}};function fs({routeContext:e,match:t,children:n}){let r=p.useContext(Uo);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),p.createElement(Xo.Provider,{value:e},n)}function ps(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);Ci(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){s=!0,a=c>=0?a.slice(0,c+1):[a[0]];break}}}return a.reduceRight((e,i,l)=>{let u,d=!1,f=null,m=null;n&&(u=o&&i.route.id?o[i.route.id]:void 0,f=i.route.errorElement||us,s&&(c<0&&l===0?(Cs(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,m=null):c===l&&(d=!0,m=i.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,l+1)),g=()=>{let t;return t=u?f:d?m:i.route.Component?p.createElement(i.route.Component,null):i.route.element?i.route.element:e,p.createElement(fs,{match:i,routeContext:{outlet:e,matches:h,isDataRoute:n!=null},children:t})};return n&&(i.route.ErrorBoundary||i.route.errorElement||l===0)?p.createElement(ds,{location:n.location,revalidation:n.revalidation,component:f,error:u,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},unstable_onError:r}):g()},null)}function ms(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hs(e){let t=p.useContext(Uo);return Ci(t,ms(e)),t}function gs(e){let t=p.useContext(Wo);return Ci(t,ms(e)),t}function _s(e){let t=p.useContext(Xo);return Ci(t,ms(e)),t}function vs(e){let t=_s(e),n=t.matches[t.matches.length-1];return Ci(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ys(){return vs(`useRouteId`)}function bs(){let e=p.useContext(Zo),t=gs(`useRouteError`),n=vs(`useRouteError`);return e===void 0?t.errors?.[n]:e}function xs(){let{router:e}=hs(`useNavigate`),t=vs(`useNavigate`),n=p.useRef(!1);return ns(()=>{n.current=!0}),p.useCallback(async(r,i={})=>{wi(n.current,ts),n.current&&(typeof r==`number`?e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Ss={};function Cs(e,t,n){!t&&!Ss[e]&&(Ss[e]=!0,wi(!1,n))}var ws={};function Ts(e,t){!e&&!ws[t]&&(ws[t]=!0,console.warn(t))}function Es(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&wi(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:p.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&wi(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:p.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&wi(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:p.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Ds=[`HydrateFallback`,`hydrateFallbackElement`],Os=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function ks({router:e,flushSync:t,unstable_onError:n}){let[r,i]=p.useState(e.state),[a,o]=p.useState(),[s,c]=p.useState({isTransitioning:!1}),[l,u]=p.useState(),[d,f]=p.useState(),[m,h]=p.useState(),g=p.useRef(new Map),_=p.useCallback(e=>{i(t=>(e.errors&&n&&Object.entries(e.errors).forEach(([e,r])=>{t.errors?.[e]!==r&&n(r)}),e))},[n]),v=p.useCallback((n,{deletedFetchers:r,flushSync:i,viewTransitionOpts:a})=>{n.fetchers.forEach((e,t)=>{e.data!==void 0&&g.current.set(t,e.data)}),r.forEach(e=>g.current.delete(e)),Ts(i===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let s=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(Ts(a==null||s,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!a||!s){t&&i?t(()=>_(n)):p.startTransition(()=>_(n));return}if(t&&i){t(()=>{d&&(l&&l.resolve(),d.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:a.currentLocation,nextLocation:a.nextLocation})});let r=e.window.document.startViewTransition(()=>{t(()=>_(n))});r.finished.finally(()=>{t(()=>{u(void 0),f(void 0),o(void 0),c({isTransitioning:!1})})}),t(()=>f(r));return}d?(l&&l.resolve(),d.skipTransition(),h({state:n,currentLocation:a.currentLocation,nextLocation:a.nextLocation})):(o(n),c({isTransitioning:!0,flushSync:!1,currentLocation:a.currentLocation,nextLocation:a.nextLocation}))},[e.window,t,d,l,_]);p.useLayoutEffect(()=>e.subscribe(v),[e,v]),p.useEffect(()=>{s.isTransitioning&&!s.flushSync&&u(new Os)},[s]),p.useEffect(()=>{if(l&&a&&e.window){let t=a,n=l.promise,r=e.window.document.startViewTransition(async()=>{p.startTransition(()=>_(t)),await n});r.finished.finally(()=>{u(void 0),f(void 0),o(void 0),c({isTransitioning:!1})}),f(r)}},[a,l,e.window,_]),p.useEffect(()=>{l&&a&&r.location.key===a.location.key&&l.resolve()},[l,d,r.location,a]),p.useEffect(()=>{!s.isTransitioning&&m&&(o(m.state),c({isTransitioning:!0,flushSync:!1,currentLocation:m.currentLocation,nextLocation:m.nextLocation}),h(void 0))},[s.isTransitioning,m]);let y=p.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),b=e.basename||`/`,x=p.useMemo(()=>({router:e,navigator:y,static:!1,basename:b,unstable_onError:n}),[e,y,b,n]);return p.createElement(p.Fragment,null,p.createElement(Uo.Provider,{value:x},p.createElement(Wo.Provider,{value:r},p.createElement(Ko.Provider,{value:g.current},p.createElement(Go.Provider,{value:s},p.createElement(Ps,{basename:b,location:r.location,navigationType:r.historyAction,navigator:y},p.createElement(As,{routes:e.routes,future:e.future,state:r,unstable_onError:n})))))),null)}var As=p.memo(js);function js({routes:e,future:t,state:n,unstable_onError:r}){return cs(e,void 0,n,r,t)}function Ms({to:e,replace:t,state:n,relative:r}){Ci($o(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=p.useContext(Jo);wi(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=p.useContext(Xo),{pathname:o}=es(),s=rs(),c=fa(e,da(a),o,r===`path`),l=JSON.stringify(c);return p.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Ns(e){return os(e.context)}function Ps({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1}){Ci(!$o(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let o=e.replace(/^\/*/,`/`),s=p.useMemo(()=>({basename:o,navigator:i,static:a,future:{}}),[o,i,a]);typeof n==`string`&&(n=ki(n));let{pathname:c=`/`,search:l=``,hash:u=``,state:d=null,key:f=`default`}=n,m=p.useMemo(()=>{let e=aa(c,o);return e==null?null:{location:{pathname:e,search:l,hash:u,state:d,key:f},navigationType:r}},[o,c,l,u,d,f,r]);return wi(m!=null,`<Router basename="${o}"> is not able to match the URL "${c}${l}${u}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:p.createElement(Jo.Provider,{value:s},p.createElement(Yo.Provider,{children:t,value:m}))}p.Component;var Fs=`get`,Is=`application/x-www-form-urlencoded`;function Ls(e){return e!=null&&typeof e.tagName==`string`}function Rs(e){return Ls(e)&&e.tagName.toLowerCase()===`button`}function zs(e){return Ls(e)&&e.tagName.toLowerCase()===`form`}function Bs(e){return Ls(e)&&e.tagName.toLowerCase()===`input`}function Vs(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Hs(e,t){return e.button===0&&(!t||t===`_self`)&&!Vs(e)}function Us(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Ws(e,t){let n=Us(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Gs=null;function Ks(){if(Gs===null)try{new FormData(document.createElement(`form`),0),Gs=!1}catch{Gs=!0}return Gs}var qs=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Js(e){return e!=null&&!qs.has(e)?(wi(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Is}"`),null):e}function Ys(e,t){let n,r,i,a,o;if(zs(e)){let o=e.getAttribute(`action`);r=o?aa(o,t):null,n=e.getAttribute(`method`)||Fs,i=Js(e.getAttribute(`enctype`))||Is,a=new FormData(e)}else if(Rs(e)||Bs(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?aa(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Fs,i=Js(e.getAttribute(`formenctype`))||Js(o.getAttribute(`enctype`))||Is,a=new FormData(o,e),!Ks()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Ls(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Fs,r=null,i=Is,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Xs(e,t){if(e===!1||e==null)throw Error(t)}function Zs(e,t,n){let r=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return r.pathname=r.pathname===`/`?`_root.${n}`:t&&aa(r.pathname,t)===`/`?`${t.replace(/\/$/,``)}/_root.${n}`:`${r.pathname.replace(/\/$/,``)}.${n}`,r}async function Qs(e,t){if(e.id in t)return t[e.id];try{let n=await gi(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function $s(e){return e!=null&&typeof e.page==`string`}function ec(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function tc(e,t,n){return oc((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Qs(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(ec).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function nc(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function rc(e,t,{includeHydrateFallback:n}={}){return ic(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function ic(e){return[...new Set(e)]}function ac(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function oc(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!$s(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ac(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function sc(){let e=p.useContext(Uo);return Xs(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function cc(){let e=p.useContext(Wo);return Xs(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var lc=p.createContext(void 0);lc.displayName=`FrameworkContext`;function uc(){let e=p.useContext(lc);return Xs(e,`You must render this element inside a <HydratedRouter> element`),e}function dc(e,t){let n=p.useContext(lc),[r,i]=p.useState(!1),[a,o]=p.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=p.useRef(null);p.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),p.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:fc(s,m),onBlur:fc(c,h),onMouseEnter:fc(l,m),onMouseLeave:fc(u,h),onTouchStart:fc(d,m)}]:[a,f,{}]:[!1,f,{}]}function fc(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function pc({page:e,...t}){let{router:n}=sc(),r=p.useMemo(()=>Bi(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?p.createElement(hc,{page:e,matches:r,...t}):null}function mc(e){let{manifest:t,routeModules:n}=uc(),[r,i]=p.useState([]);return p.useEffect(()=>{let r=!1;return tc(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function hc({page:e,matches:t,...n}){let r=es(),{manifest:i,routeModules:a}=uc(),{basename:o}=sc(),{loaderData:s,matches:c}=cc(),l=p.useMemo(()=>nc(e,t,c,i,r,`data`),[e,t,c,i,r]),u=p.useMemo(()=>nc(e,t,c,i,r,`assets`),[e,t,c,i,r]),d=p.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,c=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!l.some(t=>t.route.id===e.route.id)&&e.route.id in s&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?c=!0:n.add(e.route.id))}),n.size===0)return[];let u=Zs(e,o,`data`);return c&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[o,s,r,i,l,t,e,a]),f=p.useMemo(()=>rc(u,i),[u,i]),m=mc(u);return p.createElement(p.Fragment,null,d.map(e=>p.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),f.map(e=>p.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>p.createElement(`link`,{key:e,nonce:n.nonce,...t})))}function gc(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}p.Component;var _c=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{_c&&(window.__reactRouterVersion=`7.9.3`)}catch{}function vc(e,t){return Na({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:Si({window:t?.window}),hydrationData:t?.hydrationData||yc(),routes:e,mapRouteProperties:Es,hydrationRouteProperties:Ds,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function yc(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:bc(e.errors)}),e}function bc(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new _a(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(r.__subType){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var xc=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Sc=p.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:o,target:s,to:c,preventScrollReset:l,viewTransition:u,...d},f){let{basename:m}=p.useContext(Jo),h=typeof c==`string`&&xc.test(c),g,_=!1;if(typeof c==`string`&&h&&(g=c,_c))try{let e=new URL(window.location.href),t=c.startsWith(`//`)?new URL(e.protocol+c):new URL(c),n=aa(t.pathname,m);t.origin===e.origin&&n!=null?c=n+t.search+t.hash:_=!0}catch{wi(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let v=Qo(c,{relative:r}),[y,b,x]=dc(n,d),S=Dc(c,{replace:a,state:o,target:s,preventScrollReset:l,relative:r,viewTransition:u});function C(t){e&&e(t),t.defaultPrevented||S(t)}let w=p.createElement(`a`,{...d,...x,href:g||v,onClick:_||i?e:C,ref:gc(f,b),target:s,"data-discover":!h&&t===`render`?`true`:void 0});return y&&!h?p.createElement(p.Fragment,null,w,p.createElement(pc,{page:v})):w});Sc.displayName=`Link`;var Cc=p.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=ss(a,{relative:c.relative}),d=es(),f=p.useContext(Wo),{navigator:m,basename:h}=p.useContext(Jo),g=f!=null&&Nc(u)&&o===!0,_=m.encodeLocation?m.encodeLocation(u).pathname:u.pathname,v=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=aa(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return p.createElement(Sc,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Cc.displayName=`NavLink`;var wc=p.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Fs,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,...f},m)=>{let h=jc(),g=Mc(s,{relative:l}),_=o.toLowerCase()===`get`?`get`:`post`,v=typeof s==`string`&&xc.test(s);return p.createElement(`form`,{ref:m,method:_,action:g,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o;h(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d})},...f,"data-discover":!v&&e===`render`?`true`:void 0})});wc.displayName=`Form`;function Tc(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ec(e){let t=p.useContext(Uo);return Ci(t,Tc(e)),t}function Dc(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o}={}){let s=rs(),c=es(),l=ss(e,{relative:a});return p.useCallback(u=>{if(Hs(u,t)){u.preventDefault();let t=n===void 0?Oi(c)===Oi(l):n;s(e,{replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o})}},[c,s,l,n,r,t,e,i,a,o])}function Oc(e){wi(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=p.useRef(Us(e)),n=p.useRef(!1),r=es(),i=p.useMemo(()=>Ws(r.search,n.current?null:t.current),[r.search]),a=rs();return[i,p.useCallback((e,t)=>{let r=Us(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var kc=0,Ac=()=>`__${String(++kc)}__`;function jc(){let{router:e}=Ec(`useSubmit`),{basename:t}=p.useContext(Jo),n=ys();return p.useCallback(async(r,i={})=>{let{action:a,method:o,encType:s,formData:c,body:l}=Ys(r,t);if(i.navigate===!1){let t=i.fetcherKey||Ac();await e.fetch(t,n,i.action||a,{preventScrollReset:i.preventScrollReset,formData:c,body:l,formMethod:i.method||o,formEncType:i.encType||s,flushSync:i.flushSync})}else await e.navigate(i.action||a,{preventScrollReset:i.preventScrollReset,formData:c,body:l,formMethod:i.method||o,formEncType:i.encType||s,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[e,t,n])}function Mc(e,{relative:t}={}){let{basename:n}=p.useContext(Jo),r=p.useContext(Xo);Ci(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...ss(e||`.`,{relative:t})},o=es();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:pa([n,a.pathname])),Oi(a)}function Nc(e,{relative:t}={}){let n=p.useContext(Go);Ci(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ec(`useViewTransitionState`),i=ss(e,{relative:t});if(!n.isTransitioning)return!1;let a=aa(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=aa(n.nextLocation.pathname,r)||n.nextLocation.pathname;return na(i.pathname,o)!=null||na(i.pathname,a)!=null}var Pc=`en.es-419.pt-BR.fr.de.it.ru.ja.ko.zh-Hans.zh-Hant.tr.pl.ar.he.id.vi.th.hi.uk.nl.sv.cs.el.ro.hu.ms`.split(`.`),Fc=`ripple:language`,Ic=Pc,Lc=new Set([`ar`,`ckb`,`dv`,`fa`,`he`,`ps`,`sd`,`ug`,`ur`,`yi`]),Rc=()=>globalThis.navigator?.languages??[],zc=e=>{try{return new Intl.Locale(e)}catch{return}},Bc=e=>Lc.has(zc(e)?.language??``),Vc=(e,t)=>{let n=t.flatMap(e=>{let t=zc(e);if(!t)return[];let{language:n,script:r}=t.maximize();return[{tag:e,exact:t.baseName,language:n,script:r}]});for(let t of e){let e=zc(t);if(!e)continue;let{language:r,script:i}=e.maximize(),a=n.find(t=>t.exact===e.baseName)??n.find(e=>e.language===r&&e.script===i)??n.find(e=>e.language===r);if(a)return a.tag}},Hc,Uc=()=>{let e=Hc;if(e===void 0)try{e=globalThis.localStorage?.getItem(Fc)}catch{}return e&&Ic.includes(e)?e:void 0},Wc=e=>{try{e?localStorage.setItem(Fc,e):localStorage.removeItem(Fc),Hc=void 0}catch{Hc=e??null}},Gc=`en-US`,Kc=()=>Gc,qc=e=>{Gc=zc(e)?.language===`en`?`en-US`:e},Jc=(e=Rc(),t=Ic)=>Vc(e,t)??`en`,Yc=()=>{let{pathname:e,search:t,hash:n}=globalThis.location??{pathname:``,search:``,hash:``};return/^\/(?:watch|download)\/?$/.test(e)?new URLSearchParams(n.slice(1)).get(`language`)??new URLSearchParams(t).get(`language`):null},Xc=(e=Rc(),t=Ic,n=Yc())=>(n?Vc([n],t):void 0)??Uc()??Jc(e,t),Zc=(e=Xc(),t=Rc())=>{let{language:n,script:r}=zc(e)?.maximize()??{};return t.find(e=>{let t=zc(e)?.maximize();return!!t&&t.language===n&&t.script===r})??e},Qc=or(),$c=3e3,el=e=>e.flatMap(e=>e.type===Yt.argument?[{type:Yt.literal,value:``},e,{type:Yt.literal,value:``}]:e.type===Yt.tag?[{...e,children:el(e.children)}]:e.type===Yt.select||e.type===Yt.plural?[{...e,options:Object.fromEntries(Object.entries(e.options).map(([e,t])=>[e,{...t,value:el(t.value)}]))}]:[e]),tl=e=>{try{return el(Mn(e))}catch{return e}},nl=(e,t,n)=>ci({locale:t,defaultLocale:e===`en`?t:`en`,messages:n},Qc),q=nl(`en`,`en`,{}),rl=`en`,il=0,al=()=>rl,ol=new Set,sl=e=>(ol.add(e),()=>{ol.delete(e)}),cl=({children:e})=>(0,p.createElement)(ei,{value:(0,p.useSyncExternalStore)(sl,()=>q)},e),ll=e=>{if(typeof e==`string`)return e;let t={id:e.message,defaultMessage:e.message};return q.formatMessage(t,e.values)},ul=Object.assign({"../locales/ar.json":()=>gi(()=>import(`./assets/ar-CnUKoSP-.js`).then(e=>e.default),[]),"../locales/cs.json":()=>gi(()=>import(`./assets/cs-Be9L4VBV.js`).then(e=>e.default),[]),"../locales/de.json":()=>gi(()=>import(`./assets/de-BsSeEGSU.js`).then(e=>e.default),[]),"../locales/el.json":()=>gi(()=>import(`./assets/el-jYB89Eok.js`).then(e=>e.default),[]),"../locales/es-419.json":()=>gi(()=>import(`./assets/es-419-BCvLqLTT.js`).then(e=>e.default),[]),"../locales/fr.json":()=>gi(()=>import(`./assets/fr-BpklDC1Z.js`).then(e=>e.default),[]),"../locales/he.json":()=>gi(()=>import(`./assets/he-B7Hli7a4.js`).then(e=>e.default),[]),"../locales/hi.json":()=>gi(()=>import(`./assets/hi-DM2t-_zN.js`).then(e=>e.default),[]),"../locales/hu.json":()=>gi(()=>import(`./assets/hu-Bhbq6QWM.js`).then(e=>e.default),[]),"../locales/id.json":()=>gi(()=>import(`./assets/id-BBHACgWu.js`).then(e=>e.default),[]),"../locales/it.json":()=>gi(()=>import(`./assets/it-CkMR8wbx.js`).then(e=>e.default),[]),"../locales/ja.json":()=>gi(()=>import(`./assets/ja-C3JB3FWD.js`).then(e=>e.default),[]),"../locales/ko.json":()=>gi(()=>import(`./assets/ko-DloJnipq.js`).then(e=>e.default),[]),"../locales/ms.json":()=>gi(()=>import(`./assets/ms-liouKvNc.js`).then(e=>e.default),[]),"../locales/nl.json":()=>gi(()=>import(`./assets/nl-W_PeOM2E.js`).then(e=>e.default),[]),"../locales/pl.json":()=>gi(()=>import(`./assets/pl-DLBfSk2F.js`).then(e=>e.default),[]),"../locales/pt-BR.json":()=>gi(()=>import(`./assets/pt-BR-D-z17RQ-.js`).then(e=>e.default),[]),"../locales/ro.json":()=>gi(()=>import(`./assets/ro-C7lLdGLO.js`).then(e=>e.default),[]),"../locales/ru.json":()=>gi(()=>import(`./assets/ru-8WfNTygd.js`).then(e=>e.default),[]),"../locales/sv.json":()=>gi(()=>import(`./assets/sv-DGLnNJYk.js`).then(e=>e.default),[]),"../locales/th.json":()=>gi(()=>import(`./assets/th-B45mx1J2.js`).then(e=>e.default),[]),"../locales/tr.json":()=>gi(()=>import(`./assets/tr-BcKw28qa.js`).then(e=>e.default),[]),"../locales/uk.json":()=>gi(()=>import(`./assets/uk-bpXwThGf.js`).then(e=>e.default),[]),"../locales/vi.json":()=>gi(()=>import(`./assets/vi-BvcwHbPM.js`).then(e=>e.default),[]),"../locales/zh-Hans.json":()=>gi(()=>import(`./assets/zh-Hans-BD-UCl7V.js`).then(e=>e.default),[]),"../locales/zh-Hant.json":()=>gi(()=>import(`./assets/zh-Hant-BF48qh7h.js`).then(e=>e.default),[])}),dl=async({language:e=Xc(),languages:t,catalogues:n=ul,html:r=globalThis.document?.documentElement}={})=>{let i=++il,a=e===`en`?{}:await Promise.race([n[`../locales/${e}.json`]?.().catch(()=>void 0),new Promise(e=>setTimeout(e,$c))]);if(i!==il)return q;rl=a?e:`en`;let o=a&&Bc(rl)?Object.fromEntries(Object.entries(a).map(([e,t])=>[e,tl(t)])):a??{};q=nl(rl,Zc(rl,t),o),qc(q.locale),r&&(r.lang=rl,Bc(rl)?r.dir=`rtl`:r.removeAttribute(`dir`));for(let e of ol)e();return q},fl=e=>(Wc(e),dl()),pl=e=>{let t=[],n=[],r=!1;for(let i of e.slice(e.indexOf(`?`)+1).split(`&`)){let e=i.indexOf(`=`);if(r||e<0){r=e<0;continue}if(!/^xt(\.\d*)?$/i.test(i.slice(0,e)))continue;let a=i.slice(e+1);try{a=decodeURIComponent(a)}catch{}let o=a.match(/^urn:btih:([0-9a-zA-Z]+)/)?.[1];if(o){t.push(o.toLowerCase());continue}let s=a.match(/^urn:btmh:([0-9a-fA-F]+)/)?.[1]?.toLowerCase();s&&n.push(s.startsWith(`1220`)&&s.length===68?s.slice(4):s)}return new Set(t.map(gl)).size>1||new Set(n).size>1?null:t[0]??n[0]??null},ml=e=>{let t=pl(e);return e.startsWith(`magnet:?`)&&t!==null&&/^([0-9a-f]{40}|[0-9a-f]{64})$/.test(gl(t))},hl=`abcdefghijklmnopqrstuvwxyz234567`,gl=e=>{let t=e.toLowerCase();if(!/^[a-z2-7]{32}$/.test(t))return t;let n=``;for(let e of t)n+=hl.indexOf(e).toString(2).padStart(5,`0`);let r=``;for(let e=0;e<n.length;e+=4)r+=parseInt(n.slice(e,e+4),2).toString(16);return r},_l=(e,t)=>!!e&&!!t&&gl(e)===gl(t),vl=e=>{let t=new Map;for(let n of e.split(/\s+|(?=magnet:\?)/i)){let e=/^magnet:\?/i.test(n)?n:/^([0-9a-f]{40}|[a-z2-7]{32})$/i.test(n)?`magnet:?xt=urn:btih:${n}`:/^[0-9a-f]{64}$/i.test(n)?`magnet:?xt=urn:btmh:1220${n}`:null;if(!e)continue;let r=gl(pl(e)??e);t.has(r)||t.set(r,e)}return[...t.values()]},yl=(e,t)=>{let n=[];for(let r of e.matchAll(RegExp(`[?&]`+t+`=([^&]+)`,`g`))){let e=r[1];try{n.push(decodeURIComponent(e.replace(/\+/g,` `)))}catch{n.push(e)}}return[...new Set(n)]},bl=(e,t)=>{let n=e.match(RegExp(`[?&]`+t+`=([^&]+)`));if(n)try{return decodeURIComponent(n[1].replace(/\+/g,` `))}catch{return n[1]}},xl=/^[0-9a-f]{40}$/,Sl=/^[0-9a-f]{64}$/,Cl=300,wl=e=>{let t=bl(e,`xl`);if(!t)return;let n=Number(t);return Number.isSafeInteger(n)&&n>0?n:void 0},Tl=e=>(e.match(/[?&]tr=/g)??[]).length,El=e=>{if(!e)return;let t=e.replace(/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2066-\u2069]/g,``).trim();if(t)return t.length>Cl?t.slice(0,Cl)+`…`:t},Dl=(e,t)=>{let n=e.startsWith(`magnet:?`)&&!bl(e,`dn`)?El(t):void 0;return n?`${e}&dn=${encodeURIComponent(n)}`:e},Ol=({magnet:e})=>{if(!e)return{ok:!1,problem:q.formatMessage({id:`This link has no torrent in it.`,defaultMessage:`This link has no torrent in it.`})};if(!e.startsWith(`magnet:`))return{ok:!1,problem:q.formatMessage({id:`This is not a magnet link.`,defaultMessage:`This is not a magnet link.`})};let t=pl(e);return t?!xl.test(gl(t))&&!Sl.test(t)?{ok:!1,problem:q.formatMessage({id:`This magnet link's info hash is malformed.`,defaultMessage:`This magnet link's info hash is malformed.`})}:{ok:!0,magnet:e,infoHash:t,name:El(bl(e,`dn`))??t,trackers:Tl(e),sizeBytes:wl(e)}:{ok:!1,problem:q.formatMessage({id:`This magnet link has no info hash.`,defaultMessage:`This magnet link has no info hash.`})}},kl=function(e){return e.HOME=`HOME`,e.ADD=`ADD`,e.WATCH=`WATCH`,e.DOWNLOAD=`DOWNLOAD`,e.LEGAL=`LEGAL`,e.PRIVACY=`PRIVACY`,e.SETTINGS=`SETTINGS`,e}({}),Al={HOME:e=>{let t=new URLSearchParams(e?.torrent?{torrent:e.torrent}:{});return e?.magnet&&t.set(e.magnet.key,e.magnet.value),t.toString()?`/?${t.toString()}`:`/`},ADD:e=>`/add?${new URLSearchParams(e).toString()}`,WATCH:e=>Ml(`WATCH`,new URLSearchParams(e)),DOWNLOAD:e=>Ml(`DOWNLOAD`,new URLSearchParams(e)),LEGAL:()=>`/legal`,PRIVACY:()=>`/privacy`,SETTINGS:()=>`/settings`},jl={HOME:`/`,ADD:`/add`,WATCH:`/watch`,DOWNLOAD:`/download`,LEGAL:`/legal`,PRIVACY:`/privacy`,SETTINGS:`/settings`},Ml=(e,t)=>`${jl[e]}#${t}`,Nl=({search:e,hash:t})=>new URLSearchParams([...new URLSearchParams(t.slice(1)),...new URLSearchParams(e)]),Pl=e=>jl[e],Fl=(e,t)=>Al[e](t),Il=Kr.Fragment,J=function(e,t,n){return st.call(t,`css`)?Kr.jsx(dt,lt(e,t),n):Kr.jsx(e,t,n)},Y=function(e,t,n){return st.call(t,`css`)?Kr.jsxs(dt,lt(e,t),n):Kr.jsxs(e,t,n)},Ll=()=>{let[e]=Oc(),{hash:t}=es();if(t&&!e.has(`magnet`))return J(Ms,{to:`${Fl(kl.HOME)}?group${t}`,replace:!0});let n=new URLSearchParams({add:Dl(e.get(`magnet`)??``,e.get(`name`))});return J(Ms,{to:`${Fl(kl.HOME)}?${n.toString()}`,replace:!0})},Rl=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),zl=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Bl=e=>{let t=zl(e);return t.charAt(0).toUpperCase()+t.slice(1)},Vl=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Hl=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},Ul={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`},Wl=(0,p.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,p.createElement)(`svg`,{ref:c,...Ul,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Vl(`lucide`,i),...!a&&!Hl(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,p.createElement)(e,t)),...Array.isArray(a)?a:[a]])),X=(e,t)=>{let n=(0,p.forwardRef)(({className:n,...r},i)=>(0,p.createElement)(Wl,{ref:i,iconNode:t,className:Vl(`lucide-${Rl(Bl(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Bl(e),n},Gl=X(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Kl=X(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),ql=X(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Jl=X(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Yl=X(`arrow-up-narrow-wide`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}],[`path`,{d:`M11 16h7`,key:`uosisv`}],[`path`,{d:`M11 20h10`,key:`jvxblo`}]]),Xl=X(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Zl=X(`captions-off`,[[`path`,{d:`M10.5 5H19a2 2 0 0 1 2 2v8.5`,key:`jqtk4d`}],[`path`,{d:`M17 11h-.5`,key:`1961ue`}],[`path`,{d:`M19 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2`,key:`1keqsi`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M7 11h4`,key:`1o1z6v`}],[`path`,{d:`M7 15h2.5`,key:`1ina1g`}]]),Ql=X(`captions`,[[`rect`,{width:`18`,height:`14`,x:`3`,y:`5`,rx:`2`,ry:`2`,key:`12ruh7`}],[`path`,{d:`M7 15h4M15 15h2M7 11h2M13 11h4`,key:`1ueiar`}]]),$l=X(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),eu=X(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),tu=X(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),nu=X(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ru=X(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),iu=X(`clock`,[[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),au=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`}]]),ou=X(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),su=X(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),cu=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`}]]),lu=X(`file-play`,[[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`,key:`1mlx9k`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),uu=X(`file-plus`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),du=X(`file`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),fu=X(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),pu=X(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),mu=X(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),hu=X(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),gu=X(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),_u=X(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),vu=X(`list`,[[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 18h.01`,key:`1tta3j`}],[`path`,{d:`M3 6h.01`,key:`1rqtza`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 18h13`,key:`1lx6n3`}],[`path`,{d:`M8 6h13`,key:`ik3vkj`}]]),yu=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`}]]),bu=X(`magnet`,[[`path`,{d:`m12 15 4 4`,key:`lnac28`}],[`path`,{d:`M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z`,key:`nlhkjb`}],[`path`,{d:`m5 8 4 4`,key:`j6kj7e`}]]),xu=X(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),Su=X(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),Cu=X(`monitor-down`,[[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`m15 10-3 3-3-3`,key:`lzhmyn`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]),wu=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`}]]),Tu=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`}]]),Eu=X(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Du=X(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Ou=X(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ku=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`}]]),Au=X(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),ju=X(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Mu=X(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Nu=X(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Pu=X(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Fu=X(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Iu=X(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Lu=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`}]]),Ru=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`}]]),zu=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`}]]),Bu=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`}]]),Vu=X(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Hu={};(function(e){var t=Object.prototype.hasOwnProperty,n=`~`;function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if(typeof r!=`function`)throw TypeError(`The listener must be a function`);var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){--e._eventsCount===0?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)t.call(r,i)&&e.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,i),!0;case 5:return c.fn.call(c.context,t,r,i,a),!0;case 6:return c.fn.call(c.context,t,r,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,r);break;case 4:c[d].fn.call(c[d].context,t,r,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn===t&&(!i||s.once)&&(!r||s.context===r)&&o(this,a);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&l.push(s[c]);l.length?this._events[a]=l.length===1?l[0]:l:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})({get exports(){return Hu},set exports(e){Hu=e}});var Uu=Hu,Wu=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}},Gu=class extends Error{constructor(e){super(),this.name=`AbortError`,this.message=e}},Ku=e=>globalThis.DOMException===void 0?new Gu(e):new DOMException(e),qu=e=>{let t=e.reason===void 0?Ku(`This operation was aborted.`):e.reason;return t instanceof Error?t:Ku(t)};function Ju(e,t,n,r){let i,a=new Promise((a,o)=>{if(typeof t!=`number`||Math.sign(t)!==1)throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t===1/0){a(e);return}if(r={customTimers:{setTimeout,clearTimeout},...r},r.signal){let{signal:e}=r;e.aborted&&o(qu(e)),e.addEventListener(`abort`,()=>{o(qu(e))})}i=r.customTimers.setTimeout.call(void 0,()=>{if(typeof n==`function`){try{a(n())}catch(e){o(e)}return}let r=typeof n==`string`?n:`Promise timed out after ${t} milliseconds`,i=n instanceof Error?n:new Wu(r);typeof e.cancel==`function`&&e.cancel(),o(i)},t),(async()=>{try{a(await e)}catch(e){o(e)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()});return a.clear=()=>{clearTimeout(i),i=void 0},a}function Yu(e,t,n){let r=0,i=e.length;for(;i>0;){let a=Math.trunc(i/2),o=r+a;n(e[o],t)<=0?(r=++o,i-=a+1):i=a}return r}var Xu=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},Zu,Qu=class{constructor(){Zu.set(this,[])}enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&Xu(this,Zu,`f`)[this.size-1].priority>=t.priority){Xu(this,Zu,`f`).push(n);return}let r=Yu(Xu(this,Zu,`f`),n,(e,t)=>t.priority-e.priority);Xu(this,Zu,`f`).splice(r,0,n)}dequeue(){return Xu(this,Zu,`f`).shift()?.run}filter(e){return Xu(this,Zu,`f`).filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return Xu(this,Zu,`f`).length}};Zu=new WeakMap;var $u=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},ed=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed,Dd=new Wu,Od=class extends Error{},kd=class extends Uu{constructor(e){if(super(),td.add(this),nd.set(this,void 0),rd.set(this,void 0),id.set(this,0),ad.set(this,void 0),od.set(this,void 0),sd.set(this,0),cd.set(this,void 0),ld.set(this,void 0),ud.set(this,void 0),dd.set(this,void 0),fd.set(this,0),pd.set(this,void 0),md.set(this,void 0),hd.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:Qu,...e},!(typeof e.intervalCap==`number`&&e.intervalCap>=1))throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??``}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??``}\` (${typeof e.interval})`);$u(this,nd,e.carryoverConcurrencyCount,`f`),$u(this,rd,e.intervalCap===1/0||e.interval===0,`f`),$u(this,ad,e.intervalCap,`f`),$u(this,od,e.interval,`f`),$u(this,ud,new e.queueClass,`f`),$u(this,dd,e.queueClass,`f`),this.concurrency=e.concurrency,this.timeout=e.timeout,$u(this,hd,e.throwOnTimeout===!0,`f`),$u(this,md,e.autoStart===!1,`f`)}get concurrency(){return ed(this,pd,`f`)}set concurrency(e){if(!(typeof e==`number`&&e>=1))throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);$u(this,pd,e,`f`),ed(this,td,`m`,Td).call(this)}async add(e,t={}){return new Promise((n,r)=>{ed(this,ud,`f`).enqueue(async()=>{var i,a;$u(this,fd,(i=ed(this,fd,`f`),i++,i),`f`),$u(this,id,(a=ed(this,id,`f`),a++,a),`f`);try{if(t.signal?.aborted){r(new Od(`The task was aborted.`));return}let i=await(this.timeout===void 0&&t.timeout===void 0?e({signal:t.signal}):Ju(Promise.resolve(e({signal:t.signal})),t.timeout===void 0?this.timeout:t.timeout,()=>{(t.throwOnTimeout===void 0?ed(this,hd,`f`):t.throwOnTimeout)&&r(Dd)}));n(i),this.emit(`completed`,i)}catch(e){r(e),this.emit(`error`,e)}ed(this,td,`m`,vd).call(this)},t),ed(this,td,`m`,Sd).call(this),this.emit(`add`)})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return ed(this,md,`f`)?($u(this,md,!1,`f`),ed(this,td,`m`,Td).call(this),this):this}pause(){$u(this,md,!0,`f`)}clear(){$u(this,ud,new(ed(this,dd,`f`)),`f`)}async onEmpty(){ed(this,ud,`f`).size!==0&&await ed(this,td,`m`,Ed).call(this,`empty`)}async onSizeLessThan(e){ed(this,ud,`f`).size<e||await ed(this,td,`m`,Ed).call(this,`next`,()=>ed(this,ud,`f`).size<e)}async onIdle(){(ed(this,fd,`f`)!==0||ed(this,ud,`f`).size!==0)&&await ed(this,td,`m`,Ed).call(this,`idle`)}get size(){return ed(this,ud,`f`).size}sizeBy(e){return ed(this,ud,`f`).filter(e).length}get pending(){return ed(this,fd,`f`)}get isPaused(){return ed(this,md,`f`)}};nd=new WeakMap,rd=new WeakMap,id=new WeakMap,ad=new WeakMap,od=new WeakMap,sd=new WeakMap,cd=new WeakMap,ld=new WeakMap,ud=new WeakMap,dd=new WeakMap,fd=new WeakMap,pd=new WeakMap,md=new WeakMap,hd=new WeakMap,td=new WeakSet,gd=function(){return ed(this,rd,`f`)||ed(this,id,`f`)<ed(this,ad,`f`)},_d=function(){return ed(this,fd,`f`)<ed(this,pd,`f`)},vd=function(){var e;$u(this,fd,(e=ed(this,fd,`f`),e--,e),`f`),ed(this,td,`m`,Sd).call(this),this.emit(`next`)},yd=function(){this.emit(`empty`),ed(this,fd,`f`)===0&&this.emit(`idle`)},bd=function(){ed(this,td,`m`,wd).call(this),ed(this,td,`m`,Cd).call(this),$u(this,ld,void 0,`f`)},xd=function(){let e=Date.now();if(ed(this,cd,`f`)===void 0){let t=ed(this,sd,`f`)-e;if(t<0)$u(this,id,ed(this,nd,`f`)?ed(this,fd,`f`):0,`f`);else return ed(this,ld,`f`)===void 0&&$u(this,ld,setTimeout(()=>{ed(this,td,`m`,bd).call(this)},t),`f`),!0}return!1},Sd=function(){if(ed(this,ud,`f`).size===0)return ed(this,cd,`f`)&&clearInterval(ed(this,cd,`f`)),$u(this,cd,void 0,`f`),ed(this,td,`m`,yd).call(this),!1;if(!ed(this,md,`f`)){let e=!ed(this,td,`a`,xd);if(ed(this,td,`a`,gd)&&ed(this,td,`a`,_d)){let t=ed(this,ud,`f`).dequeue();return t?(this.emit(`active`),t(),e&&ed(this,td,`m`,Cd).call(this),!0):!1}}return!1},Cd=function(){ed(this,rd,`f`)||ed(this,cd,`f`)!==void 0||($u(this,cd,setInterval(()=>{ed(this,td,`m`,wd).call(this)},ed(this,od,`f`)),`f`),$u(this,sd,Date.now()+ed(this,od,`f`),`f`))},wd=function(){ed(this,id,`f`)===0&&ed(this,fd,`f`)===0&&ed(this,cd,`f`)&&(clearInterval(ed(this,cd,`f`)),$u(this,cd,void 0,`f`)),$u(this,id,ed(this,nd,`f`)?ed(this,fd,`f`):0,`f`),ed(this,td,`m`,Td).call(this)},Td=function(){for(;ed(this,td,`m`,Sd).call(this););},Ed=async function(e,t){return new Promise(n=>{let r=()=>{(!t||t())&&(this.off(e,r),n())};this.on(e,r)})};var Ad=Object.defineProperty,jd=(e,t)=>{let n={};for(var r in e)Ad(n,r,{get:e[r],enumerable:!0});return t||Ad(n,Symbol.toStringTag,{value:`Module`}),n},Md=`__OSRA_KEY__`,Nd=`__OSRA_DEFAULT_KEY__`,Pd=`__OSRA_BOX__`,Fd=()=>globalThis.browser??globalThis.chrome,Id=()=>Fd()?.runtime,Ld=(e,t)=>nf(e)&&e.__OSRA_KEY__===t,Rd=(e,t)=>{if(e){if(e.aborted){t();return}e.addEventListener(`abort`,t,{once:!0})}},zd=({listener:e,transport:t,remoteName:n,key:r=Nd,origin:i=`*`,unregisterSignal:a})=>{if(a?.aborted)return;let o=xf(t)?t.receive:t;if(typeof o==`function`){let t=o((t,i)=>{a?.aborted||Ld(t,r)&&(n&&t.name!==n||e(t,i))});typeof t==`function`&&Rd(a,t);return}if(sf(o)||cf(o)||uf(o)||df(o)){let t=(t,i)=>{let o=(t,a)=>{Ld(t,r)&&(n&&t.name!==n||e(t,{port:i,sender:a}))};t.addListener(o),Rd(a,()=>t.removeListener(o))};if(sf(o))t(o.onMessage);else if(uf(o)){let e=e=>t(e.onMessage,e);o.addListener(e),Rd(a,()=>o.removeListener(e))}else df(o)?t(o):t(o.onMessage);return}let s=ef(o)?o.port:o,c=i!==`*`&&ff(o),l=t=>{let a=t.data;if(typeof a==`string`)try{a=JSON.parse(a)}catch{return}Ld(a,r)&&(n&&a.name!==n||c&&t.origin&&t.origin!==i||e(a,{receiveTransport:o,source:t.source,origin:t.origin}))};s.addEventListener(`message`,l),s instanceof MessagePort&&s.start(),Rd(a,()=>s.removeEventListener(`message`,l))},Bd=new WeakSet,Vd=e=>String(e?.message??e).includes(`disconnected port`),Hd=(e,t,n=`*`,r=[])=>{let i=xf(e)?e.emit:e;if(typeof i==`function`)i(t,r);else if(ff(i))i.postMessage(t,n,r);else if(cf(i)){if(Bd.has(i))return;try{i.postMessage(t)}catch(e){if(!Vd(e))throw e;Bd.add(i)}}else if(sf(i))i.sendMessage(t)?.catch?.(e=>{if(!String(e?.message).includes(`Receiving end does not exist`))throw e});else if(Yd(i)){let e=JSON.stringify(t);i.readyState===WebSocket.CONNECTING?i.addEventListener(`open`,()=>i.send(e),{once:!0}):i.send(e)}else ef(i)?i.port.postMessage(t,r):i.postMessage(t,r)},Ud=globalThis.Float16Array,Wd={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float16Array:Ud,Float32Array,Float64Array,BigInt64Array,BigUint64Array},Gd=Object.values(Wd),Kd=e=>{let t=e.constructor.name;if(t in Wd)return t;for(let[t,n]of Object.entries(Wd))if(n&&e instanceof n)return t;throw Error(`Unknown typed array type`)},qd=e=>{let t=Wd[e];if(!t)throw Error(`Unknown typed array type`);return t},Jd=e=>rf(e,Gd),Yd=e=>e instanceof WebSocket,Xd=e=>!!globalThis.ServiceWorkerContainer&&e instanceof ServiceWorkerContainer,Zd=e=>!!globalThis.ServiceWorker&&e instanceof ServiceWorker,Qd=e=>!!globalThis.Worker&&e instanceof Worker,$d=e=>{let t=globalThis.DedicatedWorkerGlobalScope;return!!t&&e instanceof t},ef=e=>!!globalThis.SharedWorker&&e instanceof SharedWorker,tf=e=>e instanceof MessagePort,nf=e=>!!e&&typeof e==`object`&&`__OSRA_KEY__`in e&&!!e.__OSRA_KEY__,rf=(e,t)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return!1;for(let n of t)if(n&&e instanceof n)return!0;return!1},af=e=>rf(e,[globalThis.SharedArrayBuffer]),of=e=>rf(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),sf=e=>{let t=Id();return t?e===t:!1},cf=(e,t=!1)=>!e||typeof e!=`object`||ff(e)||!(`name`in e)||!(`disconnect`in e)||!(`postMessage`in e)?!1:!t||`sender`in e&&`onMessage`in e&&`onDisconnect`in e,lf=e=>!!e&&typeof e==`object`&&!ff(e)&&`addListener`in e&&`hasListener`in e&&`removeListener`in e,uf=e=>{let t=Id();return t?e===t.onConnect||e===t.onConnectExternal:!1},df=e=>lf(e),ff=e=>{if(!e||typeof e!=`object`)return!1;try{return`window`in e&&e.window===e}catch{try{return`closed`in e&&typeof e.closed==`boolean`&&`close`in e&&typeof e.close==`function`}catch{return!1}}},pf=e=>Yd(e)||cf(e)||sf(e),mf=e=>Yd(e)||cf(e)||uf(e)||df(e)||sf(e),hf=e=>!!e&&typeof e==`object`&&!ff(e)&&`isJson`in e&&e.isJson===!0||pf(e)||mf(e),gf=e=>ff(e)||pf(e)||Zd(e)||Qd(e)||$d(e)||ef(e)||tf(e)||yf(e),_f=e=>ff(e)||mf(e)||Xd(e)||Qd(e)||$d(e)||ef(e)||tf(e)||bf(e),vf=e=>{if(!e||typeof e!=`object`||ff(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},yf=e=>!vf(e)||!(`emit`in e)?!1:gf(e.emit)||typeof e.emit==`function`,bf=e=>!vf(e)||!(`receive`in e)?!1:_f(e.receive)||typeof e.receive==`function`,xf=e=>yf(e)||bf(e),Sf=()=>globalThis.Buffer,Cf=32768,wf=e=>{let t=e.toBase64;if(typeof t==`function`)return t.call(e);let n=Sf();if(n)return n.from(e).toString(`base64`);let r=``;for(let t=0;t<e.length;t+=Cf)r+=String.fromCharCode(...e.subarray(t,t+Cf));return btoa(r)},Tf=e=>{let t=Uint8Array.fromBase64;if(typeof t==`function`)return t(e);let n=Sf();if(n)return new Uint8Array(n.from(e,`base64`));let r=atob(e),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return i},Ef={[Pd]:`revivable`},Df=e=>!!e&&typeof e==`object`&&`__OSRA_BOX__`in e&&e.__OSRA_BOX__===`revivable`,Of=(e,t)=>hf(t.transport)?{base64Buffer:wf(new Uint8Array(e))}:{arrayBuffer:e},kf=e=>`arrayBuffer`in e?e.arrayBuffer:Tf(e.base64Buffer).buffer,Af=jd({box:()=>Nf,isType:()=>Mf,objectsOnly:()=>!0,revive:()=>Pf,type:()=>jf}),jf=`arrayBuffer`,Mf=e=>e instanceof ArrayBuffer,Nf=(e,t)=>({...Ef,type:jf,...Of(e,t)}),Pf=(e,t)=>kf(e),Ff=jd({box:()=>Rf,isType:()=>Lf,objectsOnly:()=>!0,revive:()=>zf,type:()=>If}),If=`date`,Lf=e=>e instanceof Date,Rf=(e,t)=>({...Ef,type:If,ISOString:e.toISOString()}),zf=(e,t)=>new Date(e.ISOString),Bf=jd({box:()=>Uf,isType:()=>Hf,objectsOnly:()=>!0,revive:()=>Wf,type:()=>Vf}),Vf=`headers`,Hf=e=>e instanceof Headers,Uf=(e,t)=>({...Ef,type:Vf,entries:[...e.entries()]}),Wf=(e,t)=>new Headers(e.entries),Gf=jd({box:()=>Yf,isType:()=>Jf,objectsOnly:()=>!0,revive:()=>Xf,type:()=>Kf}),Kf=`error`,qf={Error,TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError},Jf=e=>e instanceof Error,Yf=(e,t)=>{let n=`cause`in e&&e.cause!==void 0,r=typeof AggregateError<`u`&&e instanceof AggregateError,i=typeof DOMException<`u`&&e instanceof DOMException;return{...Ef,type:Kf,name:e.name,message:e.message,stack:e.stack||e.toString(),...n?{cause:lg(e.cause,t)}:{},...r?{errors:lg(e.errors,t)}:{},...i?{isDOMException:!0}:{}}},Xf=(e,t)=>{let n=e.cause===void 0?void 0:dg(e.cause,t),r=n===void 0?void 0:{cause:n};if(e.isDOMException&&typeof DOMException<`u`){let t=new DOMException(e.message,e.name);if(e.stack)try{Object.defineProperty(t,"stack",{value:e.stack,configurable:!0})}catch{}return t}let i;if(e.errors!==void 0&&typeof AggregateError<`u`)i=AggregateError(dg(e.errors,t),e.message,r);else{let t=qf[e.name]??Error;i=r===void 0?new t(e.message):new t(e.message,r)}return e.name&&i.name!==e.name&&(i.name=e.name),e.stack&&(i.stack=e.stack),i},Zf=jd({box:()=>ep,isType:()=>$f,objectsOnly:()=>!0,revive:()=>tp,type:()=>Qf}),Qf=`typedArray`,$f=Jd,ep=(e,t)=>{let n=e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return{...Ef,type:Qf,typedArrayType:Kd(e),...Of(n,t)}},tp=(e,t)=>new(qd(e.typedArrayType))(kf(e)),np=new WeakMap,rp=new WeakSet,ip=(e,t)=>{if(rp.has(e))return t(),()=>{};let n=np.get(e);return n||np.set(e,n=new Set),n.add(t),()=>n.delete(t)},ap=e=>rp.has(e),op=e=>{if(rp.has(e))return;rp.add(e);let t=np.get(e);if(t){np.delete(e);for(let e of t)try{e()}catch{}}},sp=jd({box:()=>yp,forceTransfer:()=>gp,isInTransfer:()=>hp,isType:()=>vp,objectsOnly:()=>!0,outsideTransfer:()=>_p,revive:()=>bp,transfer:()=>pp,type:()=>cp}),cp=`transfer`,lp=Symbol.for(`osra.transfer`),up=e=>typeof e==`object`&&!!e,dp=e=>up(e)&&lp in e&&e[lp]===!0,fp=e=>up(e)?ArrayBuffer.isView(e)?!0:rf(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.Request,globalThis.Response,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.VideoFrame,globalThis.AudioData]):!1,pp=e=>fp(e)?{[lp]:!0,value:e}:e,mp=0,hp=()=>mp>0,gp=e=>up(e)&&!dp(e)?{[lp]:!0,value:e}:e,_p=e=>{let t=mp;mp=0;try{return e()}finally{mp=t}},vp=e=>dp(e),yp=(e,t)=>{mp++;try{return{...Ef,type:cp,inner:lg(e.value,t),degraded:hf(t.transport)}}finally{mp--}},bp=(e,t)=>dg(e.inner,t),xp=e=>rf(e,[globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.OffscreenCanvas,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),Sp=e=>Df(e)&&e.type===`transfer`,Cp=e=>{let t=[],n=new WeakSet,r=(e,i)=>{if(e&&typeof e==`object`&&!n.has(e)&&(n.add(e),!af(e))){if(Sp(e)){r(e.inner,i||!e.degraded);return}if(xp(e)){t.push(e);return}if(of(e)){i&&t.push(e);return}if(ArrayBuffer.isView(e)){i&&e instanceof DataView&&!af(e.buffer)&&!n.has(e.buffer)&&(n.add(e.buffer),t.push(e.buffer));return}if(Array.isArray(e)){for(let t of e)r(t,i);return}for(let t of Object.values(e))r(t,i)}};return r(e,!1),t},wp=class{_listeners=new Map;addEventListener(e,t,n){if(!t)return;let r=this._listeners.get(e);r||(r=new Map,this._listeners.set(e,r)),r.has(t)||r.set(t,typeof n==`object`&&!!n?.once)}removeEventListener(e,t,n){t&&this._listeners.get(e)?.delete(t)}_peer;_queue=[];_started=!1;_closed=!1;_onClose;_onmessage=null;get onmessage(){return this._onmessage}set onmessage(e){this._onmessage=e,e!==null&&this.start()}onmessageerror=null;dispatchEvent(e){e.type===`message`?this._onmessage?.call(this,e):e.type===`messageerror`&&this.onmessageerror?.call(this,e);let t=this._listeners.get(e.type);if(t)for(let[n,r]of[...t])r&&t.delete(n),typeof n==`function`?n.call(this,e):n.handleEvent(e);return!0}postMessage(e,t){let n=this._peer;!n||n._closed||queueMicrotask(()=>{if(n._closed)return;let t=new MessageEvent(`message`,{data:e});n._started?n.dispatchEvent(t):n._queue.push(t)})}start(){if(!this._started){this._started=!0;for(let e of this._queue.splice(0))this.dispatchEvent(e)}}close(){if(this._closed)return;this._closed=!0,this._queue.length=0,this._onClose?.();let e=this._peer;e&&!e._closed&&queueMicrotask(()=>{e._closed||e.dispatchEvent(new Event(`close`))})}},Tp=class{port1;port2;constructor(){let e=new wp,t=new wp;e._peer=t,t._peer=e,this.port1=e,this.port2=t}},Ep=new FinalizationRegistry(e=>{try{e()}catch{}}),Dp=(e,t)=>{let n={};return Ep.register(e,t,n),()=>Ep.unregister(n)},Op=jd({box:()=>Xp,createRevivableChannel:()=>tm,init:()=>Bp,isType:()=>Vp,markPortsShipped:()=>$p,objectsOnly:()=>!0,postPreBoxed:()=>Jp,revive:()=>Zp,type:()=>kp}),kp=`messagePort`,Ap=2048,jp=128,Mp=1024,Np=new WeakMap,Pp=e=>{let t=Np.get(e);if(!t)throw Error(`osra message-port: connection state missing; did init() run?`);return t},Fp=(e,t)=>{let n=e.ports.get(t);return n||(n={nextSeq:0,buffer:new Map,outSeq:0},e.ports.set(t,n),e.pendingPorts++),n},Ip=(e,t)=>{let n=e.ports.get(t);if(n&&!n.handler&&e.pendingPorts--,e.ports.delete(t),e.tombstones.size>=jp){let t=e.tombstones.values().next().value;t!==void 0&&e.tombstones.delete(t)}e.tombstones.add(t)},Lp=e=>{if(e.handler)for(let t=e.buffer.get(e.nextSeq);t!==void 0;t=e.buffer.get(e.nextSeq))e.buffer.delete(e.nextSeq),e.nextSeq++,e.handler(t)},Rp=(e,t)=>Fp(Pp(e),t).outSeq++,zp=(e,t,n)=>{let r=Pp(e);if(r.tombstones.has(t)){setTimeout(()=>n({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t}));return}let i=Fp(r,t);i.handler||r.pendingPorts--,i.handler=n,Lp(i)},Bp=e=>{let t={ports:new Map,tombstones:new Set,pendingPorts:0};Np.set(e,t),e.eventTarget.addEventListener(`message`,({detail:n})=>{if(n.type!==`message`&&n.type!==`message-port-close`||t.tombstones.has(n.portId))return;let r=t.ports.get(n.portId);if(n.seq===void 0){r?.handler?.(n);return}if(!r){if(t.pendingPorts>=Mp)return;r=Fp(t,n.portId)}if(!(n.seq<r.nextSeq)){if(r.buffer.size>=Ap&&!(n.seq===r.nextSeq&&r.handler)){r.buffer.clear(),Ip(t,n.portId),r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n.portId});return}r.buffer.set(n.seq,n),Lp(r)}}),ip(e,()=>{for(let[n,r]of[...t.ports])r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n});t.ports.clear(),t.tombstones.clear(),t.pendingPorts=0})},Vp=e=>e instanceof MessagePort||e instanceof wp,Hp=(e,t)=>{try{let n=Pp(e).ports.get(t);e.sendMessage({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t,seq:n?n.outSeq++:0})}catch{}},Up=(e,t,n)=>{if(n){e.postMessage(t);return}let r=Cp(t);e.postMessage(t,r),$p(r)},Wp=(e,t,n,r)=>{let i;try{i=dg(e,t)}catch(e){r(),globalThis.reportError?.(e);return}n(i)},Gp=(e,t,n)=>()=>{let r=e.deref();r&&Hp(r,n);let i=t.deref();i&&Ip(i,n)},Kp=new WeakSet,qp=e=>e!==null&&(typeof e==`object`||typeof e==`function`),Jp=(e,t,n)=>{qp(t)&&Kp.add(t),e.postMessage(t,n??[])},Yp=(e,t)=>qp(e)&&Kp.delete(e)?e:_p(()=>lg(e,t)),Xp=(e,t,n)=>{let r=e instanceof wp;if(!r&&!hf(t.transport))return{...Ef,type:kp,port:e,...n?.autoBox?{autoBox:!0}:{}};let i=Pp(t),a=e,o=globalThis.crypto.randomUUID(),s=new WeakRef(a),c=new WeakRef(t),l=new WeakRef(i),u=!1,d=()=>{if(u)return;u=!0;let e=l.deref();e&&Ip(e,o),m?.();let t=s.deref();t?.removeEventListener(`message`,p),t instanceof wp&&(t._onClose=void 0)},f=e=>{if(e.type===`message-port-close`){d(),a.dispatchEvent(new Event(`close`)),a.close();return}Wp(e.data,t,e=>Up(a,e,!1),()=>{})};function p({data:e}){t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:Yp(e,t),portId:o,seq:Rp(t,o)})}let m=Dp(a,Gp(c,l,o));return a.addEventListener(`message`,p),a.start(),a instanceof wp&&(a._onClose=()=>{u||(Hp(t,o),d())}),zp(t,o,f),{...Ef,type:kp,portId:o,synthetic:r}},Zp=(e,t)=>`port`in e?($p([e.port]),e.autoBox?em(e.port,t):e.port):nm(e.portId,t,e.synthetic),Qp=new WeakMap,$p=e=>{for(let t of e){let e=Qp.get(t);if(e){Qp.delete(t),e.shipped=!0;for(let t of e.pending.splice(0))t()}}},em=(e,t,n)=>{let r=new EventTarget,i=({data:e})=>{Wp(e,t,e=>r.dispatchEvent(new MessageEvent(`message`,{data:e})),()=>r.dispatchEvent(new Event(`messageerror`)))},a=()=>{r.dispatchEvent(new Event(`messageerror`))},o=()=>{r.dispatchEvent(new Event(`close`))};e.addEventListener(`message`,i),e.addEventListener(`messageerror`,a),e.addEventListener(`close`,o),r.postMessage=(r,i)=>{let a=_p(()=>lg(r,t)),o=Cp(a),s=Array.isArray(i)?i:[],c=s.length?[...o,...s]:o,l=()=>{e.postMessage(a,c),$p(c)};if(n&&!n.shipped){n.pending.push(l);return}l()},r.start=()=>e.start();let s=()=>{e.removeEventListener(`message`,i),e.removeEventListener(`messageerror`,a),e.removeEventListener(`close`,o),e.close()};return r.close=()=>{if(n&&!n.shipped){n.pending.push(s);return}s()},r},tm=e=>{if(hf(e.transport)){let{port1:t,port2:n}=new Tp;return{localPort:t,boxedRemote:Xp(n,e)}}let{port1:t,port2:n}=new MessageChannel,r={shipped:!1,pending:[]};return Qp.set(n,r),{localPort:em(t,e,r),boxedRemote:Xp(n,e,{autoBox:!0})}},nm=(e,t,n)=>{let r=Pp(t),{port1:i,port2:a}=n?new Tp:new MessageChannel,o=new WeakRef(i),s=new WeakRef(a),c=!1,l=!1;i instanceof wp||i.addEventListener(`close`,e=>{l&&e.stopImmediatePropagation()});let u=()=>{if(c)return;c=!0,Ip(r,e);let t=s.deref();t?.removeEventListener(`message`,f),t?.close(),p?.()},d=e=>{if(e.type===`message-port-close`){u();let e=o.deref();e?.dispatchEvent(new Event(`close`)),l=!0,e?.close();return}if(!o.deref()){u();return}let r=s.deref();r&&Wp(e.data,t,e=>Up(r,e,n),()=>o.deref()?.dispatchEvent(new Event(`messageerror`)))},f=({data:n})=>{t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:Yp(n,t),portId:e,seq:Rp(t,e)})},p=Dp(i,()=>{Hp(t,e),u()});return i instanceof wp&&(i._onClose=()=>{c||(Hp(t,e),u())}),a.addEventListener(`message`,f),a.start(),zp(t,e,d),i},rm=jd({box:()=>cm,isType:()=>sm,objectsOnly:()=>!0,revive:()=>lm,type:()=>im}),im=`promise`,am=e=>e instanceof Promise,om=new Set,sm=e=>e instanceof Promise,cm=(e,t)=>{if(!am(e))throw TypeError(`Expected Promise`);let{localPort:n,boxedRemote:r}=tm(t),i=e=>{n.postMessage(e),n.close()};return e.then(e=>i({type:`resolve`,data:e})).catch(e=>i({type:`reject`,error:e})),{...Ef,type:im,port:r}},lm=(e,t)=>{let n=Zp(e.port,t);om.add(n);let r=`portId`in e.port;return new Promise((e,i)=>{let a,o=()=>{n.close(),om.delete(n),a?.()};if(r&&ap(t)){i(Error(`osra: connection closed`)),o();return}a=r?ip(t,()=>{i(Error(`osra: connection closed`)),o()}):void 0,n.addEventListener(`message`,({data:t})=>{t.type===`resolve`?e(t.data):i(t.error),o()},{once:!0}),n.start()})},um=jd({box:()=>hm,isType:()=>mm,objectsOnly:()=>!0,revive:()=>gm,type:()=>dm}),dm=`function`,fm=new Set,pm=e=>{e instanceof ReadableStream?e.locked||e.cancel(Error(`osra: connection closed`)).catch(()=>{}):typeof WritableStream<`u`&&e instanceof WritableStream&&(e.locked||e.abort(Error(`osra: connection closed`)).catch(()=>{}))},mm=e=>typeof e==`function`,hm=(e,t)=>{let{port1:n,port2:r}=new Tp;return n.addEventListener(`message`,({data:n})=>{let[r,i]=n;(async()=>{let n;try{n={type:`return`,value:await e(...i)}}catch(e){n={type:`throw`,error:e}}if(ap(t)){n.type===`return`&&pm(n.value);try{r.close()}catch{}return}let a=(()=>{try{return lg(n,t)}catch(e){return lg({type:`throw`,error:e},t)}})();Jp(r,a),queueMicrotask(()=>{try{r.close()}catch{}})})()}),n.start(),{...Ef,type:dm,port:Xp(r,t)}},gm=(e,t)=>{let n=Zp(e.port,t);return((...e)=>new Promise((r,i)=>{if(ap(t)){i(Error(`osra: connection closed`));return}let{port1:a,port2:o}=new Tp;fm.add(a);let s,c=()=>{a.close(),fm.delete(a),s?.()};s=ip(t,()=>{i(Error(`osra: connection closed`)),c()}),a.addEventListener(`message`,({data:e})=>{let t=e;t.type===`return`?r(t.value):i(t.error),c()},{once:!0}),a.start();let l=_p(()=>lg([o,e],t));Jp(n,l)}))},_m=jd({MAX_CREDIT_WINDOW:()=>64,box:()=>Cm,isType:()=>ym,objectsOnly:()=>!0,revive:()=>Dm,type:()=>vm}),vm=`readableStream`,ym=e=>e instanceof ReadableStream,bm=2,xm=8,Sm=4194304,Cm=(e,t)=>{let{localPort:n,boxedRemote:r}=tm(t),i=e.getReader(),a=hp(),o=0,s=!1,c=!1,l=e=>{c=!0;try{n.postMessage(e)}catch{}n.close()},u=async()=>{if(!(s||c)){for(s=!0;o>0;){let e;try{e=await i.read()}catch(e){c||l({type:`error`,error:e});return}if(c)return;if(e.done){l({type:`end`});return}o--;let t=a?gp(e.value):e.value;try{n.postMessage({type:`chunk`,value:t})}catch(e){l({type:`error`,error:e}),i.cancel(e).catch(()=>{});return}}s=!1}};return n.addEventListener(`message`,({data:e})=>{e instanceof Promise||!(`type`in e)||(e.type===`pull`?n.postMessage(i.read()):e.type===`credit`?(o+=e.n,u()):e.type===`cancel`&&(c=!0,i.cancel(e.reason).catch(()=>{}),n.close()))}),n.addEventListener(`close`,()=>{c||(c=!0,i.cancel(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...Ef,type:vm,credit:!0,port:r}},wm=e=>ArrayBuffer.isView(e)||e instanceof ArrayBuffer?e.byteLength:typeof e==`string`?e.length*2:typeof Blob<`u`&&e instanceof Blob?e.size:void 0,Tm=e=>{let t=!1,n=0,r,i=[],a=!1,o=!1,s,c,l=()=>r===void 0?xm:Math.max(bm,Math.min(64,Math.floor(Sm/r))),u=()=>{let t=l(),r=n+i.length;if(r>t/2)return;let a=t-r;n+=a,e.postMessage({type:`credit`,n:a})},d=()=>{t=!0,queueMicrotask(()=>e.close())},f=e=>{if(o=!0,s=e,!c||i.length)return;let t=c;c=void 0,d(),t.reject(e)};return new ReadableStream({start:()=>{e.addEventListener(`message`,({data:o})=>{if(!(o instanceof Promise||!(`type`in o))){if(o.type===`chunk`){if(t)return;if(n<=0){i.length=0,f(Error(`osra: stream exceeded its credit window`)),queueMicrotask(()=>e.close());return}n--;let a=wm(o.value);if(a!==void 0&&(r=r===void 0?a:r*.875+a*.125),c){let e=c;c=void 0,e.controller.enqueue(o.value),e.resolve()}else i.push(o.value)}else if(o.type===`end`){if(t||(a=!0,!c||i.length))return;let e=c;c=void 0,d(),e.controller.close(),e.resolve()}else if(o.type===`error`){if(t)return;f(o.error)}}}),e.addEventListener(`messageerror`,()=>{t||f(Error(`osra: a chunk failed to deserialize on this platform`))}),e.addEventListener(`close`,()=>{t||a||o||f(Error(`osra: connection closed`))},{once:!0})},pull:e=>{if(!t){if(i.length){e.enqueue(i.shift()),!a&&!o&&u();return}if(o)return d(),Promise.reject(s);if(a){d(),e.close();return}return u(),new Promise((t,n)=>{c={controller:e,resolve:t,reject:n}})}},cancel:n=>{t=!0,i.length=0;let r=c;c=void 0,r?.resolve(),e.postMessage({type:`cancel`,reason:n}),queueMicrotask(()=>e.close())}})},Em=e=>{let t=!1;return new ReadableStream({start:n=>{e.addEventListener(`messageerror`,()=>{if(!t){t=!0;try{n.error(Error(`osra: a chunk failed to deserialize on this platform`))}catch{}queueMicrotask(()=>e.close())}}),e.addEventListener(`close`,()=>{if(!t){t=!0;try{n.error(Error(`osra: connection closed`))}catch{}}},{once:!0})},pull:n=>new Promise((r,i)=>{e.addEventListener(`message`,({data:a})=>{a instanceof Promise&&a.then(i=>{i.done?(t=!0,n.close(),e.postMessage({type:`cancel`}),queueMicrotask(()=>e.close())):n.enqueue(i.value),r()}).catch(e=>{t=!0,i(e)})},{once:!0}),e.postMessage({type:`pull`})}),cancel:n=>{t=!0,e.postMessage({type:`cancel`,reason:n}),queueMicrotask(()=>e.close())}})},Dm=(e,t)=>{let n=Zp(e.port,t);return n.start(),e.credit?Tm(n):Em(n)},Om=jd({box:()=>jm,isType:()=>Am,objectsOnly:()=>!0,revive:()=>Mm,type:()=>km}),km=`writableStream`,Am=e=>e instanceof WritableStream,jm=(e,t)=>{let{localPort:n,boxedRemote:r}=tm(t),i=e.getWriter(),a=!1,o=(e,t)=>e.then(()=>n.postMessage({type:`ack`})).catch(e=>n.postMessage({type:`err`,error:e?.message??String(e)})).then(()=>{t&&(a=!0,queueMicrotask(()=>n.close()))});return n.addEventListener(`message`,({data:e})=>{!e||typeof e!=`object`||!(`type`in e)||(e.type===`write`?o(i.write(e.chunk),!1):e.type===`close`?o(i.close(),!0):e.type===`abort`&&o(i.abort(e.reason),!0))}),n.addEventListener(`messageerror`,()=>{n.postMessage({type:`err`,error:`osra: a chunk failed to deserialize on this platform`})}),n.addEventListener(`close`,()=>{a||(a=!0,i.abort(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...Ef,type:km,port:r,...hp()?{transferChunks:!0}:{}}},Mm=(e,t)=>{let n=Zp(e.port,t);n.start();let r=new Set,i=!1;n.addEventListener(`close`,()=>{i=!0;let e=Error(`osra: connection closed`);for(let t of[...r])t(e);r.clear()},{once:!0});let a=Promise.resolve(),o=e=>{let t=a.then(()=>new Promise((t,a)=>{if(i){a(Error(`osra: connection closed`));return}let o=e=>{r.delete(a),e()};r.add(a),n.addEventListener(`message`,({data:e})=>{!e||typeof e!=`object`||!(`type`in e)||(e.type===`ack`?o(t):e.type===`err`&&o(()=>a(Error(e.error))))},{once:!0}),n.postMessage(e)}));return a=t.catch(()=>{}),t},s=e.transferChunks===!0;return new WritableStream({write:e=>o({type:`write`,chunk:s?gp(e):e}),close:()=>o({type:`close`}),abort:e=>o({type:`abort`,reason:e})})},Nm=jd({box:()=>Lm,isType:()=>Fm,objectsOnly:()=>!0,revive:()=>Rm,type:()=>Pm}),Pm=`abortSignal`,Fm=e=>e instanceof AbortSignal,Im=new WeakMap,Lm=(e,t)=>{if(e.aborted)return{...Ef,type:Pm,aborted:!0,reason:lg(e.reason,t)};let{localPort:n,boxedRemote:r}=tm(t),i=()=>{n.postMessage({type:`abort`,reason:e.reason}),n.close(),a()},a=ip(t,()=>{e.removeEventListener(`abort`,i),n.close()});return e.addEventListener(`abort`,i,{once:!0}),{...Ef,type:Pm,aborted:!1,reason:void 0,port:r}},Rm=(e,t)=>{let n=new AbortController;if(e.aborted||e.port===void 0)return n.abort(dg(e.reason,t)),n.signal;let r=Zp(e.port,t);return Im.set(n.signal,r),r.start(),r.addEventListener(`message`,({data:e})=>{e.type===`abort`&&(n.abort(dg(e.reason,t)),Im.delete(n.signal),r.close())}),n.signal},zm=jd({box:()=>Hm,isType:()=>Vm,objectsOnly:()=>!0,revive:()=>Um,type:()=>Bm}),Bm=`response`,Vm=e=>e instanceof Response,Hm=(e,t)=>({...Ef,type:Bm,status:e.status,statusText:e.statusText,headers:Uf(e.headers,t),body:e.body?Cm(e.body,t):null,url:e.url,redirected:e.redirected}),Um=(e,t)=>{if(e.status===0)return Response.error();let n=Wf(e.headers,t),r=e.body?Dm(e.body,t):null,i=e.status===101||e.status===204||e.status===205||e.status===304;r&&i&&r.cancel().catch(()=>{});let a=new Response(i?null:r,{status:e.status,statusText:e.statusText,headers:n});return e.url&&Object.defineProperty(a,"url",{value:e.url,configurable:!0}),e.redirected&&Object.defineProperty(a,"redirected",{value:!0,configurable:!0}),a},Wm=jd({box:()=>qm,isType:()=>Km,objectsOnly:()=>!0,revive:()=>Jm,type:()=>Gm}),Gm=`request`,Km=e=>e instanceof Request,qm=(e,t)=>({...Ef,type:Gm,method:e.method,url:e.url,headers:Uf(e.headers,t),body:e.body?Cm(e.body,t):null,credentials:e.credentials,cache:e.cache,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,integrity:e.integrity,keepalive:e.keepalive,signal:Lm(e.signal,t)}),Jm=(e,t)=>{let n=Wf(e.headers,t),r={method:e.method,headers:n,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,integrity:e.integrity,keepalive:e.keepalive,signal:Rm(e.signal,t)};return e.mode!==`navigate`&&(r.mode=e.mode),e.body&&(r.body=Dm(e.body,t),r.duplex=`half`),new Request(e.url,r)},Ym=jd({box:()=>sh,boxByReference:()=>ch,identity:()=>th,isType:()=>ih,objectsOnly:()=>!0,revive:()=>lh,type:()=>Xm}),Xm=`identity`,Zm=e=>e!==null&&(typeof e==`object`||typeof e==`function`),Qm=e=>{if(e===null)return!1;let t=typeof e;return t===`object`||t===`function`||t===`symbol`&&Symbol.keyFor(e)===void 0},$m=new WeakMap,eh=e=>{let t=$m.get(e);if(t!==void 0)return t;let n=globalThis.crypto.randomUUID();return $m.set(e,n),n},th=e=>(Zm(e)&&eh(e),e),nh=new WeakMap,rh=e=>{let t=nh.get(e);if(t)return t;let n=new Map,r={idToLocal:n,pins:new Map,aliasIds:new WeakMap,disposeRegistry:new FinalizationRegistry(t=>{if(n.delete(t),!ap(e))try{e.sendMessage({type:`identity-dispose`,remoteUuid:e.remoteUuid,id:t})}catch{}})};return nh.set(e,r),e.eventTarget.addEventListener(`message`,({detail:e})=>{e?.type===`identity-dispose`&&(r.pins.delete(e.id),r.idToLocal.delete(e.id))}),ip(e,()=>{r.pins.clear(),r.idToLocal.clear()}),r},ih=e=>Zm(e)&&$m.has(e),ah=(e,t)=>{let n=t.aliasIds.get(e);if(n!==void 0)return n;let r=eh(e),i=t.idToLocal.get(r);if(i===void 0||i.deref()===e)return r;let a=globalThis.crypto.randomUUID();return t.aliasIds.set(e,a),a},oh=(e,t,n)=>{let r=ah(e,n);if(n.idToLocal.has(r))return{...Ef,type:Xm,id:r};let i=t();return n.idToLocal.set(r,new WeakRef(e)),n.disposeRegistry.register(e,r,e),rg(()=>{},()=>{n.idToLocal.delete(r),n.disposeRegistry.unregister(e)}),{...Ef,type:Xm,id:r,inner:i}},sh=(e,t)=>{let n=rh(t),r=()=>ug(e,t,Xm);return Qm(e)?oh(e,r,n):{...Ef,type:Xm,id:globalThis.crypto.randomUUID(),inner:r()}},ch=(e,t,n)=>oh(e,()=>t,rh(n)),lh=(e,t)=>{let n=rh(t);if(n.pins.has(e.id))return n.pins.get(e.id);let r=n.idToLocal.get(e.id)?.deref();if(r!==void 0)return r;if(!(`inner`in e)||e.inner===void 0){try{t.sendMessage({type:`identity-dispose`,remoteUuid:t.remoteUuid,id:e.id})}catch{}throw Error(`osra identity: received id=${e.id} with no inner payload and nothing local to resolve it to`)}let i=dg(e.inner,t);return n.pins.set(e.id,i),Qm(i)&&($m.has(i)||$m.set(i,e.id),n.idToLocal.set(e.id,new WeakRef(i))),i},uh=jd({box:()=>fh,isType:()=>dh,objectsOnly:()=>!0,revive:()=>ph,type:()=>`map`}),dh=e=>e instanceof Map,fh=(e,t)=>({...Ef,type:`map`,entries:Array.from(e,([e,n])=>[lg(e,t),lg(n,t)])}),ph=(e,t)=>new Map(e.entries.map(([e,n])=>[dg(e,t),dg(n,t)])),mh=jd({box:()=>gh,isType:()=>hh,objectsOnly:()=>!0,revive:()=>_h,type:()=>`set`}),hh=e=>e instanceof Set,gh=(e,t)=>({...Ef,type:`set`,values:Array.from(e,e=>lg(e,t))}),_h=(e,t)=>new Set(e.values.map(e=>dg(e,t))),vh=jd({box:()=>xh,isType:()=>bh,revive:()=>Sh,type:()=>yh}),yh=`bigint`,bh=e=>typeof e==`bigint`,xh=(e,t)=>({...Ef,type:yh,value:e.toString()}),Sh=(e,t)=>BigInt(e.value),Ch=jd({box:()=>Eh,isType:()=>Th,objectsOnly:()=>!0,revive:()=>Dh,type:()=>wh}),wh=`event`,Th=e=>e instanceof Event,Eh=(e,t)=>({...Ef,type:wh,eventType:e.type,bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed,...e instanceof CustomEvent?{detail:lg(e.detail,t)}:{}}),Dh=(e,t)=>{let n={bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed};return`detail`in e?new CustomEvent(e.eventType,{...n,detail:dg(e.detail,t)}):new Event(e.eventType,n)},Oh=jd({box:()=>jh,isType:()=>Ah,objectsOnly:()=>!0,revive:()=>Fh,type:()=>kh}),kh=`eventTarget`,Ah=e=>e instanceof EventTarget,jh=(e,t)=>{let n=[],r=e=>typeof e==`boolean`?e:!!e?.capture;return{...Ef,type:kh,addListener:hm((t,i,a)=>{n.push({eventType:t,listener:i,capture:r(a)}),e.addEventListener(t,i,a)},t),removeListener:hm((t,i,a)=>{let o=r(a),s=n.findIndex(e=>e.eventType===t&&e.listener===i&&e.capture===o);s!==-1&&n.splice(s,1),e.removeEventListener(t,i,a)},t),removeAllListeners:hm(()=>{for(let{eventType:t,listener:r,capture:i}of n.splice(0))e.removeEventListener(t,r,{capture:i})},t)}},Mh=new WeakMap,Nh=e=>{if(typeof e==`function`)return e;let t=Mh.get(e);return t||Mh.set(e,t=t=>e.handleEvent(t)),t},Ph=(e,t,n,r)=>e.find(e=>e.eventType===t&&e.listener===n&&e.capture===r),Fh=(e,t)=>{let n=gm(e.addListener,t),r=gm(e.removeListener,t),i=gm(e.removeAllListeners,t),a=new EventTarget,o=[],s=e=>{let t=o.indexOf(e);t!==-1&&o.splice(t,1)};return Object.defineProperty(a,"addEventListener",{value:(e,t,r)=>{if(t===null)return;let i=Nh(t),a=typeof r==`boolean`?r:!!r?.capture;if(Ph(o,e,i,a))return;let c=typeof r==`object`&&r?.once?e=>(s(l),i(e)):i,l={eventType:e,listener:i,capture:a,wire:c};o.push(l),(typeof r==`object`?r?.signal:void 0)?.addEventListener(`abort`,()=>s(l),{once:!0}),n(e,th(c),r).catch(()=>{})}}),Object.defineProperty(a,"removeEventListener",{value:(e,t,n)=>{if(t===null)return;let i=Nh(t),a=typeof n==`boolean`?n:!!n?.capture,c=Ph(o,e,i,a);c&&(s(c),r(e,th(c.wire),{capture:a}).catch(()=>{}))}}),Dp(a,()=>{i().catch(()=>{})}),a},Ih=jd({box:()=>eee,isType:()=>Rh,revive:()=>tee,type:()=>Lh}),Lh=`symbol`,Rh=e=>typeof e==`symbol`,eee=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?ch(e,{...Ef,type:Lh,description:e.description},t):{...Ef,type:Lh,registryKey:n}},tee=(e,t)=>`registryKey`in e?Symbol.for(e.registryKey):Symbol(e.description),nee=jd({box:()=>Bh,isType:()=>ree,objectsOnly:()=>!0,revive:()=>iee,type:()=>zh}),zh=`asyncIterator`,ree=e=>!e||typeof e!=`object`||typeof ReadableStream<`u`&&e instanceof ReadableStream?!1:typeof e[Symbol.asyncIterator]==`function`,Bh=(e,t)=>{let n=e[Symbol.asyncIterator]();return{...Ef,type:zh,next:hm((e=>n.next(e)),t),return:hm((e=>n.return?.(e)??Promise.resolve({done:!0,value:e})),t),throw:hm((e=>n.throw?.(e)??Promise.reject(e)),t)}},iee=(e,t)=>{let n=gm(e.next,t),r=gm(e.return,t),i=gm(e.throw,t),a={next:(...e)=>n(...e),return:e=>r(e),throw:e=>i(e),[Symbol.asyncIterator]:()=>a};return a},Vh=[globalThis.File,globalThis.FileList,globalThis.RegExp,globalThis.DataView,globalThis.ImageData,globalThis.FormData,globalThis.DOMException,globalThis.DOMMatrix,globalThis.DOMMatrixReadOnly,globalThis.DOMPoint,globalThis.DOMPointReadOnly,globalThis.DOMQuad,globalThis.DOMRect,globalThis.DOMRectReadOnly,globalThis.CryptoKey,globalThis.FileSystemHandle,globalThis.FileSystemFileHandle,globalThis.FileSystemDirectoryHandle,globalThis.RTCCertificate],Hh=[globalThis.CropTarget,globalThis.EncodedAudioChunk,globalThis.EncodedVideoChunk,globalThis.FencedFrameConfig,globalThis.GPUCompilationInfo,globalThis.GPUCompilationMessage,globalThis.GPUPipelineError,globalThis.RTCEncodedAudioFrame,globalThis.RTCEncodedVideoFrame,globalThis.WebTransportError],Uh={type:`clonable`,capableOnly:!0,objectsOnly:!0,isType:e=>rf(e,Vh)||rf(e,Hh),box:(e,t)=>e,revive:(e,t)=>e},Wh=[globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.WritableStream,globalThis.TransformStream,globalThis.MediaStreamTrack,globalThis.RTCDataChannel],Gh=[globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MIDIAccess,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream],Kh={type:`transferable`,capableOnly:!0,objectsOnly:!0,isType:e=>rf(e,Wh)||rf(e,Gh),box:(e,t)=>e,revive:(e,t)=>e},qh={type:`blob`,capableOnly:!0,objectsOnly:!0,isType:e=>typeof Blob<`u`&&e instanceof Blob,box:(e,t)=>{if(hf(t.transport))throw TypeError(`osra: Blob is only supported on structured-clone transports, send an ArrayBuffer or Uint8Array instead`);return e},revive:(e,t)=>e},Jh=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Yh=[sp,Ym,Af,Ff,Bf,Gf,Zf,rm,um,Op,_m,Om,Nm,zm,Wm,uh,mh,vh,Ih,Ch,nee,{type:`nonFiniteNumber`,isType:e=>typeof e==`number`&&!Number.isFinite(e),box:(e,t)=>hf(t.transport)?{...Ef,type:`nonFiniteNumber`,value:String(e)}:e,revive:(e,t)=>Number(e.value)},{type:`undefined`,isType:e=>e===void 0,box:(e,t)=>hf(t.transport)?{...Ef,type:`undefined`}:e,revive:(e,t)=>void 0},Uh,Kh,qh,Oh,{type:`unclonable`,objectsOnly:!0,isType:e=>{if(typeof e!=`object`||!e||Array.isArray(e)||Jh(e))return!1;try{return structuredClone(e),!1}catch{return!0}},box:(e,t)=>({...Ef,type:`unclonable`}),revive:(e,t)=>({})}],Xh=(e,t)=>t.find(t=>t.type===e.type),Zh=e=>!!e&&typeof e==`object`&&Object.getPrototypeOf(e)===Object.prototype,Qh=(e,t)=>Array.isArray(e)?e.map(e=>t(e)):Zh(e)?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)])):e,$h=new WeakSet,eg=new WeakSet,tg=0,ng=[],rg=(e,t)=>{if(tg===0){e();return}ng.push({commit:e,rollback:t})},ig=e=>{let t=ng;ng=[];for(let n of t)try{e?n.rollback():n.commit()}catch{}},ag=e=>e!==null&&(typeof e==`object`||typeof e==`function`),og=new WeakMap,sg=e=>{let t=og.get(e);if(t)return t;let n=e.filter(e=>!e.objectsOnly);return og.set(e,n),n},cg=(e,t,n)=>{let r=(e===null||typeof e!=`object`&&typeof e!=`function`?sg(t.revivableModules):t.revivableModules).find(t=>t.type!==n&&t.isType(e));return r?r.box(e,t):Qh(e,e=>lg(e,t))},lg=(e,t)=>{if(Df(e))return e;let n=ag(e);if(n){if($h.has(e))throw TypeError(`osra: cannot serialize a circular structure - break the cycle or send the container by reference`);$h.add(e)}tg++;let r=!0;try{let n=cg(e,t);return r=!1,n}finally{n&&$h.delete(e),tg--,tg===0&&ig(r)}},ug=(e,t,n)=>cg(e,t,n),dg=(e,t)=>{let n=ag(e);if(n){if(eg.has(e))throw TypeError(`osra: cannot revive a circular structure`);eg.add(e)}try{if(Df(e)){let n=Xh(e,t.revivableModules);if(n)return n.revive(e,t)}return Qh(e,e=>dg(e,t))}finally{n&&eg.delete(e)}},fg=jd({init:()=>hg,startBidirectionalConnection:()=>mg,type:()=>pg}),pg=`bidirectional`,mg=({transport:e,value:t,remoteUuid:n,eventTarget:r,send:i,revivableModules:a})=>{let o={transport:e,remoteUuid:n,sendMessage:i,eventTarget:r,revivableModules:a};for(let e of a)e.init?.(o);let{promise:s,resolve:c}=Promise.withResolvers();return r.addEventListener(`message`,function e({detail:t}){t.type===`init`&&(c(t.data),r.removeEventListener(`message`,e))}),i({type:`init`,remoteUuid:n,data:lg(t,o)}),{revivableContext:o,remoteValue:s.then(e=>dg(e,o))}},hg=e=>{if(!(gf(e.transport)&&_f(e.transport)))return;if(e.protocolEventTarget.addEventListener(`message`,({detail:{message:t,peer:n}})=>{if(t.type===`announce`){if(!t.remoteUuid){e.sendMessage({type:`announce`,remoteUuid:t.uuid});return}if(t.remoteUuid!==e.getUuid()||e.connectionContexts.has(t.uuid))return;e.sendMessage({type:`announce`,remoteUuid:t.uuid});let r=e.createConnectionEventTarget(),i={...n(),abort:()=>e.abortConnection(t.uuid)},a;try{let n=e.valueFor(i);if(e.claimPendingAbort(t.uuid)){e.sendMessage({type:`close`,remoteUuid:t.uuid});return}a=mg({transport:e.transport,value:n,remoteUuid:t.uuid,eventTarget:r,send:t=>e.sendMessage(t),revivableModules:e.revivableModules})}catch(n){e.sendMessage({type:`close`,remoteUuid:t.uuid}),e.rejectRemoteValue(n);return}let o={type:`bidirectional`,eventTarget:r,connection:a};e.connectionContexts.set(t.uuid,o),o.connection.remoteValue.then(t=>e.addConnection(i,t),t=>e.rejectRemoteValue(t));return}if(t.type===`close`){if(t.remoteUuid!==e.getUuid())return;let n=e.connectionContexts.get(t.uuid);if(!n)return;e.connectionContexts.delete(t.uuid),op(n.connection.revivableContext),e.rejectRemoteValue(Error(`osra: peer closed the connection`));return}if(t.remoteUuid!==e.getUuid())return;let r=e.connectionContexts.get(t.uuid);r&&r.eventTarget.dispatchEvent(new CustomEvent(`message`,{detail:t}))}),e.presetRemoteUuid!==void 0){let t=e.presetRemoteUuid,n=e.createConnectionEventTarget(),r,i;try{i={abort:()=>e.abortConnection(t)};let a=e.valueFor(i);if(e.claimPendingAbort(t)){e.sendMessage({type:`close`,remoteUuid:t});return}r=mg({transport:e.transport,value:a,remoteUuid:e.presetRemoteUuid,eventTarget:n,send:t=>e.sendMessage(t),revivableModules:e.revivableModules})}catch(n){e.sendMessage({type:`close`,remoteUuid:t}),e.rejectRemoteValue(n);return}let a={type:`bidirectional`,eventTarget:n,connection:r};e.connectionContexts.set(e.presetRemoteUuid,a),a.connection.remoteValue.then(t=>e.addConnection(i,t),t=>e.rejectRemoteValue(t));return}let t=50,n,r=()=>{if(!(e.unregisterSignal?.aborted||e.connectionContexts.size>0)){try{e.sendMessage({type:`announce`},`*`)}catch{}n=setTimeout(r,t),t=Math.min(t*2,1e3)}};e.unregisterSignal?.addEventListener(`abort`,()=>clearTimeout(n),{once:!0}),r()},gg=()=>new EventTarget,aee=e=>{let t=xf(e),n=t?e.emit:e,r=t?e.receive:e;return{isJson:t&&`isJson`in e&&e.isJson!==void 0?e.isJson:n!==void 0&&hf(n)||r!==void 0&&hf(r),...n===void 0?{}:{emit:n},...r===void 0?{}:{receive:r}}},oee=e=>e?e(Yh):Yh,see=32,_g=()=>{let e=[],t=new Set,n=!1,r=()=>({value:void 0,done:!0});return{push:r=>{if(!n){if(t.size===0){e.push(r),e.length>see&&e.shift();return}for(let e of t){let t=e.wake;if(t){e.wake=void 0,t({value:r,done:!1});continue}e.buffered.push(r)}}},close:()=>{n=!0;for(let e of t){let t=e.wake;e.wake=void 0,t?.(r())}},iterate:()=>{let i={buffered:[...e]};t.add(i);let a=!1;return{[Symbol.asyncIterator](){return this},next:()=>{if(a)return Promise.resolve(r());let e=i.buffered.shift();return e?Promise.resolve({value:e,done:!1}):n?Promise.resolve(r()):new Promise(e=>{i.wake=e})},return:()=>{a=!0,t.delete(i);let e=i.wake;return i.wake=void 0,e?.(r()),Promise.resolve(r())}}}}},vg=(e,t,n)=>{let r=e.then(n);r.catch(()=>{});let i=()=>{let e=t.iterate();return{[Symbol.asyncIterator](){return this},next:()=>e.next().then(e=>e.done?{value:void 0,done:!0}:{value:n(e.value),done:!1}),return:()=>e.return?.()??Promise.resolve({value:void 0,done:!0})}};return Object.assign(r,{[Symbol.asyncIterator]:i})},yg=Symbol.for(`osra.context`),bg=e=>typeof e==`object`&&!!e&&yg in e,xg=[fg],Sg=(e,{transport:t,name:n,remoteName:r,key:i=Nd,origin:a=`*`,unregisterSignal:o,revivableModules:s,uuid:c,remoteUuid:l,connection:u=({value:e})=>e})=>{let d=u,f=aee(t);if(!(gf(f)&&_f(f))){let e=_g();e.close();let t=Promise.reject(Error(`osra: transport must be able to both emit and receive to establish a connection; pass a bidirectional platform transport or a custom { emit, receive } pair`));return t.catch(()=>{}),vg(t,e,d)}let p=oee(s),m=new Map,h=new Set,g=_g(),{promise:_,resolve:v,reject:y}=Promise.withResolvers();_.catch(()=>{});let b=c??globalThis.crypto.randomUUID(),x=(e,t=a)=>{let r={[Md]:i,name:n,uuid:b,...e},o=Cp(r);Hd(f,r,t,o),$p(o)},S=(e,t)=>{o?.aborted||x(e,t)},C=gg(),w={transport:f,valueFor:t=>bg(e)?e[yg](t):e,revivableModules:p,connectionContexts:m,getUuid:()=>b,presetRemoteUuid:l,sendMessage:S,protocolEventTarget:C,rejectRemoteValue:y,abortConnection:e=>{let t=m.get(e);if(!t){h.add(e);return}m.delete(e),x({type:`close`,remoteUuid:e}),op(t.connection.revivableContext),y(Error(`osra: connection aborted`))},claimPendingAbort:e=>h.delete(e),addConnection:(e,t)=>{let n={value:t,context:e};v(n),g.push(n)},createConnectionEventTarget:gg,unregisterSignal:o};if(zd({listener:(e,t)=>{e.uuid!==b&&C.dispatchEvent(new CustomEvent(`message`,{detail:{message:e,peer:()=>({...t.origin?{origin:t.origin}:{},...t.source?{source:t.source}:{},...t.port?{port:t.port}:{},...t.sender?{sender:t.sender}:{}})}}))},transport:f,remoteName:r,key:i,origin:a,unregisterSignal:o}),o?.aborted)return y(o.reason),g.close(),vg(_,g,d);o?.addEventListener(`abort`,()=>{for(let[e,t]of m)x({type:`close`,remoteUuid:e}),op(t.connection.revivableContext);m.clear(),g.close(),y(o.reason)},{once:!0});for(let e of xg)e.init(w);return vg(_,g,d)},Cg=(e,t)=>Sg(e,t),wg=[[`aac`,`audio/mp4; codecs="mp4a.40.2"`],[`opus`,`audio/mp4; codecs="opus"`],[`flac`,`audio/mp4; codecs="flac"`],[`ac3`,`audio/mp4; codecs="ac-3"`],[`eac3`,`audio/mp4; codecs="ec-3"`]],Tg=[`aac`,`opus`,`flac`],Eg=()=>{let e=globalThis.MediaSource;if(typeof e?.isTypeSupported!=`function`)return[...Tg];let t=wg.filter(([,t])=>{try{return e.isTypeSupported(t)}catch{return!1}}).map(([e])=>e);return t.includes(`aac`)?t:[...Tg]},Dg=e=>new Promise((t,n)=>{if(e.aborted)return n();e.addEventListener(`abort`,()=>{n()})}),Og=async({publicPath:e,workerUrl:t,workerOptions:n,read:r,length:i,bufferSize:a,audioStreamIndex:o,audioCodecs:s,transferReads:c=!0})=>{let l=new Worker(t,n),{makeRemuxer:u}=await Cg({},{transport:l}),d=await u({publicPath:e,length:i,bufferSize:a,audioStreamIndex:o,audioCodecs:s??Eg()}),f=new kd({concurrency:1}),p=!1,m=(e,t)=>{p||!c||e.byteLength>0||t>=i||(p=!0,console.warn(`libav-wasm: read(${t}) returned 0 bytes, ${i-t} bytes before the end of the file. Reads are transferred, so the buffer read() returns is detached in the caller and handing back bytes you keep returns that same detached buffer. Return a copy, or pass transferReads: false.`))},h=e=>(t,n)=>e.signal.aborted?Promise.resolve({resolved:new Uint8Array().buffer,rejected:!0}):Promise.race([r(Number(t),Number(n)).then(e=>{m(e,Number(t));let n=new Uint8Array(e).buffer;return{resolved:c?pp(n):n,rejected:!1}},()=>({resolved:new Uint8Array().buffer,rejected:!0})),Dg(e.signal).then(()=>({resolved:new Uint8Array().buffer,rejected:!0}),()=>({resolved:new Uint8Array().buffer,rejected:!0}))]),g=[];return{worker:l,remuxer:d,wasmRead:h,addTask:e=>{let t=[...g];g=[],f.clear(),t.forEach(e=>e.abort());let n=new AbortController;return g=[...g,n],Promise.race([f.add(async()=>e(n),{signal:n.signal}),Dg(n.signal).then(()=>Promise.reject(Error(`Cancelled`)),()=>Promise.reject(Error(`Cancelled`)))])},destroy:async()=>{let e=[...g];g=[],f.clear(),e.forEach(e=>e.abort()),await d.destroy(),l.terminate()}}},kg=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await Og({...e,bufferSize:e.bufferSize??25e5});return{worker:t,init:()=>i(e=>n.init(r(e))),destroy:a,seek:e=>i(t=>n.seek(r(t),e)),read:()=>i(e=>n.read(r(e))),readKeyframe:e=>i(t=>n.readKeyframe(r(t),e)),setAudioStreamIndex:e=>n.setAudioStreamIndex(e)}},Ag=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await Og({...e,bufferSize:e.bufferSize??1e6});return{worker:t,init:()=>i(e=>n.initThumbnail(r(e))),readKeyframe:e=>i(t=>n.readKeyframe(r(t),e)),destroy:a}},jg=typeof HTMLVideoElement<`u`?HTMLVideoElement.prototype:{},Mg=`getVideoPlaybackQuality`in jg||`webkitDecodedFrameCount`in jg||`mozPresentedFrames`in jg||`mozPaintedFrames`in jg;if(!(`requestVideoFrameCallback`in jg)&&Mg&&typeof requestAnimationFrame==`function`){jg._rvfcpolyfillmap={};let e=`getVideoPlaybackQuality`in jg?e=>{let{totalFrameDelay:t,totalVideoFrames:n,droppedVideoFrames:r}=e.getVideoPlaybackQuality();return{presentedFrames:n-r,totalFrameDelay:t}}:e=>({presentedFrames:e.mozPresentedFrames||e.mozPaintedFrames||e.webkitDecodedFrameCount-(e.webkitDroppedFrameCount||0),totalFrameDelay:e.mozFrameDelay||0});jg.requestVideoFrameCallback=function(t){let n=performance.now(),r=e(this),i=r.presentedFrames,a=(o,s)=>{let c=e(this),l=c.presentedFrames;if(l>i){let e=c.totalFrameDelay-r.totalFrameDelay||0,i=s-o;t(s,{presentationTime:s+e*1e3,expectedDisplayTime:s+i,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+i/1e3,presentedFrames:l,processingDuration:e}),delete this._rvfcpolyfillmap[n]}else this._rvfcpolyfillmap[n]=requestAnimationFrame(e=>a(s,e))};return this._rvfcpolyfillmap[n]=requestAnimationFrame(e=>a(n,e)),n},jg.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]}}var Ng={RAW:`RAW`,PROXY:`PROXY`,THROW:`THROW`,HANDLER:`HANDLER`},Pg={GET:`GET`,SET:`SET`,APPLY:`APPLY`,CONSTRUCT:`CONSTRUCT`,RELEASE:`RELEASE`},Fg=Symbol(`Abslink.proxy`),Ig=Symbol(`Abslink.releaseProxy`),Lg=Symbol(`Abslink.finalizer`),Rg=Symbol(`Abslink.thrown`),zg=e=>typeof e==`object`&&!!e||typeof e==`function`,Bg=new Map([[`proxy`,{canHandle:e=>zg(e)&&Fg in e,serialize(e,t){let n=e[Fg];return Hg(e,t,n),[n,[]]},deserialize(e,t){return Ug(t,e)}}],[`throw`,{canHandle:e=>zg(e)&&Rg in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function Vg(e,t){let n=t,r=e.slice(0,-1);for(let e of r)Object.prototype.hasOwnProperty.call(n,e)&&(n=n[e]);let i=e[e.length-1],a=i?n[i]:n;return{parent:n,RawValue:a,lastSegment:i}}function Hg(e,t,n){return t.on(`message`,function r(i){if(!i)return;let{id:a,type:o,path:s,markerID:c}={path:[],...i};if(c!==n)return;let l=(i.argumentList??[]).map(e=>n_(e,t)),u;try{let{parent:n,RawValue:r,lastSegment:a}=Vg(s,e);switch(o){case Pg.GET:u=r;break;case Pg.SET:n[a]=n_(i.value,t),u=!0;break;case Pg.APPLY:u=r.apply(n,l);break;case Pg.CONSTRUCT:u=new r(...l);break;case Pg.RELEASE:u=void 0;break;default:return}}catch(e){u={value:e,[Rg]:0}}Promise.resolve(u).catch(e=>({value:e,[Rg]:0})).then(i=>{o===Pg.CONSTRUCT&&!(zg(i)&&Rg in i)&&(i=e_(i));let[s,c]=t_(i,t);t.postMessage({...s,id:a,markerID:n},c),o===Pg.RELEASE&&(t.off(`message`,r),e[Lg]?.())}).catch(e=>{let[r,i]=t_({value:TypeError(`Unserializable return value`),[Rg]:0},t);t.postMessage({...r,id:a,markerID:n},i)})}),e}function Ug(e,t){let n=new Map;return e.on(`message`,e=>{if(!e?.id)return;let t=n.get(e.id);if(t)try{t(e)}finally{n.delete(e.id)}}),Xg({endpoint:e,pendingListeners:n,rootMarkerID:t})}function Wg(e){if(e)throw Error(`Proxy has been released and is not useable`)}async function Gg(e){await r_(e,{type:Pg.RELEASE})}var Kg=new WeakMap,qg=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(Kg.get(e)??0)-1;Kg.set(e,t),t===0&&Gg(e).finally(()=>{e.pendingListeners.clear()})});function Jg(e,t){let n=(Kg.get(t)??0)+1;Kg.set(t,n),qg&&qg.register(e,t,e)}function Yg(e){qg&&qg.unregister(e)}function Xg(e,t=[]){let n=!1,r=new Map,i=new Proxy(function(){},{get(a,o){if(Wg(n),o===Ig)return async()=>{for(let e of r.values())e[Ig]();r.clear(),Yg(i),Gg(e).finally(()=>{e.pendingListeners.clear()}),n=!0};if(o===`then`){if(t.length===0)return{then:()=>i};let n=r_(e,{type:Pg.GET,path:t.map(e=>e.toString())}).then(t=>n_(t,e.endpoint));return n.then.bind(n)}let s=r.get(o);if(s)return s;let c=Xg(e,[...t,o]);return r.set(o,c),c},set(r,i,a){Wg(n);let[o,s]=t_(a,e.endpoint);return r_(e,{type:Pg.SET,path:[...t,i].map(e=>e.toString()),value:o},s).then(t=>n_(t,e.endpoint))},apply(r,i,a){if(Wg(n),t[t.length-1]===`bind`)return Xg(e,t.slice(0,-1));let[o,s]=$g(a,e);return r_(e,{type:Pg.APPLY,path:t.map(e=>e.toString()),argumentList:o},s).then(t=>n_(t,e.endpoint))},construct(r,i){Wg(n);let[a,o]=$g(i,e);return r_(e,{type:Pg.CONSTRUCT,path:t.map(e=>e.toString()),argumentList:a},o).then(t=>n_(t,e.endpoint))}});return Jg(i,e),i}var Zg=new WeakMap;function Qg(e,t){return Zg.set(e,t),e}function $g(e,t){let n=[],r=[];for(let i of e){let[e,a]=t_(i,t.endpoint);n.push(e),r.push(...a)}return[n,r]}function e_(e){return Object.assign(e,{[Fg]:c_()})}function t_(e,t){for(let[n,r]of Bg)if(r.canHandle(e)){let[i,a]=r.serialize(e,t);return[{type:Ng.HANDLER,name:n,value:i},a]}return[{type:Ng.RAW,value:e},Zg.get(e)??[]]}function n_(e,t){switch(e.type){case Ng.HANDLER:return Bg.get(e.name).deserialize(e.value,t);case Ng.RAW:return e.value}}function r_(e,t,n=[]){return new Promise(r=>{let i=c_();e.pendingListeners.set(i,r),e.endpoint.postMessage({id:i,...t,markerID:e.rootMarkerID},n)})}var i_=[],a_=`0123456789abcdef`;for(let e=0;e<256;e++)i_[e]=a_[e>>4&15]+a_[e&15];var o_=0,s_=``;function c_(){let e=0;if(!s_||o_+16>512)for(s_=``,o_=0;e<256;++e)s_+=i_[Math.random()*256|0];return s_.substring(o_,++o_+16)}function l_(e,t){let n=new WeakMap;return e.start?.(),t.start?.(),{on(t,r){let i=e=>r(e.data);`addEventListener`in e?e.addEventListener(t,i):`addListener`in e?e.addListener(t,i):e.on(t,i),n.set(r,i)},off(t,r){let i=n.get(r);`removeEventListener`in e?e.removeEventListener(t,i):`removeListener`in e?e.removeListener(t,i):e.off(t,i),n.delete(r)},postMessage(e,n=[]){t.postMessage(e,n)}}}function u_(e,t=e){return Ug(l_(e,t))}var d_=l(o(((e,t)=>{var n=typeof process<`u`&&!!process.hrtime,r=65535,i=10,a=n?1e9/i:1e3/i,o=n?()=>{let[e,t]=process.hrtime();return e*1e9+t}:()=>performance.now();function s(e){return(o()-e)/a&r}t.exports=function(e){let t=o(),n=i*(e||5),a=[0],c=1,l=s(t)-1&r;return function(e){let o=s(t),u=o-l&r;for(u>n&&(u=n),l=o;u--;)c===n&&(c=0),a[c]=a[c===0?n-1:c-1],c++;e&&(a[c-1]+=e);let d=a[c-1],f=a.length<n?0:a[c===n?0:c];return a.length<i?d:(d-f)*i/a.length}}}))(),1),f_=class{fps=(0,d_.default)(5);processingDuration=(0,d_.default)(5);droppedFrames=0;presentedFrames=0;mistimedFrames=0;_drop(){++this.droppedFrames}_startTime=0;_startFrame(){this._startTime=performance.now()}onsubtitleFrameCallback=(e,{fps:t,processingDuration:n,droppedFrames:r})=>console.info(`%cFPS: %c%f %c| Frame Time: %c%d ms %c| Dropped Frames: %c%d %c| 5s Avg`,`color: #888`,`color: #0f0; font-weight: bold`,t.toFixed(1),`color: #888`,`color: #0ff; font-weight: bold`,n,`color: #888`,`color: #f00; font-weight: bold`,r,`color: #888`);_endFrame(e){++this.presentedFrames;let t=this.fps(1),n=performance.now(),r=this.processingDuration((n-this._startTime)/t),i=Math.max(0,n-e.expectedDisplayTime);i&&++this.mistimedFrames,this.onsubtitleFrameCallback?.(n,{fps:t,processingDuration:r,droppedFrames:this.droppedFrames,presentedFrames:this.presentedFrames,mistimedFrames:this.mistimedFrames,presentationTime:n,expectedDisplayTime:e.expectedDisplayTime+(i>0?t/1e3:0),frameDelay:i,width:e.width,height:e.height,mediaTime:e.mediaTime})}},p_=class e{timeOffset;prescaleFactor;prescaleHeightLimit;maxRenderHeight;debug;renderer;ready;busy=!1;_video;_videoWidth=0;_videoHeight=0;_videoColorSpace=null;_canvas;_ro=new ResizeObserver(async()=>{try{await this.ready,this.resize()}catch{}});_destroyed=!1;_lastDemandTime;_skipped=!1;_worker;constructor(t){if(!globalThis.Worker)throw Error(`Worker not supported`);if(!t)throw Error(`No options provided`);if(!t.video&&!t.canvas)throw Error(`You should give video or canvas in options.`);e._test(),this.timeOffset=t.timeOffset??0,this._video=t.video,this._canvas=t.canvas??document.createElement(`canvas`),this._video&&!t.canvas&&(this._canvas.className=`JASSUB`,this._canvas.style.position=`absolute`,this._canvas.style.pointerEvents=`none`,this._video.insertAdjacentElement(`afterend`,this._canvas));let n=this._canvas.transferControlToOffscreen();this.debug=t.debug?new f_:null,this.prescaleFactor=t.prescaleFactor??1,this.prescaleHeightLimit=t.prescaleHeightLimit??1080,this.maxRenderHeight=t.maxRenderHeight??2160,this._worker=t.workerUrl?new Worker(t.workerUrl,{name:`jassub-worker`,type:`module`}):(()=>{throw Error(`jassub's bundled worker is not built into this app; pass the url explicitly`)})();let r=u_(this._worker),i=t.modernWasmUrl??(()=>{throw Error(`jassub's bundled simd wasm is not built into this app; pass the url explicitly`)})(),a=t.wasmUrl??(()=>{throw Error(`jassub's bundled fallback wasm is not built into this app; pass the url explicitly`)})(),o=t.modernWasmWorkerUrl??(()=>{throw Error(`jassub's bundled simd wasm script is not built into this app; pass the url explicitly`)})(),s=t.wasmWorkerUrl??(()=>{throw Error(`jassub's bundled fallback wasm script is not built into this app; pass the url explicitly`)})(),c=!!e._supportsSIMD&&(navigator.deviceMemory??1/0)>2,l={...t.availableFonts};!l[`liberation sans`]&&!t.defaultFont&&(l[`liberation sans`]=(()=>{throw Error(`jassub's bundled fallback font is not built into this app; pass the url explicitly`)})()),this.ready=new r({wasmUrl:c?i:a,wasmWorkerUrl:c?o:s,width:n.width,height:n.height,subUrl:t.subUrl,subContent:t.subContent??null,fonts:t.fonts??[],availableFonts:l,defaultFont:t.defaultFont??`liberation sans`,debug:!!t.debug,libassMemoryLimit:t.libassMemoryLimit??((navigator.deviceMemory??1/0)<=2?32:128),libassGlyphLimit:t.libassGlyphLimit??((navigator.deviceMemory??1/0)<=2?1e3:3e3),queryFonts:t.queryFonts??`local`},e_(e=>this._getLocalFont(e)),Qg(n,[n])).then(e=>{this.renderer=e}),this._video?this.setVideo(this._video):this._ro.observe(this._canvas)}static _supportsSIMD;static _test(){if(e._supportsSIMD!=null)return;try{e._supportsSIMD=WebAssembly.validate(Uint8Array.of(0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,43,1,41,0,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,128,2,11))}catch{e._supportsSIMD=!1}let t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(t instanceof WebAssembly.Module)||!(new WebAssembly.Instance(t)instanceof WebAssembly.Instance))throw Error(`WASM not supported`)}async resize(e=!!this._video?.paused,t=0,n=0){let r=this._video?.videoWidth??this._videoWidth,i=this._video?.videoHeight??this._videoHeight,a=this._getElementBoundingBox(this._video??this._canvas,r,i);if(!t||!n){let e=this._videoWidth/r||1,o=this._videoHeight/i||1,{width:s,height:c}=this._computeRenderSize(a.width*e,a.height*o);t=Math.round(s),n=Math.round(c)}this._video&&(this._canvas.style.width=Math.round(a.width)+`px`,this._canvas.style.height=Math.round(a.height)+`px`,this._canvas.style.top=a.y+`px`,this._canvas.style.left=a.x+`px`),await this.renderer._resizeCanvas(t,n,this._video?this._videoWidth||t:0,this._video?this._videoHeight||n:0),this._lastDemandTime&&await this._demandRender(e)}_getElementBoundingBox(e,t,n){let{clientWidth:r,clientHeight:i,offsetLeft:a,offsetTop:o}=e,s=t/n;return r/i>s?(n=i,t=i*s):(n=r/s,t=r),{x:a+(r-t)/2,y:o+(i-n)/2,width:t,height:n}}_computeRenderSize(e=0,t=0){if(t<=0||e<=0)return{width:0,height:0};let n=this.prescaleFactor<=0?1:this.prescaleFactor,r=self.devicePixelRatio||1,i=n<1?-1:1,a=t*r;return i*a*n<=i*this.prescaleHeightLimit?a*=n:i*a<i*this.prescaleHeightLimit&&(a=this.prescaleHeightLimit),this.maxRenderHeight>0&&a>this.maxRenderHeight&&(a=this.maxRenderHeight),e*=a/t,t=a,{width:e,height:t}}async setVideo(e){this._removeListeners(),this._video=e,this._ro.observe(e),typeof VideoFrame<`u`&&(e.addEventListener(`loadedmetadata`,this._boundUpdateColorSpace),this._updateColorSpace({target:e}));let t=++this._rvfcLoop;await this.ready,t===this._rvfcLoop&&e.requestVideoFrameCallback((e,n)=>this._handleRVFC(t,n))}async _getLocalFont(e,t=`regular`){if(navigator.permissions?.query){let{state:e}=await navigator.permissions.query({name:`local-fonts`});if(e!==`granted`)return}for(let n of await self.queryLocalFonts()){let r=n.family.toLowerCase(),i=n.style.toLowerCase();if(r===e&&i===t){let e=await n.blob();return new Uint8Array(await e.arrayBuffer())}}}_rvfcLoop=0;_handleRVFC(e,t){this._destroyed||e!==this._rvfcLoop||(this.manualRender(t).catch(console.error),this._video.requestVideoFrameCallback((t,n)=>this._handleRVFC(e,n)))}manualRender(e,t=!1){return this._lastDemandTime=e,this._demandRender(t)}async _demandRender(e=!1){let{mediaTime:t,width:n,height:r}=this._lastDemandTime;if(n!==this._videoWidth||r!==this._videoHeight)return this._videoWidth=n,this._videoHeight=r,await this.resize(e);if(this.busy){this._skipped=!0,this.debug?._drop();return}this.busy=!0,this._skipped=!1;try{this.debug?._startFrame(),await this.renderer._draw(t+this.timeOffset,e),this.debug?._endFrame(this._lastDemandTime)}catch(e){console.error(e)}finally{this.busy=!1}this._skipped&&await this._demandRender()}_boundUpdateColorSpace=this._updateColorSpace.bind(this);_updateColorSpace({target:e}){this._video.requestVideoFrameCallback(async()=>{if(!(this._destroyed||this._video!==e))try{let e=new VideoFrame(this._video),{matrix:t,fullRange:n}=e.colorSpace;e.close(),await this.ready,await this.renderer._setColorSpace(t,n)}catch(e){console.warn(e)}})}_removeListeners(){this._ro.disconnect(),this._video?.removeEventListener(`loadedmetadata`,this._boundUpdateColorSpace)}async destroy(){if(!this._destroyed){this._destroyed=!0,this._canvas.remove(),this._removeListeners();try{await this.ready,await this.renderer?.[Ig]()}finally{this._worker.terminate()}}}};function m_(e){var t=e.toLowerCase().trim().split(/\s*;\s*/);return t[0]===`banner`?{name:t[0],delay:t[1]*1||0,leftToRight:t[2]*1||0,fadeAwayWidth:t[3]*1||0}:/^scroll\s/.test(t[0])?{name:t[0],y1:Math.min(t[1]*1,t[2]*1),y2:Math.max(t[1]*1,t[2]*1),delay:t[3]*1||0,fadeAwayHeight:t[4]*1||0}:e===``?null:{name:e}}function h_(e){return e?e.toLowerCase().replace(/([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)/g,` $1 `).replace(/([mnlbspc])/g,` $1 `).trim().replace(/\s+/g,` `).split(/\s(?=[mnlbspc])/).map(function(e){return e.split(` `).filter(function(e,t){return!(t&&isNaN(e*1))})}):[]}var g_=`b.i.u.s.fsp.k.K.kf.ko.kt.fe.q.p.pbo.a.an.fscx.fscy.fax.fay.frx.fry.frz.fr.be.blur.bord.xbord.ybord.shad.xshad.yshad`.split(`.`).map(function(e){return{name:e,regex:RegExp(`^`+e+`-?\\d`)}});function __(e){for(var t,n={},r=0;r<g_.length;r++){var i=g_[r],a=i.name;if(i.regex.test(e))return n[a]=e.slice(a.length)*1,n}if(/^fn/.test(e))n.fn=e.slice(2);else if(/^r/.test(e))n.r=e.slice(1);else if(/^fs[\d+-]/.test(e))n.fs=e.slice(2);else if(/^\d?c&?H?[0-9a-fA-F]+|^\d?c$/.test(e)){var o=e.match(/^(\d?)c&?H?(\w*)/),s=o[1],c=o[2];n[`c`+(s||1)]=c&&(`000000`+c).slice(-6)}else if(/^\da&?H?[0-9a-fA-F]+/.test(e)){var l=e.match(/^(\d)a&?H?([0-9a-f]+)/i),u=l[1],d=l[2];n[`a`+u]=(`00`+d).slice(-2)}else if(/^alpha&?H?[0-9a-fA-F]+/.test(e))t=e.match(/^alpha&?H?([0-9a-f]+)/i),n.alpha=t[1],n.alpha=(`00`+n.alpha).slice(-2);else if(/^(?:pos|org|move|fad|fade)\([^)]+/.test(e)){var f=e.match(/^(\w+)\((.*?)\)?$/),p=f[1];n[p]=f[2].trim().split(/\s*,\s*/).map(Number)}else if(/^i?clip\([^)]+/.test(e)){var m=e.match(/^i?clip\((.*?)\)?$/)[1].trim().split(/\s*,\s*/);n.clip={inverse:/iclip/.test(e),scale:1,drawing:null,dots:null},m.length===1&&(n.clip.drawing=h_(m[0])),m.length===2&&(n.clip.scale=m[0]*1,n.clip.drawing=h_(m[1])),m.length===4&&(n.clip.dots=m.map(Number))}else if(/^t\(/.test(e)){var h=e.match(/^t\((.*?)\)?$/)[1].trim().replace(/\\.*/,function(e){return e.replace(/,/g,`
|
|
37
37
|
`)}).split(/\s*,\s*/);if(!h[0])return n;n.t={t1:0,t2:0,accel:1,tags:h[h.length-1].replace(/\n/g,`,`).split(`\\`).slice(1).map(__)},h.length===2&&(n.t.accel=h[0]*1),h.length===3&&(n.t.t1=h[0]*1,n.t.t2=h[1]*1),h.length===4&&(n.t.t1=h[0]*1,n.t.t2=h[1]*1,n.t.accel=h[2]*1)}return n}function v_(e){for(var t=[],n=0,r=``,i=e.split(`\\`).slice(1).concat(``).join(`\\`),a=0;a<i.length;a++){var o=i[a];o===`(`&&n++,o===`)`&&n--,n<0&&(n=0),!n&&o===`\\`?(r&&t.push(r),r=``):r+=o}return t.map(__)}function y_(e){var t=e.split(/{(.*?)}/),n=[];t[0].length&&n.push({tags:[],text:t[0],drawing:[]});for(var r=1;r<t.length;r+=2){var i=v_(t[r]),a=i.reduce(function(e,t){return t.p===void 0?e:!!t.p},!1);n.push({tags:i,text:a?``:t[r+1],drawing:a?h_(t[r+1]):[]})}return{raw:e,combined:n.map(function(e){return e.text}).join(``),parsed:n}}function b_(e){var t=e.split(`:`);return t[0]*3600+t[1]*60+t[2]*1}function x_(e,t){var n=e.split(`,`);if(n.length>t.length){var r=n.slice(t.length-1).join();n=n.slice(0,t.length-1),n.push(r)}for(var i={},a=0;a<n.length;a++){var o=t[a],s=n[a].trim();switch(o){case`Layer`:case`MarginL`:case`MarginR`:case`MarginV`:i[o]=s*1;break;case`Start`:case`End`:i[o]=b_(s);break;case`Effect`:i[o]=m_(s);break;case`Text`:i[o]=y_(s);break;default:i[o]=s}}return i}var S_=[`Name`,`Fontname`,`Fontsize`,`PrimaryColour`,`SecondaryColour`,`OutlineColour`,`BackColour`,`Bold`,`Italic`,`Underline`,`StrikeOut`,`ScaleX`,`ScaleY`,`Spacing`,`Angle`,`BorderStyle`,`Outline`,`Shadow`,`Alignment`,`MarginL`,`MarginR`,`MarginV`,`Encoding`],C_=[`Layer`,`Start`,`End`,`Style`,`Name`,`MarginL`,`MarginR`,`MarginV`,`Effect`,`Text`];function w_(e){var t=S_.concat(C_);return e.match(/Format\s*:\s*(.*)/i)[1].split(/\s*,\s*/).map(function(e){return t.find(function(t){return t.toLowerCase()===e.toLowerCase()})||e})}function T_(e,t){var n=e.match(/Style\s*:\s*(.*)/i)[1].split(/\s*,\s*/);return Object.assign.apply(Object,[{}].concat(t.map(function(e,t){var r={};return r[e]=n[t],r})))}function E_(e){for(var t={info:{},styles:{format:[],style:[]},events:{format:[],comment:[],dialogue:[]}},n=e.split(/\r?\n/),r=0,i=0;i<n.length;i++){var a=n[i].trim();if(!/^;/.test(a)&&(/^\[Script Info\]/i.test(a)?r=1:/^\[V4\+? Styles\]/i.test(a)?r=2:/^\[Events\]/i.test(a)?r=3:/^\[.*\]/.test(a)&&(r=0),r!==0)){if(r===1&&/:/.test(a)){var o=a.match(/(.*?)\s*:\s*(.*)/),s=o[1],c=o[2];t.info[s]=c}if(r===2&&(/^Format\s*:/i.test(a)&&(t.styles.format=w_(a)),/^Style\s*:/i.test(a)&&t.styles.style.push(T_(a,t.styles.format))),r===3&&(/^Format\s*:/i.test(a)&&(t.events.format=w_(a)),/^(?:Comment|Dialogue)\s*:/i.test(a))){var l=a.match(/^(\w+?)\s*:\s*(.*)/i),u=l[1],d=l[2];t.events[u.toLowerCase()].push(x_(d,t.events.format))}}}return t}var D_={M:`m`,L:`l`,C:`b`};function O_(e){return e.instructions.map(function(e){var t,n=e.type,r=e.points;return(t=[D_[n]]).concat.apply(t,r.map(function(e){return[e.x,e.y]})).join(` `)}).join(` `)}var k_=function(e){return function(t){return function(n){return``+t+e+`&H`+n+`&`}}},A_=k_(`c`),j_=k_(`a`),M_={c1:A_(1),c2:A_(2),c3:A_(3),c4:A_(4),a1:j_(1),a2:j_(2),a3:j_(3),a4:j_(4),pos:function(e){return`pos(`+[e.x,e.y]+`)`},org:function(e){return`org(`+[e.x,e.y]+`)`},move:function(e){return`move(`+[e.x1,e.y1,e.x2,e.y2,e.t1,e.t2]+`)`},fade:function(e){return e.type===`fad`?`fad(`+[e.t1,e.t2]+`)`:`fade(`+[e.a1,e.a2,e.a3,e.t1,e.t2,e.t3,e.t4]+`)`},clip:function(e){return(e.inverse?`i`:``)+`clip(`+(e.dots?``+[e.dots.x1,e.dots.y1,e.dots.x2,e.dots.y2]:(e.scale===1?``:e.scale+`,`)+O_(e.drawing))+`)`},t:function(e){return e.map(function(e){return`t(`+[e.t1,e.t2,e.accel,N_(e.tag)]+`)`}).join(`\\`)}};function N_(e){return Object.keys(e).map(function(t){return`\\`+(M_[t]||(function(e){return``+t+e}))(e[t])}).join(``)}var P_={play:`Play`,pause:`Pause`,replay:`Replay`,playKey:`Play (k)`,pauseKey:`Pause (k)`,replayKey:`Replay (k)`,mute:`Mute`,muteKey:`Mute (m)`,unmuteKey:`Unmute (m)`,fullScreen:`Full screen`,fullScreenKey:`Full screen (f)`,exitFullScreenKey:`Exit full screen (f)`,pictureInPicture:`Picture in picture`,exitPictureInPicture:`Exit picture in picture`,burnIn:`Put the subtitles in the video`,burnInOffer:`Put the subtitles in the picture`,burnedIn:`Subtitles are in the picture`,noSubtitles:`This file has no subtitles`,burnInHint:`Now click your browser's pop out button`,subtitles:`Subtitles`,subtitlesOff:`Disable`,settings:`Settings`,audio:`Audio`,quality:`Quality`,playbackSpeed:`Playback speed`,defaultSpeed:`(Default)`,speed:`{rate}x`,normalizeVolume:`Normalize volume`,autoplayNext:`Autoplay next episode`,unavailable:`Unavailable`,switchFailed:`Could not switch. Try again.`,track:`Track {number}`,skipOpening:`Skip Opening`,skipEnding:`Skip Ending`,errors:`Playback errors ({count})`,copyErrors:`Copy the errors`,copy:`Copy`,copied:`Copied`,errorSpan:`{start} to {end}`,errorAt:`at {time}`,recovered:`recovered`,failed:`Playback failed`,codecUnknown:`The video codec in this file could not be identified`,codecsUnsupported:`This browser cannot play the codecs in this file: {codecs}`,sourceNeverOpened:`The MediaSource never opened`,sourceClosed:`The MediaSource closed before a SourceBuffer could be created`,readFailed:`Reading the video file failed`,segmentRejected:`The browser rejected a media segment`},F_=(e,t={})=>e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n])),I_=(e,t,n)=>Object.assign(Error(F_(e,t),n),{label:e,values:t}),L_=e=>Array(e.buffered.length).fill(void 0).map((t,n)=>({index:n,start:e.buffered.start(n),end:e.buffered.end(n)})),R_=e=>new Promise((t,n)=>{let r=()=>{e.removeEventListener(`updateend`,i),e.removeEventListener(`abort`,i),e.removeEventListener(`error`,a)},i=()=>{r(),t()},a=e=>{r(),n(I_(`The browser rejected a media segment`,void 0,{cause:e}))};e.addEventListener(`updateend`,i,{once:!0}),e.addEventListener(`abort`,i,{once:!0}),e.addEventListener(`error`,a,{once:!0})}),z_=(e,t)=>{let n=Promise.resolve(),r=e=>{let t=n.then(e,e);return n=t.catch(()=>{}),t};return{appendBuffer:t=>r(()=>(e.appendBuffer(t),R_(e))),unbufferRange:(t,n)=>r(()=>t>=n?Promise.resolve():(e.remove(t,n),R_(e))),endOfStream:(n=()=>!0)=>r(async()=>{if(t.readyState===`open`&&!e.updating&&n())try{t.endOfStream()}catch{}})}},B_=e=>e===void 0?void 0:new URL(e,document.baseURI).toString(),V_=e=>new Date(e).toISOString().slice(11,22),H_=/[\u3000-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff00-\uffef]/,U_=1,W_=e=>new Map(E_(e).styles.style.map((e,t)=>[e.Name,t+U_])),G_=(e,t)=>{let n=t.replace(/^\*+/,``),r=n.toLowerCase()==="default"?`Default`:n;return e.styles.get(r)??e.styles.get(`Default`)??0},K_=e=>{let t=e.content.match(/\r?\n\[Events\]\r?\nFormat: (.*)/)?.[0];return t?{type:`header`,streamIndex:e.streamIndex,content:e.content,eventsContent:t,styles:W_(e.content)}:(console.warn(`subtitle stream ${e.streamIndex} has no Events format, ignoring the track`),null)},q_=(e,t)=>{let[n,r]=t.content.split(`,`),i=Number(n),a=`Dialogue: ${r},${V_(t.start)},${V_(t.end)},${t.content.replace(`${i},${r},`,``)}`,o=E_(`${e.eventsContent}\r\n${a}`).events.dialogue[0];if(!o)throw Error(`dialogue event is undefined`);return{type:`dialogue`,streamIndex:t.streamIndex,assEvent:{Name:o.Name??``,Effect:o.Effect?.name??``,Layer:o.Layer,MarginL:o.MarginL,MarginR:o.MarginR,MarginV:o.MarginV,Style:G_(e,o.Style),Text:o.Text.raw,Start:o.Start*1e3,Duration:(o.End-o.Start)*1e3,ReadOrder:i}}},J_=e=>{let{video:t,container:n,workerUrl:r}=e,i=B_(e.wasmUrl),a=B_(e.wasmWorkerUrl),o=B_(e.legacyWasmUrl),s=B_(e.legacyWasmWorkerUrl),c=B_(e.defaultFontUrl),l=B_(e.cjkFontUrl),u=!1,d=Promise.resolve(),f,p=[],m=new Map,h=[],g=new Map,_,v=e.onStreams,y=!1,b=e=>{console.warn(`the subtitle renderer failed; the file plays without subtitles`,e)},x=()=>void 0,S=e=>{let t=f;t&&t.ready.then(()=>f===t?e(t.renderer):void 0,x).catch(b)},C=!1,w=()=>{C||(C=!0,queueMicrotask(()=>{C=!1;let e=f;e&&t.videoWidth&&e.ready.then(()=>{if(f===e)return e.manualRender({expectedDisplayTime:performance.now(),width:t.videoWidth,height:t.videoHeight,mediaTime:t.currentTime||Number.MIN_VALUE},!0)},x).catch(b)}))},T=[`loadedmetadata`,`seeked`,`pause`],E=()=>w(),D=e=>{let l=document.createElement(`canvas`);n.append(l);try{f=new p_({canvas:l,subContent:e.content,workerUrl:r,modernWasmUrl:i,modernWasmWorkerUrl:a,...o?{wasmUrl:o}:{},...s?{wasmWorkerUrl:s}:{},fonts:p.map(([,e])=>e),availableFonts:{...Object.fromEntries(p),...c?{"liberation sans":c}:{}},queryFonts:!1})}catch(e){l.remove(),b(e);return}f.setVideo(t).catch(x),f.ready.catch(b);for(let e of T)t.addEventListener(e,E);c&&S(e=>{d=Promise.resolve(e.addFonts([c])).then(w,b)}),w()},O=e=>{l&&!u&&e.some(e=>H_.test(e.Text))&&(u=!0,S(async e=>{await d,await e.addFonts([l]),w()}))};return{pushAttachments:e=>{p=[...p,...e.map(e=>[e.filename,new Uint8Array(e.data)])]},pushFragments:e=>{let t=[];for(let n of e)if(n.type===`header`){if(m.has(n.streamIndex))continue;let e=K_(n);if(!e)continue;m.set(n.streamIndex,e),h.push({streamIndex:n.streamIndex,title:n.title,language:n.language}),v?.([...h]),_===void 0&&(_=n.streamIndex),!f&&!y&&D(e)}else{let e=m.get(n.streamIndex);if(!e)continue;let r=g.get(n.streamIndex);r||(r=new Map,g.set(n.streamIndex,r));let i=`${n.start},${n.end},${n.content.slice(n.content.indexOf(`,`)+1)}`;if(r.has(i))continue;let a=q_(e,n);r.set(i,a),_===n.streamIndex&&t.push(a.assEvent)}t.length&&(S(e=>Promise.all(t.map(t=>e.createEvent(t)))),O(t),w())},selectStream:e=>{let t=e??-1;if(t===_||!f)return;_=t;let n=m.get(t),r=[...g.get(t)?.values()??[]].map(e=>e.assEvent);S(e=>n?Promise.all([e.freeTrack(),e.setTrack(n.content),...r.map(t=>e.createEvent(t))]):e.removeAllEvents()),O(r),w()},getStreams:()=>[...h],getSelectedStream:()=>_,setOnStreams:e=>{v=e},destroy:()=>{y=!0;let e=f;f=void 0;for(let e of T)t.removeEventListener(e,E);e?.destroy().catch(()=>{})}}},Y_=class extends Error{mediaElement=!0;constructor(e,t){super(e,t),this.name=`MediaElementError`}},X_=e=>!!e&&typeof e==`object`&&e.mediaElement===!0,Z_=-20,Q_=60,$_=30,ev=-5,tv=20,nv=5,rv=15e3,iv=1,av=3,cee=12,ov=200,sv=250,cv=25e5,lv=e=>{let{worker:t}=e,n=setTimeout(()=>t.terminate(),2e3);e.destroy().catch(()=>{}).finally(()=>{clearTimeout(n),t.terminate()})},uv=async e=>{let{videoElement:t,subtitleContainer:n,read:r,length:i,publicPath:a,libavWorkerUrl:o,jassubWorkerUrl:s,jassubWasmUrl:c,jassubWasmWorkerUrl:l,jassubLegacyWasmUrl:u,jassubLegacyWasmWorkerUrl:d,defaultFontUrl:f,cjkFontUrl:p,bufferSize:m=cv,audioStreamIndex:h,chooseAudioStream:g,onReady:_,onError:v,onRecovered:y,onSeek:b,onSubtitleStreams:x,onAudioStreams:S,onOutput:C}=e,w=e=>kg({publicPath:a,workerUrl:o,workerOptions:{type:`module`},bufferSize:m,length:i,audioStreamIndex:e,read:r}),T=await w(h),E=[],D=!1,O=()=>{if(!D){D=!0;for(let e of[...E].reverse())try{e()}catch{}}};E.push(()=>lv(T));try{let e=await T.init(),r=h??g?.(e.audioStreams??[]);h===void 0&&r!==void 0&&r!==e.audioStreams?.[0]?.streamIndex&&(lv(T),T=await w(r),e=await T.init());let i=e.audioStreams??[],a=i.some(e=>e.streamIndex===r)?r:i[0]?.streamIndex??-1;S?.(i,a);let o=J_({video:t,container:n,workerUrl:s,wasmUrl:c,wasmWorkerUrl:l,legacyWasmUrl:u,legacyWasmWorkerUrl:d,defaultFontUrl:f,cjkFontUrl:p,onStreams:x});if(E.push(()=>o.destroy()),e.attachments?.length&&o.pushAttachments(e.attachments),!e.info.output.videoMimeType)throw I_(`The video codec in this file could not be identified`);let m=[e.info.output.videoMimeType,e.info.output.audioMimeType].filter(Boolean).join(`,`),k=`video/mp4; codecs="${m}"`;if(!MediaSource.isTypeSupported(k))throw I_(`This browser cannot play the codecs in this file: {codecs}`,{codecs:m});let A=new MediaSource,j=URL.createObjectURL(A);E.push(()=>URL.revokeObjectURL(j)),t.src=j,E.push(()=>{try{t.pause()}catch{}t.removeAttribute(`src`),t.load()});let M=await new Promise((t,n)=>{let r=setTimeout(()=>{i(),n(I_(`The MediaSource never opened`))},rv),i=()=>{clearTimeout(r),A.removeEventListener(`sourceopen`,a),A.removeEventListener(`sourceclose`,o),A.removeEventListener(`error`,o)},a=()=>{try{let n=A.addSourceBuffer(k);n.mode=`segments`,n.timestampOffset=e.timestampOffset;let r=e.info.input.duration;Number.isFinite(r)&&r>0&&(A.duration=r),i(),t(n)}catch(e){i(),n(e)}},o=()=>{i(),n(I_(`The MediaSource closed before a SourceBuffer could be created`))};A.addEventListener(`sourceopen`,a,{once:!0}),A.addEventListener(`sourceclose`,o,{once:!0}),A.addEventListener(`error`,o,{once:!0})}),{appendBuffer:N,unbufferRange:P,endOfStream:F}=z_(M,A);await N(e.data),C?.({type:`init`,data:e.data,audioMimeType:e.info.output.audioMimeType,audioStreamIndex:a}),C?.({type:`run`,pts:e.timestampOffset,from:0}),e.subtitles?.length&&o.pushFragments(e.subtitles),_?.();let I=!1,L=!1,R=0,ee,z=()=>ee??t.currentTime,B=!1,V=!1,H=0,U=0,W=null,te=0,G=0,ne=!1,re=0,ie=!0,ae=(e,t,n=!1)=>{let r=e?.message===`Cancelled`;t&&r||(console.error(e),(!ne||n)&&(ne=!0,v?.(r?I_(`Reading the video file failed`,void 0,{cause:e}):e)))},oe=async(e=!1)=>{if(R>0&&!e)return;let n=t.currentTime,r=e?ev:Z_,i=e?tv:Q_,a=L_(M),o=(e,t)=>(ie=!1,P(e,t));a.length&&a[0].start<n+r&&await o(0,n+r);for(let{end:e}of a)e>n+i&&await o(n+i,e)},se=()=>{let e=L_(M);if(!e.length)return!0;let t=z(),n=e.find(e=>e.start<=t+iv&&t<e.end);return de()&&le(t)&&(!n||n.start<=t)||n&&n.end>=t+Q_?!1:!n||n.end<t+$_},K=e=>L_(M).find(t=>t.start<=e+iv&&e<t.end),ce=()=>K(t.currentTime),le=(e=t.currentTime)=>{let n=K(e);return e>=G-.1||!!n&&n.end>=G-.1},ue=()=>{let e=L_(M).map(e=>e.end);e.length&&(G=Math.max(G,...e)),B&&(V=!0)},de=()=>B||V&&(L_(M).at(-1)?.end??0)>=G-.1,fe=async t=>{L=!0,W=null,te=0,re=t,ie=!0;let n=++U;try{let{data:r,pts:i,subtitles:a,finished:s}=await T.seek(t);if(D||n!==U)return;s&&(B=!0),a?.length&&o.pushFragments(a),C?.({type:`run`,pts:e.timestampOffset,from:i}),r.byteLength&&C?.({type:`fragment`,data:r}),s&&C?.({type:`end`}),r.byteLength&&(await N(r),ue())}catch(e){n===U&&(ie=!1),ae(e,D||n!==U)}finally{n===U&&(L=!1)}},pe=async()=>{let e=W;if(e)try{await N(e),ue(),W===e&&(W=null,te=0)}catch(n){if(W!==e)return;if(n?.name===`QuotaExceededError`){let n=await oe(!0).then(()=>!0,()=>!1);if(W!==e)return;if(n){B=!1,await fe(ce()?.end??t.currentTime);return}}if(te+=1,te<nv)return;throw W=null,n}},me=async()=>{if(I||L||Te!==void 0||D||!W&&(B||!se()))return;let e=++H,t=U,n=()=>D||e!==H||t!==U;I=!0;try{if(!W){let{data:e,subtitles:t,finished:r}=await T.read();if(n()||(r&&(B=!0),t?.length&&o.pushFragments(t),e.byteLength&&C?.({type:`fragment`,data:e}),r&&C?.({type:`end`}),!e.byteLength))return;W=e,te=0}await pe(),!n()&&ne&&(ne=!1,y?.())}catch(e){ae(e,n())}finally{e===H&&(I=!1)}},he=e=>L_(M).some(t=>t.start<=e&&e<t.end&&t.end>=re)&&ve(e),ge=e=>L_(M).some(t=>t.start<=e&&e<t.end),_e=e=>{let t=K(e);return t?t.end-e:0},ve=e=>_e(e)>=av||de()&&le(e),ye=async e=>{if(!D&&!(ge(e)&&ve(e))){Te&&clearTimeout(Te),Te=void 0,B=!1,R++,ee=e;try{await fe(e);let t=U;for(let n=0;n<cee&&!(D||t!==U||B||_e(e)>=av);n++){let t=_e(e);if(await me(),_e(e)<=t)break}}finally{R--,ee===e&&(ee=void 0)}}},be=0,xe=null,Se,Ce=e=>{let t=performance.now(),n=t-be;if(n>=ov){be=t,xe=null,b?.(e);return}xe=e,!Se&&(Se=setTimeout(()=>{Se=void 0;let e=xe;xe=null,!(e===null||D)&&(be=performance.now(),b?.(e))},ov-n))};E.push(()=>{Se&&clearTimeout(Se)});let we=0,Te;E.push(()=>{Te&&clearTimeout(Te)});let Ee=()=>{let n=t.currentTime,r=e.info.input.duration||t.duration;r>0&&Ce(Math.min(Math.max(n/r,0),1));let i=performance.now(),a=i-we<sv;if(we=i,!he(n)&&!(ie&&(L||_e(n)>0)&&Math.abs(n-re)<.001)){if(B=!1,Te&&clearTimeout(Te),!a){Te=void 0,fe(n);return}Te=setTimeout(()=>{if(Te=void 0,D)return;let e=t.currentTime;he(e)||(B=!1,fe(e))},sv)}};t.addEventListener(`seeking`,Ee),E.push(()=>t.removeEventListener(`seeking`,Ee));let De=!1,Oe=()=>{if(De)return;De=!0;let e=t.error;ae(new Y_(`the media element failed: ${e?.message??`unknown`}`,{cause:e}),!1,!0)};t.addEventListener(`error`,Oe),E.push(()=>t.removeEventListener(`error`,Oe));let ke=setInterval(()=>{De||t.error||(oe().catch(()=>{}),me().catch(e=>ae(e,!1)),de()&&!W&&le()&&A.readyState===`open`&&F(()=>!L).catch(()=>{}))},100);return E.push(()=>clearInterval(ke)),{destroy:O,prepareSeek:ye,videoElement:t,selectSubtitleStream:e=>o.selectStream(e),indexes:e.indexes??[],chapters:e.chapters??[],duration:e.info.input.duration,videoMimeType:e.info.output.videoMimeType,audioMimeType:e.info.output.audioMimeType}}catch(e){throw O(),e}},dv=5,fv=500,pv=320,mv=1e6,hv=3,gv=1e4,_v=1.5,vv=4e6,yv=3e4,bv=async e=>{let{publicPath:t,workerUrl:n,length:r,read:i,onThumbnails:a,width:o=pv}=e,s=await Ag({publicPath:t,workerUrl:n,workerOptions:{type:`module`},length:r,read:i});try{let t=await s.init(),n=t.duration,i=Math.max(e.interval??dv,n/fv),c=[],l=e=>{let t=[];for(let[a,o]of e.entries()){let s=t.at(-1);s&&o.timestamp-s.timestamp<i||t.push({timestamp:o.timestamp,endTime:n,startByte:o.pos,endByte:Math.min((e[a+1]?.pos??r)+mv,r),done:!1,attempts:0})}for(let[e,r]of t.entries())r.endTime=t[e+1]?.timestamp??n;return t.length>1&&t.at(-1).timestamp>n-i*2&&t.pop(),t};c=l(t.indexes);let u=[],d=!1,f=[],p=!1,m,h=-1,g=!1,_=!1,v,y=()=>{let e=m;if(e!==void 0){let t=f.findIndex(({timestamp:t,endTime:n})=>t<=e&&e<n);if(t>=0)return t}return 0},b=()=>{let e=[];for(let[t,n]of u.entries()){n.startTime-(e.at(-1)?.endTime??0)>.01&&e.push({url:``,startTime:e.at(-1)?.endTime??0,endTime:n.startTime}),e.push(n);let r=u[t+1];r&&r.startTime-n.endTime>.01&&e.push({url:``,startTime:n.endTime,endTime:r.startTime})}let t=e.at(-1)?.endTime??0;n-t>.01&&e.push({url:``,startTime:t,endTime:n}),a(e)},x=async e=>{if(d)return;let t=await Promise.race([s.readKeyframe(e.timestamp),new Promise((e,t)=>setTimeout(()=>t(Error(`timed out`)),gv))]),n=await createImageBitmap(new Blob([t],{type:`image/png`})),r=new OffscreenCanvas(o,Math.max(1,Math.round(n.height*(o/n.width))));r.getContext(`2d`).drawImage(n,0,0,r.width,r.height),n.close();let i=await r.convertToBlob({type:`image/webp`,quality:.7});d||(u=[...u,{url:URL.createObjectURL(i),startTime:e.timestamp,endTime:e.endTime}].sort((e,t)=>e.startTime-t.startTime),b())},S=()=>{if(p||d||_)return;if(g){g=!1;let e=v;w(T(e)).then(()=>{E(e),S()});return}if(!f.length)return;let e=f.splice(y(),1)[0];p=!0,x(e).catch(()=>{e.attempts+=1,e.done=e.attempts>=hv}).finally(()=>{p=!1,S()})},C=e=>{e.done=!0,f.push(e),S()},w=async e=>{_=!0;try{let t=await Promise.race([s.init(),new Promise((e,t)=>setTimeout(()=>t(Error(`timed out`)),yv))]);if(d)return;h=e;let n=l(t.indexes);if(!n.length)return;let r=new Map(u.map(e=>[e.startTime,e]));for(let e of n)r.has(e.timestamp)&&(e.done=!0);c=n;let i=new Set(n.map(e=>e.timestamp));for(let e of u)i.has(e.startTime)||URL.revokeObjectURL(e.url);u=n.filter(e=>r.has(e.timestamp)).map(e=>({url:r.get(e.timestamp).url,startTime:e.timestamp,endTime:e.endTime})),f.length=0,b()}catch{}finally{_=!1}},T=e=>e?e.reduce((e,[,t])=>Math.max(e,t),0):r,E=e=>{for(let t of c)t.done||(!e||e.some(([e,n])=>e<=t.startByte&&t.endByte<=n))&&C(t)};return b(),{update:e=>{if(d)return;v=e;let t=T(e);h<0?h=t:(t>=Math.max(h*_v,h+vv)||t>=r&&h<r)&&(g=!0),E(e),S()},prioritize:e=>{d||(m=e)},destroy:()=>{d=!0,f.length=0;for(let e of u)URL.revokeObjectURL(e.url);u=[],lv(s)}}}catch(e){throw lv(s),e}},xv=1280,Sv=1920,Cv=100,wv=1e3/60,Tv=250,Ev=2,Dv=100,Ov=1e3,kv,Av=e=>{kv?.close();let t=()=>{clearTimeout(r),e.mirror.removeEventListener(`leavepictureinpicture`,n),kv=void 0},n=()=>{t(),document.pictureInPictureElement===e.mirror&&document.exitPictureInPicture().catch(()=>{});for(let t of e.stream.getTracks())t.stop();e.mirror.remove()},r=setTimeout(n,Ov);e.mirror.addEventListener(`leavepictureinpicture`,n),kv={session:e,close:n,cancel:t}},jv=()=>{let e=kv;return e?.cancel(),e?.session},Mv=()=>typeof HTMLCanvasElement<`u`&&`captureStream`in HTMLCanvasElement.prototype,Nv=()=>typeof document<`u`&&typeof HTMLVideoElement<`u`&&typeof HTMLVideoElement.prototype.requestPictureInPicture==`function`&&!!document.pictureInPictureEnabled,Pv=()=>typeof HTMLVideoElement<`u`&&`mozCaptureStream`in HTMLVideoElement.prototype,Fv=()=>Mv()?Nv()?`window`:Pv()?`burn-in`:null:null,Iv=e=>{let{video:t,subtitles:n}=e,r=e.mode??Fv()??`window`,i=e.maxWidth??(r===`burn-in`?Sv:xv),a,o,s,c=0,l=0,u=0,d=!1,f=!1,p=!1,m=!1,h,g=()=>r===`burn-in`?!!a:!!a&&document.pictureInPictureElement===a.mirror,_=(e,r)=>{r.drawImage(t,0,0,e.width,e.height);let i=n.querySelector(`canvas`);i&&i.width>0&&i.height>0&&Math.abs(t.currentTime-u)<=Ev&&r.drawImage(i,0,0,e.width,e.height)},v=()=>{let e=Math.min(t.videoWidth||i,i);return{width:e,height:Math.round(e*((t.videoHeight||9)/(t.videoWidth||16)))}},y=()=>{if(!a)return;let{composite:e,context:n}=a,{width:r,height:i}=v();t.videoWidth&&(e.width!==r||e.height!==i)&&Object.assign(e,{width:r,height:i}),l=performance.now(),_(e,n)},b=`requestVideoFrameCallback`in t,x=()=>{c=performance.now(),u=t.currentTime,y(),S()},S=()=>{!m&&a&&(o=b?t.requestVideoFrameCallback(x):requestAnimationFrame(x))},C=()=>{o!==void 0&&(b?t.cancelVideoFrameCallback(o):cancelAnimationFrame(o)),s!==void 0&&clearInterval(s),o=void 0,s=void 0},w=()=>{`mediaSession`in navigator&&(navigator.mediaSession.playbackState=t.paused?`paused`:`playing`)},T=()=>{d||f||!t.paused||t.play().catch(()=>{})},E=()=>{d||f||(t.paused||t.pause(),r!==`burn-in`&&(d=!0,a?.mirror.play().catch(()=>{}).finally(()=>{d=!1})))},D=()=>{w(),a?.mirror.play().catch(()=>{})},O=()=>{w(),r===`burn-in`&&a?.mirror.pause()},k=()=>{if(r!==`burn-in`||!a||!t.paused||f)return;f=!0;let{mirror:e}=a;y(),e.play().then(()=>new Promise(e=>{setTimeout(e,Dv)})).catch(()=>{}).finally(()=>{e.pause(),setTimeout(()=>{f=!1},Dv)})},A=[[`play`,()=>{t.play().catch(()=>{})}],[`pause`,()=>t.pause()]],j=e=>{if(`mediaSession`in navigator)for(let[t,n]of A)try{navigator.mediaSession.setActionHandler(t,e?n:null)}catch{}},M=()=>{u=t.currentTime,S(),s=setInterval(()=>{let e=performance.now();e-c<Cv||t.paused&&e-l<Tv||y()},wv)},N=e=>{e.addEventListener(`play`,T),e.addEventListener(`pause`,E),e.addEventListener(`leavepictureinpicture`,I),t.addEventListener(`play`,D),t.addEventListener(`pause`,O),t.addEventListener(`seeked`,k),j(!0),w()},P=()=>{C(),j(!1),t.removeEventListener(`play`,D),t.removeEventListener(`pause`,O),t.removeEventListener(`seeked`,k);let e=a;return a=void 0,e?.mirror.removeEventListener(`play`,T),e?.mirror.removeEventListener(`pause`,E),e?.mirror.removeEventListener(`leavepictureinpicture`,I),e},F=()=>{let e=P();if(e){for(let t of e.stream.getTracks())t.stop();e.mirror.remove()}h?.()},I=()=>F(),L=()=>{let e=t.style.visibility;t.style.visibility=`hidden`,h=()=>{h=void 0,t.style.visibility=e}},R=e=>{let r=t.style.opacity,i=n.style.display;e.style.cssText=`position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#000;z-index:1`,t.style.opacity=`0`,n.style.display=`none`,h=()=>{h=void 0,t.style.opacity=r,n.style.display=i}},ee=async()=>{let n=Object.assign(document.createElement(`canvas`),v()),i=n.getContext(`2d`);if(!i)throw Error(`the picture in picture composite has no 2d context`);let o=document.createElement(`video`);o.muted=!0,o.playsInline=!0,r===`burn-in`?R(o):o.style.cssText=`position:fixed;width:1px;height:1px;opacity:0;pointer-events:none;left:-1px;top:-1px`,_(n,i);let s={composite:n,context:i,stream:n.captureStream(),mirror:o};if(a=s,o.srcObject=s.stream,(e.container??(r===`burn-in`?t.parentElement:null)??document.body).appendChild(o),M(),o.play().catch(()=>{}),o.readyState===0&&await new Promise(e=>{let t=()=>{clearTimeout(n),e()},n=setTimeout(t,1e3);o.addEventListener(`loadedmetadata`,t,{once:!0})}),m||a!==s){o.remove();return}if(N(o),r===`burn-in`){t.paused&&o.pause(),e.onBurnedInChange?.(!0);return}await o.requestPictureInPicture(),a===s&&L()},z=async()=>{if(!(m||p)){p=!0;try{if(g()){if(r===`burn-in`){F(),e.onBurnedInChange?.(!1);return}await document.exitPictureInPicture().catch(()=>{});return}r!==`burn-in`&&document.pictureInPictureElement&&await document.exitPictureInPicture().catch(()=>{});try{await ee()}catch(t){console.warn(`subtitle compositing for picture in picture failed`,t),F(),r===`burn-in`&&e.onBurnedInChange?.(!1)}}finally{p=!1}}},B=r===`window`?jv():void 0;return B&&(a=B,B.context.fillRect(0,0,B.composite.width,B.composite.height),M(),N(B.mirror),L()),{toggle:z,mode:r,destroy:()=>{if(m=!0,r===`window`&&g()){let e=P();return h?.(),Av(e)}F(),r===`burn-in`&&e.onBurnedInChange?.(!1)}}},Lv=`aa ab ae af ak am an ar as av ay az ba be bg bi bm bn bo br bs ca ce ch co cr cs cu cv cy da de dv dz ee el en eo es et eu fa ff fi fj fo fr fy ga gd gl gn gu gv ha he hi ho hr ht hu hy hz ia id ie ig ii ik io is it iu ja jv ka kg ki kj kk kl km kn ko kr ks ku kv kw ky la lb lg li ln lo lt lu lv mg mh mi mk ml mn mr ms mt my na nb nd ne ng nl nn no nr nv ny oc oj om or os pa pi pl ps pt qu rm rn ro ru rw sa sc sd se sg si sk sl sm sn so sq sr ss st su sv sw ta te tg th ti tk tn to tr ts tt tw ty ug uk ur uz ve vi vo wa wo xh yi yo za zh zu fil yue`.split(` `),Rv=[`en-US`,`en-GB`,`es-419`,`es-ES`,`fr-CA`,`pt-BR`,`pt-PT`,`zh-Hans`,`zh-Hant`],zv=new Set([`und`,`zxx`,`mul`,`mis`]),Bv=/sign|song|forced|commentary|karaoke|descri/i,Vv=/full|dialog/i,Hv=new Set([`CC`,`HI`,`AD`]),Uv=e=>e.normalize(`NFKC`).toLowerCase().replace(/\s+/g,` `).trim(),Wv=new Intl.DisplayNames([`en`],{type:`language`,fallback:`none`}),Gv=e=>{if(/^[a-z]{2,3}(?:[-_][a-z\d]{2,8})*$/i.test(e))try{let t=new Intl.Locale(e.replace(/_/g,`-`));return zv.has(t.language)||!Wv.of(t.language)?void 0:{language:t.language,variant:t.region??t.script}}catch{return}},Kv,qv=()=>{if(Kv)return Kv;let e=new Map,t=[...new Set([`en`,globalThis.navigator?.language].filter(e=>!!e))],n=(t,n,r)=>{try{let i=new Intl.DisplayNames([n],{type:`language`,languageDisplay:r,fallback:`none`}).of(t);i&&!e.has(Uv(i))&&e.set(Uv(i),t)}catch{}};for(let e of Rv)for(let r of[...t,e])for(let t of[`dialect`,`standard`])n(e,r,t);for(let e of Lv)for(let r of[...t,e])n(e,r,`dialect`);return Kv=e},Jv,Yv=()=>{if(Jv)return Jv;let e=new Map,t=[`en`,globalThis.navigator?.language,...Rv].filter(e=>!!e);for(let n of new Set(Rv.map(e=>new Intl.Locale(e).region).filter(e=>!!e)))for(let r of t)try{let t=new Intl.DisplayNames([r],{type:`region`,fallback:`none`}).of(n);t&&e.set(Uv(t),n)}catch{}return Jv=e},Xv=e=>{let t=e?.trim();if(!t)return;let n=qv(),r=n.get(Uv(t));if(r)return Gv(r);let[,i,a]=/^([^([]+)(?:\(([^)]*)\))?/.exec(t.normalize(`NFKC`))??[],o=i?n.get(Uv(i)):void 0;if(!o)return;let s=a?.trim(),c=!s||Hv.has(s)?void 0:/^(?:[A-Z]{2}|\d{3})$/.test(s)?s:Yv().get(Uv(s));return(c?Gv(`${o}-${c}`):void 0)??Gv(o)},Zv=e=>{let t=e?.trim();return t?Gv(t)??Xv(t):void 0},Qv=e=>Zv(e?.language)?e.language.trim():Xv(e?.title)?e.title.trim():void 0,$v=({language:e=``,title:t=``})=>{let n=`${e} ${t}`;return Bv.test(n)&&!Vv.test(n)},ey=({language:e,title:t})=>{let n=Zv(e),r=Xv(t);return n&&!n.variant&&r?.variant&&r.language===n.language?r:n??r},ty=(e,t)=>{let n=Zv(e),r=-1,i=0;return n&&t.forEach((t,a)=>{let o=ey(t);if(o?.language!==n.language)return;let s=Qv(t),c=1+ +(o.variant===n.variant)+(s&&Uv(s)===Uv(e)?2:0)+($v(t)?0:4);c>i&&(r=a,i=c)}),r===-1?t.findIndex(({title:t})=>!!t?.trim()&&Uv(t)===Uv(e)):r},ny=(e,t)=>{let n=e&&(Zv(e.language)??Xv(e.title));return!!n&&Zv(t)?.language===n.language},ry=(e,t,{audio:n,original:r,subtitles:i,alwaysSubtitles:a=!0})=>{let o=n===void 0?-1:ty(n,e),s=o!==-1&&!$v(e[o])?o:-1,c=s!==-1||r===void 0?s:ty(r,e);return i===null?{audio:c,subtitles:null}:i===void 0?{audio:c,subtitles:-1}:{audio:c,subtitles:!a&&ny(e[Math.max(c,0)],i)?null:ty(i,t)}},iy=`#0000`,ay=(e,t)=>{if(!t)return[];let n=new Set;for(let{start:r,end:i}of e)for(let e of[r,i]){let r=e/t;r<=.005||r>=.995||n.add(Number((r*100).toFixed(4)))}return n.size?[0,...[...n].sort((e,t)=>e-t),100]:[]},oy=(e,t)=>{let n=e.length-2,r=[];for(let i=0;i<=n;i+=1){let a=e[i],o=e[i+1],s=i===0?`0%`:`calc(${a}% + 1px)`,c=i===n?`100%`:`calc(${o}% - 1px)`;r.push(`${t(i)?`#000`:iy} ${s} ${c}`),i!==n&&r.push(`${iy} calc(${o}% - 1px) calc(${o}% + 1px)`)}return`linear-gradient(90deg, ${r.join(`, `)})`},sy=new Set([`op`,`ops`,`opening`,`openings`,`ncop`,`オープニング`,`op主題歌`]),cy=new Set([`ed`,`eds`,`ending`,`endings`,`nced`,`credits`,`endcard`,`endroll`,`エンディング`,`エンドカード`,`エンドロール`,`ed主題歌`]),lee=new Set([`intro`,`イントロ`]),uee=new Set([`outro`,`アウトロ`]),ly={"credits start":`ending`,"credits end":null,"preview end":null,"end credits":`ending`,"closing credits":`ending`},dee=new Set([`theme`,`themes`,`song`,`sequence`,`nc`,`non`,`credit`,`creditless`,`textless`,`clean`,`tv`,`size`,`version`,`ver`,`full`,`the`,`主題歌`,`ノンクレジット`]),uy=new Set([`post`,`pre`,`after`,`before`,`non`]),dy=/[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u,fy=e=>!e.trim()||/^chapter\s*\d+$/i.test(e.trim())||/^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()),py=e=>e.replace(/([a-z-ヿ一-鿿])\s*\d+\s*$/u,`$1`).split(/[\s_]+/u).map(e=>e.replace(/^[^\w-ヿ一-鿿]+|[^\w-ヿ一-鿿]+$/gu,``)).filter(e=>e&&!/^\d+$/.test(e)&&!dee.has(e)),my=(e,t)=>{if(sy.has(e))return`opening`;if(cy.has(e))return`ending`;if(t){if(lee.has(e))return`opening`;if(uee.has(e))return`ending`}},hy=(e,t)=>{if(fy(e))return;let n=e.trim().toLowerCase().replace(/\s+/gu,` `);if(n in ly)return ly[n]??void 0;let r=n.split(dy).map(e=>e.trim()).filter(Boolean);if(r.some(e=>e.split(/[\s_]+/u).some(e=>uy.has(e))))return;let i=r.length>1?[r[0],r.at(-1)]:r;for(let e of i){let n=py(e);if(n.length!==1)continue;let r=my(n[0],t);if(r)return r}},gy=15,_y=87,vy=93,yy=e=>{let t=e.map(()=>void 0),n=e.at(-1)?.end??0;if(!n)return t;let r=e.map((e,t)=>({index:t,start:e.start,length:e.end-e.start})).filter(({length:e})=>e>=_y&&e<=vy),i=n/2,a=r.filter(({start:e})=>e<i),o=r.filter(({start:e})=>e>=i);return a.length===1&&(t[a[0].index]=`opening`),o.length===1&&(t[o[0].index]=`ending`),t},by=e=>{let t=e.map(({title:e})=>hy(e,!1)),n=e.reduce((e,n,r)=>e+(t[r]?n.end-n.start:0),0),r=e.reduce((e,t)=>e+(t.end-t.start),0);if(r>0&&n*2>r)return e.map(()=>void 0);let i=e.map((e,n)=>{if(e.end-e.start<gy)return;let r=t[n];if(r)return r;let i=hy(e.title,!0);return i&&!t.includes(i)?i:void 0});return e.every(({title:e})=>fy(e))?yy(e):i};function xy(e){return typeof e==`function`}function Sy(e){return e===null}function Cy(e){return e===void 0}function wy(e){return typeof e==`object`&&!!e}var Ty=Object.prototype.hasOwnProperty;function Ey(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Ty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Dy=new Map,Oy=new Set;function ky(e){return e.trim().replaceAll(`_`,`-`).toLowerCase()}function Ay(e){let t=e.indexOf(`-x-`),n=(t===-1?e:e.slice(0,t)).indexOf(`-u-`);return n===-1?e:e.slice(0,n)+(t===-1?``:e.slice(t))}function jy(e){if(e[0]!==`zh`)return;let t=e.find(e=>e===`hant`||e===`hans`);return t===`hant`?`zh-tw`:t===`hans`?`zh-cn`:void 0}function My(e){return Ay(ky(e))}function Ny(e){let t=My(e);if(!t)return[`en`];let n=t.split(`-`).filter(Boolean),r=[];for(let e=n.length;e>=1;e--)r.push(n.slice(0,e).join(`-`));let i=jy(n),a=r.indexOf(`zh`);i&&a!==-1&&r.splice(a,0,i);let o=[],s=new Set;for(let e of r)s.has(e)||(s.add(e),o.push(e));return s.has(`en`)||o.push(`en`),o}function Py(e){let t={};for(let n=e.length-1;n>=0;n--){let r=e[n],i=Dy.get(r);i&&Object.assign(t,i)}return t}function Fy(e){return Py(Ny(e))}function Iy(e){return Oy.add(e),()=>{Oy.delete(e)}}var Ly=/\{([^{}]+)\}/g;function Ry(e,t){return t?e.replace(Ly,(e,n)=>Object.hasOwn(t,n)?String(t[n]):e):e}function zy(e,t){return(t,n)=>{let r=n,i=typeof t!=`string`,a=i?t.key:t,o=e[a],s=r?.default,c=r?{...r}:void 0;return c&&delete c.default,Ry(o??(i?t.text:s)??String(a),c)}}var By=(0,p.createContext)(null);(0,p.createContext)(void 0);function Vy(){let e=(0,p.useContext)(By),[t,n]=(0,p.useReducer)(e=>e+1,0);(0,p.useEffect)(()=>Iy(()=>n()),[]);let r=(0,p.useMemo)(()=>zy(Fy(`en`),`en`),[t]);return e?e.translator:r}function Hy(e,t,n){return new Promise((r,i)=>{let a=()=>{i(n?.signal?.reason??`Aborted`)};if(n?.signal?.aborted){a();return}n?.signal?.addEventListener(`abort`,a,{once:!0}),e.addEventListener(t,e=>{n?.signal?.removeEventListener(`abort`,a),r(e)},{...n,once:!0})})}function Uy(e=document){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function Wy(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Gy(e){return e instanceof Node&&e.nodeType===11&&`host`in e}function Ky(e){return e.kind===`captions`||e.kind===`subtitles`}function qy(e,t){if(!(e instanceof HTMLElement))return null;for(let n of e.querySelectorAll(`track`))if(n.track===t)return n;return null}function Jy(e,t){return e.textTracks?Array.from(e.textTracks).filter(t).sort(Yy):[]}function Yy(e,t){return e.kind>t.kind?1:e.kind<t.kind?-1:0}function Xy(e){let t=[];for(let n=0;n<e.length;n++)t.push([e.start(n),e.end(n)]);return t}function Zy(e,t){let n=t;for(;n;){if(n===e||e.contains(n))return!0;let t=n.getRootNode();n=Gy(t)?t.host:n.parentNode}return!1}function Qy(){return`WebKitPlaybackTargetAvailabilityEvent`in globalThis}function $y(e){return Qy()&&`webkitCurrentPlaybackTargetIsWireless`in e}function eb(e,t){if(xy(e))return e(t);e!=null&&(e.current=t)}function tb(...e){let t=e.flat();return e=>{let n=t.map(t=>eb(t,e));if(n.some(xy))return()=>{for(let e=0;e<n.length;e++){let r=n[e];xy(r)?r():eb(t[e],null)}}}}function nb(...e){return(0,p.useCallback)(tb(...e),[...e])}function rb(e,t,n,r=Ey){let i=(0,p.useRef)(void 0),a=()=>{let e=n(t());return i.current!==void 0&&r(i.current,e)?i.current:(i.current=e,e)};return(0,p.useSyncExternalStore)(e,a,a)}function ib(e){return e}function ab(...e){}var ob=()=>ab;function sb(e,t,n){return rb(t?t=>e.subscribe(t):ob,t?()=>e.state:()=>e,t??ib,n)}var cb=(0,p.createContext)(null);function lb({value:e,children:t}){return(0,Kr.jsx)(cb.Provider,{value:e,children:t})}function ub(){let e=(0,p.useContext)(cb);if(!e)throw Error(`usePlayerContext must be used within a Player Provider`);return e}function db(){let{media:e}=ub();return e}function fb(){return(0,p.useContext)(cb)?.setMedia}function pb(){return(0,p.useContext)(cb)?.setContainer}function mb(e){if(`any`in AbortSignal)return AbortSignal.any(e);let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(n.reason),t.signal;n.addEventListener(`abort`,()=>t.abort(n.reason),{signal:t.signal})}return t.signal}var hb=class{#e=new AbortController;#t=new Map;get base(){return this.#e.signal}clear(){for(let e of this.#t.values())e.abort();this.#t.clear()}reset(){this.clear(),this.#e.abort(),this.#e=new AbortController}supersede(e){this.#t.get(e)?.abort();let t=new AbortController;return this.#t.set(e,t),mb([this.#e.signal,t.signal])}};function gb(...e){return{state:t=>{let n=e.map(e=>e.state(t));return Object.assign({},...n)},attach:t=>{for(let n of e)try{n.attach?.(t)}catch(e){t.reportError(e)}}}}var _b=class extends Error{code;cause;constructor(e,t){super(t?.message??e),this.name=`StoreError`,this.code=e,this.cause=t?.cause}};function vb(){throw new _b(`NO_TARGET`)}function yb(){throw new _b(`DESTROYED`)}function bb(){return e=>e}var xb=!1;function Sb(){xb||(xb=!0,queueMicrotask(wb))}var Cb=new Set;function wb(){xb=!1;for(let e of Cb)e.flush();Cb.clear()}var Tb=Object.prototype.hasOwnProperty,Eb=class{#e;#t=new Set;#n=!1;constructor(e){this.#e=Object.freeze({...e})}get current(){return this.#e}patch(e){let t={...this.#e},n=!1;for(let r in e){if(!Tb.call(e,r))continue;let i=e[r];Object.is(this.#e[r],i)||(t[r]=i,n=!0)}n&&(this.#e=Object.freeze(t),this.#r())}subscribe(e,t){let n=t?.signal;if(n?.aborted)return ab;if(this.#t.add(e),!n)return()=>this.#t.delete(e);let r=()=>this.#t.delete(e);return n.addEventListener(`abort`,r,{once:!0}),()=>{n.removeEventListener(`abort`,r),this.#t.delete(e)}}flush(){if(this.#n){this.#n=!1;for(let e of this.#t)e()}}#r(){this.#n=!0,Cb.add(this),Sb()}};function Db(e){return new Eb(e)}var Ob=Symbol.for(`@videojs/store`);function kb(){return(e,t={})=>{let n=null,r=!1,i=new AbortController,a=new hb,o;function s(){r&&yb(),n||vb()}let c=e.state({target:()=>(s(),n),signals:a,get:()=>o.current,set:e=>o.patch(e)});o=Db(c);let l={[Ob]:!0,get $state(){return o},get target(){return n},get destroyed(){return r},get state(){return o.current},attach:u,destroy:f,subscribe:p};for(let e of Object.keys(c))Object.defineProperty(l,e,{get:()=>o.current[e],enumerable:!0});try{t.onSetup?.({store:l,signal:i.signal})}catch(e){m(e)}return l;function u(i){r&&yb(),a.reset(),n=i;let s={target:i,signal:a.base,get:()=>o.current,set:e=>o.patch(e),reportError:m,store:{get state(){return o.current},subscribe:p}};try{e.attach?.(s)}catch(e){m(e)}try{t.onAttach?.({store:l,target:i,signal:a.base})}catch(e){m(e)}return d}function d(){Sy(n)||(a.reset(),n=null,o.patch(c))}function f(){r||(r=!0,d(),i.abort())}function p(e,t){return o.subscribe(e,t)}function m(e){t.onError?t.onError({store:l,error:e}):console.error(`[vjs-store]`,e)}}}var Ab=bb();function jb(e,t){if(arguments.length===1)return Ab(e);let{name:n,state:r,attach:i}=e,a=e=>Ab({...Cy(n)?{}:{name:n},state:t=>r(t,e),...i?{attach:t=>i(t,e)}:{}}),o=a(t),s=(e=>Cy(e)?o:a(e));return s.state=o.state,o.attach&&(s.attach=o.attach),Cy(n)||Object.defineProperty(s,"name",{value:n}),s}var Mb=Object.freeze({length:0,start:()=>0,end:()=>0}),Nb=Object.assign(new EventTarget,{length:0,*[Symbol.iterator](){},getTrackById:()=>null}),Pb=new EventTarget;Object.freeze({});function Fb(e){return e.readyState>=1}function Ib(e){if(!wy(e))return!1;let t=e;return!Cy(t.paused)&&!Cy(t.ended)&&xy(t.pause)}function Lb(e){if(!wy(e))return!1;let t=e;return!Cy(t.currentTime)&&!Cy(t.duration)&&!Cy(t.seeking)}function Rb(e){if(!wy(e))return!1;let t=e;return!Cy(t.src)&&!Cy(t.currentSrc)&&!Cy(t.readyState)&&xy(t.load)}function zb(e){if(!wy(e))return!1;let t=e;return!Cy(t.volume)&&!Cy(t.muted)}function Bb(e){return wy(e)?!Cy(e.playbackRate):!1}function Vb(e){if(!wy(e))return!1;let t=e;return!Cy(t.buffered)&&t.buffered!==Mb&&!Cy(t.seekable)&&t.seekable!==Mb}function Hb(e){return wy(e)?!Cy(e.error):!1}function Ub(e){if(!wy(e))return!1;let t=e;return!Cy(t.textTracks)&&t.textTracks!==Nb}function Wb(e){return wy(e)?!Cy(e.videoRenditions):!1}function Gb(e){return wy(e)?!Cy(e.audioTracks):!1}function Kb(e){if(!wy(e))return!1;let t=e;return!Cy(t.videoWidth)&&!Cy(t.videoHeight)}function qb(e){if(!wy(e))return!1;let t=e;return wy(t.remote)&&t.remote!==Pb}function Jb(e){return wy(e)&&`querySelectorAll`in e&&xy(e.querySelectorAll)}function Yb(e,t){return e.id||String(t)}function Xb(e){return{...e.id!==void 0&&{id:e.id},...e.kind!==void 0&&{kind:e.kind},label:e.label,language:e.language,enabled:e.enabled}}var Zb=jb({name:`audioTrack`,state:({target:e})=>({audioTrackList:[],selectAudioTrack(t){let{media:n}=e();if(!Gb(n))return;let r=[...n.audioTracks],i=r.find((e,n)=>Yb(e,n)===t);if(i)for(let e of r)e.enabled=e===i}}),attach({target:e,signal:t,set:n}){let{media:r}=e,i=null,a=null,o=()=>Gb(r)?r.audioTracks:null,s=(e=o())=>{n({audioTrackList:e?[...e].map(Xb):[]})},c=()=>{let e=o();if(e===i){s(e);return}a?.abort(),a=new AbortController,i=e,i&&(Wy(i,`addtrack`,()=>s(i),{signal:a.signal}),Wy(i,`removetrack`,()=>s(i),{signal:a.signal}),Wy(i,`change`,()=>s(i),{signal:a.signal})),s(i)};c(),Wy(r,`loadstart`,c,{signal:t}),t.addEventListener(`abort`,()=>a?.abort(),{once:!0})}}),Qb=jb({name:`buffer`,state:()=>({buffered:[],seekable:[]}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Vb(r))return;let i=()=>n({buffered:Xy(r.buffered),seekable:Xy(r.seekable)});i(),Wy(r,`progress`,i,{signal:t}),Wy(r,`emptied`,i,{signal:t})}}),$b=new WeakMap;function ex(e){return $b.get(e)}function tx(e){let t=e;if(wy(t.remote)&&`state`in t.remote&&`prompt`in t.remote)return t.remote}function nx(e){return tx(e)?.state===`connected`}function rx(e){return tx(e)?.state===`connecting`}async function ix(e){let t=tx(e);if(!t)throw new DOMException(`Remote playback not supported`,`NotSupportedError`);return t.prompt()}var ax=2e3,ox=250,sx=500,cx=jb({name:`controls`,state:({get:e,set:t})=>({userActive:!0,controlsVisible:!0,toggleControls(){let n=!e().userActive;return t({userActive:n,controlsVisible:n}),n}}),attach({target:e,signal:t,get:n,set:r}){let{media:i,container:a}=e;if(!Ib(i)||Sy(a))return;let o=e=>e||i.paused||nx(i)||rx(i),s;function c(){clearTimeout(s),s=void 0}function l(){c(),s=setTimeout(d,ax)}function u(){n().userActive||r({userActive:!0,controlsVisible:!0}),l()}function d(){c(),r({userActive:!1,controlsVisible:o(!1)})}r({toggleControls(){return n().controlsVisible?d():u(),n().controlsVisible}});let f=0,p=0,m=()=>p>0&&Date.now()-p<sx;function h(e){f=Date.now(),e.pointerType===`touch`&&(p=f)}function g(e){if(e.pointerType===`touch`&&(p=Date.now()),e.pointerType===`touch`&&Date.now()-f<ox){if(ex(a)?.claimsTap(e,`toggleControls`))return;let t=[i,a].includes(e.target);n().controlsVisible&&t?d():u()}else u()}let _=()=>{let{userActive:e}=n();r({controlsVisible:o(e)}),!i.paused&&e&&l()};function v(e){if(e.pointerType===`touch`){n().userActive&&l();return}u()}if(Wy(a,`pointermove`,v,{signal:t}),Wy(a,`pointerdown`,h,{signal:t}),Wy(a,`pointerup`,g,{signal:t}),Wy(a,`keyup`,u,{signal:t}),Wy(a,`focusin`,()=>{m()||u()},{signal:t}),Wy(a,`mouseleave`,()=>{m()||d()},{signal:t}),Wy(i,`play`,_,{signal:t}),Wy(i,`pause`,_,{signal:t}),Wy(i,`ended`,_,{signal:t}),qb(i)){let e=()=>{let{userActive:e}=n();r({controlsVisible:o(e)})};Wy(i.remote,`connect`,e,{signal:t}),Wy(i.remote,`connecting`,e,{signal:t}),Wy(i.remote,`disconnect`,e,{signal:t})}t.addEventListener(`abort`,c,{once:!0}),l()}}),lx=jb({name:`error`,state:({set:e})=>({error:null,dismissError(){e({error:null})}}),attach({target:e,signal:t,set:n}){let{media:r}=e;Hb(r)&&(Wy(r,`error`,()=>n({error:r.error}),{signal:t}),Wy(r,`emptied`,()=>n({error:null}),{signal:t}))}});function ux(){let e=document;return e.fullscreenEnabled||e.webkitFullscreenEnabled?!0:xy(document.createElement(`video`).webkitSetPresentationMode)}function dx(){let e=document;return e.fullscreenElement??e.webkitFullscreenElement??null}function fx(e){if(!(e instanceof Element))return!1;try{return e.matches(`:fullscreen`)}catch{return!1}}function px(e,t){if(t.webkitPresentationMode===`fullscreen`)return!0;let n=dx();return n&&(n===e||n===t)||fx(e)||fx(t)?!0:t.isFullscreen??!1}async function mx(e,t){let n=document;if(e&&(n.fullscreenEnabled||n.webkitFullscreenEnabled)){let t=e;if(xy(t.requestFullscreen))return t.requestFullscreen();if(xy(t.webkitRequestFullscreen))return t.webkitRequestFullscreen()}let r=t;if(xy(r.webkitSetPresentationMode)){r.webkitSetPresentationMode(`fullscreen`);return}let i=t;if(xy(i.requestFullscreen))return i.requestFullscreen()}async function hx(e){let t=document,n=e;if(n.webkitPresentationMode===`fullscreen`&&xy(n.webkitSetPresentationMode)){n.webkitSetPresentationMode(`inline`);return}if(xy(t.exitFullscreen))return t.exitFullscreen();if(xy(t.webkitExitFullscreen))return t.webkitExitFullscreen();let r=e;if(xy(r.exitFullscreen))return r.exitFullscreen()}function gx(){if(document.pictureInPictureEnabled){let e=/.*Version\/.*Safari\/.*/.test(navigator.userAgent),t=typeof matchMedia==`function`&&matchMedia(`(display-mode: standalone)`).matches;return!e||!t}return xy(document.createElement(`video`).webkitSetPresentationMode)}function _x(e){return e.webkitPresentationMode===`picture-in-picture`||document.pictureInPictureElement===e?!0:e.isPictureInPicture??!1}async function vx(e){let t=e;if(xy(t.webkitSetPresentationMode)){t.webkitSetPresentationMode(`picture-in-picture`);return}let n=e;if(xy(n.requestPictureInPicture))return n.requestPictureInPicture()}async function yx(e){let t=e;if(t.webkitPresentationMode===`picture-in-picture`&&xy(t.webkitSetPresentationMode)){t.webkitSetPresentationMode(`inline`);return}if(xy(document.exitPictureInPicture))return document.exitPictureInPicture();let n=e;if(xy(n.exitPictureInPicture))return n.exitPictureInPicture()}var bx=jb({name:`fullscreen`,state:({target:e})=>({fullscreen:!1,fullscreenAvailability:`unavailable`,async requestFullscreen(){let{media:t,container:n}=e();return _x(t)&&await yx(t),mx(n,t)},async exitFullscreen(){let{media:t}=e();return hx(t)},async toggleFullscreen(){let{media:t,container:n}=e();return px(n,t)?hx(t):(_x(t)&&await yx(t),mx(n,t))}}),attach({target:e,signal:t,set:n}){let{media:r,container:i}=e;n({fullscreenAvailability:ux()?`available`:`unsupported`});let a=()=>n({fullscreen:px(i,r)});a(),Wy(document,`fullscreenchange`,a,{signal:t}),Wy(document,`webkitfullscreenchange`,a,{signal:t}),`webkitPresentationMode`in r&&Wy(r,`webkitpresentationmodechanged`,a,{signal:t})}}),xx=jb({name:`pip`,state:({target:e})=>({pip:!1,pipAvailability:`unavailable`,async requestPictureInPicture(){let{media:t,container:n}=e();return px(n,t)&&await hx(t),vx(t)},async exitPictureInPicture(){let{media:t}=e();return yx(t)},async togglePictureInPicture(){let{media:t,container:n}=e();return _x(t)?yx(t):(px(n,t)&&await hx(t),vx(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;n({pipAvailability:gx()?`available`:`unsupported`});let i=()=>n({pip:_x(r)});i(),Wy(r,`enterpictureinpicture`,i,{signal:t}),Wy(r,`leavepictureinpicture`,i,{signal:t}),`webkitPresentationMode`in r&&Wy(r,`webkitpresentationmodechanged`,i,{signal:t})}}),Sx=jb({name:`playback`,state:({target:e})=>({paused:!0,ended:!1,started:!1,waiting:!1,play(){return e().media.play()},pause(){let{media:t}=e();Ib(t)&&t.pause()},togglePaused(){let t=e().media;return Ib(t)?t.paused?(t.play(),!0):(t.pause(),!1):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Ib(r)||!Lb(r)||!Rb(r))return;let i=()=>n({paused:r.paused,ended:r.ended,started:!r.paused||r.currentTime>0,waiting:r.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&!r.paused});i(),Wy(r,`emptied`,i,{signal:t}),Wy(r,`play`,i,{signal:t}),Wy(r,`pause`,i,{signal:t}),Wy(r,`ended`,i,{signal:t}),Wy(r,`playing`,i,{signal:t}),Wy(r,`waiting`,i,{signal:t}),Wy(r,`seeked`,i,{signal:t})}}),Cx=[.2,.5,.7,1,1.2,1.5,1.7,2],wx=jb({name:`playbackRate`,state:({target:e})=>({playbackRates:Cx,playbackRate:1,setPlaybackRate(t){let{media:n}=e();Bb(n)&&(n.playbackRate=t)}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Bb(r))return;let i=()=>n({playbackRate:r.playbackRate});i(),Wy(r,`ratechange`,i,{signal:t})}}),Tx=`auto`;function Ex(e,t){return e.id||String(t)}function Dx(e){return{...e.id!==void 0&&{id:e.id},...e.width!==void 0&&{width:e.width},...e.height!==void 0&&{height:e.height},...e.bitrate!==void 0&&{bitrate:e.bitrate},...e.frameRate!==void 0&&{frameRate:e.frameRate},...e.codec!==void 0&&{codec:e.codec},selected:e.selected}}function Ox(e){return e.width&&e.height?Math.min(e.width,e.height):e.height??e.width}var kx=jb({name:`quality`,state:({target:e})=>({videoRenditionList:[],activeVideoRendition:null,selectVideoRendition(t){let{media:n}=e();if(!Wb(n))return;if(t===Tx){n.videoRenditions.selectedIndex=-1;return}let r=[...n.videoRenditions].findIndex((e,n)=>Ex(e,n)===t);r!==-1&&(n.videoRenditions.selectedIndex=r)}}),attach({target:e,signal:t,set:n}){let{media:r}=e,i=null,a=null,o=()=>Wb(r)?r.videoRenditions:null,s=e=>{if(!e)return null;let t=[...e],n=t.find(e=>e.active);if(n)return n;if(!Kb(r)||!r.videoWidth&&!r.videoHeight)return null;let i=Ox({width:r.videoWidth||void 0,height:r.videoHeight||void 0}),a=t.filter(e=>Ox(e)===i);return a.length===1?a[0]:null},c=(e=o())=>{let t=s(e);n({videoRenditionList:e?[...e].map(Dx):[],activeVideoRendition:t?Dx(t):null})},l=()=>{let e=o();if(e===i){c(e);return}a?.abort(),a=new AbortController,i=e,i&&(Wy(i,`addrendition`,()=>c(i),{signal:a.signal}),Wy(i,`removerendition`,()=>c(i),{signal:a.signal}),Wy(i,`change`,()=>c(i),{signal:a.signal}),Wy(i,`activechange`,()=>c(i),{signal:a.signal})),c(i)};l(),Wy(r,`loadstart`,l,{signal:t}),Wy(r,`resize`,()=>c(i),{signal:t}),t.addEventListener(`abort`,()=>a?.abort(),{once:!0})}}),Ax=jb({name:`remotePlayback`,state:({target:e})=>({remotePlaybackState:`disconnected`,remotePlaybackAvailability:`unsupported`,async toggleRemotePlayback(){let{media:t,container:n}=e();return nx(t)?ix(t):(px(n,t)&&await hx(t),await ix(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!qb(r))return;if($y(r)){let e=()=>{n({remotePlaybackState:r.webkitCurrentPlaybackTargetIsWireless?`connected`:`disconnected`})};Wy(r,`webkitplaybacktargetavailabilitychanged`,e=>{let{availability:t}=e;n({remotePlaybackAvailability:t===`available`?`available`:`unavailable`})},{signal:t}),Wy(r,`webkitcurrentplaybacktargetiswirelesschanged`,e,{signal:t}),e();return}let i=()=>n({remotePlaybackState:r.remote.state});i(),Wy(r.remote,`connect`,i,{signal:t}),Wy(r.remote,`connecting`,i,{signal:t}),Wy(r.remote,`disconnect`,i,{signal:t}),r.remote.watchAvailability(e=>{n({remotePlaybackAvailability:e?`available`:`unavailable`})}).catch(()=>{n({remotePlaybackAvailability:`unsupported`})}),t.addEventListener(`abort`,()=>{r.remote?.cancelWatchAvailability?.().catch(()=>{})})}}),jx=jb({name:`source`,state:({target:e,signals:t})=>({source:null,canPlay:!1,loadSource(n){t.clear();let{media:r}=e();return Rb(r)?(r.src=n,r.load(),n):n}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Rb(r))return;let i=()=>n({source:r.currentSrc||r.src||null,canPlay:r.readyState>=HTMLMediaElement.HAVE_ENOUGH_DATA});i(),Wy(r,`canplay`,i,{signal:t}),Wy(r,`canplaythrough`,i,{signal:t}),Wy(r,`loadstart`,i,{signal:t}),Wy(r,`emptied`,i,{signal:t})}});function Mx(e,t){return e.id||`track:${t}:${e.kind}:${e.language}:${e.label}`}var Nx=jb({name:`textTrack`,state:({target:e})=>({chaptersCues:[],thumbnailCues:[],thumbnailTrackSrc:null,textTrackList:[],subtitlesShowing:!1,toggleSubtitles(t){let{media:n}=e();if(!Ub(n))return!1;let r=Jy(n,Ky);if(!r.length)return!1;let i=r.some(e=>e.mode===`showing`),a=t??!i;for(let e of r)e.mode=a?`showing`:`disabled`;return a},selectSubtitlesTrack(t){let{media:n}=e();if(!Ub(n))return;let r=Array.from(n.textTracks).map((e,t)=>({index:t,track:e})).filter(({track:e})=>Ky(e));if(!r.length)return;if(t===`off`){for(let{track:e}of r)e.mode=`disabled`;return}let i=r.find(({index:e,track:n})=>Mx(n,e)===t)?.track;if(i)for(let{track:e}of r)e.mode=e===i?`showing`:`disabled`}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Ub(r))return;let i=null,a=()=>{i?.abort(),i=new AbortController;let e=null,t=null,o=[],s=!1;for(let n=0;n<r.textTracks.length;n++){let i=r.textTracks[n];!e&&i.kind===`chapters`&&(e=i),!t&&i.kind===`metadata`&&i.label===`thumbnails`&&(t=i),o.push({id:Mx(i,n),kind:i.kind,label:i.label,language:i.language,mode:i.mode}),Ky(i)&&i.mode===`showing`&&(s=!0)}let c=e?.cues?Array.from(e.cues):[],l=t?.cues?Array.from(t.cues):[],u=null;t&&(u=qy(r,t)?.src??null);let d=Jb(r)&&r.querySelectorAll(`track`)||[],f=r instanceof HTMLElement&&r.shadowRoot?.querySelectorAll(`track`)||[];for(let e of[...d,...f])e.track?.cues?.length||Wy(e,`load`,a,{signal:i.signal});n({chaptersCues:c,thumbnailCues:l,thumbnailTrackSrc:u,textTrackList:o,subtitlesShowing:s})};a();let o=r.textTracks;o instanceof EventTarget&&(Wy(o,`addtrack`,a,{signal:t}),Wy(o,`removetrack`,a,{signal:t}),Wy(o,`change`,a,{signal:t})),Wy(r,`loadstart`,a,{signal:t}),t.addEventListener(`abort`,()=>i?.abort(),{once:!0})}}),Px={seek:Symbol.for(`@videojs/seek`)},Fx=jb({name:`time`,state:({target:e,signals:t,set:n})=>({currentTime:0,duration:0,seeking:!1,async seek(r){let{media:i}=e(),a=t.supersede(Px.seek);if(!Lb(i)||!Rb(i))return 0;if(!Fb(i)&&!await Hy(i,`loadedmetadata`,{signal:a}).catch(()=>!1))return i.currentTime;let o=Math.max(0,Math.min(r,i.duration||1/0));return n({currentTime:o,seeking:!0}),i.currentTime=o,await Hy(i,`seeked`,{signal:a}).catch(ab),i.currentTime}}),attach({target:e,signal:t,set:n,get:r}){let{media:i}=e;if(!Lb(i))return;let a=()=>{let{duration:e}=i;if(e===1/0&&Vb(i)){let{seekable:e}=i;return e.length>0?e.end(e.length-1):0}return Number.isFinite(e)?e:0},o=()=>n({currentTime:i.currentTime,duration:a(),seeking:i.seeking}),s=()=>{r().seeking||o()};o(),Wy(i,`timeupdate`,s,{signal:t}),Wy(i,`durationchange`,o,{signal:t}),Wy(i,`seeking`,o,{signal:t}),Wy(i,`seeked`,o,{signal:t}),Wy(i,`loadedmetadata`,o,{signal:t}),Wy(i,`emptied`,o,{signal:t}),Wy(i,`progress`,s,{signal:t})}}),Ix=.25,Lx=jb({name:`volume`,state:({target:e})=>({volume:1,muted:!1,volumeAvailability:`unavailable`,setVolume(t){let{media:n}=e();if(!zb(n))return 0;let r=Math.max(0,Math.min(1,t));return r>0&&n.muted&&(n.muted=!1),n.volume=r,n.volume},toggleMuted(){let{media:t}=e();return zb(t)?(t.muted||t.volume===0?(t.muted=!1,t.volume===0&&(t.volume=Ix)):t.muted=!0,t.muted):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!zb(r))return;n({volumeAvailability:Rx()});let i=()=>n({volume:r.volume,muted:r.muted});i(),Wy(r,`volumechange`,i,{signal:t})}});function Rx(){let e=document.createElement(`video`);try{return e.volume=.5,e.volume===.5?`available`:`unsupported`}catch{return`unsupported`}}var zx=[Sx,wx,kx,Zb,Lx,Fx,jx,Qb,bx,xx,Ax,cx,Nx,lx],Bx=`group`;function Vx(e){let t=Uy(e.ownerDocument);(!t||t===e.ownerDocument.body||!Zy(e,t))&&e.focus({preventScroll:!0})}function Hx(){let e=null;return{open(t){e!==t&&(e?.close(`group-open`),e=t)},close(t){e===t&&(e=null)}}}var Ux={key:`container.label`,text:`Media player`},Wx=(0,p.forwardRef)(function({children:e,tabIndex:t=0,role:n=Bx,"aria-label":r,"aria-labelledby":i,...a},o){let s=pb(),c=Vy(),l=(0,p.useRef)(null),u=nb(o,l);(0,p.useEffect)(()=>(s?.(l.current),()=>s?.(null)),[s]);let d=e=>{a.onPointerUp?.(e);let t=l.current;t&&Vx(t)};return(0,Kr.jsx)(`div`,{ref:u,role:n,tabIndex:t,...r!==void 0||i!==void 0?{"aria-label":r,"aria-labelledby":i}:{"aria-label":c(Ux)},...a,onPointerUp:d,children:e})});function Gx(e){let t=(0,p.useRef)(e);return t.current=e,t}function Kx(e,t,n){let r=(0,p.useRef)(null),i=Gx(t),a=Gx(n);(0,p.useEffect)(()=>(r.current===null?i.current?.():(clearTimeout(r.current),r.current=null),()=>{r.current=setTimeout(()=>{a.current?.(),e.destroy()},0)}),[e])}function qx(e){function t({children:t}){let[n,r]=(0,p.useState)(()=>kb()(gb(...e.features))),[i]=(0,p.useState)(()=>Hx()),[a,o]=(0,p.useState)(null),[s,c]=(0,p.useState)(null);return Kx(n),(0,p.useEffect)(()=>{if(a){if(n.destroyed){r(kb()(gb(...e.features)));return}return n.attach({media:a,container:s})}},[a,s,n]),(0,Kr.jsx)(lb,{value:(0,p.useMemo)(()=>({store:n,media:a,setMedia:o,container:s,setContainer:c,popupGroup:i}),[n,a,s,i]),children:t})}function n(e){let{store:t}=ub();return sb(t,e)}return{Provider:t,Container:Wx,usePlayer:n,useMedia:db}}var Jx=(e,t)=>{if(globalThis.navigator?.vendor===`Apple Computer, Inc.`)throw new DOMException(`A media element routed into Web Audio loses its volume and mute, or its sound, in this engine`,`NotSupportedError`);return e.createMediaElementSource(t)},Yx=Math.min,Xx=Math.max,Zx=Math.round,Qx=Math.floor,$x=e=>({x:e,y:e}),eS={left:`right`,right:`left`,bottom:`top`,top:`bottom`},tS={start:`end`,end:`start`};function nS(e,t,n){return Xx(e,Yx(t,n))}function rS(e,t){return typeof e==`function`?e(t):e}function iS(e){return e.split(`-`)[0]}function aS(e){return e.split(`-`)[1]}function oS(e){return e===`x`?`y`:`x`}function sS(e){return e===`y`?`height`:`width`}var cS=new Set([`top`,`bottom`]);function lS(e){return cS.has(iS(e))?`y`:`x`}function uS(e){return oS(lS(e))}function dS(e,t,n){n===void 0&&(n=!1);let r=aS(e),i=uS(e),a=sS(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=bS(o)),[o,bS(o)]}function fS(e){let t=bS(e);return[pS(e),t,pS(t)]}function pS(e){return e.replace(/start|end/g,e=>tS[e])}var mS=[`left`,`right`],hS=[`right`,`left`],gS=[`top`,`bottom`],_S=[`bottom`,`top`];function vS(e,t,n){switch(e){case`top`:case`bottom`:return n?t?hS:mS:t?mS:hS;case`left`:case`right`:return t?gS:_S;default:return[]}}function yS(e,t,n,r){let i=aS(e),a=vS(iS(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(pS)))),a}function bS(e){return e.replace(/left|right|bottom|top/g,e=>eS[e])}function xS(e){return{top:0,right:0,bottom:0,left:0,...e}}function SS(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:xS(e)}function CS(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function wS(e,t,n){let{reference:r,floating:i}=e,a=lS(t),o=uS(t),s=sS(o),c=iS(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(aS(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1)}return p}var TS=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=wS(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=wS(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function ES(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=rS(t,e),p=SS(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=CS(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=CS(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var DS=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=rS(e,t)||{};if(l==null)return{};let d=SS(u),f={x:n,y:r},p=uS(i),m=sS(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Yx(d[_],T),D=Yx(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=nS(O,A,k),M=!c.arrow&&aS(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),OS=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=rS(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=iS(r),_=lS(o),v=iS(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[bS(o)]:fS(o)),x=p!==`none`;!d&&x&&b.push(...yS(o,m,p,y));let S=[o,...b],C=await ES(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=dS(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===lS(t)||T.every(e=>lS(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=lS(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},kS=new Set([`left`,`top`]);async function AS(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=iS(n),s=aS(n),c=lS(n)===`y`,l=kS.has(o)?-1:1,u=a&&c?-1:1,d=rS(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var jS=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await AS(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},MS=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=rS(e,t),l={x:n,y:r},u=await ES(t,c),d=lS(iS(i)),f=oS(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=nS(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=nS(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[d]:o}}}}}};function NS(){return typeof window<`u`}function PS(e){return LS(e)?(e.nodeName||``).toLowerCase():`#document`}function FS(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function IS(e){return((LS(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function LS(e){return NS()?e instanceof Node||e instanceof FS(e).Node:!1}function RS(e){return NS()?e instanceof Element||e instanceof FS(e).Element:!1}function zS(e){return NS()?e instanceof HTMLElement||e instanceof FS(e).HTMLElement:!1}function BS(e){return!NS()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof FS(e).ShadowRoot}var VS=new Set([`inline`,`contents`]);function HS(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=tC(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!VS.has(i)}var US=new Set([`table`,`td`,`th`]);function WS(e){return US.has(PS(e))}var GS=[`:popover-open`,`:modal`];function KS(e){return GS.some(t=>{try{return e.matches(t)}catch{return!1}})}var qS=[`transform`,`translate`,`scale`,`rotate`,`perspective`],JS=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],YS=[`paint`,`layout`,`strict`,`content`];function XS(e){let t=QS(),n=RS(e)?tC(e):e;return qS.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||JS.some(e=>(n.willChange||``).includes(e))||YS.some(e=>(n.contain||``).includes(e))}function ZS(e){let t=rC(e);for(;zS(t)&&!eC(t);){if(XS(t))return t;if(KS(t))return null;t=rC(t)}return null}function QS(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var $S=new Set([`html`,`body`,`#document`]);function eC(e){return $S.has(PS(e))}function tC(e){return FS(e).getComputedStyle(e)}function nC(e){return RS(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rC(e){if(PS(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||BS(e)&&e.host||IS(e);return BS(t)?t.host:t}function iC(e){let t=rC(e);return eC(t)?e.ownerDocument?e.ownerDocument.body:e.body:zS(t)&&HS(t)?t:iC(t)}function aC(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=iC(e),i=r===e.ownerDocument?.body,a=FS(r);if(i){let e=oC(a);return t.concat(a,a.visualViewport||[],HS(r)?r:[],e&&n?aC(e):[])}return t.concat(r,aC(r,[],n))}function oC(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function sC(e){let t=tC(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=zS(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Zx(n)!==a||Zx(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function cC(e){return RS(e)?e:e.contextElement}function lC(e){let t=cC(e);if(!zS(t))return $x(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=sC(t),o=(a?Zx(n.width):n.width)/r,s=(a?Zx(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var uC=$x(0);function dC(e){let t=FS(e);return!QS()||!t.visualViewport?uC:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function fC(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==FS(e)?!1:t}function pC(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=cC(e),o=$x(1);t&&(r?RS(r)&&(o=lC(r)):o=lC(e));let s=fC(a,n,r)?dC(a):$x(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=FS(a),t=r&&RS(r)?FS(r):r,n=e,i=oC(n);for(;i&&r&&t!==n;){let e=lC(i),t=i.getBoundingClientRect(),r=tC(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=FS(i),i=oC(n)}}return CS({width:u,height:d,x:c,y:l})}function mC(e,t){let n=nC(e).scrollLeft;return t?t.left+n:pC(IS(e)).left+n}function hC(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-mC(e,n),y:n.top+t.scrollTop}}function gC(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=IS(r),s=t?KS(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=$x(1),u=$x(0),d=zS(r);if((d||!d&&!a)&&((PS(r)!==`body`||HS(o))&&(c=nC(r)),zS(r))){let e=pC(r);l=lC(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?hC(o,c):$x(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function _C(e){return Array.from(e.getClientRects())}function vC(e){let t=IS(e),n=nC(e),r=e.ownerDocument.body,i=Xx(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Xx(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+mC(e),s=-n.scrollTop;return tC(r).direction===`rtl`&&(o+=Xx(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var yC=25;function bC(e,t){let n=FS(e),r=IS(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=QS();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=mC(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=yC&&(a-=o)}else l<=yC&&(a+=l);return{width:a,height:o,x:s,y:c}}var xC=new Set([`absolute`,`fixed`]);function SC(e,t){let n=pC(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=zS(e)?lC(e):$x(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function CC(e,t,n){let r;if(t===`viewport`)r=bC(e,n);else if(t===`document`)r=vC(IS(e));else if(RS(t))r=SC(t,n);else{let n=dC(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return CS(r)}function wC(e,t){let n=rC(e);return n===t||!RS(n)||eC(n)?!1:tC(n).position===`fixed`||wC(n,t)}function TC(e,t){let n=t.get(e);if(n)return n;let r=aC(e,[],!1).filter(e=>RS(e)&&PS(e)!==`body`),i=null,a=tC(e).position===`fixed`,o=a?rC(e):e;for(;RS(o)&&!eC(o);){let t=tC(o),n=XS(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&xC.has(i.position)||HS(o)&&!n&&wC(e,o))?r=r.filter(e=>e!==o):i=t,o=rC(o)}return t.set(e,r),r}function EC(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?KS(t)?[]:TC(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=CC(t,n,i);return e.top=Xx(r.top,e.top),e.right=Yx(r.right,e.right),e.bottom=Yx(r.bottom,e.bottom),e.left=Xx(r.left,e.left),e},CC(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function DC(e){let{width:t,height:n}=sC(e);return{width:t,height:n}}function OC(e,t,n){let r=zS(t),i=IS(t),a=n===`fixed`,o=pC(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=$x(0);function l(){c.x=mC(i)}if(r||!r&&!a){if((PS(t)!==`body`||HS(i))&&(s=nC(t)),r){let e=pC(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l()}a&&!r&&i&&l();let u=i&&!r&&!a?hC(i,s):$x(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function kC(e){return tC(e).position===`static`}function AC(e,t){if(!zS(e)||tC(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return IS(e)===n&&(n=n.ownerDocument.body),n}function jC(e,t){let n=FS(e);if(KS(e))return n;if(!zS(e)){let t=rC(e);for(;t&&!eC(t);){if(RS(t)&&!kC(t))return t;t=rC(t)}return n}let r=AC(e,t);for(;r&&WS(r)&&kC(r);)r=AC(r,t);return r&&eC(r)&&kC(r)&&!XS(r)?n:r||ZS(e)||n}var MC=async function(e){let t=this.getOffsetParent||jC,n=this.getDimensions,r=await n(e.floating);return{reference:OC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function NC(e){return tC(e).direction===`rtl`}var PC={convertOffsetParentRelativeRectToViewportRelativeRect:gC,getDocumentElement:IS,getClippingRect:EC,getOffsetParent:jC,getElementRects:MC,getClientRects:_C,getDimensions:DC,getScale:lC,isElement:RS,isRTL:NC};function FC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function IC(e,t){let n=null,r,i=IS(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Qx(d),h=Qx(i.clientWidth-(u+f)),g=Qx(i.clientHeight-(d+p)),_=Qx(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Xx(0,Yx(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!FC(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function LC(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=cC(e),u=i||a?[...l?aC(l):[],...aC(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?IC(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?pC(e):null;c&&g();function g(){let t=pC(e);h&&!FC(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var RC=jS,zC=MS,BC=OS,VC=DS,HC=(e,t,n)=>{let r=new Map,i={platform:PC,...n},a={...i.platform,_c:r};return TS(e,t,{...i,platform:a})},UC=l(o(((e,t)=>{(function(){var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}))(),1),WC=`react-tooltip-core-styles`,GC=`react-tooltip-base-styles`,KC={core:!1,base:!1};function qC({css:e,id:t=GC,type:n=`base`,ref:r}){if(!e||typeof document>`u`||KC[n]||n===`core`&&typeof process<`u`&&(process==null?void 0:{})?.REACT_TOOLTIP_DISABLE_CORE_STYLES||n!==`base`&&typeof process<`u`&&(process==null?void 0:{})?.REACT_TOOLTIP_DISABLE_BASE_STYLES)return;n===`core`&&(t=WC),r||={};let{insertAt:i}=r;if(document.getElementById(t))return;let a=document.head||document.getElementsByTagName(`head`)[0],o=document.createElement(`style`);o.id=t,o.type=`text/css`,i===`top`&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e)),KC[n]=!0}var JC=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r=`top`,offset:i=10,strategy:a=`absolute`,middlewares:o=[RC(Number(i)),BC({fallbackAxisSideDirection:`start`}),zC({padding:5})],border:s,arrowSize:c=8})=>{if(!e||t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};let l=o;return n?(l.push(VC({element:n,padding:5})),HC(e,t,{placement:r,strategy:a,middleware:l}).then((({x:e,y:t,placement:n,middlewareData:r})=>{let i={left:`${e}px`,top:`${t}px`,border:s},{x:a,y:o}=r.arrow??{x:0,y:0},l={top:`bottom`,right:`left`,bottom:`top`,left:`right`}[n.split(`-`)[0]]??`bottom`,u=s&&{borderBottom:s,borderRight:s},d=0;if(s){let e=`${s}`.match(/(\d+)px/);d=e?.[1]?Number(e[1]):1}return{tooltipStyles:i,tooltipArrowStyles:{left:a==null?``:`${a}px`,top:o==null?``:`${o}px`,right:``,bottom:``,...u,[l]:`-${c/2+d}px`},place:n}}))):HC(e,t,{placement:`bottom`,strategy:a,middleware:l}).then((({x:e,y:t,placement:n})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:n})))},YC=(e,t)=>!(`CSS`in window&&`supports`in window.CSS)||window.CSS.supports(e,t),XC=(e,t,n)=>{let r=null,i=function(...i){let a=()=>{r=null,n||e.apply(this,i)};n&&!r&&(e.apply(this,i),r=setTimeout(a,t)),n||(r&&clearTimeout(r),r=setTimeout(a,t))};return i.cancel=()=>{r&&=(clearTimeout(r),null)},i},ZC=e=>e!==null&&!Array.isArray(e)&&typeof e==`object`,QC=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,n)=>QC(e,t[n])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!ZC(e)||!ZC(t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>QC(e[n],t[n])))},$C=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;let t=getComputedStyle(e);return[`overflow`,`overflow-x`,`overflow-y`].some((e=>{let n=t.getPropertyValue(e);return n===`auto`||n===`scroll`}))},ew=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if($C(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},tw=typeof window<`u`?p.useLayoutEffect:p.useEffect,nw=e=>{e.current&&=(clearTimeout(e.current),null)},rw=`DEFAULT_TOOLTIP_ID`,iw={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},aw=(0,p.createContext)({getTooltipData:()=>iw});function ow(e=rw){return(0,p.useContext)(aw).getTooltipData(e)}var sw={tooltip:`core-styles-module_tooltip__3vRRp`,fixed:`core-styles-module_fixed__pcSol`,arrow:`core-styles-module_arrow__cvMwQ`,noArrow:`core-styles-module_noArrow__xock6`,clickable:`core-styles-module_clickable__ZuTTB`,show:`core-styles-module_show__Nt9eE`,closing:`core-styles-module_closing__sGnxF`},cw={tooltip:`styles-module_tooltip__mnnfp`,arrow:`styles-module_arrow__K0L3T`,dark:`styles-module_dark__xNqje`,light:`styles-module_light__Z6W-X`,success:`styles-module_success__A2AKt`,warning:`styles-module_warning__SCK0X`,error:`styles-module_error__JvumD`,info:`styles-module_info__BWdHW`},lw=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i=`dark`,anchorId:a,anchorSelect:o,place:s=`top`,offset:c=10,events:l=[`hover`],openOnClick:u=!1,positionStrategy:d=`absolute`,middlewares:f,wrapper:m,delayShow:h=0,delayHide:g=0,float:_=!1,hidden:v=!1,noArrow:y=!1,clickable:b=!1,closeOnEsc:x=!1,closeOnScroll:S=!1,closeOnResize:C=!1,openEvents:w,closeEvents:T,globalCloseEvents:E,imperativeModeOnly:D,style:O,position:k,afterShow:A,afterHide:j,disableTooltip:M,content:N,contentWrapperRef:P,isOpen:F,defaultIsOpen:I=!1,setIsOpen:L,activeAnchor:R,setActiveAnchor:ee,border:z,opacity:B,arrowColor:V,arrowSize:H=8,role:U=`tooltip`})=>{let W=(0,p.useRef)(null),te=(0,p.useRef)(null),G=(0,p.useRef)(null),ne=(0,p.useRef)(null),re=(0,p.useRef)(null),[ie,ae]=(0,p.useState)({tooltipStyles:{},tooltipArrowStyles:{},place:s}),[oe,se]=(0,p.useState)(!1),[K,ce]=(0,p.useState)(!1),[le,ue]=(0,p.useState)(null),de=(0,p.useRef)(!1),fe=(0,p.useRef)(null),{anchorRefs:pe,setActiveAnchor:me}=ow(t),he=(0,p.useRef)(!1),[ge,_e]=(0,p.useState)([]),ve=(0,p.useRef)(!1),ye=u||l.includes(`click`),be=ye||w?.click||w?.dblclick||w?.mousedown,xe=w?{...w}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!w&&ye&&Object.assign(xe,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});let Se=T?{...T}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!T&&ye&&Object.assign(Se,{mouseleave:!1,blur:!1,mouseout:!1});let Ce=E?{...E}:{escape:x||!1,scroll:S||!1,resize:C||!1,clickOutsideAnchor:be||!1};D&&(Object.assign(xe,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Se,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Ce,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),tw((()=>(ve.current=!0,()=>{ve.current=!1})),[]);let we=e=>{ve.current&&(e&&ce(!0),setTimeout((()=>{ve.current&&(L?.(e),F===void 0&&se(e))}),10))};(0,p.useEffect)((()=>{if(F===void 0)return()=>null;F&&ce(!0);let e=setTimeout((()=>{se(F)}),10);return()=>{clearTimeout(e)}}),[F]),(0,p.useEffect)((()=>{if(oe!==de.current){if(nw(re),de.current=oe,oe)A?.();else{let e=(e=>{let t=e.match(/^([\d.]+)(ms|s)$/);if(!t)return 0;let[,n,r]=t;return Number(n)*(r===`ms`?1:1e3)})(getComputedStyle(document.body).getPropertyValue(`--rt-transition-show-delay`));re.current=setTimeout((()=>{ce(!1),ue(null),j?.()}),e+25)}}}),[oe]);let Te=e=>{ae((t=>QC(t,e)?t:e))},Ee=(e=h)=>{nw(G),K?we(!0):G.current=setTimeout((()=>{we(!0)}),e)},De=(e=g)=>{nw(ne),ne.current=setTimeout((()=>{he.current||we(!1)}),e)},Oe=e=>{if(!e)return;let t=e.currentTarget??e.target;if(!t?.isConnected)return ee(null),void me({current:null});h?Ee():we(!0),ee(t),me({current:t}),nw(ne)},ke=()=>{b?De(g||100):g?De():we(!1),nw(G)},Ae=({x:e,y:t})=>{JC({place:le?.place??s,offset:c,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:W.current,tooltipArrowReference:te.current,strategy:d,middlewares:f,border:z,arrowSize:H}).then((e=>{Te(e)}))},je=e=>{if(!e)return;let t=e,n={x:t.clientX,y:t.clientY};Ae(n),fe.current=n},Me=e=>{if(!oe)return;let t=e.target;t.isConnected&&(W.current?.contains(t)||[document.querySelector(`[id='${a}']`),...ge].some((e=>e?.contains(t)))||(we(!1),nw(G)))},Ne=XC(Oe,50,!0),Pe=XC(ke,50,!0),Fe=e=>{Pe.cancel(),Ne(e)},Ie=()=>{Ne.cancel(),Pe()},Le=(0,p.useCallback)((()=>{let e=le?.position??k;e?Ae(e):_?fe.current&&Ae(fe.current):R!=null&&R.isConnected&&JC({place:le?.place??s,offset:c,elementReference:R,tooltipReference:W.current,tooltipArrowReference:te.current,strategy:d,middlewares:f,border:z,arrowSize:H}).then((e=>{ve.current&&Te(e)}))}),[oe,R,N,O,s,le?.place,c,d,k,le?.position,_,H]);(0,p.useEffect)((()=>{var e,t;let n=new Set(pe);ge.forEach((e=>{M!=null&&M(e)||n.add({current:e})}));let r=document.querySelector(`[id='${a}']`);r&&!(M!=null&&M(r))&&n.add({current:r});let i=()=>{we(!1)},o=ew(R),s=ew(W.current);Ce.scroll&&(window.addEventListener(`scroll`,i),o?.addEventListener(`scroll`,i),s?.addEventListener(`scroll`,i));let c=null;Ce.resize?window.addEventListener(`resize`,i):R&&W.current&&(c=LC(R,W.current,Le,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));let l=e=>{e.key===`Escape`&&we(!1)};Ce.escape&&window.addEventListener(`keydown`,l),Ce.clickOutsideAnchor&&window.addEventListener(`click`,Me);let u=[],d=e=>!!(e?.target&&R?.contains(e.target)),f=e=>{oe&&d(e)||Oe(e)},p=e=>{oe&&d(e)&&ke()},m=[`mouseover`,`mouseout`,`mouseenter`,`mouseleave`,`focus`,`blur`],h=[`click`,`dblclick`,`mousedown`,`mouseup`];Object.entries(xe).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:Fe}):h.includes(e)&&u.push({event:e,listener:f}))})),Object.entries(Se).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:Ie}):h.includes(e)&&u.push({event:e,listener:p}))})),_&&u.push({event:`pointermove`,listener:je});let g=()=>{he.current=!0},v=()=>{he.current=!1,ke()},y=b&&(Se.mouseout||Se.mouseleave);return y&&((e=W.current)==null||e.addEventListener(`mouseover`,g),(t=W.current)==null||t.addEventListener(`mouseout`,v)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;(r=n.current)==null||r.addEventListener(e,t)}))})),()=>{var e,t;Ce.scroll&&(window.removeEventListener(`scroll`,i),o?.removeEventListener(`scroll`,i),s?.removeEventListener(`scroll`,i)),Ce.resize?window.removeEventListener(`resize`,i):c?.(),Ce.clickOutsideAnchor&&window.removeEventListener(`click`,Me),Ce.escape&&window.removeEventListener(`keydown`,l),y&&((e=W.current)==null||e.removeEventListener(`mouseover`,g),(t=W.current)==null||t.removeEventListener(`mouseout`,v)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;(r=n.current)==null||r.removeEventListener(e,t)}))}))}}),[R,Le,K,pe,ge,w,T,E,ye,h,g]),(0,p.useEffect)((()=>{let e=le?.anchorSelect??o??``;!e&&t&&(e=`[data-tooltip-id='${t.replace(/'/g,`\\'`)}']`);let n=new MutationObserver((n=>{let r=[],i=[];n.forEach((n=>{if(n.type===`attributes`&&n.attributeName===`data-tooltip-id`&&(n.target.getAttribute(`data-tooltip-id`)===t?r.push(n.target):n.oldValue===t&&i.push(n.target)),n.type===`childList`){if(R){let t=[...n.removedNodes].filter((e=>e.nodeType===1));if(e)try{i.push(...t.filter((t=>t.matches(e)))),i.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}t.some((e=>!!(e?.contains)?.call(e,R)&&(ce(!1),we(!1),ee(null),nw(G),nw(ne),!0)))}if(e)try{let t=[...n.addedNodes].filter((e=>e.nodeType===1));r.push(...t.filter((t=>t.matches(e)))),r.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}}})),(r.length||i.length)&&_e((e=>[...e.filter((e=>!i.includes(e))),...r]))}));return n.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-tooltip-id`],attributeOldValue:!0}),()=>{n.disconnect()}}),[t,o,le?.anchorSelect,R]),(0,p.useEffect)((()=>{Le()}),[Le]),(0,p.useEffect)((()=>{if(!P?.current)return()=>null;let e=new ResizeObserver((()=>{setTimeout((()=>Le()))}));return e.observe(P.current),()=>{e.disconnect()}}),[N,P?.current]),(0,p.useEffect)((()=>{let e=document.querySelector(`[id='${a}']`),t=[...ge,e];R&&t.includes(R)||ee(ge[0]??e)}),[a,ge,R]),(0,p.useEffect)((()=>(I&&we(!0),()=>{nw(G),nw(ne)})),[]),(0,p.useEffect)((()=>{let e=le?.anchorSelect??o;if(!e&&t&&(e=`[data-tooltip-id='${t.replace(/'/g,`\\'`)}']`),e)try{let t=Array.from(document.querySelectorAll(e));_e(t)}catch{_e([])}}),[t,o,le?.anchorSelect]),(0,p.useEffect)((()=>{G.current&&(nw(G),Ee(h))}),[h]);let Re=le?.content??N,ze=oe&&Object.keys(ie.tooltipStyles).length>0;return(0,p.useImperativeHandle)(e,(()=>({open:e=>{if(e?.anchorSelect)try{document.querySelector(e.anchorSelect)}catch{console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`);return}ue(e??null),e?.delay?Ee(e.delay):we(!0)},close:e=>{e?.delay?De(e.delay):we(!1)},activeAnchor:R,place:ie.place,isOpen:!!(K&&!v&&Re&&ze)}))),K&&!v&&Re?p.createElement(m,{id:t,role:U,className:(0,UC.default)(`react-tooltip`,sw.tooltip,cw.tooltip,cw[i],n,`react-tooltip__place-${ie.place}`,sw[ze?`show`:`closing`],ze?`react-tooltip__show`:`react-tooltip__closing`,d===`fixed`&&sw.fixed,b&&sw.clickable),onTransitionEnd:e=>{nw(re),oe||e.propertyName!==`opacity`||(ce(!1),ue(null),j?.())},style:{...O,...ie.tooltipStyles,opacity:B!==void 0&&ze?B:void 0},ref:W},Re,p.createElement(m,{className:(0,UC.default)(`react-tooltip-arrow`,sw.arrow,cw.arrow,r,y&&sw.noArrow),style:{...ie.tooltipArrowStyles,background:V?`linear-gradient(to right bottom, transparent 50%, ${V} 50%)`:void 0,"--rt-arrow-size":`${H}px`},ref:te})):null},uw=({content:e})=>p.createElement(`span`,{dangerouslySetInnerHTML:{__html:e}}),dw=p.forwardRef((({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:a,className:o,classNameArrow:s,variant:c=`dark`,place:l=`top`,offset:u=10,wrapper:d=`div`,children:f=null,events:m=[`hover`],openOnClick:h=!1,positionStrategy:g=`absolute`,middlewares:_,delayShow:v=0,delayHide:y=0,float:b=!1,hidden:x=!1,noArrow:S=!1,clickable:C=!1,closeOnEsc:w=!1,closeOnScroll:T=!1,closeOnResize:E=!1,openEvents:D,closeEvents:O,globalCloseEvents:k,imperativeModeOnly:A=!1,style:j,position:M,isOpen:N,defaultIsOpen:P=!1,disableStyleInjection:F=!1,border:I,opacity:L,arrowColor:R,arrowSize:ee,setIsOpen:z,afterShow:B,afterHide:V,disableTooltip:H,role:U=`tooltip`},W)=>{let[te,G]=(0,p.useState)(r),[ne,re]=(0,p.useState)(i),[ie,ae]=(0,p.useState)(l),[oe,se]=(0,p.useState)(c),[K,ce]=(0,p.useState)(u),[le,ue]=(0,p.useState)(v),[de,fe]=(0,p.useState)(y),[pe,me]=(0,p.useState)(b),[he,ge]=(0,p.useState)(x),[_e,ve]=(0,p.useState)(d),[ye,be]=(0,p.useState)(m),[xe,Se]=(0,p.useState)(g),[Ce,we]=(0,p.useState)(null),[Te,Ee]=(0,p.useState)(null),De=(0,p.useRef)(F),{anchorRefs:Oe,activeAnchor:ke}=ow(e),Ae=e=>e?.getAttributeNames().reduce(((t,n)=>(n.startsWith(`data-tooltip-`)&&(t[n.replace(/^data-tooltip-/,``)]=e?.getAttribute(n)??null),t)),{}),je=e=>{let t={place:e=>{ae(e??l)},content:e=>{G(e??r)},html:e=>{re(e??i)},variant:e=>{se(e??c)},offset:e=>{ce(e===null?u:Number(e))},wrapper:e=>{ve(e??d)},events:e=>{let t=e?.split(` `);be(t??m)},"position-strategy":e=>{Se(e??g)},"delay-show":e=>{ue(e===null?v:Number(e))},"delay-hide":e=>{fe(e===null?y:Number(e))},float:e=>{me(e===null?b:e===`true`)},hidden:e=>{ge(e===null?x:e===`true`)},"class-name":e=>{we(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;(r=t[e])==null||r.call(t,n)}))};(0,p.useEffect)((()=>{G(r)}),[r]),(0,p.useEffect)((()=>{re(i)}),[i]),(0,p.useEffect)((()=>{ae(l)}),[l]),(0,p.useEffect)((()=>{se(c)}),[c]),(0,p.useEffect)((()=>{ce(u)}),[u]),(0,p.useEffect)((()=>{ue(v)}),[v]),(0,p.useEffect)((()=>{fe(y)}),[y]),(0,p.useEffect)((()=>{me(b)}),[b]),(0,p.useEffect)((()=>{ge(x)}),[x]),(0,p.useEffect)((()=>{Se(g)}),[g]),(0,p.useEffect)((()=>{De.current!==F&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[F]),(0,p.useEffect)((()=>{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`react-tooltip-inject-styles`,{detail:{disableCore:F===`core`,disableBase:F}}))}),[]),(0,p.useEffect)((()=>{let r=new Set(Oe),i=n;if(!i&&e&&(i=`[data-tooltip-id='${e.replace(/'/g,`\\'`)}']`),i)try{document.querySelectorAll(i).forEach((e=>{r.add({current:e})}))}catch{console.warn(`[react-tooltip] "${i}" is not a valid CSS selector`)}let a=document.querySelector(`[id='${t}']`);if(a&&r.add({current:a}),!r.size)return()=>null;let o=Te??a??ke.current,s=new MutationObserver((e=>{e.forEach((e=>{if(!o||e.type!==`attributes`||!e.attributeName?.startsWith(`data-tooltip-`))return;let t=Ae(o);je(t)}))})),c={attributes:!0,childList:!1,subtree:!1};if(o){let e=Ae(o);je(e),s.observe(o,c)}return()=>{s.disconnect()}}),[Oe,ke,Te,t,n]),(0,p.useEffect)((()=>{j!=null&&j.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),I&&!YC(`border`,`${I}`)&&console.warn(`[react-tooltip] "${I}" is not a valid \`border\`.`),j!=null&&j.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),L&&!YC(`opacity`,`${L}`)&&console.warn(`[react-tooltip] "${L}" is not a valid \`opacity\`.`)}),[]);let Me=f,Ne=(0,p.useRef)(null);if(a){let e=a({content:Te?.getAttribute(`data-tooltip-content`)||te||null,activeAnchor:Te});Me=e?p.createElement(`div`,{ref:Ne,className:`react-tooltip-content-wrapper`},e):null}else te&&(Me=te);ne&&(Me=p.createElement(uw,{content:ne}));let Pe={forwardRef:W,id:e,anchorId:t,anchorSelect:n,className:(0,UC.default)(o,Ce),classNameArrow:s,content:Me,contentWrapperRef:Ne,place:ie,variant:oe,offset:K,wrapper:_e,events:ye,openOnClick:h,positionStrategy:xe,middlewares:_,delayShow:le,delayHide:de,float:pe,hidden:he,noArrow:S,clickable:C,closeOnEsc:w,closeOnScroll:T,closeOnResize:E,openEvents:D,closeEvents:O,globalCloseEvents:k,imperativeModeOnly:A,style:j,position:M,isOpen:N,defaultIsOpen:P,border:I,opacity:L,arrowColor:R,arrowSize:ee,setIsOpen:z,afterShow:B,afterHide:V,disableTooltip:H,activeAnchor:Te,setActiveAnchor:e=>Ee(e),role:U};return p.createElement(lw,{...Pe})}));typeof window<`u`&&window.addEventListener(`react-tooltip-inject-styles`,(e=>{e.detail.disableCore||qC({css:`:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s;--rt-arrow-size:8px}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit;z-index:-1}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}`,type:`core`}),e.detail.disableBase||qC({css:`
|
|
38
38
|
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:`base`})}));var fw={indexes:[],chapters:[],thumbnails:[],requestThumbnail:()=>{},seekPreview:!1,subtitleTracks:[],selectedSubtitleTrack:void 0,selectSubtitleTrack:()=>{},audioTracks:[],selectedAudioTrack:void 0,selectAudioTrack:()=>{},quality:null,hideUI:!1,setHideUI:()=>{},hasMedia:!1,togglePictureInPicture:null,passThroughPictureInPicture:null,pictureInPictureMode:null,burnedInSubtitles:!1,volumeNormalizer:null,autoplayNext:null,playbackError:null,playbackErrors:[],ready:!1,setSourceState:()=>{}},pw=jb({name:`source`,state:()=>({...fw}),attach({set:e}){e({setSourceState:t=>e(t),setHideUI:t=>e({hideUI:t})})}}),mw=qx({features:[...zx,pw],displayName:`MediaPlayer`}),Z=mw.usePlayer,hw={ar:()=>gi(()=>import(`./assets/ar-CWVutin3-DasjSN4g.js`),[]),cs:()=>gi(()=>import(`./assets/cs-CmwRGxyE-6NRXZVON.js`),[]),de:()=>gi(()=>import(`./assets/de-DLdKEf3t-BrnH-_PW.js`),[]),el:()=>gi(()=>import(`./assets/el-Ckj-z6DX-CGAcSJAq.js`),[]),"es-419":()=>gi(()=>import(`./assets/es-419-zORhhU8D-CeeUCFRa.js`),[]),fr:()=>gi(()=>import(`./assets/fr-BtPmNkri-Hie1msTo.js`),[]),he:()=>gi(()=>import(`./assets/he-Bu79qEth-CsdNKnCH.js`),[]),hi:()=>gi(()=>import(`./assets/hi-BsH3tSHa-DdJFREf5.js`),[]),hu:()=>gi(()=>import(`./assets/hu-BkYBW-YP-BYIrZak1.js`),[]),id:()=>gi(()=>import(`./assets/id-nUaBCV4o-D-Ujb-Hr.js`),[]),it:()=>gi(()=>import(`./assets/it-CqPSHyFA-D79hiYXL.js`),[]),ja:()=>gi(()=>import(`./assets/ja-DTjvriHw-DmCA-L-o.js`),[]),ko:()=>gi(()=>import(`./assets/ko-dV8T7XOJ-D8qpVvbw.js`),[]),ms:()=>gi(()=>import(`./assets/ms-VZQ7BI0z-Cckr4FFS.js`),[]),nl:()=>gi(()=>import(`./assets/nl-Q6iDxbDz-DUxpni5S.js`),[]),pl:()=>gi(()=>import(`./assets/pl-BN7bK74l-Dnn2r2Ko.js`),[]),"pt-BR":()=>gi(()=>import(`./assets/pt-BR-CPFILeFW-CEzqpq0l.js`),[]),ro:()=>gi(()=>import(`./assets/ro-Bwcm-i3k-BhF7xVq7.js`),[]),ru:()=>gi(()=>import(`./assets/ru-D1FMz751-CSNPRieo.js`),[]),sv:()=>gi(()=>import(`./assets/sv-ci9K0Lkk-CqQQUp8e.js`),[]),th:()=>gi(()=>import(`./assets/th-DR-UBONQ-M32Q8z0I.js`),[]),tr:()=>gi(()=>import(`./assets/tr-BqhdfT22-1QDWyzkL.js`),[]),uk:()=>gi(()=>import(`./assets/uk-8pkZqdni-oYiPCZea.js`),[]),vi:()=>gi(()=>import(`./assets/vi-3mKZ9G_M-56GIblP3.js`),[]),"zh-Hans":()=>gi(()=>import(`./assets/zh-Hans-CDgigWKY-CT8Xi5lc.js`),[]),"zh-Hant":()=>gi(()=>import(`./assets/zh-Hant-3WSNI0ne-DNbJLxsD.js`),[])},gw=Object.keys(hw),_w=e=>{try{let t=new Intl.Locale(e),{language:n,script:r}=t.maximize();return{tag:t.baseName,language:n,script:r}}catch{return}},vw=e=>{let t=_w(e);if(!t)return;let n=gw.map(e=>({..._w(e),catalogue:e}));return(n.find(({tag:e})=>e===t.tag)??n.find(({language:e,script:n})=>e===t.language&&n===t.script)??n.find(({language:e})=>e===t.language))?.catalogue},yw=new Map,bw=new Map,xw=(e,t)=>{let n=bw.get(e);return n||(n=Promise.all([gi(()=>Promise.resolve().then(()=>Kn),void 0),hw[t]()]).then(([{createIntl:t},{default:n}])=>{let r=t({locale:e,defaultLocale:`en`,messages:n});return yw.set(e,r),r}),n.catch(()=>bw.delete(e)),bw.set(e,n)),n},Sw=e=>{try{return Intl.getCanonicalLocales(e)[0]}catch{return}},Cw=(e,t)=>{let n=t?Sw(t)??`en`:void 0;return{format:(t,...[n])=>e?e.formatMessage({id:t,defaultMessage:t},n):F_(t,n),number:(e,t)=>new Intl.NumberFormat(n??`en`,t).format(e),locale:n}},ww=Cw(void 0,void 0),Tw=(0,p.createContext)(ww),Ew=()=>(0,p.useContext)(Tw),Dw=({language:e,children:t})=>{let n=e?vw(e):void 0,[,r]=(0,p.useState)();(0,p.useEffect)(()=>{if(!e||!n||yw.has(e))return;let t=!1;return xw(e,n).then(e=>{t||r(e)},()=>{}),()=>{t=!0}},[e,n]);let i=e&&n?yw.get(e):void 0,a=(0,p.useMemo)(()=>e?Cw(i,e):ww,[i,e]);return J(Tw.Provider,{value:a,children:t})},Ow=(e,t)=>{if(e&&e!==`und`)try{return new Intl.DisplayNames([t??(navigator.language||`en`)],{type:`language`,fallback:`none`}).of(e)||void 0}catch{return}},kw=e=>e?.replace(/_/g,` `).trim()||void 0,Aw=(e,t)=>{let n=e=>t?t.format(P_.track,{number:e}):F_(P_.track,{number:e}),r=e.map(e=>Ow(e.language,t?.locale)??kw(e.title)??n(e.streamIndex)),i=r.reduce((e,t)=>({...e,[t]:(e[t]??0)+1}),{});return e.map((e,t)=>{let n=r[t],a=kw(e.title);return{track:e,label:(i[n]??0)>1&&a&&a!==n?`${n} (${a})`:n}})},jw=(e,t)=>Aw(e,t).map(({track:e,label:t})=>({id:e.streamIndex,label:t})),Mw=[0,250,1e3,3e3,1e4],Nw=6e4,Pw=500,Fw=15e3,Iw=e=>e instanceof Error?e.message:String(e),Lw=e=>{let t=[],n=e?.cause;for(let e=0;n!=null&&e<8;e++){if(typeof MediaError<`u`&&n instanceof MediaError){t.push(`MediaError code ${n.code}${n.message?`: ${n.message}`:``}`);break}t.push(Iw(n)),n=n?.cause}return t.length?t.join(`
|
|
39
39
|
`):void 0},Rw=(e,t,n,r)=>{let i=Z(),{read:a,size:o,publicPath:s=``,libavWorkerUrl:c=``,jassubWorkerUrl:l=``,jassubWasmUrl:u=``,jassubWasmWorkerUrl:d=``,jassubLegacyWasmUrl:f,jassubLegacyWasmWorkerUrl:m,defaultFontUrl:h,cjkFontUrl:g,bufferSize:_,autoplay:v=!1,chapters:y,seekPrepareBudgetMs:b=Pw}=n??{},x=(0,p.useRef)(y);x.current=y;let[S,C]=(0,p.useState)(),w=S&&S.size===o?S.streamIndex:void 0,[T,E]=(0,p.useState)(0),D=(0,p.useRef)({count:0,at:0}),O=(0,p.useRef)(void 0);(0,p.useEffect)(()=>(D.current={count:0,at:0},i.setSourceState({playbackErrors:[]}),()=>{O.current&&clearTimeout(O.current)}),[o]);let k=(0,p.useRef)(null),A=(0,p.useRef)(null),j=(0,p.useRef)(void 0),M=(0,p.useRef)(o);M.current=o;let N=(0,p.useRef)({audio:[],subtitles:[]}),P=(0,p.useCallback)(()=>N.current.audio.find(e=>e.streamIndex===i.selectedAudioTrack),[i]),F=(0,p.useRef)(a);F.current=a;let I={audio:n?.preferredAudioLanguage,original:n?.originalLanguage,subtitles:n?.preferredSubtitleLanguage,alwaysSubtitles:n?.alwaysShowSubtitles},L=(0,p.useRef)(I);L.current=I;let R=(0,p.useRef)(n?.onPreferredAudioLanguageChange);R.current=n?.onPreferredAudioLanguageChange;let ee=(0,p.useRef)(n?.onPreferredSubtitleLanguageChange);ee.current=n?.onPreferredSubtitleLanguageChange;let z=(0,p.useRef)(n?.onAlwaysShowSubtitlesChange);z.current=n?.onAlwaysShowSubtitlesChange;let B=(0,p.useRef)(n?.onSeek);B.current=n?.onSeek;let V=(0,p.useRef)(n?.onPlaybackError);V.current=n?.onPlaybackError;let H=(0,p.useRef)(r);H.current=r;let U=Ew(),W=(0,p.useRef)(U);W.current=U,(0,p.useEffect)(()=>{let{audio:e,subtitles:t}=N.current;t.length&&i.setSourceState({subtitleTracks:jw(t,U)}),e.length&&i.setSourceState({audioTracks:jw(e,U)})},[i,U]);let te=(0,p.useCallback)(e=>{let t=typeof e==`number`?e:void 0,n=i.selectedSubtitleTrack===void 0;j.current=M.current,i.setSourceState({selectedSubtitleTrack:t}),k.current?.selectSubtitleStream(t);let r=N.current.subtitles.find(e=>e.streamIndex===t),a=t===void 0?null:Qv(r)??(n?r?.title?.trim()||`und`:void 0);a!==void 0&&ee.current?.(a),a&&ny(P(),a)&&z.current?.(!0)},[i,P]),G=(0,p.useCallback)(e=>{let t=k.current;if(!t||b<=0){i.seek(e);return}let n=typeof window<`u`&&window.__mediaPlayerSeekDebug,r=performance.now(),a=!1,o=`prepared`,s=()=>{if(!a&&(a=!0,i.seek(e),n)){let n=t.videoElement,i=0;if(n)for(let t=0;t<n.buffered.length;t++)n.buffered.start(t)<=e+1&&e<n.buffered.end(t)&&(i=n.buffered.end(t)-e);console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now()-r)}ms via ${o}, runway ${i.toFixed(1)}s${o===`deadline`?` (EXPOSED: moved before its data was ready)`:``}`)}};i.setSourceState({seekingTo:e});let c=t.videoElement,l=()=>{c?.removeEventListener(`seeked`,l),clearTimeout(u),i.setSourceState({seekingTo:void 0})},u=setTimeout(l,Fw);c?.addEventListener(`seeked`,l);let d=setTimeout(()=>{o=`deadline`,s()},b);t.prepareSeek(e).catch(()=>{}).finally(()=>{clearTimeout(d),s()})},[i,b]),ne=(0,p.useCallback)(e=>{if(typeof e!=`number`||M.current===void 0)return;i.setSourceState({selectedAudioTrack:e}),C({size:M.current,streamIndex:e});let t=Qv(N.current.audio.find(t=>t.streamIndex===e));t!==void 0&&R.current?.(t)},[i]),re=Z(e=>e.setSourceState);(0,p.useEffect)(()=>{re({selectSubtitleTrack:te,selectAudioTrack:ne,requestSeek:G})},[re,te,ne,G]),(0,p.useEffect)(()=>{if(!e||!t||!o||!a)return;let n=!1;i.setSourceState({playbackError:null,ready:!1});let r=(t,n)=>{let r=Date.now(),a=Iw(t),o=Lw(t),s=i.playbackErrors,c=s[s.length-1];if(c&&c.message===a&&c.detail===o&&c.recovered===n){let e={...c,count:c.count+1,lastAt:r};i.setSourceState({playbackErrors:[...s.slice(0,-1),e]});return}let l={at:r,lastAt:r,count:1,atMediaTime:Number.isFinite(e.currentTime)?e.currentTime:void 0,message:a,detail:o,recovered:n};i.setSourceState({playbackErrors:[...s,l]})},p=e=>{if(n)return;let t=X_(e);if(r(e,t),t){let t=performance.now();t-D.current.at>Nw&&(D.current={count:0,at:t});let n=Mw[Math.min(D.current.count,Mw.length-1)];D.current={count:D.current.count+1,at:t},console.warn(`the media element failed; rebuilding the pipeline${n?` in ${n}ms`:``}`,e),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>E(e=>e+1),n);return}console.error(`playback failed`,e),i.setSourceState({playbackError:e}),V.current?.(e)};return(async()=>{try{let r=await uv({videoElement:e,subtitleContainer:t,read:(e,t)=>F.current(e,t),length:o,publicPath:s,libavWorkerUrl:c,jassubWorkerUrl:l,jassubWasmUrl:u,jassubWasmWorkerUrl:d,jassubLegacyWasmUrl:f,jassubLegacyWasmWorkerUrl:m,defaultFontUrl:h,cjkFontUrl:g,bufferSize:_,audioStreamIndex:w,chooseAudioStream:e=>e[ry(e,[],L.current).audio]?.streamIndex,onReady:()=>{if(n)return;i.setSourceState({ready:!0});let t=A.current;A.current=null,t&&t.size===o&&t.time>0&&(e.currentTime=t.time),v&&e.play().catch(()=>{})},onError:p,onRecovered:()=>{n||i.setSourceState({playbackError:null})},onSeek:e=>B.current?.(e),onOutput:e=>H.current?.(e),onSubtitleStreams:e=>{if(n)return;N.current.subtitles=e;let t=P(),r=ry(t?[t]:[],e,L.current).subtitles;i.setSourceState({subtitleTracks:jw(e,W.current),...j.current===o?{}:{selectedSubtitleTrack:r===null?void 0:e[Math.max(r,0)]?.streamIndex}})},onAudioStreams:(e,t)=>{n||(N.current.audio=e,i.setSourceState({audioTracks:jw(e,W.current),selectedAudioTrack:t}))}});if(n){r.destroy();return}k.current=r,i.setSourceState({indexes:r.indexes,chapters:x.current??r.chapters});let a=i.selectedSubtitleTrack;r.selectSubtitleStream(typeof a==`number`?a:void 0)}catch(e){p(e)}})(),()=>{n=!0,A.current={time:e.currentTime,size:o},k.current?.destroy(),k.current=null,i.setSourceState({ready:!1})}},[i,P,e,t,o,s,c,l,u,d,f,m,h,g,_,w,v,T])},zw=1001/24e3,Bw=(e,t)=>new Promise(n=>{let r=setTimeout(n,t);e.requestVideoFrameCallback(()=>{clearTimeout(r),n()})}),Vw=e=>{let t=!1,n,r=async i=>{if(t){n=i;return}t=!0;try{await e(i)}finally{t=!1;let e=n;n=void 0,e&&r(e)}};return r},Hw=(e,t)=>{let n=Z(),r=Z(e=>e.setSourceState),i=(0,p.useRef)(t);i.current=t;let a=!!t;(0,p.useEffect)(()=>{let t=e;if(!t)return;if(typeof t.requestVideoFrameCallback!=`function`)return a?(r({stepFrame:Vw(async e=>{try{await i.current?.(e)}catch(e){console.warn(`the host could not step a frame`,e)}})}),()=>r({stepFrame:void 0})):void 0;let o,s=!1,c=[],l=()=>{s=!0,o=void 0},u=()=>{o=void 0,c.length=0};t.addEventListener(`seeking`,l),t.addEventListener(`emptied`,u);let d=0,f=(e,n)=>{let r=s;!t.paused&&!t.seeking&&(s=!1),!r&&!t.paused&&t.playbackRate<=1&&o&&n.presentedFrames===o.presentedFrames+1&&n.mediaTime>o.mediaTime&&(c.push(n.mediaTime-o.mediaTime),c.length>60&&c.shift()),o=r?void 0:n,d=t.requestVideoFrameCallback(f)};d=t.requestVideoFrameCallback(f);let p=()=>{if(c.length<5)return zw;let e=[...c].sort((e,t)=>e-t),t=e[e.length>>1],n=e.filter(e=>Math.abs(e-t)<=t/4);return n.reduce((e,t)=>e+t,0)/n.length},m=Vw(async e=>{t.paused||(t.pause(),await Bw(t,100));let r=p(),i=n.state.seekingTo,a=i===void 0?o?o.mediaTime+(e>0?1.5:-.5)*r:t.currentTime+e*r:i+e*r,s=Math.max(0,Math.min(a,t.duration||a)),c=new Promise(e=>{let n=setTimeout(e,1e3);t.addEventListener(`seeked`,()=>{clearTimeout(n),e()},{once:!0})}),{requestSeek:l}=n.state;l?l(s):t.currentTime=s,await c});return r({stepFrame:m}),()=>{t.removeEventListener(`seeking`,l),t.removeEventListener(`emptied`,u),t.cancelVideoFrameCallback(d),r({stepFrame:void 0})}},[e,a,n,r])},Uw=5e3,Ww=6e4,Gw=1e6,Kw=(e,t)=>!e||e.some(([e,n])=>e<=0&&n>=Math.min(Gw,t)),qw=({publicPath:e,workerUrl:t,length:n,read:r,downloadedRanges:i})=>{let[a,o]=(0,p.useState)([]),s=(0,p.useRef)(null),c=(0,p.useRef)(r);c.current=r;let l=(0,p.useMemo)(()=>i?.map(({startByteOffset:e,endByteOffset:t})=>[e,t]),[i?.map(({startByteOffset:e,endByteOffset:t})=>`${e}-${t}`).join(`,`)]),u=(0,p.useRef)(l);u.current=l;let d=(0,p.useRef)(null);return(0,p.useEffect)(()=>{if(!n||!r||!e||!t)return;let i=!1,a=null,l,f=Uw,p=()=>{d.current=null;let r=!Kw(u.current,n);bv({publicPath:e,workerUrl:t,length:n,read:(e,t)=>c.current(e,t),onThumbnails:e=>{i||o(e)}}).then(e=>{if(i){e.destroy();return}a=e,s.current=e,e.update(u.current)},()=>{if(i||(l=setTimeout(p,f),f=Math.min(f*2,Ww),!r))return;let e=()=>{clearTimeout(l),p()};Kw(u.current,n)?e():d.current=e})};return p(),()=>{i=!0,d.current=null,clearTimeout(l),s.current=null,a?.destroy(),o([])}},[n,e,t]),(0,p.useEffect)(()=>{s.current?.update(l),n&&Kw(l,n)&&d.current?.()},[l]),{thumbnails:a,requestThumbnail:(0,p.useCallback)(e=>{s.current?.prioritize(e)},[])}},Jw=(e,t)=>{let n=(0,p.useRef)(null),[r,i]=(0,p.useState)(!1),[a]=(0,p.useState)(()=>Fv());(0,p.useEffect)(()=>{if(!e||!t||!a)return;let r=Iv({video:e,subtitles:t,mode:a,onBurnedInChange:i});return n.current=r,()=>{r.destroy(),n.current=null,i(!1)}},[e,t,a]);let o=(0,p.useCallback)(()=>{n.current?.toggle().catch(e=>{console.warn(`picture in picture was refused`,e)})},[]);return{toggle:e&&t&&a?o:null,mode:a,burnedIn:r}},Yw=`(hover: hover) and (pointer: fine)`,Xw=()=>typeof matchMedia==`function`?matchMedia(Yw):void 0,Zw=e=>{let t=Xw();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},Qw=()=>!!Xw()?.matches,$w=()=>!1,eT=(e,t)=>{let[n,r]=(0,p.useState)(!1),[i,a]=(0,p.useState)(),o=(0,p.useRef)(t);t&&(o.current=t);let s=(0,p.useRef)(!1),c=(0,p.useCallback)(e=>{s.current!==e&&(s.current=e,o.current?.onArmedChange(e))},[]),l=(0,p.useCallback)(t=>{!e||e.readyState<1||e.error||(a(t),c(!0))},[e,c]),u=(0,p.useCallback)(()=>{a(void 0),c(!1)},[c]),d=!!t&&!!e;(0,p.useEffect)(()=>{if(!d||!e)return;let t=()=>{r(!0),u()},n=()=>r(!1);return e.addEventListener(`enterpictureinpicture`,t),e.addEventListener(`leavepictureinpicture`,n),()=>{e.removeEventListener(`enterpictureinpicture`,t),e.removeEventListener(`leavepictureinpicture`,n),r(!1),u()}},[e,d,u]);let f=(0,p.useSyncExternalStore)(Zw,Qw,$w),[m,h]=(0,p.useState)(!1);(0,p.useEffect)(()=>{if(!d)return;let e=e=>{e.pointerType===`touch`&&h(!0)},t=e=>{e.pointerType!==`touch`&&h(!1)};return window.addEventListener(`pointerdown`,e,{capture:!0,passive:!0}),window.addEventListener(`pointermove`,t,{capture:!0,passive:!0}),()=>{window.removeEventListener(`pointerdown`,e,{capture:!0}),window.removeEventListener(`pointermove`,t,{capture:!0})}},[d]);let g=d&&f&&!m;(0,p.useEffect)(()=>{g||u()},[g,u]);let _=(0,p.useCallback)(()=>{Promise.resolve(e?.exitPictureInPicture?.()).catch(e=>{console.warn(`leaving picture in picture was refused`,e)})},[e]);return(0,p.useMemo)(()=>g?{active:n,armed:i,arm:l,disarm:u,exit:_}:null,[g,n,i,l,u,_])},tT=async(e,t,n={})=>(await e.audioWorklet.addModule(t),new AudioWorkletNode(e,`banou-volume-normalizer`,{channelCountMode:`max`,processorOptions:n})),nT=new WeakMap,rT=e=>new Promise((t,n)=>{let r=()=>{(e.state===`running`||e.state===`closed`)&&(e.removeEventListener(`statechange`,r),e.state===`running`?t():n(new DOMException(`The AudioContext closed before it ran`,`InvalidStateError`)))};e.addEventListener(`statechange`,r),r()}),iT=(e,t,n={})=>{let r=nT.get(e);if(r)return r.wake(),r;let i=new AudioContext,a=n.enabled!==!1,o,s=!1,c=!1,l=()=>20*Math.log10(Math.max(e.volume,1e-6)),u=e.ownerDocument,d=()=>{i.state===`suspended`&&i.resume().catch(()=>{})},f=e=>{for(let t of[`pointerdown`,`pointerup`,`keydown`])e?u.addEventListener(t,d,!0):u.removeEventListener(t,d,!0)},p=()=>{c&&i.state===`running`&&i.suspend().catch(()=>{});let e=!s&&!c&&i.state===`suspended`;f(e),e&&o&&d()};i.addEventListener(`statechange`,p),p();let m=(async()=>{let r=await tT(i,t,{...n,enabled:a,inputGainDb:l()});await rT(i);let s=Jx(i,e);return r.port.postMessage({enabled:a,inputGainDb:l()}),s.connect(r).connect(i.destination),e.addEventListener(`volumechange`,()=>r.port.postMessage({inputGainDb:l()})),e.addEventListener(`seeking`,()=>r.port.postMessage({reset:`seek`})),e.addEventListener(`emptied`,()=>r.port.postMessage({reset:`source`})),e.addEventListener(`pause`,()=>{c=!0,i.state===`running`&&i.suspend().catch(()=>{})}),e.addEventListener(`play`,()=>{c=!1,d()}),o=r,r})();m.catch(()=>{s=!0,f(!1),i.close().catch(()=>{})});let h={context:i,routed:m,setEnabled:e=>{a=e,o?.port.postMessage({enabled:a})},release:()=>{s=!0,f(!1),e.isConnected?i.state===`running`&&i.suspend().catch(()=>{}):(nT.delete(e),i.close().catch(()=>{}))},wake:()=>{i.state!==`closed`&&(s=!1,d(),p())}};return nT.set(e,h),h},aT=20,oT=5,sT=1,cT=50,lT=({node:e,element:t,scriptUrl:n,source:r})=>{let i=!1,a,o=new Set,s=new Set,c=()=>{for(let e of[...s])e();s.clear()},l=()=>new Promise(e=>s.add(e)),u=async(e,t,n)=>{let r=Math.min(t+n,e.length);for(;a&&!a.some(([e,n])=>e<=t&&r<=n);)if(i||await new Promise(e=>o.add(e)))throw Error(`Cancelled`);return e.read(t,n)},d=e=>{for(let t of[...o])t(e);o.clear()},f;try{f=new Worker(n,{type:`module`})}catch(e){return console.warn(`[media-player] the volume normalizer cannot analyse ahead:`,e),{update:()=>{},stop:()=>{}}}let p=new MessageChannel;f.postMessage({type:`port`,port:p.port1},[p.port1]),e.port.postMessage({analysis:p.port2},[p.port2]);let m={spans:[],end:null},h=0,g=new Map,_=(e,t)=>new Promise(n=>g.set(`${e}:${t}`,n)),v=-1;f.onmessage=({data:e})=>{if(e.type===`unsupported`){U();return}e.spans&&((JSON.stringify(e.spans)!==JSON.stringify(m.spans)||e.end!==m.end)&&h++,m={spans:e.spans,end:e.end}),e.type===`merged`&&(v=e.run),g.get(`${e.type}:${e.run}`)?.(m),g.delete(`${e.type}:${e.run}`),c()};let y=e.context,b=()=>e.port.postMessage({media:t.currentTime,ctx:y.currentTime,rate:t.playbackRate,paused:t.paused||t.seeking||t.readyState<3}),x=()=>f.postMessage({type:`playhead`,time:t.currentTime}),S=setInterval(b,cT),C=[`play`,`playing`,`pause`,`seeking`,`seeked`,`ratechange`,`waiting`,`ended`];for(let e of C)t.addEventListener(e,b);let w=1/0,T=!1,E=0,D=!1,O=0,k=0,A=new Map,j=e=>{let t=e;for(let[e,n]of m.spans)e<=t&&t<n&&(t=n);return t>=(m.end??w)-.05?null:t},M=e=>A.get(Math.round(e*10))===h?`idle`:e,N=()=>{let e=t.currentTime,n=j(e),r=D&&v!==E;if(n!==null&&n<e+aT)return r&&O<=n+1&&n<=k+oT?`read`:M(n);if(r)return`read`;let i=n??j(0);return i===null?`done`:M(i)},P=()=>{},F=e=>(e.catch(()=>{}),Promise.race([e,new Promise(e=>{P=()=>e(void 0)})])),I=()=>{x(),T&&o.size&&typeof N()==`number`&&P(),c()},L=()=>{x(),c()};t.addEventListener(`seeking`,I),t.addEventListener(`seeked`,L),t.addEventListener(`timeupdate`,L);let R,ee=async e=>{if(!D)return;D=!1;let t=_(`ended`,E);f.postMessage({type:`end`,run:E,finished:e}),await t},z=async e=>{if(k=e.pts+e.duration,!e.data.byteLength)return;let t=_(`ack`,E);f.postMessage({type:`fragment`,run:E,data:e.data},[e.data]),await t},B=async e=>{if(R=await kg({publicPath:e.publicPath,workerUrl:e.libavWorkerUrl,workerOptions:{type:`module`},length:e.length,read:(t,n)=>u(e,t,n),audioStreamIndex:e.audioStreamIndex}),i)return lv(R);let t=await R.init();if(!i){for(w=t.info.input.duration||1/0,f.postMessage({type:`init`,data:t.data,codec:t.info.output.audioMimeType},[t.data]),D=!0,T=!0,f.postMessage({type:`run`,run:E,pts:t.timestampOffset,from:0,start:!0});!i;){let e=N();if(e===`done`)break;if(e===`idle`){await l();continue}try{if(e===`read`){let e=await F(R.read());if(i)return;if(!e)continue;await z(e),e.finished&&await ee(!0)}else{await ee(!1),A.set(Math.round(e*10),h);let n=R.seek(Math.max(0,e-sT));d(!0);let r=await F(n);if(i)return;if(!r)continue;E++,D=!0,O=r.pts,f.postMessage({type:`run`,run:E,pts:t.timestampOffset,from:r.pts,start:r.pts<=0}),await z(r),r.finished&&await ee(!0)}}catch{if(i)return;await ee(!1),typeof N()!=`number`&&await l()}}lv(R),R=void 0}},V=()=>{},H=(e,t)=>{let n=!1,r=e=>{n&&f.postMessage({type:`end`,run:E,finished:e}),n=!1};V=e.attach(t,(e,t)=>{if(e.type===`init`){r(!1);let t=e.data.slice(0);f.postMessage({type:`init`,data:t,codec:e.audioMimeType},[t])}else if(e.type===`run`)r(!1),n=!0,f.postMessage({type:`run`,run:++E,pts:e.pts,from:e.from,start:!t&&e.from<=0,join:t});else if(e.type===`end`)r(!0);else if(n){let t=e.data.slice(0);f.postMessage({type:`fragment`,run:E,data:t},[t])}})},U=()=>{if(!i){i=!0,d(!0),c(),clearInterval(S);for(let e of C)t.removeEventListener(e,b);t.removeEventListener(`seeking`,I),t.removeEventListener(`seeked`,L),t.removeEventListener(`timeupdate`,L),V(),R&&lv(R),f.terminate(),e.port.postMessage({analysis:null});for(let e of g.values())e(m);g.clear()}};return`tap`in r?H(r.tap,r.audioStreamIndex):B(r).catch(e=>{i||(console.warn(`[media-player] the volume normalizer cannot analyse ahead:`,e),U())}),x(),{update:e=>{a=e,d(!1)},stop:U}},uT=(e,t,n,r,i)=>{let a=(0,p.useRef)(null),[o,s]=(0,p.useState)(!1),[c,l]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(e&&t){if(n&&!a.current){let r=iT(e,t,{enabled:n});a.current=r,r.routed.then(e=>{a.current===r&&l(e)},e=>{a.current===r&&(console.warn(`[media-player] the volume normalizer is unavailable:`,e),s(!0))})}a.current?.setEnabled(n)}},[e,t,n]),(0,p.useEffect)(()=>()=>{a.current?.release(),a.current=null,l(null)},[e]);let u=(0,p.useRef)(i);u.current=i;let d=(0,p.useRef)(null),f=(0,p.useRef)(r);f.current=r;let{length:m,publicPath:h,libavWorkerUrl:g}=r&&`read`in r?r:{},_=r&&`tap`in r?r.tap:void 0,v=r?.audioStreamIndex;return(0,p.useEffect)(()=>{let r=f.current;if(!c||!e||!t||!n||!r)return;let i=lT({node:c,element:e,scriptUrl:t,source:r});return i.update(u.current),d.current=i,()=>{i.stop(),d.current=null}},[c,e,t,n,m,h,g,v,_]),(0,p.useEffect)(()=>{d.current?.update(i)},[i]),{refused:o}},dT=()=>{let e,t,n,r=()=>n&&e?.audioStreamIndex===n.audioStreamIndex?n:void 0;return{push:n=>{n.type===`init`?(e=n,t=void 0):n.type===`run`?t={output:n,begun:!1}:n.type===`fragment`&&t&&(t.begun=!0),r()?.take(n)},attach:(i,a)=>{let o={audioStreamIndex:i,take:a};return n=o,r()&&e&&(a(e),t&&a(t.output,t.begun)),()=>{n===o&&(n=void 0)}}}},fT={headings:{large:`
|
|
@@ -1293,7 +1293,7 @@ ${zT}
|
|
|
1293
1293
|
&.hide {
|
|
1294
1294
|
cursor: none;
|
|
1295
1295
|
}
|
|
1296
|
-
`,gE=(e,t=``)=>p.Children.toArray(e).flatMap((e,n)=>{let r=`${t}${(0,p.isValidElement)(e)&&e.key!=null?e.key:n}`;return(0,p.isValidElement)(e)&&e.type===p.Fragment?gE(e.props.children,`${r}/`):[{key:r,item:e}]}),Cee=({ref:e,onVideoRef:t,onSubtitleRef:n,overlay:r,controls:i,shortcuts:a,fullscreen:o,endingOffered:s,children:c})=>{let l=Z(),u=Z(e=>e.hideUI),d=Z(e=>e.setHideUI),f=Z(e=>e.hasMedia),m=Z(e=>e.passThroughPictureInPicture),h=(0,p.useRef)(void 0),g=(0,p.useRef)(`mouse`),_=(0,p.useRef)({x:-1,y:-1}),v=(0,p.useRef)(!1),y=(0,p.useRef)(null);(0,p.useEffect)(()=>()=>clearTimeout(h.current),[]),(0,p.useEffect)(()=>{let e=y.current;if(!e)return;let t=new ResizeObserver(([t])=>e.style.setProperty(`--mp-height`,`${t.contentRect.height}px`));return t.observe(e),()=>t.disconnect()},[]),(0,p.useEffect)(()=>{f||(clearTimeout(h.current),d(!1))},[f,d]);let b=()=>{f&&d(!0)},x=t=>{y.current=t,typeof e==`function`?e(t):e&&(e.current=t)},S=()=>{if(l.passThroughPictureInPicture?.armed)return!0;if(g.current!==`mouse`)return!1;let{x:e,y:t}=_.current;if(!y.current||e<0)return!1;let n=document.elementFromPoint(e,t);return!n||!y.current.contains(n)||n.closest(`.video`)?!1:!n.closest(`.control-bar`)||v.current||!!y.current.querySelector(`.control-bar [aria-expanded="true"]`)},C=()=>{if(S()){h.current=setTimeout(C,fE);return}b()},w=()=>{d(!1),clearTimeout(h.current),h.current=setTimeout(C,fE)},T=e=>{g.current=e.pointerType,e.pointerType===`mouse`&&(_.current={x:e.clientX,y:e.clientY},w())},E=e=>{g.current=e.pointerType,v.current=!0},D=()=>{v.current=!1},O=(0,p.useRef)(!0);return Y(`div`,{css:hE,ref:x,onPointerMove:T,onPointerDown:E,onPointerUp:D,onPointerCancel:D,onMouseOut:e=>{let t=e.relatedTarget;if(t&&e.currentTarget.contains(t))return;let{left:n,right:r,top:i,bottom:a}=e.currentTarget.getBoundingClientRect();e.clientX>=n&&e.clientX<r&&e.clientY>=i&&e.clientY<a||(clearTimeout(h.current),b())},className:u?`hide`:``,tabIndex:a===`player`?-1:void 0,children:[J(bT,{onSubtitleRef:n}),gE(r).map(({key:e,item:t})=>J(`div`,{css:pE,style:{...u?{opacity:`0`,visibility:`hidden`,pointerEvents:`none`}:{}},children:t},e)),i===!1?null:J(jT,{value:!!o,children:J(nE,{shortcuts:a,root:y,fullscreen:o})}),J(aE,{}),J(dE,{endingOffered:s}),m?.armed&&y.current?J(`div`,{className:`pass-through`,style:{clipPath:mE(m.armed,y.current.getBoundingClientRect())},onPointerOver:m.disarm}):null,Y(`div`,{className:`video`,onClick:e=>{if(g.current===`mouse`){if(e.detail>1)return;O.current=l.paused,l.togglePaused();return}u?w():(clearTimeout(h.current),b())},onDoubleClick:()=>{g.current===`mouse`&&(O.current?l.pause():l.play().catch(()=>{}),o?o.request():l.toggleFullscreen())},children:[t?J(`video`,{ref:t,playsInline:!0}):null,c]})]})},_E=(e,t)=>({title:e.options.find(e=>e.id===t)?.label}),vE=(e,t)=>e instanceof Promise?e.then(t):t(),wee=({options:e,children:t})=>{let n=`media`in e?e:null,r=n?null:e,{title:i,chapters:a}=e,{size:o,downloadedRanges:s,publicPath:c,libavWorkerUrl:l,read:u,thumbnailRead:d,thumbnailsEnabled:f,readsDownload:m}=r??{},h=fb(),g=pb(),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(null),x=n?.media??_;(0,p.useEffect)(()=>(h?.(x),()=>h?.(null)),[x,h]),Hw(x,n?.stepFrame);let{expose:S}=e,[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(!0),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(e.autoplayNext),[j]=(0,p.useState)(()=>Object.assign(new EventTarget,{chapters:[],endingOffered:!0,autoplayNext:null,onHostFullscreen:w,onEndingOffered:E,onAutoplayNext:e=>{O(e),e!==null&&A(e)}})),M=S===!0?{}:S||void 0,N=(0,p.useRef)(M);N.current=M;let P=M?M.id:void 0,F=M?M.origin:void 0,I=M?M.channel:void 0;(0,p.useEffect)(()=>{if(!S||!x)return;let e,t=!1;return gi(async()=>{let{exposePlayer:e}=await import(`./assets/remote-
|
|
1296
|
+
`,gE=(e,t=``)=>p.Children.toArray(e).flatMap((e,n)=>{let r=`${t}${(0,p.isValidElement)(e)&&e.key!=null?e.key:n}`;return(0,p.isValidElement)(e)&&e.type===p.Fragment?gE(e.props.children,`${r}/`):[{key:r,item:e}]}),Cee=({ref:e,onVideoRef:t,onSubtitleRef:n,overlay:r,controls:i,shortcuts:a,fullscreen:o,endingOffered:s,children:c})=>{let l=Z(),u=Z(e=>e.hideUI),d=Z(e=>e.setHideUI),f=Z(e=>e.hasMedia),m=Z(e=>e.passThroughPictureInPicture),h=(0,p.useRef)(void 0),g=(0,p.useRef)(`mouse`),_=(0,p.useRef)({x:-1,y:-1}),v=(0,p.useRef)(!1),y=(0,p.useRef)(null);(0,p.useEffect)(()=>()=>clearTimeout(h.current),[]),(0,p.useEffect)(()=>{let e=y.current;if(!e)return;let t=new ResizeObserver(([t])=>e.style.setProperty(`--mp-height`,`${t.contentRect.height}px`));return t.observe(e),()=>t.disconnect()},[]),(0,p.useEffect)(()=>{f||(clearTimeout(h.current),d(!1))},[f,d]);let b=()=>{f&&d(!0)},x=t=>{y.current=t,typeof e==`function`?e(t):e&&(e.current=t)},S=()=>{if(l.passThroughPictureInPicture?.armed)return!0;if(g.current!==`mouse`)return!1;let{x:e,y:t}=_.current;if(!y.current||e<0)return!1;let n=document.elementFromPoint(e,t);return!n||!y.current.contains(n)||n.closest(`.video`)?!1:!n.closest(`.control-bar`)||v.current||!!y.current.querySelector(`.control-bar [aria-expanded="true"]`)},C=()=>{if(S()){h.current=setTimeout(C,fE);return}b()},w=()=>{d(!1),clearTimeout(h.current),h.current=setTimeout(C,fE)},T=e=>{g.current=e.pointerType,e.pointerType===`mouse`&&(_.current={x:e.clientX,y:e.clientY},w())},E=e=>{g.current=e.pointerType,v.current=!0},D=()=>{v.current=!1},O=(0,p.useRef)(!0);return Y(`div`,{css:hE,ref:x,onPointerMove:T,onPointerDown:E,onPointerUp:D,onPointerCancel:D,onMouseOut:e=>{let t=e.relatedTarget;if(t&&e.currentTarget.contains(t))return;let{left:n,right:r,top:i,bottom:a}=e.currentTarget.getBoundingClientRect();e.clientX>=n&&e.clientX<r&&e.clientY>=i&&e.clientY<a||(clearTimeout(h.current),b())},className:u?`hide`:``,tabIndex:a===`player`?-1:void 0,children:[J(bT,{onSubtitleRef:n}),gE(r).map(({key:e,item:t})=>J(`div`,{css:pE,style:{...u?{opacity:`0`,visibility:`hidden`,pointerEvents:`none`}:{}},children:t},e)),i===!1?null:J(jT,{value:!!o,children:J(nE,{shortcuts:a,root:y,fullscreen:o})}),J(aE,{}),J(dE,{endingOffered:s}),m?.armed&&y.current?J(`div`,{className:`pass-through`,style:{clipPath:mE(m.armed,y.current.getBoundingClientRect())},onPointerOver:m.disarm}):null,Y(`div`,{className:`video`,onClick:e=>{if(g.current===`mouse`){if(e.detail>1)return;O.current=l.paused,l.togglePaused();return}u?w():(clearTimeout(h.current),b())},onDoubleClick:()=>{g.current===`mouse`&&(O.current?l.pause():l.play().catch(()=>{}),o?o.request():l.toggleFullscreen())},children:[t?J(`video`,{ref:t,playsInline:!0}):null,c]})]})},_E=(e,t)=>({title:e.options.find(e=>e.id===t)?.label}),vE=(e,t)=>e instanceof Promise?e.then(t):t(),wee=({options:e,children:t})=>{let n=`media`in e?e:null,r=n?null:e,{title:i,chapters:a}=e,{size:o,downloadedRanges:s,publicPath:c,libavWorkerUrl:l,read:u,thumbnailRead:d,thumbnailsEnabled:f,readsDownload:m}=r??{},h=fb(),g=pb(),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(null),x=n?.media??_;(0,p.useEffect)(()=>(h?.(x),()=>h?.(null)),[x,h]),Hw(x,n?.stepFrame);let{expose:S}=e,[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(!0),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(e.autoplayNext),[j]=(0,p.useState)(()=>Object.assign(new EventTarget,{chapters:[],endingOffered:!0,autoplayNext:null,onHostFullscreen:w,onEndingOffered:E,onAutoplayNext:e=>{O(e),e!==null&&A(e)}})),M=S===!0?{}:S||void 0,N=(0,p.useRef)(M);N.current=M;let P=M?M.id:void 0,F=M?M.origin:void 0,I=M?M.channel:void 0;(0,p.useEffect)(()=>{if(!S||!x)return;let e,t=!1;return gi(async()=>{let{exposePlayer:e}=await import(`./assets/remote-Chj4n8pS.js`);return{exposePlayer:e}},[]).then(({exposePlayer:n})=>{t||(e=n(x,{...N.current,player:j}))}).catch(()=>{}),()=>{t=!0,e?.()}},[x,!!S,P,F,I]);let L=Z(e=>e.chapters),R=JSON.stringify(L);(0,p.useEffect)(()=>{j.chapters=L,j.endingOffered=T,j.dispatchEvent(new Event(`chapterschange`))},[R,T]);let ee=e.autoplayNext;(0,p.useEffect)(()=>{D===null&&A(ee)},[ee,D]);let z=(0,p.useRef)(e.onAutoplayNextChange);z.current=e.onAutoplayNextChange,(0,p.useEffect)(()=>{j.autoplayNext=k??null,j.dispatchEvent(new Event(`autoplaynextchange`))},[k]);let B=e.fullscreen??(C===null?void 0:{active:C,request:()=>j.dispatchEvent(new Event(`fullscreenrequest`))}),V=(0,p.useMemo)(()=>dT(),[o]);Rw(_,y,r,m?V.push:void 0);let H=r?.normalizeVolume??!0,[U,W]=(0,p.useState)(H);(0,p.useEffect)(()=>{W(H)},[H]);let te=(0,p.useRef)(r?.onNormalizeVolumeChange);te.current=r?.onNormalizeVolumeChange;let G=r?.normalizerWorkletUrl,ne=(0,p.useRef)(d??u);ne.current=d??u;let re=Z(e=>e.selectedAudioTrack),ie=!!u,{refused:ae}=uT(_,G,U,(0,p.useMemo)(()=>ie&&o&&c&&l&&typeof re==`number`&&re>=0?m?{tap:V,audioStreamIndex:re}:{read:(e,t)=>ne.current(e,t),length:o,publicPath:c,libavWorkerUrl:l,audioStreamIndex:re}:void 0,[ie,o,c,l,re,m,V]),(0,p.useMemo)(()=>s?.map(({startByteOffset:e,endByteOffset:t})=>[e,t]),[s?.map(({startByteOffset:e,endByteOffset:t})=>`${e}-${t}`).join(`,`)])),oe=(0,p.useMemo)(()=>G&&typeof AudioWorkletNode==`function`?{enabled:U,available:!ae,setEnabled:e=>{W(e),te.current?.(e)}}:null,[G,U,ae]),{thumbnails:se,requestThumbnail:K}=qw({publicPath:c,workerUrl:l,length:f===!1?void 0:o,read:d??u,downloadedRanges:s}),ce=n?.thumbnails?.all??se,{toggle:le,mode:ue,burnedIn:de}=Jw(_,y),fe=eT(n?.media??null,n?.pictureInPicture),pe=Z(e=>e.setSourceState),me=n?!!n.media:o!==void 0;(0,p.useEffect)(()=>{pe({title:i,size:o,downloadedRanges:s,hasMedia:me})},[pe,i,o,s,me]);let he=n?.thumbnails?.at;(0,p.useEffect)(()=>{pe({thumbnails:ce,thumbnailAt:he,requestThumbnail:K,togglePictureInPicture:le,pictureInPictureMode:ue,burnedInSubtitles:de})},[pe,ce,he,K,le,ue,de]),(0,p.useEffect)(()=>{pe({volumeNormalizer:oe})},[pe,oe]),(0,p.useEffect)(()=>{pe({autoplayNext:k===void 0?null:{enabled:k,setEnabled:e=>{A(e),z.current?.(e)}}})},[pe,k]),(0,p.useEffect)(()=>{pe({passThroughPictureInPicture:fe})},[pe,fe]);let ge=n?.subtitles?.selection,_e=n?.audioTracks?.selection,ve=(0,p.useRef)({options:e,audio:_e});ve.current={options:e,audio:_e},(0,p.useEffect)(()=>{ge&&pe({subtitleTracks:ge.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedSubtitleTrack:ge.selectedId??void 0,selectSubtitleTrack:e=>{let t=e==null?null:String(e),n=t===null?void 0:_E(ge,t),r=ge.selectedId===null;return vE(ge.select(t),()=>{let e=t===null?null:Qv(n)??(r?n?.title:void 0),i=ve.current;e!==void 0&&i.options.onPreferredSubtitleLanguageChange?.(e);let a=i.audio&&_E(i.audio,i.audio.selectedId??``);e&&ny(a,e)&&i.options.onAlwaysShowSubtitlesChange?.(!0)})},subtitleOffLabel:ge.offLabel})},[pe,ge]),(0,p.useEffect)(()=>{_e&&pe({audioTracks:_e.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedAudioTrack:_e.selectedId??void 0,selectAudioTrack:e=>vE(_e.select(String(e)),()=>{let t=Qv(_E(_e,String(e)));t!==void 0&&ve.current.options.onPreferredAudioLanguageChange?.(t)})})},[pe,_e]);let ye=n?.quality?.selection??null;return(0,p.useEffect)(()=>{pe({quality:ye})},[pe,ye]),(0,p.useEffect)(()=>{a&&pe({chapters:a})},[pe,a]),J(Cee,{ref:g,onVideoRef:n?void 0:v,onSubtitleRef:b,overlay:e.overlay,controls:e.controls,shortcuts:e.shortcuts,fullscreen:B,endingOffered:T,children:t})},yE=mt`
|
|
1297
1297
|
/**
|
|
1298
1298
|
* The chrome's whole scale, in one place.
|
|
1299
1299
|
*
|
|
@@ -5157,7 +5157,7 @@ This browser reports limited detail, so the cause above is a best guess.`:``)))}
|
|
|
5157
5157
|
`+(e.v1??e.v2);i.sort((e,t)=>o(e)<o(t)?-1:1);let s=i.flatMap(e=>[e.v1,e.v2].filter(e=>e!==void 0)).map(m1),c=[x9];T9(c,a),T9(c,s.reduce((e,t)=>e+t.length,0));let l=i.map(e=>String.fromCharCode((e.v1?S9:0)|(e.v2?C9:0))).join(``),u=qte.encode(l+e.replace(/[\r\n]+/g,` `)+`
|
|
5158
5158
|
`+i.map(e=>e.line+`
|
|
5159
5159
|
`).join(``)),d=g1(new Uint8Array([...c,...s.flatMap(e=>[...e]),...X$(u,{level:9,dictionary:i1})]));return{link:D9(d)?Wte+d:null,count:a,privateLeftOut:n}},D9=e=>{try{if(!/^[\w-]+$/.test(e))return null;let t=_1(e);if(t[0]!==x9)return null;let n={i:1},r=E9(t,n),i=E9(t,n);if(r<1||r>1e3)return null;let a=t.subarray(n.i,n.i+i),o=Z$(t.subarray(n.i+i),{dictionary:i1,out:new Uint8Array(4194305)});if(o.length>Kte)return null;let s=Jte.decode(o),c=0,l=[];for(let e=0;e<r;e++){let t=s.charCodeAt(e);if(!(t>=1&&t<=3))return null;l.push(t),c+=(t&S9?20:0)+(t&C9?32:0)}if(c!==i)return null;let[u,...d]=s.slice(r).split(`
|
|
5160
|
-
`);if(!u?.trim()||d.pop()!==``||d.length!==r||d.some(e=>!/^[\x21-\x7e]*$/.test(e)||e.split(`&`).some(Yte)))return null;let f=new Set,p=[],m=0;for(let[e,t]of l.entries()){let n=t&S9?h1(a.subarray(m,m+=20)):``,r=t&C9?h1(a.subarray(m,m+=32)):``;for(let e of[n,r])if(e){if(f.has(e))return null;f.add(e)}let i=[n&&`xt=urn:btih:${n}`,r&&`xt=urn:btmh:1220${r}`,d[e]].filter(Boolean);p.push({infoHash:n||r,magnet:`magnet:?${i.join(`&`)}`})}return{name:u,torrents:p}}catch{return null}},Qte=e=>{let t=_Y(),[n,r]=(0,p.useState)(()=>k7(e=>localStorage.getItem(e))),i=(0,p.useRef)(0),a=n?t?.find(e=>e.id===n):void 0;return(0,p.useEffect)(()=>{i.current=Date.now()},[]),(0,p.useEffect)(()=>{if(!a)return;let t=new Set(a.members.map(e=>e.infoHash)),n=e.flatMap(e=>e.infoHash&&!t.has(e.infoHash)&&e.state!==`missing`&&!e7(e)&&(e.addedAt??0)>=i.current?[e.infoHash]:[]);n.length&&EY(a.id,n).catch(()=>{})},[a,e]),{groups:t,group:a,members:a?cY(a):void 0,choose:e=>{r(e),i.current=Date.now();try{e?localStorage.setItem(C7,e):localStorage.removeItem(C7)}catch{}}}},$te=(e,t)=>{let n=b9(t);return(0,p.useMemo)(()=>n&&{...Zte(e,n.magnets.map(e=>({magnet:e}))),privateLeftOut:n.left},[e,n])},ene=1048576,tne=e=>e&&e.torrents.reduce((e,t)=>e+t.magnet.length,0)<=ene?{...e,name:CY(e.name)}:null,nne=async(e,t,n)=>{let r=Date.now();n(e.torrents.map(({infoHash:e,magnet:t})=>({infoHash:e,magnet:t,savePath:TJ(e),addedAt:r})));let i=e.torrents.map(e=>e.infoHash),a=CY(e.name),o=t.find(e=>e.name===a&&[...cY(e)].every(e=>i.includes(e)));return o?(await EY(o.id,i),o.id):wY(a,i)},O9=(e,t)=>(e.flags&t)!==0,k9=e=>e.state===`missing`,A9=e=>k9(e)||e.state===`starting`,j9=(e,t,n={savedToUserStorage:!1})=>{let r=A9(e)?k9(e)?q.formatMessage({id:`Not on this device`,defaultMessage:`Not on this device`}):q.formatMessage({id:`Still starting`,defaultMessage:`Still starting`}):void 0,i=e.progress>=1,a=O9(e,wD.sequentialDownload),o=O9(e,wD.paused)&&O9(e,wD.autoManaged)&&e.state!==`retrying`,s=D1(e.files).length>1,c=n.sessionLimits??{down:0,up:0},l=[];F1(e)&&!k9(e)&&l.push({kind:`action`,id:`watch`,label:q.formatMessage({id:`Watch`,defaultMessage:`Watch`}),run:t.watch}),k9(e)&&e.saveTo!==`source`&&l.push({kind:`action`,id:`start`,label:q.formatMessage({id:`Download to this device`,defaultMessage:`Download to this device`}),run:t.start}),D1(e.files).length&&i&&!k9(e)&&l.push({kind:`action`,id:`save`,label:s?q.formatMessage({id:`Save as a zip`,defaultMessage:`Save as a zip`}):q.formatMessage({id:`Save to disk`,defaultMessage:`Save to disk`}),run:t.save}),e.magnet&&l.push({kind:`action`,id:`embed`,label:q.formatMessage({id:`Get a share link`,defaultMessage:`Get a share link`}),run:t.embed}),l.push({kind:`action`,id:`copy-name`,label:q.formatMessage({id:`Copy name`,defaultMessage:`Copy name`}),disabled:!r&&!e.files?.length&&!bl(e.magnet??``,`dn`)?q.formatMessage({id:`Waiting for metadata`,defaultMessage:`Waiting for metadata`}):void 0,run:t.copyName}),e.infoHash&&l.push({kind:`action`,id:`copy-info-hash`,label:q.formatMessage({id:`Copy info hash`,defaultMessage:`Copy info hash`}),run:t.copyInfoHash}),e.magnet&&(l.push({kind:`action`,id:`copy-magnet`,label:q.formatMessage({id:`Copy magnet`,defaultMessage:`Copy magnet`}),run:t.copyMagnet}),l.push({kind:`action`,id:`save-torrent-file`,label:q.formatMessage({id:`Save .torrent`,defaultMessage:`Save .torrent`}),disabled:e.files?.length?void 0:k9(e)?q.formatMessage({id:`Not on this device`,defaultMessage:`Not on this device`}):q.formatMessage({id:`Waiting for metadata`,defaultMessage:`Waiting for metadata`}),run:t.saveTorrentFile}));let u=[];l.length&&u.push({id:`actions`,label:q.formatMessage({id:`Actions`,defaultMessage:`Actions`}),items:l});let d=[{kind:`action`,id:`toggle-run`,label:A1(e)?j1(e)?q.formatMessage({id:`Start`,defaultMessage:`Start`}):q.formatMessage({id:`Resume`,defaultMessage:`Resume`}):j1(e)?q.formatMessage({id:`Stop`,defaultMessage:`Stop`}):q.formatMessage({id:`Pause`,defaultMessage:`Pause`}),disabled:r,run:()=>A1(e)?t.resume():t.pause()},...o||e.forced?[{kind:`toggle`,id:`force-start`,label:q.formatMessage({id:`Force start`,defaultMessage:`Force start`}),checked:e.forced===!0,apply:e=>e?t.forceStart():t.resume()}]:[],{kind:`action`,id:`recheck`,label:q.formatMessage({id:`Force recheck`,defaultMessage:`Force recheck`}),disabled:r??(e.state===`checking`?q.formatMessage({id:`Already checking`,defaultMessage:`Already checking`}):void 0),run:t.recheck}];if(e.state===`retrying`&&d.splice(1,0,{kind:`action`,id:`retry-now`,label:q.formatMessage({id:`Try again now`,defaultMessage:`Try again now`}),run:t.retryNow}),k9(e)?d.push({kind:`action`,id:`remove`,label:q.formatMessage({id:`Remove from the library`,defaultMessage:`Remove from the library`}),danger:!0,run:t.remove}):(n.savedToUserStorage&&d.push({kind:`action`,id:`remove`,label:q.formatMessage({id:`Remove from the library`,defaultMessage:`Remove from the library`}),danger:!0,run:t.remove}),d.push({kind:`action`,id:`remove-files`,label:n.savedToUserStorage?q.formatMessage({id:`Remove and delete Ripple's copy`,defaultMessage:`Remove and delete Ripple's copy`}):q.formatMessage({id:`Remove and delete the files`,defaultMessage:`Remove and delete the files`}),danger:!0,run:t.removeWithFiles})),u.push({id:`maintenance`,label:q.formatMessage({id:`Manage`,defaultMessage:`Manage`}),items:d}),n.folderReady&&!A9(e)){let r=n.intended??`browser`,a=M6(j6({current:n.current??`browser`,intended:r,complete:i,folderReady:!0,leavesFilesOut:k1(e)}),n.folderName,q);u.push({id:`location`,label:q.formatMessage({id:`Set location`,defaultMessage:`Set location`}),items:[{kind:`radio`,id:`location-browser`,group:`location`,label:q.formatMessage({id:`Keep in browser storage`,defaultMessage:`Keep in browser storage`}),selected:r===`browser`,apply:()=>t.setLocation(`browser`)},{kind:`radio`,id:`location-folder`,group:`location`,label:n.folderName===void 0?q.formatMessage({id:`Move to your folder`,defaultMessage:`Move to your folder`}):q.formatMessage({id:`Move to {folder}`,defaultMessage:`Move to {folder}`},{folder:n.folderName}),hint:r===`folder`&&a?a:void 0,selected:r===`folder`,apply:()=>t.setLocation(`folder`)},{kind:`action`,id:`pick-folder`,label:q.formatMessage({id:`Choose another folder...`,defaultMessage:`Choose another folder...`}),hint:q.formatMessage({id:`Applies to every torrent`,defaultMessage:`Applies to every torrent`}),run:t.pickFolder}]})}return u.push({id:`keep`,label:q.formatMessage({id:`Storage`,defaultMessage:`Storage`}),items:[{kind:`toggle`,id:`keep`,label:q.formatMessage({id:`Keep this download`,defaultMessage:`Keep this download`}),checked:e.ephemeral!==!0,disabled:e.infoHash?void 0:q.formatMessage({id:`Waiting for the info hash`,defaultMessage:`Waiting for the info hash`}),apply:e=>t.setKept(e)}]}),u.push({id:`order`,label:q.formatMessage({id:`Piece order`,defaultMessage:`Piece order`}),items:[{kind:`radio`,id:`order-rarest`,group:`order`,label:q.formatMessage({id:`Rarest first`,defaultMessage:`Rarest first`}),selected:!a,disabled:r??(i?q.formatMessage({id:`Already downloaded`,defaultMessage:`Already downloaded`}):void 0),apply:()=>t.setFlags(0,wD.sequentialDownload)},{kind:`radio`,id:`order-sequential`,group:`order`,label:q.formatMessage({id:`Download in sequential order`,defaultMessage:`Download in sequential order`}),selected:a,disabled:r??(i?q.formatMessage({id:`Already downloaded`,defaultMessage:`Already downloaded`}):void 0),apply:()=>t.setFlags(wD.sequentialDownload,wD.sequentialDownload)},{kind:`toggle`,id:`first-last`,label:q.formatMessage({id:`Download first and last pieces first`,defaultMessage:`Download first and last pieces first`}),checked:e.firstLast===!0,disabled:r??(i?q.formatMessage({id:`Already downloaded`,defaultMessage:`Already downloaded`}):void 0),apply:e=>t.setFirstLast(e)}]},{id:`speed`,label:q.formatMessage({id:`Speed`,defaultMessage:`Speed`}),items:[[`limit-down`,q.formatMessage({id:`Limit download rate...`,defaultMessage:`Limit download rate...`}),`down`,e.downloadLimit,c.down],[`limit-up`,q.formatMessage({id:`Limit upload rate...`,defaultMessage:`Limit upload rate...`}),`up`,e.uploadLimit,c.up]].map(([e,n,i,a,o])=>({kind:`action`,id:e,label:n,hint:RD(a,o,q),disabled:r,run:()=>t.limitRate(i)}))},{id:`peers`,label:q.formatMessage({id:`Finding peers`,defaultMessage:`Finding peers`}),items:[{kind:`toggle`,id:`dht`,label:q.formatMessage({id:`Disable DHT for this torrent`,defaultMessage:`Disable DHT for this torrent`}),checked:O9(e,wD.disableDht),disabled:r,apply:e=>t.setFlags(e?wD.disableDht:0,wD.disableDht)},{kind:`toggle`,id:`pex`,label:q.formatMessage({id:`Disable PeX for this torrent`,defaultMessage:`Disable PeX for this torrent`}),checked:O9(e,wD.disablePex),disabled:r,apply:e=>t.setFlags(e?wD.disablePex:0,wD.disablePex)},{kind:`action`,id:`reannounce`,label:q.formatMessage({id:`Force reannounce`,defaultMessage:`Force reannounce`}),disabled:r,run:t.reannounce}]},{id:`sharing`,label:q.formatMessage({id:`Sharing`,defaultMessage:`Sharing`}),items:[{kind:`toggle`,id:`upload-only`,label:q.formatMessage({id:`Upload mode`,defaultMessage:`Upload mode`}),checked:O9(e,wD.uploadMode),disabled:r,apply:e=>t.setFlags(e?wD.uploadMode:0,wD.uploadMode)},{kind:`toggle`,id:`super-seed`,label:q.formatMessage({id:`Super seeding mode`,defaultMessage:`Super seeding mode`}),checked:O9(e,wD.superSeeding),disabled:r??(i?void 0:q.formatMessage({id:`Available once downloaded`,defaultMessage:`Available once downloaded`})),apply:e=>t.setFlags(e?wD.superSeeding:0,wD.superSeeding)}]}),e.queuePosition>=0&&!k9(e)&&u.push({id:`queue`,label:q.formatMessage({id:`Queue position {position}`,defaultMessage:`Queue position {position}`},{position:e.queuePosition+1}),items:[[`queue-top`,q.formatMessage({id:`Move to top`,defaultMessage:`Move to top`}),`top`],[`queue-up`,q.formatMessage({id:`Move up`,defaultMessage:`Move up`}),`up`],[`queue-down`,q.formatMessage({id:`Move down`,defaultMessage:`Move down`}),`down`],[`queue-bottom`,q.formatMessage({id:`Move to bottom`,defaultMessage:`Move to bottom`}),`bottom`]].map(([e,n,r])=>({kind:`action`,id:e,label:n,run:()=>t.moveInQueue(r)}))}),n.groups&&e.infoHash&&u.push({id:`groups`,label:q.formatMessage({id:`Groups`,defaultMessage:`Groups`}),items:[...n.groups.map(e=>({kind:`toggle`,id:`group-${e.id}`,label:e.name,typed:!0,checked:e.holds,apply:n=>t.setInGroup(e.id,n)})),{kind:`action`,id:`new-group`,label:q.formatMessage({id:`New group...`,defaultMessage:`New group...`}),run:t.newGroup}]}),u},rne=`Ripple`,ine=new URL(`/assets/logo-B9QFeSBc.svg`,``+import.meta.url).href,ane=700,one=519,M9=900,sne=`v0.0.80 · 044862e`,N9=e=>`\u2068${e}\u2069`,P9=e=>{let t=e?.types;return t?[...t].some(e=>e===`Files`||e===`text/uri-list`):!1},cne=({quota:e})=>{let t=ti(),n=J(`label`,{children:t.formatMessage({id:`FKN quota`,defaultMessage:`FKN quota`})});return e.premium?Y(`div`,{className:`stat quota`,children:[n,J(`strong`,{className:`ok`,children:t.formatMessage({id:`Premium`,defaultMessage:`Premium`})})]}):e.throttled?Y(`div`,{className:`stat quota throttled`,children:[n,J(`strong`,{children:t.formatMessage({id:`Throttled · {speed}`,defaultMessage:`Throttled · {speed}`},{speed:Tee(e.bytesPerSecond)})}),J(`a`,{href:`https://fkn.app/account`,target:`_blank`,rel:`noreferrer`,children:t.formatMessage({id:`Get full speed`,defaultMessage:`Get full speed`})})]}):Y(`div`,{className:`stat quota`,children:[n,J(`strong`,{children:t.formatMessage({id:`{size} left`,defaultMessage:`{size} left`},{size:pD(e.remainingBytes,!0)})})]})},lne=({storage:e,low:t})=>{let n=ti();return Y(`div`,{className:`stat storage`+(t?` low`:``),children:[J(`label`,{children:n.formatMessage({id:`Storage`,defaultMessage:`Storage`})}),J(`strong`,{children:n.formatMessage({id:`{done} / {total}`,defaultMessage:`{done} / {total}`},{done:pD(e.usedBytes,!0),total:pD(e.limitBytes,!0)})})]})},une=Jn({"signed-out":{id:`Connect an account to sync your library.`,defaultMessage:`Connect an account to sync your library.`},"no-storage-grant":{id:`Storage did not answer. Retrying.`,defaultMessage:`Storage did not answer. Retrying.`},"broker-timeout":{id:`FKN did not respond. Retrying.`,defaultMessage:`FKN did not respond. Retrying.`},"account-unknown":{id:`Waiting for your account.`,defaultMessage:`Waiting for your account.`},locked:{id:`Your storage is locked. Unlock it to sync.`,defaultMessage:`Your storage is locked. Unlock it to sync.`},"read-failed":{id:`Could not read your saved library. Retrying.`,defaultMessage:`Could not read your saved library. Retrying.`},"read-timeout":{id:`FKN did not respond. Retrying.`,defaultMessage:`FKN did not respond. Retrying.`},"switch-unverified":{id:`Waiting for this account's library.`,defaultMessage:`Waiting for this account's library.`},"write-failed":{id:`Could not save your library. Retrying on the next change.`,defaultMessage:`Could not save your library. Retrying on the next change.`}}),dne=({state:e})=>{let t=ti(),{status:n,reason:r}=e;if(n===`off`)return null;let i=n===`syncing`?t.formatMessage({id:`Syncing…`,defaultMessage:`Syncing…`}):n===`error`?t.formatMessage({id:`Sync failed`,defaultMessage:`Sync failed`}):t.formatMessage({id:`Synced`,defaultMessage:`Synced`});return Y(`div`,{className:`stat sync`+(n===`error`?` error`:``),...R0(r?t.formatMessage(une[r]):void 0),children:[J(`label`,{children:t.formatMessage({id:`Library`,defaultMessage:`Library`})}),J(`strong`,{className:n===`synced`?`ok`:void 0,children:i})]})},fne=({reachable:e,inboundNow:t=OD})=>{let n=ti();if(!e)return null;let{port:r,inbound:i,listenFailed:a}=e,o=e.listeners??[],s=e.portOpen??!0,c=a.length>0,l=kD(t),u=!!r&&!s&&o.some(e=>e.healing),d=c?n.formatMessage({id:`Failed`,defaultMessage:`Failed`}):r?u?n.formatMessage({id:`:{port} · reconnecting`,defaultMessage:`:{port} · reconnecting`},{port:r}):s?l?`:${r} · ${l}`:`:${r}`:n.formatMessage({id:`:{port} · closed`,defaultMessage:`:{port} · closed`},{port:r}):n.formatMessage({id:`Unreachable`,defaultMessage:`Unreachable`}),f=c?a.join(`
|
|
5160
|
+
`);if(!u?.trim()||d.pop()!==``||d.length!==r||d.some(e=>!/^[\x21-\x7e]*$/.test(e)||e.split(`&`).some(Yte)))return null;let f=new Set,p=[],m=0;for(let[e,t]of l.entries()){let n=t&S9?h1(a.subarray(m,m+=20)):``,r=t&C9?h1(a.subarray(m,m+=32)):``;for(let e of[n,r])if(e){if(f.has(e))return null;f.add(e)}let i=[n&&`xt=urn:btih:${n}`,r&&`xt=urn:btmh:1220${r}`,d[e]].filter(Boolean);p.push({infoHash:n||r,magnet:`magnet:?${i.join(`&`)}`})}return{name:u,torrents:p}}catch{return null}},Qte=e=>{let t=_Y(),[n,r]=(0,p.useState)(()=>k7(e=>localStorage.getItem(e))),i=(0,p.useRef)(0),a=n?t?.find(e=>e.id===n):void 0;return(0,p.useEffect)(()=>{i.current=Date.now()},[]),(0,p.useEffect)(()=>{if(!a)return;let t=new Set(a.members.map(e=>e.infoHash)),n=e.flatMap(e=>e.infoHash&&!t.has(e.infoHash)&&e.state!==`missing`&&!e7(e)&&(e.addedAt??0)>=i.current?[e.infoHash]:[]);n.length&&EY(a.id,n).catch(()=>{})},[a,e]),{groups:t,group:a,members:a?cY(a):void 0,choose:e=>{r(e),i.current=Date.now();try{e?localStorage.setItem(C7,e):localStorage.removeItem(C7)}catch{}}}},$te=(e,t)=>{let n=b9(t);return(0,p.useMemo)(()=>n&&{...Zte(e,n.magnets.map(e=>({magnet:e}))),privateLeftOut:n.left},[e,n])},ene=1048576,tne=e=>e&&e.torrents.reduce((e,t)=>e+t.magnet.length,0)<=ene?{...e,name:CY(e.name)}:null,nne=async(e,t,n)=>{let r=Date.now();n(e.torrents.map(({infoHash:e,magnet:t})=>({infoHash:e,magnet:t,savePath:TJ(e),addedAt:r})));let i=e.torrents.map(e=>e.infoHash),a=CY(e.name),o=t.find(e=>e.name===a&&[...cY(e)].every(e=>i.includes(e)));return o?(await EY(o.id,i),o.id):wY(a,i)},O9=(e,t)=>(e.flags&t)!==0,k9=e=>e.state===`missing`,A9=e=>k9(e)||e.state===`starting`,j9=(e,t,n={savedToUserStorage:!1})=>{let r=A9(e)?k9(e)?q.formatMessage({id:`Not on this device`,defaultMessage:`Not on this device`}):q.formatMessage({id:`Still starting`,defaultMessage:`Still starting`}):void 0,i=e.progress>=1,a=O9(e,wD.sequentialDownload),o=O9(e,wD.paused)&&O9(e,wD.autoManaged)&&e.state!==`retrying`,s=D1(e.files).length>1,c=n.sessionLimits??{down:0,up:0},l=[];F1(e)&&!k9(e)&&l.push({kind:`action`,id:`watch`,label:q.formatMessage({id:`Watch`,defaultMessage:`Watch`}),run:t.watch}),k9(e)&&e.saveTo!==`source`&&l.push({kind:`action`,id:`start`,label:q.formatMessage({id:`Download to this device`,defaultMessage:`Download to this device`}),run:t.start}),D1(e.files).length&&i&&!k9(e)&&l.push({kind:`action`,id:`save`,label:s?q.formatMessage({id:`Save as a zip`,defaultMessage:`Save as a zip`}):q.formatMessage({id:`Save to disk`,defaultMessage:`Save to disk`}),run:t.save}),e.magnet&&l.push({kind:`action`,id:`embed`,label:q.formatMessage({id:`Get a share link`,defaultMessage:`Get a share link`}),run:t.embed}),l.push({kind:`action`,id:`copy-name`,label:q.formatMessage({id:`Copy name`,defaultMessage:`Copy name`}),disabled:!r&&!e.files?.length&&!bl(e.magnet??``,`dn`)?q.formatMessage({id:`Waiting for metadata`,defaultMessage:`Waiting for metadata`}):void 0,run:t.copyName}),e.infoHash&&l.push({kind:`action`,id:`copy-info-hash`,label:q.formatMessage({id:`Copy info hash`,defaultMessage:`Copy info hash`}),run:t.copyInfoHash}),e.magnet&&(l.push({kind:`action`,id:`copy-magnet`,label:q.formatMessage({id:`Copy magnet`,defaultMessage:`Copy magnet`}),run:t.copyMagnet}),l.push({kind:`action`,id:`save-torrent-file`,label:q.formatMessage({id:`Save .torrent`,defaultMessage:`Save .torrent`}),disabled:e.files?.length?void 0:k9(e)?q.formatMessage({id:`Not on this device`,defaultMessage:`Not on this device`}):q.formatMessage({id:`Waiting for metadata`,defaultMessage:`Waiting for metadata`}),run:t.saveTorrentFile}));let u=[];l.length&&u.push({id:`actions`,label:q.formatMessage({id:`Actions`,defaultMessage:`Actions`}),items:l});let d=[{kind:`action`,id:`toggle-run`,label:A1(e)?j1(e)?q.formatMessage({id:`Start`,defaultMessage:`Start`}):q.formatMessage({id:`Resume`,defaultMessage:`Resume`}):j1(e)?q.formatMessage({id:`Stop`,defaultMessage:`Stop`}):q.formatMessage({id:`Pause`,defaultMessage:`Pause`}),disabled:r,run:()=>A1(e)?t.resume():t.pause()},...o||e.forced?[{kind:`toggle`,id:`force-start`,label:q.formatMessage({id:`Force start`,defaultMessage:`Force start`}),checked:e.forced===!0,apply:e=>e?t.forceStart():t.resume()}]:[],{kind:`action`,id:`recheck`,label:q.formatMessage({id:`Force recheck`,defaultMessage:`Force recheck`}),disabled:r??(e.state===`checking`?q.formatMessage({id:`Already checking`,defaultMessage:`Already checking`}):void 0),run:t.recheck}];if(e.state===`retrying`&&d.splice(1,0,{kind:`action`,id:`retry-now`,label:q.formatMessage({id:`Try again now`,defaultMessage:`Try again now`}),run:t.retryNow}),k9(e)?d.push({kind:`action`,id:`remove`,label:q.formatMessage({id:`Remove from the library`,defaultMessage:`Remove from the library`}),danger:!0,run:t.remove}):(n.savedToUserStorage&&d.push({kind:`action`,id:`remove`,label:q.formatMessage({id:`Remove from the library`,defaultMessage:`Remove from the library`}),danger:!0,run:t.remove}),d.push({kind:`action`,id:`remove-files`,label:n.savedToUserStorage?q.formatMessage({id:`Remove and delete Ripple's copy`,defaultMessage:`Remove and delete Ripple's copy`}):q.formatMessage({id:`Remove and delete the files`,defaultMessage:`Remove and delete the files`}),danger:!0,run:t.removeWithFiles})),u.push({id:`maintenance`,label:q.formatMessage({id:`Manage`,defaultMessage:`Manage`}),items:d}),n.folderReady&&!A9(e)){let r=n.intended??`browser`,a=M6(j6({current:n.current??`browser`,intended:r,complete:i,folderReady:!0,leavesFilesOut:k1(e)}),n.folderName,q);u.push({id:`location`,label:q.formatMessage({id:`Set location`,defaultMessage:`Set location`}),items:[{kind:`radio`,id:`location-browser`,group:`location`,label:q.formatMessage({id:`Keep in browser storage`,defaultMessage:`Keep in browser storage`}),selected:r===`browser`,apply:()=>t.setLocation(`browser`)},{kind:`radio`,id:`location-folder`,group:`location`,label:n.folderName===void 0?q.formatMessage({id:`Move to your folder`,defaultMessage:`Move to your folder`}):q.formatMessage({id:`Move to {folder}`,defaultMessage:`Move to {folder}`},{folder:n.folderName}),hint:r===`folder`&&a?a:void 0,selected:r===`folder`,apply:()=>t.setLocation(`folder`)},{kind:`action`,id:`pick-folder`,label:q.formatMessage({id:`Choose another folder...`,defaultMessage:`Choose another folder...`}),hint:q.formatMessage({id:`Applies to every torrent`,defaultMessage:`Applies to every torrent`}),run:t.pickFolder}]})}return u.push({id:`keep`,label:q.formatMessage({id:`Storage`,defaultMessage:`Storage`}),items:[{kind:`toggle`,id:`keep`,label:q.formatMessage({id:`Keep this download`,defaultMessage:`Keep this download`}),checked:e.ephemeral!==!0,disabled:e.infoHash?void 0:q.formatMessage({id:`Waiting for the info hash`,defaultMessage:`Waiting for the info hash`}),apply:e=>t.setKept(e)}]}),u.push({id:`order`,label:q.formatMessage({id:`Piece order`,defaultMessage:`Piece order`}),items:[{kind:`radio`,id:`order-rarest`,group:`order`,label:q.formatMessage({id:`Rarest first`,defaultMessage:`Rarest first`}),selected:!a,disabled:r??(i?q.formatMessage({id:`Already downloaded`,defaultMessage:`Already downloaded`}):void 0),apply:()=>t.setFlags(0,wD.sequentialDownload)},{kind:`radio`,id:`order-sequential`,group:`order`,label:q.formatMessage({id:`Download in sequential order`,defaultMessage:`Download in sequential order`}),selected:a,disabled:r??(i?q.formatMessage({id:`Already downloaded`,defaultMessage:`Already downloaded`}):void 0),apply:()=>t.setFlags(wD.sequentialDownload,wD.sequentialDownload)},{kind:`toggle`,id:`first-last`,label:q.formatMessage({id:`Download first and last pieces first`,defaultMessage:`Download first and last pieces first`}),checked:e.firstLast===!0,disabled:r??(i?q.formatMessage({id:`Already downloaded`,defaultMessage:`Already downloaded`}):void 0),apply:e=>t.setFirstLast(e)}]},{id:`speed`,label:q.formatMessage({id:`Speed`,defaultMessage:`Speed`}),items:[[`limit-down`,q.formatMessage({id:`Limit download rate...`,defaultMessage:`Limit download rate...`}),`down`,e.downloadLimit,c.down],[`limit-up`,q.formatMessage({id:`Limit upload rate...`,defaultMessage:`Limit upload rate...`}),`up`,e.uploadLimit,c.up]].map(([e,n,i,a,o])=>({kind:`action`,id:e,label:n,hint:RD(a,o,q),disabled:r,run:()=>t.limitRate(i)}))},{id:`peers`,label:q.formatMessage({id:`Finding peers`,defaultMessage:`Finding peers`}),items:[{kind:`toggle`,id:`dht`,label:q.formatMessage({id:`Disable DHT for this torrent`,defaultMessage:`Disable DHT for this torrent`}),checked:O9(e,wD.disableDht),disabled:r,apply:e=>t.setFlags(e?wD.disableDht:0,wD.disableDht)},{kind:`toggle`,id:`pex`,label:q.formatMessage({id:`Disable PeX for this torrent`,defaultMessage:`Disable PeX for this torrent`}),checked:O9(e,wD.disablePex),disabled:r,apply:e=>t.setFlags(e?wD.disablePex:0,wD.disablePex)},{kind:`action`,id:`reannounce`,label:q.formatMessage({id:`Force reannounce`,defaultMessage:`Force reannounce`}),disabled:r,run:t.reannounce}]},{id:`sharing`,label:q.formatMessage({id:`Sharing`,defaultMessage:`Sharing`}),items:[{kind:`toggle`,id:`upload-only`,label:q.formatMessage({id:`Upload mode`,defaultMessage:`Upload mode`}),checked:O9(e,wD.uploadMode),disabled:r,apply:e=>t.setFlags(e?wD.uploadMode:0,wD.uploadMode)},{kind:`toggle`,id:`super-seed`,label:q.formatMessage({id:`Super seeding mode`,defaultMessage:`Super seeding mode`}),checked:O9(e,wD.superSeeding),disabled:r??(i?void 0:q.formatMessage({id:`Available once downloaded`,defaultMessage:`Available once downloaded`})),apply:e=>t.setFlags(e?wD.superSeeding:0,wD.superSeeding)}]}),e.queuePosition>=0&&!k9(e)&&u.push({id:`queue`,label:q.formatMessage({id:`Queue position {position}`,defaultMessage:`Queue position {position}`},{position:e.queuePosition+1}),items:[[`queue-top`,q.formatMessage({id:`Move to top`,defaultMessage:`Move to top`}),`top`],[`queue-up`,q.formatMessage({id:`Move up`,defaultMessage:`Move up`}),`up`],[`queue-down`,q.formatMessage({id:`Move down`,defaultMessage:`Move down`}),`down`],[`queue-bottom`,q.formatMessage({id:`Move to bottom`,defaultMessage:`Move to bottom`}),`bottom`]].map(([e,n,r])=>({kind:`action`,id:e,label:n,run:()=>t.moveInQueue(r)}))}),n.groups&&e.infoHash&&u.push({id:`groups`,label:q.formatMessage({id:`Groups`,defaultMessage:`Groups`}),items:[...n.groups.map(e=>({kind:`toggle`,id:`group-${e.id}`,label:e.name,typed:!0,checked:e.holds,apply:n=>t.setInGroup(e.id,n)})),{kind:`action`,id:`new-group`,label:q.formatMessage({id:`New group...`,defaultMessage:`New group...`}),run:t.newGroup}]}),u},rne=`Ripple`,ine=new URL(`/assets/logo-B9QFeSBc.svg`,``+import.meta.url).href,ane=700,one=519,M9=900,sne=`v0.0.81 · d2ec0f9`,N9=e=>`\u2068${e}\u2069`,P9=e=>{let t=e?.types;return t?[...t].some(e=>e===`Files`||e===`text/uri-list`):!1},cne=({quota:e})=>{let t=ti(),n=J(`label`,{children:t.formatMessage({id:`FKN quota`,defaultMessage:`FKN quota`})});return e.premium?Y(`div`,{className:`stat quota`,children:[n,J(`strong`,{className:`ok`,children:t.formatMessage({id:`Premium`,defaultMessage:`Premium`})})]}):e.throttled?Y(`div`,{className:`stat quota throttled`,children:[n,J(`strong`,{children:t.formatMessage({id:`Throttled · {speed}`,defaultMessage:`Throttled · {speed}`},{speed:Tee(e.bytesPerSecond)})}),J(`a`,{href:`https://fkn.app/account`,target:`_blank`,rel:`noreferrer`,children:t.formatMessage({id:`Get full speed`,defaultMessage:`Get full speed`})})]}):Y(`div`,{className:`stat quota`,children:[n,J(`strong`,{children:t.formatMessage({id:`{size} left`,defaultMessage:`{size} left`},{size:pD(e.remainingBytes,!0)})})]})},lne=({storage:e,low:t})=>{let n=ti();return Y(`div`,{className:`stat storage`+(t?` low`:``),children:[J(`label`,{children:n.formatMessage({id:`Storage`,defaultMessage:`Storage`})}),J(`strong`,{children:n.formatMessage({id:`{done} / {total}`,defaultMessage:`{done} / {total}`},{done:pD(e.usedBytes,!0),total:pD(e.limitBytes,!0)})})]})},une=Jn({"signed-out":{id:`Connect an account to sync your library.`,defaultMessage:`Connect an account to sync your library.`},"no-storage-grant":{id:`Storage did not answer. Retrying.`,defaultMessage:`Storage did not answer. Retrying.`},"broker-timeout":{id:`FKN did not respond. Retrying.`,defaultMessage:`FKN did not respond. Retrying.`},"account-unknown":{id:`Waiting for your account.`,defaultMessage:`Waiting for your account.`},locked:{id:`Your storage is locked. Unlock it to sync.`,defaultMessage:`Your storage is locked. Unlock it to sync.`},"read-failed":{id:`Could not read your saved library. Retrying.`,defaultMessage:`Could not read your saved library. Retrying.`},"read-timeout":{id:`FKN did not respond. Retrying.`,defaultMessage:`FKN did not respond. Retrying.`},"switch-unverified":{id:`Waiting for this account's library.`,defaultMessage:`Waiting for this account's library.`},"write-failed":{id:`Could not save your library. Retrying on the next change.`,defaultMessage:`Could not save your library. Retrying on the next change.`}}),dne=({state:e})=>{let t=ti(),{status:n,reason:r}=e;if(n===`off`)return null;let i=n===`syncing`?t.formatMessage({id:`Syncing…`,defaultMessage:`Syncing…`}):n===`error`?t.formatMessage({id:`Sync failed`,defaultMessage:`Sync failed`}):t.formatMessage({id:`Synced`,defaultMessage:`Synced`});return Y(`div`,{className:`stat sync`+(n===`error`?` error`:``),...R0(r?t.formatMessage(une[r]):void 0),children:[J(`label`,{children:t.formatMessage({id:`Library`,defaultMessage:`Library`})}),J(`strong`,{className:n===`synced`?`ok`:void 0,children:i})]})},fne=({reachable:e,inboundNow:t=OD})=>{let n=ti();if(!e)return null;let{port:r,inbound:i,listenFailed:a}=e,o=e.listeners??[],s=e.portOpen??!0,c=a.length>0,l=kD(t),u=!!r&&!s&&o.some(e=>e.healing),d=c?n.formatMessage({id:`Failed`,defaultMessage:`Failed`}):r?u?n.formatMessage({id:`:{port} · reconnecting`,defaultMessage:`:{port} · reconnecting`},{port:r}):s?l?`:${r} · ${l}`:`:${r}`:n.formatMessage({id:`:{port} · closed`,defaultMessage:`:{port} · closed`},{port:r}):n.formatMessage({id:`Unreachable`,defaultMessage:`Unreachable`}),f=c?a.join(`
|
|
5161
5161
|
`):u?n.formatMessage({id:`Connection dropped. Reconnecting.`,defaultMessage:`Connection dropped. Reconnecting.`}):r&&!s?n.formatMessage({id:`Port {port} is closed. Reload to get a new one.`,defaultMessage:`Port {port} is closed. Reload to get a new one.`},{port:r}):r?(e=>i>0?n.formatMessage({id:`{sentence} {count} accepted this session.`,defaultMessage:`{sentence} {count} accepted this session.`},{sentence:e,count:i}):e)(t.total>0?n.formatMessage({id:`{count, plural, one {{count} peer connected in on port {port}: {detail}.} other {{count} peers connected in on port {port}: {detail}.}}`,defaultMessage:`{count, plural, one {{count} peer connected in on port {port}: {detail}.} other {{count} peers connected in on port {port}: {detail}.}}`},{count:t.total,port:r,detail:l}):n.formatMessage({id:`Nobody connected in on port {port}.`,defaultMessage:`Nobody connected in on port {port}.`},{port:r})):void 0;return Y(`div`,{className:`stat inbound`+(c||r&&!s?` error`:``),...R0(f),children:[J(`label`,{children:n.formatMessage({id:`Inbound`,defaultMessage:`Inbound`})}),J(`strong`,{className:i>0&&s?`ok`:void 0,children:d})]})},pne=({nodes:e})=>Y(`div`,{className:`stat dht`,children:[J(`label`,{children:ti().formatMessage({id:`DHT nodes`,defaultMessage:`DHT nodes`})}),J(`strong`,{children:e})]}),F9=({dir:e,big:t,bps:n,room:r,label:i})=>Y(`div`,{className:`stat`+(t?` big`:``)+` rate ${e}`+(n>0?` live`:``),children:[J(`label`,{children:i}),J(`strong`,{"data-room":r,children:r3(n)})]}),mne=120,I9=60,hne=mt`
|
|
5162
5162
|
/* dvh minus whatever the broker reserved at the top, so docking its header does not push the
|
|
5163
5163
|
footer under the fold. See the root rule in index.tsx for what writes the variable. */
|
|
@@ -6710,7 +6710,7 @@ This browser reports limited detail, so the cause above is a best guess.`:``)))}
|
|
|
6710
6710
|
}
|
|
6711
6711
|
`,_ne=({history:e})=>{let t=Math.max(...e,1),n=mne-e.length,r=e.map((e,r)=>`${((n+r)/119*100).toFixed(2)},${(29-e/t*26).toFixed(2)}`).join(` `);return r?Y(`svg`,{className:`graph`,viewBox:`0 0 100 30`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[J(`polygon`,{fill:rD,points:`${(n/119*100).toFixed(2)},30 ${r} 100,30`}),J(`polyline`,{points:r})]}):null},vne=({down:e,up:t})=>{let n=Math.max(...e,...t,1),r=e=>{let t=I9-e.length;return e.map((e,r)=>`${((t+r)/59*100).toFixed(2)},${(25-e/n*23).toFixed(2)}`).join(` `)};if(!e.length)return null;let i=r(e);return Y(`svg`,{className:`spark`,viewBox:`0 0 100 26`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[J(`polygon`,{className:`down-fill`,points:`${((I9-e.length)/59*100).toFixed(2)},26 ${i} 100,26`}),J(`polyline`,{className:`down-line`,points:i}),t.some(e=>e>0)&&J(`polyline`,{className:`up-line`,points:r(t)})]})},L9=(e,t)=>`${e}:${t}`,R9=({name:e})=>J(`strong`,{dir:`auto`,children:e.split(/(?<=[._-])/u).flatMap((e,t)=>t?[J(`wbr`,{},t),e]:[e])}),z9=({url:e,t})=>e?J(`img`,{className:`poster`,src:e,alt:``}):J(`div`,{className:`poster placeholder`,children:J(V4,{name:t.name,files:t.files})}),yne=({t:e,poster:t})=>{let n=ti();return Y(`div`,{className:`torrent surface starting`,"data-state":e.state,children:[J(z9,{url:t,t:e}),J(`div`,{className:`content`,children:Y(`div`,{className:`main`,children:[Y(`div`,{className:`body`,children:[J(`div`,{className:`title`,children:J(R9,{name:e.name})}),J(`div`,{className:`meta`,children:J(`span`,{children:n.formatMessage({id:`Connecting`,defaultMessage:`Connecting`})})})]}),J(`div`,{className:`side`,children:J(`span`,{className:`badge ${e.state}`,children:n.formatMessage(n3[e.state])})})]})})]})},bne=({t:e,poster:t,onStart:n,onOptions:r,selected:i,onSelect:a,checked:o,onPick:s})=>{let c=ti();return Y(`div`,{className:`torrent surface missing`+(i?` selected`:``)+(o?` picked`:``),"data-state":e.state,"aria-current":i||void 0,...Z7(t=>s(e,t),t=>{t.target.closest(`button, a`)||a(e)}),onContextMenu:t=>{t.shiftKey||t.ctrlKey||(t.preventDefault(),r(e,{x:t.clientX,y:t.clientY}))},children:[I7(e)&&J(Y7,{name:e.name,checked:o,onChange:t=>s(e,t),overPicture:!0}),J(z9,{url:t,t:e}),J(`div`,{className:`content`,children:Y(`div`,{className:`main`,children:[Y(`div`,{className:`body`,children:[J(`div`,{className:`title`,children:J(R9,{name:e.name})}),Y(`div`,{className:`meta`,children:[e.ephemeral===!0&&Y(`button`,{type:`button`,className:`temp`,onClick:()=>r(e,null),"aria-label":c.formatMessage({id:`Temporary download: options for {name}`,defaultMessage:`Temporary download: options for {name}`},{name:e.name}),...R0(c.formatMessage(Z5)),children:[J(iu,{"aria-hidden":`true`}),c.formatMessage({id:`Temporary`,defaultMessage:`Temporary`})]}),e.saveTo===`source`?J(`span`,{children:c.formatMessage({id:`Source files unavailable. Create it again from the same files.`,defaultMessage:`Source files unavailable. Create it again from the same files.`})}):e.size>0&&J(`span`,{children:pD(e.size,!0)})]})]}),Y(`div`,{className:`side`,children:[J(`span`,{className:`badge ${e.state}`,children:c.formatMessage(n3[e.state])}),Y(`div`,{className:`actions`,children:[e.saveTo!==`source`&&J(`button`,{className:`primary`,onClick:()=>n(e),...R0(c.formatMessage({id:`Download to this device`,defaultMessage:`Download to this device`})),"aria-label":c.formatMessage({id:`Download {name}`,defaultMessage:`Download {name}`},{name:e.name}),children:J(ou,{size:16,"aria-hidden":`true`})}),J(`button`,{className:`more`,"aria-haspopup":`dialog`,"aria-label":c.formatMessage({id:`Options for {name}`,defaultMessage:`Options for {name}`},{name:e.name}),...R0(c.formatMessage({id:`Options`,defaultMessage:`Options`})),onClick:()=>r(e,null),children:J(su,{size:16,"aria-hidden":`true`})})]})]})]})})]})},B9=[999.9,999900,9999e5,99995e4,999e7],xne=[999.9,999900,9999e5,99999e7,99999e10],V9=(e,t)=>t.map(e).join(`
|
|
6712
6712
|
`),Sne=(e,t,n)=>{let r=pD(t,!0),i=n===void 0?r:a3(e,pD(n,!0),r),a=t=>e.formatMessage({id:`{done} / {total}`,defaultMessage:`{done} / {total}`},{done:pD(t,!0),total:i}),o=t=>e.formatMessage({id:`↓ {speed}`,defaultMessage:`↓ {speed}`},{speed:r3(t)}),s=t=>e.formatMessage({id:`↑ {speed}`,defaultMessage:`↑ {speed}`},{speed:r3(t)}),c=t=>e.formatMessage({id:`{count, plural, one {{count} peer} other {{count} peers}}`,defaultMessage:`{count, plural, one {{count} peer} other {{count} peers}}`},{count:t});return{pair:a,down:o,up:s,peers:c,rooms:{pair:V9(a,xne),down:V9(o,B9),up:V9(s,B9),peers:c(999)}}},H9=(e,t)=>{if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null)return!1;let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>H9(e[n],t[n]))},Cne=(0,p.memo)(({t:e,saving:t,onToggle:n,onSave:r,onSaveZip:i,onStart:a,onOptions:o,selected:s,onSelect:c,checked:l,onPick:u,savedToUserStorage:d,rates:f,transport:m})=>{let h=ti(),g=b4(e.infoHash),_=i3(e),v=(0,p.useMemo)(()=>Sne(h,e.size,_?.size),[h,e.size,_?.size]);if(e.state===`starting`)return J(yne,{t:e,poster:g});if(e.state===`missing`)return J(bne,{t:e,poster:g,onStart:a,onOptions:o,selected:s,onSelect:c,checked:l,onPick:u});let y=I1(e),b=P1(e.files),x=D1(e.files).length>1,S=t[L9(e.id,x?-1:b)],C=e.progress>=1,w=!A1(e),T=j1(e),E={};return e.files?.forEach((n,r)=>{let i=t[L9(e.id,r)];i!=null&&(E[r]=i)}),Y(`div`,{className:`torrent surface`+(s?` selected`:``)+(l?` picked`:``),"data-state":e.state,"aria-current":s||void 0,...Z7(t=>u(e,t),t=>{t.target.closest(`button, a, input, summary`)||window.getSelection()?.toString()||c(e)}),onContextMenu:t=>{t.target.closest(`.detail .pane`)||t.shiftKey||t.ctrlKey||(t.preventDefault(),o(e,{x:t.clientX,y:t.clientY}))},children:[I7(e)&&J(Y7,{name:e.name,checked:l,onChange:t=>u(e,t),overPicture:!0}),J(z9,{url:g,t:e}),J(`div`,{className:`content`,children:Y(`div`,{className:`main`,children:[Y(`div`,{className:`body`,children:[J(`div`,{className:`title`,children:J(R9,{name:e.name})}),Y(`div`,{className:`meta`,children:[e.ephemeral===!0&&Y(`button`,{type:`button`,className:`temp`,onClick:()=>o(e,null),"aria-label":h.formatMessage({id:`Temporary download: options for {name}`,defaultMessage:`Temporary download: options for {name}`},{name:e.name}),...R0(h.formatMessage(X5)),children:[J(iu,{"aria-hidden":`true`}),h.formatMessage({id:`Temporary`,defaultMessage:`Temporary`})]}),J(`span`,{className:`pair`,"data-room":v.rooms.pair,children:v.pair(_?.done??e.downloaded)}),J(`span`,{className:`rate down`+(e.down>0?` live`:``),"data-room":v.rooms.down,children:v.down(e.down)}),J(`span`,{className:`rate up`+(e.up>0?` live`:``),"data-room":v.rooms.up,children:v.up(e.up)}),J(`span`,{className:`peers`,"data-room":v.rooms.peers,children:v.peers(e.peers)}),e.state===`downloading`&&e.eta!==`-`&&J(`span`,{children:e.etaSeconds===void 0?h.formatMessage({id:`queued`,defaultMessage:`queued`}):h.formatMessage({id:`{eta} left`,defaultMessage:`{eta} left`},{eta:e.eta})}),T&&(e.stats?.seedingSeconds??0)>0&&J(`span`,{className:`seeded`,children:h.formatMessage({id:`seeded for {duration}`,defaultMessage:`seeded for {duration}`},{duration:vQ(e.stats?.seedingSeconds??0)})}),jD(e.downloadLimit)&&e.downloadLimit>0&&J(`span`,{className:`limit`,children:h.formatMessage({id:`↓ max {limit}`,defaultMessage:`↓ max {limit}`},{limit:LD(e.downloadLimit,h)})}),jD(e.uploadLimit)&&e.uploadLimit>0&&J(`span`,{className:`limit`,children:h.formatMessage({id:`↑ max {limit}`,defaultMessage:`↑ max {limit}`},{limit:LD(e.uploadLimit,h)})}),e.retry?J(`span`,{className:`retry`,children:s3(e,e.retry)}):e.noPeers&&m===`direct`&&J(`span`,{className:`retry`,children:BJ(m)})]}),(e.progress<1||e.state===`checking`)&&J(`div`,{className:`bar`,children:J(`div`,{className:`fill`,style:{width:`${Math.min(100,e.progress*100)}%`}})})]}),f&&J(vne,{down:f.down,up:f.up}),Y(`div`,{className:`side`,children:[J(`span`,{className:`badge ${e.state}`,children:h.formatMessage(n3[e.state])}),J(`span`,{className:`pct`,children:gD(e.progress,+(e.progress<1))}),Y(`div`,{className:`actions`,children:[y&&J(Sc,{className:`primary`,to:y,...R0(h.formatMessage({id:`Watch`,defaultMessage:`Watch`})),"aria-label":h.formatMessage({id:`Watch {name}`,defaultMessage:`Watch {name}`},{name:e.name}),children:J(ru,{size:16,"aria-hidden":`true`})}),!!e.files?.length&&C&&!d&&J(`button`,{onClick:()=>x?i(e):r(e,b),disabled:S!=null,...R0(x?h.formatMessage({id:`Save as a zip`,defaultMessage:`Save as a zip`}):h.formatMessage({id:`Save to disk`,defaultMessage:`Save to disk`})),"aria-label":x?h.formatMessage({id:`Save {name} as a zip`,defaultMessage:`Save {name} as a zip`},{name:e.name}):h.formatMessage({id:`Save {name} to disk`,defaultMessage:`Save {name} to disk`},{name:e.name}),children:S==null?J(ou,{size:16,"aria-hidden":`true`}):J(`span`,{className:`saving`,children:gD(S)})}),e.state!==`checking`&&J(`button`,{onClick:()=>n(e),...R0(w?T?h.formatMessage({id:`Stop`,defaultMessage:`Stop`}):h.formatMessage({id:`Pause`,defaultMessage:`Pause`}):T?h.formatMessage({id:`Start`,defaultMessage:`Start`}):h.formatMessage({id:`Resume`,defaultMessage:`Resume`})),"aria-label":w?T?h.formatMessage({id:`Stop {name}`,defaultMessage:`Stop {name}`},{name:e.name}):h.formatMessage({id:`Pause {name}`,defaultMessage:`Pause {name}`},{name:e.name}):T?h.formatMessage({id:`Start {name}`,defaultMessage:`Start {name}`},{name:e.name}):h.formatMessage({id:`Resume {name}`,defaultMessage:`Resume {name}`},{name:e.name}),children:J(w?T?Nu:wu:Tu,{size:16,"aria-hidden":`true`})}),J(`button`,{className:`more`,"aria-haspopup":`dialog`,"aria-label":h.formatMessage({id:`Options for {name}`,defaultMessage:`Options for {name}`},{name:e.name}),...R0(h.formatMessage({id:`Options`,defaultMessage:`Options`})),onClick:()=>o(e,null),children:J(su,{size:16,"aria-hidden":`true`})})]})]})]})})]})},H9),wne=({groups:e,row:t})=>{let n=ti();return J(Il,{children:e.flatMap(({group:e,rows:r})=>[e&&Y(`h2`,{className:`group-head`,children:[n.formatMessage(n7[e]),J(`span`,{className:`count`,children:n.formatNumber(r.length)})]},`group:`+e),...r.map(t)])})},U9=({children:e})=>{let t=(0,p.useRef)(null),[n,r]=(0,p.useState)({start:!1,end:!1}),i=(0,p.useCallback)(()=>{let e=t.current;if(!e)return;let n=Math.abs(e.scrollLeft),i=n>1,a=n+e.clientWidth<e.scrollWidth-1;r(e=>e.start===i&&e.end===a?e:{start:i,end:a})},[]);return(0,p.useLayoutEffect)(i),(0,p.useEffect)(()=>(addEventListener(`resize`,i),()=>removeEventListener(`resize`,i)),[i]),J(`div`,{className:`fades`,"data-more-start":n.start||void 0,"data-more-end":n.end||void 0,children:J(`div`,{ref:t,className:`line`,onScroll:i,children:e})})},W9=`(width < ${M9}px)`,Tne=e=>{let t=matchMedia(W9);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},G9=e=>e.preventDefault(),Ene=()=>{let e=ti(),t=(0,p.useSyncExternalStore)(Tne,()=>matchMedia(W9).matches),{torrents:n,list:r,inboundNow:i,dhtNodes:a,addMagnet:o,addTorrentFile:s,pause:c,resume:l,retry:u,recheck:d,remove:f,start:m,startMany:h,removeMissing:g,storageUnavailable:_,workerError:v,reachable:y,transport:b,sampleOffered:x,answerSample:S,client:C}=a$(),[w,T]=(0,p.useState)(``),[E,D]=(0,p.useState)(null),[O,k]=(0,p.useState)({}),[A,j]=(0,p.useState)(()=>navigator.onLine===!1),M=(0,p.useRef)(void 0),{confirm:N,confirmElement:P,confirmOpen:F}=I0(),I=rs(),L=(0,p.useRef)(null),R=(0,p.useRef)(null),[ee,z]=(0,p.useState)(!1);(0,p.useEffect)(()=>{let e=()=>z(!!R.current?.contains(document.activeElement));return document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,e),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,e)}},[]);let[B,V]=(0,p.useState)(!1),[H,U]=(0,p.useState)(null),[W,te]=(0,p.useState)(AD);(0,p.useEffect)(()=>C.onRateLimits(te),[C]);let[G,ne]=(0,p.useState)(null),[re,ie]=(0,p.useState)(null),[ae,oe]=(0,p.useState)(null),se=(0,p.useRef)(n);se.current=n;let K=(0,p.useCallback)(e=>{D(e),clearTimeout(M.current),M.current=window.setTimeout(()=>D(null),2600)},[]);(0,p.useEffect)(()=>()=>clearTimeout(M.current),[]);let ce=(0,p.useCallback)(t=>{if(_D())return;let n=tne(D9(t));n?oe(n):K(e.formatMessage({id:`That link could not be read`,defaultMessage:`That link could not be read`}))},[K,e]);(0,p.useEffect)(()=>{let e=()=>j(!navigator.onLine);return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}},[]),(0,p.useEffect)(()=>C.onAddFailed(K),[C,K]),y4(C),R6(n);let[le,ue]=(0,p.useState)(()=>Q3(e=>localStorage.getItem(e))),de=e=>{ue(e);try{localStorage.setItem(Y3,e?`1`:`0`)}catch{}},[fe,pe]=(0,p.useState)(null),me=(0,p.useRef)(fe);me.current=fe;let[he,ge]=(0,p.useState)(null),_e=(0,p.useRef)(null),ve=(0,p.useCallback)((t,n,r=null)=>{let i=Ol({magnet:t});return i.ok?se.current.find(e=>_l(e.infoHash,i.infoHash)&&!e.ephemeral&&e.state!==`missing`)?(K(e.formatMessage({id:`Already in your list`,defaultMessage:`Already in your list`})),!1):(C.addMagnet(i.magnet,{ephemeral:!0,hold:!0}),pe({magnet:i.magnet,infoHash:i.infoHash,name:i.name,external:n,from:r}),ge(null),!0):(K(i.problem),!1)},[C,K,e]),ye=(0,p.useRef)([]),be=(0,p.useCallback)(()=>{for(let e=ye.current.shift();e;e=ye.current.shift()){if(`infoHash`in e){pe(e),ge(null);return}if(ve(e.magnet,e.external,e.from))return}},[ve]),xe=(0,p.useCallback)(t=>{let n=vl(t);if(!n.length)return!1;let r=n.filter(e=>!se.current.some(t=>t.magnet&&_l(pl(t.magnet),pl(e))));if(!r.length)return K(e.formatMessage({id:`Already in your list`,defaultMessage:`Already in your list`})),!0;if(le)return ye.current.push(...r.map(e=>({magnet:e,external:!1,from:null}))),me.current||be(),!0;for(let e of r)o(e);return K(r.length===1?e.formatMessage({id:`Magnet added`,defaultMessage:`Magnet added`}):e.formatMessage({id:`{count, plural, one {{count} magnet added} other {{count} magnets added}}`,defaultMessage:`{count, plural, one {{count} magnet added} other {{count} magnets added}}`},{count:r.length})),!0},[o,K,le,be,e]),Se=(0,p.useCallback)(async t=>{let n=[...t],r=n.filter(e=>/\.torrent$/i.test(e.name));if(!r.length){n.length&&K(n.length===1?e.formatMessage({id:`That is not a .torrent file`,defaultMessage:`That is not a .torrent file`}):e.formatMessage({id:`No .torrent file in what you dropped`,defaultMessage:`No .torrent file in what you dropped`}));return}for(let t of r){let n=new Uint8Array(await t.arrayBuffer()),r=await PZ(n),i=r&&pl(r.magnet);if(se.current.some(e=>_l(e.infoHash,i))){K(e.formatMessage({id:`Already in your list`,defaultMessage:`Already in your list`}));continue}if(le&&r?.files&&i){ye.current.push({magnet:r.magnet,infoHash:i,name:r.name,external:!1,from:null,bytes:n,files:r.files});continue}s(n),K(e.formatMessage({id:`{name} added`,defaultMessage:`{name} added`},{name:t.name}))}me.current||be()},[s,K,le,be,e]),Ce=(0,p.useCallback)(e=>{let t=FZ(e);return t?(U(t),!0):!1},[]),we=(0,p.useCallback)(t=>{let n=[...t].find(e=>/\.torrent$/i.test(e.name));if(!n){K(e.formatMessage({id:`That is not a .torrent file`,defaultMessage:`That is not a .torrent file`}));return}(async()=>{let t=await PZ(new Uint8Array(await n.arrayBuffer()));if(!t){K(e.formatMessage({id:`That .torrent could not be read`,defaultMessage:`That .torrent could not be read`}));return}U(t)})()},[K,e]),Te=(0,p.useCallback)(t=>{let n=B&&!H;if(t?.files?.length){if(n){we(t.files);return}Se(t.files);return}let r=t?.getData(`text`)??``;if(r.trim()){if(n){Ce(r)||K(e.formatMessage({id:`Not a magnet link`,defaultMessage:`Not a magnet link`}));return}xe(r)||K(e.formatMessage({id:`Not a magnet link`,defaultMessage:`Not a magnet link`}))}},[Se,xe,B,H,we,Ce,K,e]),Ee=(0,p.useCallback)(e=>{U(e),V(!0)},[]),De=(0,p.useCallback)(()=>{U(null),V(!1)},[]),Oe=(0,p.useCallback)(async e=>({magnet:await UZ(e)??``,name:e.name,size:e.size,files:e.files?D1(e.files).map(e=>({name:e.name,size:e.size,index:e.index})):null,fileCount:e.files?.length??0,private:await WZ(e.infoHash)}),[]);(0,p.useEffect)(()=>{let e=e=>{if(F||G||fe||re||ae)return;let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))return;let n=e.clipboardData?.getData(`text`)??``;vl(n).length&&(e.preventDefault(),xe(n))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[xe,F,G,fe,re,ae]);let[ke,Ae]=(0,p.useState)(!1),je=(0,p.useRef)(0),[Me,Ne]=(0,p.useState)(!1),Pe=(0,p.useCallback)(()=>{je.current=0,Ae(!1),Ne(!1)},[]);(0,p.useEffect)(()=>{let e=fe||ae,t=t=>{!e&&P9(t.dataTransfer)&&++je.current===1&&Ae(!0)},n=e=>{P9(e.dataTransfer)&&--je.current<=0&&Pe()},r=e=>e.preventDefault(),i=t=>{t.preventDefault(),Pe(),e||Te(t.dataTransfer)};return window.addEventListener(`dragenter`,t),window.addEventListener(`dragleave`,n),window.addEventListener(`dragover`,r),window.addEventListener(`drop`,i),window.addEventListener(`dragend`,Pe),window.addEventListener(`blur`,Pe),()=>{window.removeEventListener(`dragenter`,t),window.removeEventListener(`dragleave`,n),window.removeEventListener(`dragover`,r),window.removeEventListener(`dragend`,Pe),window.removeEventListener(`blur`,Pe),window.removeEventListener(`drop`,i)}},[Te,Pe,fe,ae]),(0,p.useEffect)(()=>{let e=(e,t)=>na(Pl(e),t.pathname),t=t=>{if(t)try{let n=new URL(t,window.location.origin),r=e(kl.HOME,n)&&n.searchParams.get(`magnet`);r&&xe(r)}catch{}},n=t=>{if(!t)return!1;try{let n=new URL(t,window.location.origin);if(n.hash&&(e(kl.ADD,n)?!n.searchParams.has(`magnet`):e(kl.HOME,n)&&n.searchParams.has(`group`)))return ce(n.hash.slice(1)),!0;let r=e(kl.ADD,n)?Dl(n.searchParams.get(`magnet`)??``,n.searchParams.get(`name`)):e(kl.HOME,n)&&n.searchParams.get(`add`);return r?(ye.current.push({magnet:r,external:!0,from:null}),me.current||be(),!0):!1}catch{return!1}};t(window.location.href),window.location.search.includes(`magnet=`)&&window.history.replaceState(null,``,window.location.pathname+window.location.hash);let r=window.launchQueue;if(r)try{r.setConsumer(async e=>{if(n(e.targetURL)||t(e.targetURL),e.files?.length){let t=await Promise.all(e.files.map(e=>e.getFile()));await Se(t)}})}catch{}},[Se,be,xe,ce]);let Fe=(0,p.useCallback)(e=>A1(e)?l(Number(e.id)):c(Number(e.id)),[l,c]),Ie=(0,p.useCallback)(e=>{e.infoHash&&m(e.infoHash)},[m]),Le=async t=>{if(t.state!==`missing`){let n=pD(t.downloaded??0,!0);if(!await N({title:e.formatMessage({id:`Remove {name}?`,defaultMessage:`Remove {name}?`},{name:t.name}),body:e.formatMessage({id:`This deletes the {size} already downloaded.`,defaultMessage:`This deletes the {size} already downloaded.`},{size:n}),confirmLabel:e.formatMessage({id:`Remove and delete`,defaultMessage:`Remove and delete`}),tone:`danger`,rememberKey:`ripple:confirm-remove`}))return}Re(t)},Re=e=>{e.infoHash&&ZY(e.infoHash),e.state===`missing`?e.infoHash&&g(e.infoHash):f(Number(e.id),!0)},ze=t=>{d(Number(t.id)),K(e.formatMessage({id:`Checking {name}`,defaultMessage:`Checking {name}`},{name:t.name}))},Be=async t=>{(t.state===`missing`||await N({title:e.formatMessage({id:`Remove {name} from the library?`,defaultMessage:`Remove {name} from the library?`},{name:t.name}),body:e.formatMessage({id:`The downloaded files stay, but its progress is forgotten.`,defaultMessage:`The downloaded files stay, but its progress is forgotten.`}),confirmLabel:e.formatMessage({id:`Remove`,defaultMessage:`Remove`})}))&&(t.infoHash&&ZY(t.infoHash),t.state===`missing`?t.infoHash&&g(t.infoHash):f(Number(t.id),!1))},[Ve,He]=(0,p.useState)(null),[Ue,We]=(0,p.useState)(null),Ge=q8(C),[Ke,qe]=(0,p.useState)(!1),Je=(0,p.useCallback)(()=>qe(!1),[]),{waiting:Ye,allow:Xe}=J8(C,r,C.owns()),[Ze,Qe]=(0,p.useState)(null),$e=(0,p.useCallback)(e=>Qe(e.id),[]),et=(0,p.useCallback)((e,t)=>{t?(We(null),He({id:e.id,at:t})):(He(null),We(e.id))},[]),tt=(e,t,n)=>{navigator.clipboard.writeText(e).then(()=>K(t)).catch(()=>K(n))},nt=(t,n)=>({setFlags:(e,n)=>C.setFlags(Number(t.id),e,n),reannounce:()=>{C.reannounce(Number(t.id)),K(e.formatMessage({id:`Reannouncing {name}`,defaultMessage:`Reannouncing {name}`},{name:t.name}))},moveInQueue:e=>C.moveInQueue(Number(t.id),e),copyMagnet:()=>{n&&tt(n,e.formatMessage({id:`Copied {name}'s magnet`,defaultMessage:`Copied {name}'s magnet`},{name:t.name}),e.formatMessage({id:`Could not copy the magnet`,defaultMessage:`Could not copy the magnet`}))},copyName:()=>tt(t.name,e.formatMessage({id:`Copied {name}`,defaultMessage:`Copied {name}`},{name:t.name}),e.formatMessage({id:`Could not copy`,defaultMessage:`Could not copy`})),copyInfoHash:()=>{t.infoHash&&tt(gl(t.infoHash),e.formatMessage({id:`Copied {name}'s info hash`,defaultMessage:`Copied {name}'s info hash`},{name:t.name}),e.formatMessage({id:`Could not copy`,defaultMessage:`Could not copy`}))},saveTorrentFile:()=>{t.magnet&&t.infoHash&&dQ({infoHash:t.infoHash,magnet:t.magnet,name:t.name,flush:()=>C.flushResume()}).then(n=>K(n===`saved`?e.formatMessage({id:`Saved {name}.torrent`,defaultMessage:`Saved {name}.torrent`},{name:t.name}):n===`no-metadata`?e.formatMessage({id:`{name} has no metadata yet`,defaultMessage:`{name} has no metadata yet`},{name:t.name}):e.formatMessage({id:`The .torrent for {name} could not be built`,defaultMessage:`The .torrent for {name} could not be built`},{name:t.name})))},recheck:()=>ze(t),pause:()=>c(Number(t.id)),resume:()=>l(Number(t.id)),forceStart:()=>C.forceStart(Number(t.id)),remove:()=>{Be(t)},removeWithFiles:()=>{Le(t)},setLocation:e=>Ft(t,e),setKept:e=>{It(t,e)},setFirstLast:e=>C.setPlan(Number(t.id),{wanted:t.wantedFiles,firstLast:e}),pickFolder:pt,limitRate:e=>ne({scope:{torrent:t.id},direction:e}),watch:()=>{let e=I1(t);e&&I(e)},save:()=>D1(t.files).length>1?lt(t):ct(t,P1(t.files)),embed:()=>{Oe(t).then(Ee)},retryNow:()=>u(Number(t.id)),start:()=>{t.infoHash&&m(t.infoHash)},setInGroup:(e,n)=>{let r=$t?.find(t=>t.id===e);r&&t.infoHash&&Cn(r,[t.infoHash],n)},newGroup:()=>wn(()=>t.infoHash?[t.infoHash]:[])}),rt=Ze?n.find(e=>e.id===Ze):void 0,it={};rt?.files?.forEach((e,t)=>{let n=O[L9(rt.id,t)];n!=null&&(it[t]=n)});let at=Ve?n.find(e=>e.id===Ve.id):void 0,ot=Ue?n.find(e=>e.id===Ue):void 0,st=Hte(at??ot),ct=(0,p.useCallback)((t,n)=>{let r=t.files?.[n];if(!r)return;let i=L9(t.id,n);k(e=>({...e,[i]:0})),m4(C,Number(t.id),n,r.name,r.size,e=>k(t=>({...t,[i]:e}))).catch(t=>{o4(t)||K(e.formatMessage({id:`Saving {name} failed`,defaultMessage:`Saving {name} failed`},{name:r.name}))}).finally(()=>k(e=>{let{[i]:t,...n}=e;return n}))},[C,e,K]),lt=(0,p.useCallback)(t=>{if(!D1(t.files).length)return;let n=L9(t.id,-1);k(e=>({...e,[n]:0})),g4(C,Number(t.id),t.name,t.files??[],e=>k(t=>({...t,[n]:e}))).catch(n=>{o4(n)||K(e.formatMessage({id:`Saving {name} failed`,defaultMessage:`Saving {name} failed`},{name:t.name}))}).finally(()=>k(e=>{let{[n]:t,...r}=e;return r}))},[C,e,K]),{supported:ut,folder:dt,permitted:ft,pick:pt,allow:mt}=b3(),[ht,gt]=(0,p.useState)(()=>{try{return D6(e=>localStorage.getItem(e))}catch{return`browser`}}),[_t,vt]=(0,p.useState)(()=>O7(e=>localStorage.getItem(e))),[yt,bt]=(0,p.useState)(()=>A7(e=>localStorage.getItem(e))),[xt,St]=(0,p.useState)(()=>M7(e=>localStorage.getItem(e))),Ct=e=>{vt(e);try{localStorage.setItem(b7,e)}catch{}},wt=e=>{bt(e);try{localStorage.setItem(S7,e)}catch{}},Tt=(e,t)=>{St({key:e,dir:t});try{localStorage.setItem(x7,N7(e,t))}catch{}},[Et,Dt]=Oc(),Ot=(0,p.useRef)(null),kt=Et.get(`torrent`);(0,p.useEffect)(()=>{if(!kt)return;let e=n.find(e=>_l(e.infoHash,kt));e&&Ot.current!==e.id&&(Ot.current===null||Ze===Ot.current)&&(Ot.current=e.id,Qe(e.id))},[kt,n,Ze]),l0(kt,()=>{let e=E1(Et);e&&Dt(t=>(t.set(`add`,e),t),{replace:!0})});let At=e=>{gt(e);try{localStorage.setItem(T6,e)}catch{}};(0,p.useEffect)(()=>{let e=e=>{if(e.key===`ripple:save-location`||e.key===null)try{gt(D6(e=>localStorage.getItem(e)))}catch{}};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let jt=G&&typeof G.scope==`object`?n.find(e=>e.id===G.scope.torrent):void 0,Mt=e=>{if(!G)return;let t=G.direction===`down`?`down`:`up`;G.scope===`session`?C.setSessionLimits({[t]:e}):jt&&C.setLimits(Number(jt.id),{[t]:e}),ne(null)},Nt=e=>({intended:O6(e,ht),current:k6(e.stats?.savePath)}),Pt=(0,p.useRef)(new Map);(0,p.useEffect)(()=>{for(let t of n){let n=k6(t.stats?.savePath);t.infoHash&&t.stats&&Pt.current.get(t.infoHash)===n&&(Pt.current.delete(t.infoHash),K(e8(e,t.name,n,dt?.name??``)))}},[n,dt,K,e]);let Ft=(t,n)=>{if(!t.infoHash)return;C.setLocation(t.infoHash,n),Pt.current.delete(t.infoHash);let{current:r}=Nt(t),i=j6({current:r,intended:n,complete:t.progress>=1&&q3(t),folderReady:!!dt&&ft,leavesFilesOut:k1(t)});if(!i.move){let t=M6(i,dt?.name,e);t&&K(t);return}C.owns()||Pt.current.set(t.infoHash,n)},It=async(t,n)=>{if(t.infoHash){if(!n){let n=DJ(t.stats?.savePath,t.infoHash);if(!await N({title:e.formatMessage({id:`Let Ripple delete {name}?`,defaultMessage:`Let Ripple delete {name}?`},{name:t.name}),body:n?e.formatMessage({id:`Ripple may delete its files when storage runs low.`,defaultMessage:`Ripple may delete its files when storage runs low.`}):e.formatMessage({id:`It leaves your library, but its files stay until you remove it.`,defaultMessage:`It leaves your library, but its files stay until you remove it.`}),confirmLabel:e.formatMessage({id:`Let Ripple delete it`,defaultMessage:`Let Ripple delete it`})}))return}C.setTemporary(t.infoHash,!n),K(n?e.formatMessage({id:`{name} is yours to keep`,defaultMessage:`{name} is yours to keep`},{name:t.name}):e.formatMessage({id:`{name} can be deleted to free space`,defaultMessage:`{name} can be deleted to free space`},{name:t.name}))}},Lt=X6();(0,p.useEffect)(()=>Q6(K),[K]);let Rt=fe&&!fe.bytes?n.find(e=>_l(e.infoHash,fe.infoHash)&&e.state!==`missing`):void 0,zt=fe?.files??Rt?.files??[];(0,p.useEffect)(()=>{let e=fe?.files??Rt?.files;fe&&!he&&e?.length&&(ge(Z3({files:e,location:ht})),Rt&&(_e.current=Number(Rt.id),c(Number(Rt.id))))},[fe,he,Rt,ht,c]);let Bt=(0,p.useCallback)(()=>{let e=me.current?.infoHash;ye.current=ye.current.filter(t=>!_l(`infoHash`in t?t.infoHash:pl(t.magnet),e)),pe(null),ge(null),_e.current=null,Et.get(`add`)&&Dt(new URLSearchParams,{replace:!0}),be()},[Et,Dt,be]),Vt=(0,p.useCallback)(()=>{let e=fe&&!fe.bytes?r.find(e=>e.infoHash===fe.infoHash):void 0;e?.ephemeral&&g(e.infoHash),Bt()},[fe,r,g,Bt]),Ht=(0,p.useCallback)(()=>{if(fe&&he){if(fe.bytes)s(fe.bytes,{saveTo:he.location,...$3(he,fe.files??[]),sequential:he.sequential,paused:!he.start,top:he.topOfQueue});else{if(!Rt)return;let e=Number(Rt.id);o(fe.magnet),C.setPlan(e,$3(he,Rt.files??[])),C.setFlags(e,...e6(he)),fe.infoHash&&C.setLocation(fe.infoHash,he.location),he.topOfQueue&&C.moveInQueue(e,`top`),he.start&&l(e)}K(he.start?e.formatMessage({id:`{name} added`,defaultMessage:`{name} added`},{name:fe.name}):e.formatMessage({id:`{name} added, paused`,defaultMessage:`{name} added, paused`},{name:fe.name})),Bt()}},[fe,he,Rt,o,s,C,l,K,Bt,e]);(0,p.useEffect)(()=>{let e=Et.get(`add`);if(!e)return;if(_D()){Dt(new URLSearchParams,{replace:!0});return}let t=null;try{t=document.referrer?new URL(document.referrer).origin:null}catch{t=null}t===window.location.origin&&(t=null),ye.current.push({magnet:e,external:!0,from:t}),me.current||be()},[Et.get(`add`)]),(0,p.useEffect)(()=>{if(!Et.has(`group`))return;let e=window.location.hash.slice(1);Dt(new URLSearchParams,{replace:!0}),ce(e)},[]);let Ut=e=>{let{intended:t,current:n}=Nt(e);return{savedToUserStorage:!!dt&&ft&&Lt.has(K3(e)),intended:t,current:n,folderName:dt?.name,folderReady:!!dt&&ft,sessionLimits:W,groups:e.infoHash?Tn([e.infoHash]):void 0}},[Wt,Gt]=(0,p.useState)([]),[Kt,qt]=(0,p.useState)(0);(0,p.useEffect)(()=>{let e=n.reduce((e,t)=>e+t.down,0);Gt(t=>[...t.slice(-119),e]),qt(t=>Math.max(t,e))},[n]);let[Jt,Yt]=(0,p.useState)({});(0,p.useEffect)(()=>{Yt(e=>{let t={};for(let r of n){let n=e[r.id];t[r.id]={down:[...(n?.down??[]).slice(-59),r.down],up:[...(n?.up??[]).slice(-59),r.up]}}return t})},[n]);let Xt=n.reduce((e,t)=>e+t.down,0),Zt=n.reduce((e,t)=>e+t.up,0),Qt=V9(r3,B9),{groups:$t,group:en,members:tn,choose:nn}=Qte(n),rn=tn?n.filter(e=>!!e.infoHash&&tn.has(e.infoHash)):n,an=c7(rn),{rows:on,groupOf:sn,interaction:cn}=c9(rn,_t,xt.key,xt.dir),ln=vl(w).length>0,un=ln?``:w.trim(),dn=un?on.filter(e=>P7(e,un)):on,fn=a7(dn,_t,sn),pn=G7(yt===`table`?dn:fn.flatMap(e=>e.rows)),mn=()=>se.current.filter(e=>I7(e)&&pn.picked.has(e.infoHash)),hn=()=>{for(let e of R7(mn()))c(Number(e.id))},gn=()=>{for(let e of z7(mn()))l(Number(e.id))},_n=e=>h(e.flatMap(e=>e.infoHash?[e.infoHash]:[])),vn=()=>_n(B7(mn())),yn=b9(pn.rows),bn=({magnets:t,left:n})=>{let r=n?e.formatMessage({id:`{count, plural, one {{count} magnet copied} other {{count} magnets copied}}, {left, plural, one {{left} private torrent left out} other {{left} private torrents left out}}`,defaultMessage:`{count, plural, one {{count} magnet copied} other {{count} magnets copied}}, {left, plural, one {{left} private torrent left out} other {{left} private torrents left out}}`},{count:t.length,left:n}):e.formatMessage({id:`{count, plural, one {{count} magnet copied} other {{count} magnets copied}}`,defaultMessage:`{count, plural, one {{count} magnet copied} other {{count} magnets copied}}`},{count:t.length});t.length?tt(t.join(`
|
|
6713
|
-
`),r,e.formatMessage({id:`Could not copy`,defaultMessage:`Could not copy`})):K(r)},xn=async()=>{let t=pn.rows.filter(e=>e.state!==`missing`);if(t.length){let n=pD(t.reduce((e,t)=>e+(t.downloaded??0),0),!0);if(!await N({title:e.formatMessage({id:`{count, plural, one {Remove {count} torrent?} other {Remove {count} torrents?}}`,defaultMessage:`{count, plural, one {Remove {count} torrent?} other {Remove {count} torrents?}}`},{count:pn.rows.length}),body:e.formatMessage({id:`This deletes the {size} already downloaded.`,defaultMessage:`This deletes the {size} already downloaded.`},{size:n}),confirmLabel:e.formatMessage({id:`Remove and delete`,defaultMessage:`Remove and delete`}),tone:`danger`,rememberKey:`ripple:confirm-remove`}))return}for(let e of mn())Re(e),pn.toggle(e)},Sn=pn.rows.length>0,Cn=(t,n,r)=>{(r?EY:DY)(t.id,n).then(()=>K(r?e.formatMessage({id:`Added to {name}`,defaultMessage:`Added to {name}`},{name:N9(t.name)}):e.formatMessage({id:`Taken out of {name}`,defaultMessage:`Taken out of {name}`},{name:N9(t.name)})))},wn=t=>ie({title:e.formatMessage({id:`New group`,defaultMessage:`New group`}),save:n=>{let r=t();wY(n,r).then(t=>{t&&(r.length?K(e.formatMessage({id:`Added to {name}`,defaultMessage:`Added to {name}`},{name:N9(n)})):nn(t))})}}),Tn=e=>($t??[]).map(t=>{let n=cY(t);return{id:t.id,name:t.name,holds:e.every(e=>n.has(e))}}),En=async t=>{await N({title:e.formatMessage({id:`Delete {name}?`,defaultMessage:`Delete {name}?`},{name:N9(t.name)}),body:e.formatMessage({id:`Its torrents stay in your list.`,defaultMessage:`Its torrents stay in your list.`}),confirmLabel:e.formatMessage({id:`Delete group`,defaultMessage:`Delete group`}),tone:`danger`})&&await OY(t.id)},Dn=t=>{oe(null),nne(t,$t??[],C.importList).then(n=>{n&&(Ct(`all`),nn(n)),K(e.formatMessage({id:`{name} added`,defaultMessage:`{name} added`},{name:N9(t.name)}))},()=>K(e.formatMessage({id:`Could not add the group`,defaultMessage:`Could not add the group`})))},On=$te(en?.name??``,en?rn:[]),kn=({link:t,privateLeftOut:n})=>{if(!t){K(e.formatMessage({id:`Links hold up to {max, number} torrents`,defaultMessage:`Links hold up to {max, number} torrents`},{max:Gte}));return}tt(t,n?e.formatMessage({id:`{count, plural, one {Link copied, {count} private torrent left out} other {Link copied, {count} private torrents left out}}`,defaultMessage:`{count, plural, one {Link copied, {count} private torrent left out} other {Link copied, {count} private torrents left out}}`},{count:n}):e.formatMessage({id:`Link copied`,defaultMessage:`Link copied`}),e.formatMessage({id:`Could not copy the link`,defaultMessage:`Could not copy the link`}))},An=s7(n,_t),jn=B7(rn),Mn={list:($t??[]).map(e=>{let t=cY(e);return{id:e.id,name:e.name,count:An.filter(e=>!!e.infoHash&&t.has(e.infoHash)).length}}),shown:en?.id??null,all:An.length,onShow:nn,onNew:()=>wn(()=>[]),onDownloadAll:en&&jn.length?()=>_n(jn):void 0,onCopyLink:en&&On?.count?()=>kn(On):void 0,onRename:()=>{en&&ie({title:en.name,name:en.name,save:e=>{TY(en.id,e)}})},onDelete:()=>{en&&En(en)}},Nn=()=>mn().flatMap(e=>e.infoHash?[e.infoHash]:[]),Pn={filter:_t,onFilter:Ct,group:Mn,sortKey:xt.key,sortDir:xt.dir,onSort:Tt,view:yt,onView:wt,counts:an,picked:pn.all?`all`:Sn?`some`:`none`,canPick:pn.canPick,onPickAll:pn.toggleAll},Fn=pn.clear;(0,p.useEffect)(()=>{if(!Sn)return;let e=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=e.target;t instanceof Element&&t.closest(`textarea, input:not([type="checkbox"]), [role="dialog"], [role="menu"]`)||(e.preventDefault(),Fn())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[Sn,Fn]);let In=rn.length-on.length,Ln=H1(n.some(e=>e.state!==`missing`)),Rn=HQ(),zn=n.filter(e=>e.state===`retrying`).length,Bn=N3(),Vn=S3(`${n.length}:${Bn.refreshKey}`),Hn=!!Vn&&Vn.limitBytes-Vn.usedBytes<2e9,Un=C3({supported:ut,folderName:dt?.name,permitted:ft,defaultLocation:ht}),Wn=async()=>{if(Un.kind===`choose`){await pt()&&At(`folder`);return}if(Un.kind===`allow`){await mt();return}Un.kind===`move`&&At(`folder`)},Gn=e.formatMessage({id:`Create a torrent`,defaultMessage:`Create a torrent`}),Kn=e.formatMessage({id:`Settings`,defaultMessage:`Settings`}),qn=LD(W.down,e),Jn=LD(W.up,e),Yn=e.formatMessage({id:`{limit} down`,defaultMessage:`{limit} down`},{limit:qn}),Xn=e.formatMessage({id:`{limit} up`,defaultMessage:`{limit} up`},{limit:Jn}),Zn=q5({dragging:ke,overField:Me,shareOpen:B&&!H});return Y(`div`,{css:hne,"data-drag":Zn===`page`||void 0,children:[P,Ve&&at&&st&&J(L5,{groups:j9(at,nt(at,st.magnet),Ut(at)),at:Ve.at,label:e.formatMessage({id:`Options for {name}`,defaultMessage:`Options for {name}`},{name:at.name}),onClose:()=>He(null)}),ot&&st&&J(K5,{title:ot.name,groups:j9(ot,nt(ot,st.magnet),Ut(ot)),onClose:()=>We(null)}),J(`div`,{className:`drop`,children:J(`span`,{children:e.formatMessage({id:`Drop a .torrent or a magnet link to add it`,defaultMessage:`Drop a .torrent or a magnet link to add it`})})}),Y(`header`,{"data-searching":ee||void 0,children:[Y(`span`,{className:`brand`,children:[J(Sc,{className:`logo`,to:`/`,children:J(`img`,{src:ine,alt:rne,width:553,height:561})}),J(s2,{className:`powered`,label:e.formatMessage({id:`Powered by FKN`,defaultMessage:`Powered by FKN`}),linkLabel:e.formatMessage({id:`How it works`,defaultMessage:`How it works`}),href:`https://docs.fkn.dev/user/`})]}),J(`form`,{ref:R,onSubmit:e=>{e.preventDefault(),xe(w)&&T(``)},children:Y(`div`,{className:`field`,"data-drop":Zn===`field`||void 0,"data-held":!!w||void 0,onDragEnter:()=>{_||Ne(!0)},onDragOver:e=>e.preventDefault(),onDragLeave:()=>Ne(!1),onDrop:e=>{e.preventDefault(),e.stopPropagation(),Pe(),_||Te(e.dataTransfer)},children:[J(Ou,{className:`glyph`,"aria-hidden":`true`}),J(`input`,{ref:L,value:w,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Escape`&&T(``)},placeholder:e.formatMessage({id:`Add a magnet link, or search`,defaultMessage:`Add a magnet link, or search`}),"aria-label":e.formatMessage({id:`Add a magnet link, or search`,defaultMessage:`Add a magnet link, or search`}),spellCheck:!1,disabled:_}),w&&J(`button`,{className:`icon clear`,type:`button`,onMouseDown:G9,...R0(e.formatMessage({id:`Clear`,defaultMessage:`Clear`})),"aria-label":e.formatMessage({id:`Clear`,defaultMessage:`Clear`}),onClick:()=>{T(``),L.current?.focus()},children:J(Vu,{})}),J(`span`,{className:`sep`,"aria-hidden":`true`}),Y(`label`,{className:`icon file-button`,onMouseDown:G9,...R0(e.formatMessage({id:`Open a .torrent file`,defaultMessage:`Open a .torrent file`})),"aria-label":e.formatMessage({id:`Open a .torrent file`,defaultMessage:`Open a .torrent file`}),"aria-disabled":_||void 0,children:[J(uu,{}),J(`input`,{type:`file`,accept:`.torrent,application/x-bittorrent`,multiple:!0,disabled:_,onChange:e=>{let t=e.currentTarget.files;t?.length&&Se(t),e.currentTarget.value=``}})]}),J(`button`,{className:`icon go`,type:`submit`,onMouseDown:G9,...R0(e.formatMessage({id:`Add this magnet link`,defaultMessage:`Add this magnet link`})),"aria-label":e.formatMessage({id:`Add`,defaultMessage:`Add`}),disabled:_||!ln,children:J(Eu,{})})]})}),Ge.supported&&Y(`button`,{className:`tool create`,type:`button`,"aria-label":Gn,"aria-expanded":Ke,...R0(t?Gn:null),onClick:()=>Ke?Je():qe(!0),children:[J(Mu,{}),J(`span`,{children:Gn})]}),J(Sc,{className:`tool settings`,to:Fl(kl.SETTINGS),"aria-label":Kn,...R0(Kn),children:J(ku,{})}),J(W5,{onToast:K})]}),B&&J(a8,{torrent:H,dragging:Zn===`share`,onMagnet:Ce,onFiles:we,onClear:()=>U(null),onClose:De,onToast:K}),Ke&&J(O8,{create:Ge,onClose:Je,onShare:e=>{Je(),Ee(e)},onToast:K}),Ye.length>0&&Y(`div`,{className:`storage-warning surface`,role:`status`,children:[J(`strong`,{children:e.formatMessage({id:`{count, plural, one {A torrent you created needs access to its files again} other {{count} torrents you created need access to their files again}}`,defaultMessage:`{count, plural, one {A torrent you created needs access to its files again} other {{count} torrents you created need access to their files again}}`},{count:Ye.length})}),J(`div`,{className:`actions`,children:Ye.map(({entry:t,name:n})=>J(`button`,{type:`button`,onClick:()=>{Xe(t.infoHash).then(r=>{K(r?e.formatMessage({id:`Sharing {name} again`,defaultMessage:`Sharing {name} again`},{name:t.name??n}):e.formatMessage({id:`Ripple still cannot read {name}`,defaultMessage:`Ripple still cannot read {name}`},{name:n}))})},children:e.formatMessage({id:`Allow {name}`,defaultMessage:`Allow {name}`},{name:n})},t.infoHash))})]}),_&&Y(`div`,{className:`storage-warning surface`,role:`alert`,children:[J(`strong`,{children:e.formatMessage({id:`Ripple can't run in this window`,defaultMessage:`Ripple can't run in this window`})}),J(`span`,{children:e.formatMessage({id:`Open Ripple in a normal window, with site storage allowed.`,defaultMessage:`Open Ripple in a normal window, with site storage allowed.`})})]}),v&&Y(`div`,{className:`storage-warning surface`,role:`alert`,children:[J(`strong`,{children:e.formatMessage({id:`The download engine stopped`,defaultMessage:`The download engine stopped`})}),J(`button`,{onClick:()=>window.location.reload(),children:e.formatMessage({id:`Reload`,defaultMessage:`Reload`})})]}),A&&!_&&!v&&J(`div`,{className:`storage-warning surface offline`,role:`status`,children:J(`strong`,{children:e.formatMessage({id:`You're offline`,defaultMessage:`You're offline`})})}),!A&&zn>0&&!v&&J(`div`,{className:`storage-warning surface offline`,role:`status`,children:J(`strong`,{children:e.formatMessage({id:`{count, plural, one {A download hit a problem, retrying} other {{count} downloads hit a problem, retrying}}`,defaultMessage:`{count, plural, one {A download hit a problem, retrying} other {{count} downloads hit a problem, retrying}}`},{count:zn})})}),Vn&&Hn&&!_&&J(R3,{storage:Vn,relief:Un,onAct:()=>void Wn(),persist:Bn,onAskPersist:()=>void Bn.request()}),(n.length>0||Gq())&&Y(`section`,{className:`stats surface`,children:[Y(`div`,{className:`readouts`,children:[n.length>0&&Y(U9,{children:[J(F9,{dir:`down`,big:!0,bps:Xt,room:Qt,label:e.formatMessage({id:`Download#a speed`,defaultMessage:`Download`,description:`a speed`})}),J(F9,{dir:`up`,bps:Zt,room:Qt,label:e.formatMessage({id:`Upload#a speed`,defaultMessage:`Upload`,description:`a speed`})}),Y(`div`,{className:`stat rate`,children:[J(`label`,{children:e.formatMessage({id:`Peak down`,defaultMessage:`Peak down`})}),J(`strong`,{"data-room":Qt,children:r3(Kt)})]})]}),Y(U9,{children:[J(q0,{reachable:y,transport:b,quota:Ln}),n.length>0&&Y(Il,{children:[b!==`direct`&&J(fne,{reachable:y,inboundNow:i}),b!==`direct`&&a!==null&&J(pne,{nodes:a}),Vn&&J(lne,{storage:Vn,low:Hn}),Ln&&J(cne,{quota:Ln}),J(dne,{state:Rn})]})]})]}),n.length>0&&J(_ne,{history:Wt})]}),n.length>0&&J(Rte,{...Pn}),Y(`main`,{...cn,children:[x&&n.length===0&&J(X8,{onAnswer:S}),n.length===0?Y(`div`,{className:`empty`,children:[Y(`h1`,{children:[e.formatMessage({id:`Download. Stream.`,defaultMessage:`Download. Stream.`}),J(`br`,{}),J(`em`,{children:e.formatMessage({id:`In your browser.`,defaultMessage:`In your browser.`})})]}),Y(`div`,{className:`hints`,children:[J(`span`,{children:e.formatMessage({id:`Paste a magnet link above`,defaultMessage:`Paste a magnet link above`})}),J(`span`,{children:e.formatMessage({id:`Or drop a magnet or a .torrent anywhere`,defaultMessage:`Or drop a magnet or a .torrent anywhere`})})]})]}):dn.length===0?(y||!n.some(e=>e.state===`starting`))&&Y(`div`,{className:`empty`,children:[en&&!rn.length?e.formatMessage({id:`Nothing in {name}.`,defaultMessage:`Nothing in {name}.`},{name:N9(en.name)}):e.formatMessage({id:`Nothing matches this filter.`,defaultMessage:`Nothing matches this filter.`}),J(`div`,{className:`hints`,children:J(`button`,{type:`button`,className:`link`,onClick:()=>{Ct(`all`),nn(null),T(``)},children:e.formatMessage({id:`Show everything`,defaultMessage:`Show everything`})})})]}):yt===`table`?J(a9,{torrents:dn,transport:b,sortKey:xt.key,sortDir:xt.dir,onSort:Tt,selectedId:Ze,onSelect:$e,onOptions:et,picked:pn.picked,onPick:pn.toggle}):J(wne,{groups:fn,row:e=>J(Cne,{t:e,saving:O,onToggle:Fe,onSave:ct,onSaveZip:lt,onStart:Ie,onOptions:et,selected:e.id===Ze,onSelect:$e,checked:!!e.infoHash&&pn.picked.has(e.infoHash),onPick:pn.toggle,savedToUserStorage:!!dt&&ft&&Lt.has(K3(e)),rates:Jt[e.id],transport:b},e.id)}),In>0&&dn.length>0&&Y(`div`,{className:`hidden-note`,role:`status`,children:[e.formatMessage({id:`{count, plural, one {{count} torrent hidden} other {{count} torrents hidden}}`,defaultMessage:`{count, plural, one {{count} torrent hidden} other {{count} torrents hidden}}`},{count:In}),J(`button`,{type:`button`,className:`link`,onClick:()=>Ct(`all`),children:e.formatMessage({id:`Show#verb`,defaultMessage:`Show`,description:`verb`})})]})]}),Sn&&J($7,{count:pn.rows.length,canPause:R7(pn.rows).length>0,canResume:z7(pn.rows).length>0,finished:pn.rows.every(j1),canDownload:B7(pn.rows).length>0,onDownload:vn,onCopyMagnets:yn?()=>bn(yn):void 0,groups:Tn(pn.rows.map(e=>e.infoHash)),onGroup:(e,t)=>{let n=$t?.find(t=>t.id===e);n&&Cn(n,Nn(),t)},onNewGroup:()=>wn(Nn),onPause:hn,onResume:gn,onRemove:()=>{xn()},onClear:pn.clear}),rt&&J(D5,{t:rt,handle:Number.isFinite(Number(rt.id))?Number(rt.id):null,saving:it,onSave:e=>ct(rt,e),onClose:()=>Qe(null)}),fe&&J(c6,{name:fe.name,from:fe.from,external:fe.external,files:zt,choices:he??Z3({files:zt,location:ht}),onChoices:ge,folderName:dt?.name,folderReady:!!dt&&ft,storage:Vn,persist:Bn,onAskPersist:()=>void Bn.request(),onConfirm:Ht,onCancel:Vt,onNeverAsk:fe.external?void 0:()=>{de(!1);for(let e of ye.current.splice(0))e.external?ye.current.push(e):`infoHash`in e?e.bytes&&s(e.bytes):o(e.magnet)}},fe.infoHash),re&&J(Bte,{title:re.title,name:re.name,onCancel:()=>ie(null),onSave:e=>{ie(null),re.save(e)}}),ae&&J(Vte,{name:ae.name,count:ae.torrents.length,onCancel:()=>oe(null),onAdd:()=>Dn(ae)}),G&&(G.scope===`session`||jt)&&J(P6,{title:G.direction===`down`?G.scope===`session`?e.formatMessage({id:`Total download rate limit`,defaultMessage:`Total download rate limit`}):e.formatMessage({id:`Download rate limit`,defaultMessage:`Download rate limit`}):G.scope===`session`?e.formatMessage({id:`Total upload rate limit`,defaultMessage:`Total upload rate limit`}):e.formatMessage({id:`Upload rate limit`,defaultMessage:`Upload rate limit`}),subject:G.scope===`session`?e.formatMessage({id:`All torrents`,defaultMessage:`All torrents`}):jt?.name,value:G.scope===`session`?G.direction===`down`?W.down:W.up:G.direction===`down`?jt?.downloadLimit:jt?.uploadLimit,note:G.scope===`session`?null:zD(G.direction===`down`?jt?.downloadLimit:jt?.uploadLimit,G.direction===`down`?W.down:W.up,e),onCancel:()=>ne(null),onApply:Mt}),Y(`footer`,{children:[J(`a`,{href:`https://fkn.app`,target:`_blank`,rel:`noreferrer`,children:e.formatMessage({id:`Powered by FKN`,defaultMessage:`Powered by FKN`})}),J(Sc,{to:`/legal`,children:e.formatMessage({id:`Legal`,defaultMessage:`Legal`})}),J(Sc,{to:`/privacy`,children:e.formatMessage({id:`Privacy`,defaultMessage:`Privacy`})}),J(`a`,{className:`build`,href:`https://github.com/banou26/ripple/commit/044862ef2bd9e65b89ba8d764244280446c06039`,target:`_blank`,rel:`noreferrer`,...R0(e.formatMessage({id:`commit {hash}`,defaultMessage:`commit {hash}`},{hash:`044862ef2bd9e65b89ba8d764244280446c06039`})),children:sne}),J(`div`,{className:`controls`,children:Y(`div`,{className:`folder`,children:[J(`span`,{children:e.formatMessage({id:`Speed`,defaultMessage:`Speed`})}),J(`button`,{className:W.down>0?`on`:void 0,"aria-label":Yn,"data-arrow":e.formatMessage({id:`↓ {speed}`,defaultMessage:`↓ {speed}`},{speed:qn}),onClick:()=>ne({scope:`session`,direction:`down`}),children:J(`span`,{children:Yn})}),J(`button`,{className:W.up>0?`on`:void 0,"aria-label":Xn,"data-arrow":e.formatMessage({id:`↑ {speed}`,defaultMessage:`↑ {speed}`},{speed:Jn}),onClick:()=>ne({scope:`session`,direction:`up`}),children:J(`span`,{children:Xn})})]})})]}),E&&(0,T0.createPortal)(J(`div`,{role:`status`,className:`toast`,css:gne,children:E}),document.body)]})},Dne=mt`
|
|
6713
|
+
`),r,e.formatMessage({id:`Could not copy`,defaultMessage:`Could not copy`})):K(r)},xn=async()=>{let t=pn.rows.filter(e=>e.state!==`missing`);if(t.length){let n=pD(t.reduce((e,t)=>e+(t.downloaded??0),0),!0);if(!await N({title:e.formatMessage({id:`{count, plural, one {Remove {count} torrent?} other {Remove {count} torrents?}}`,defaultMessage:`{count, plural, one {Remove {count} torrent?} other {Remove {count} torrents?}}`},{count:pn.rows.length}),body:e.formatMessage({id:`This deletes the {size} already downloaded.`,defaultMessage:`This deletes the {size} already downloaded.`},{size:n}),confirmLabel:e.formatMessage({id:`Remove and delete`,defaultMessage:`Remove and delete`}),tone:`danger`,rememberKey:`ripple:confirm-remove`}))return}for(let e of mn())Re(e),pn.toggle(e)},Sn=pn.rows.length>0,Cn=(t,n,r)=>{(r?EY:DY)(t.id,n).then(()=>K(r?e.formatMessage({id:`Added to {name}`,defaultMessage:`Added to {name}`},{name:N9(t.name)}):e.formatMessage({id:`Taken out of {name}`,defaultMessage:`Taken out of {name}`},{name:N9(t.name)})))},wn=t=>ie({title:e.formatMessage({id:`New group`,defaultMessage:`New group`}),save:n=>{let r=t();wY(n,r).then(t=>{t&&(r.length?K(e.formatMessage({id:`Added to {name}`,defaultMessage:`Added to {name}`},{name:N9(n)})):nn(t))})}}),Tn=e=>($t??[]).map(t=>{let n=cY(t);return{id:t.id,name:t.name,holds:e.every(e=>n.has(e))}}),En=async t=>{await N({title:e.formatMessage({id:`Delete {name}?`,defaultMessage:`Delete {name}?`},{name:N9(t.name)}),body:e.formatMessage({id:`Its torrents stay in your list.`,defaultMessage:`Its torrents stay in your list.`}),confirmLabel:e.formatMessage({id:`Delete group`,defaultMessage:`Delete group`}),tone:`danger`})&&await OY(t.id)},Dn=t=>{oe(null),nne(t,$t??[],C.importList).then(n=>{n&&(Ct(`all`),nn(n)),K(e.formatMessage({id:`{name} added`,defaultMessage:`{name} added`},{name:N9(t.name)}))},()=>K(e.formatMessage({id:`Could not add the group`,defaultMessage:`Could not add the group`})))},On=$te(en?.name??``,en?rn:[]),kn=({link:t,privateLeftOut:n})=>{if(!t){K(e.formatMessage({id:`Links hold up to {max, number} torrents`,defaultMessage:`Links hold up to {max, number} torrents`},{max:Gte}));return}tt(t,n?e.formatMessage({id:`{count, plural, one {Link copied, {count} private torrent left out} other {Link copied, {count} private torrents left out}}`,defaultMessage:`{count, plural, one {Link copied, {count} private torrent left out} other {Link copied, {count} private torrents left out}}`},{count:n}):e.formatMessage({id:`Link copied`,defaultMessage:`Link copied`}),e.formatMessage({id:`Could not copy the link`,defaultMessage:`Could not copy the link`}))},An=s7(n,_t),jn=B7(rn),Mn={list:($t??[]).map(e=>{let t=cY(e);return{id:e.id,name:e.name,count:An.filter(e=>!!e.infoHash&&t.has(e.infoHash)).length}}),shown:en?.id??null,all:An.length,onShow:nn,onNew:()=>wn(()=>[]),onDownloadAll:en&&jn.length?()=>_n(jn):void 0,onCopyLink:en&&On?.count?()=>kn(On):void 0,onRename:()=>{en&&ie({title:en.name,name:en.name,save:e=>{TY(en.id,e)}})},onDelete:()=>{en&&En(en)}},Nn=()=>mn().flatMap(e=>e.infoHash?[e.infoHash]:[]),Pn={filter:_t,onFilter:Ct,group:Mn,sortKey:xt.key,sortDir:xt.dir,onSort:Tt,view:yt,onView:wt,counts:an,picked:pn.all?`all`:Sn?`some`:`none`,canPick:pn.canPick,onPickAll:pn.toggleAll},Fn=pn.clear;(0,p.useEffect)(()=>{if(!Sn)return;let e=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=e.target;t instanceof Element&&t.closest(`textarea, input:not([type="checkbox"]), [role="dialog"], [role="menu"]`)||(e.preventDefault(),Fn())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[Sn,Fn]);let In=rn.length-on.length,Ln=H1(n.some(e=>e.state!==`missing`)),Rn=HQ(),zn=n.filter(e=>e.state===`retrying`).length,Bn=N3(),Vn=S3(`${n.length}:${Bn.refreshKey}`),Hn=!!Vn&&Vn.limitBytes-Vn.usedBytes<2e9,Un=C3({supported:ut,folderName:dt?.name,permitted:ft,defaultLocation:ht}),Wn=async()=>{if(Un.kind===`choose`){await pt()&&At(`folder`);return}if(Un.kind===`allow`){await mt();return}Un.kind===`move`&&At(`folder`)},Gn=e.formatMessage({id:`Create a torrent`,defaultMessage:`Create a torrent`}),Kn=e.formatMessage({id:`Settings`,defaultMessage:`Settings`}),qn=LD(W.down,e),Jn=LD(W.up,e),Yn=e.formatMessage({id:`{limit} down`,defaultMessage:`{limit} down`},{limit:qn}),Xn=e.formatMessage({id:`{limit} up`,defaultMessage:`{limit} up`},{limit:Jn}),Zn=q5({dragging:ke,overField:Me,shareOpen:B&&!H});return Y(`div`,{css:hne,"data-drag":Zn===`page`||void 0,children:[P,Ve&&at&&st&&J(L5,{groups:j9(at,nt(at,st.magnet),Ut(at)),at:Ve.at,label:e.formatMessage({id:`Options for {name}`,defaultMessage:`Options for {name}`},{name:at.name}),onClose:()=>He(null)}),ot&&st&&J(K5,{title:ot.name,groups:j9(ot,nt(ot,st.magnet),Ut(ot)),onClose:()=>We(null)}),J(`div`,{className:`drop`,children:J(`span`,{children:e.formatMessage({id:`Drop a .torrent or a magnet link to add it`,defaultMessage:`Drop a .torrent or a magnet link to add it`})})}),Y(`header`,{"data-searching":ee||void 0,children:[Y(`span`,{className:`brand`,children:[J(Sc,{className:`logo`,to:`/`,children:J(`img`,{src:ine,alt:rne,width:553,height:561})}),J(s2,{className:`powered`,label:e.formatMessage({id:`Powered by FKN`,defaultMessage:`Powered by FKN`}),linkLabel:e.formatMessage({id:`How it works`,defaultMessage:`How it works`}),href:`https://docs.fkn.dev/user/`})]}),J(`form`,{ref:R,onSubmit:e=>{e.preventDefault(),xe(w)&&T(``)},children:Y(`div`,{className:`field`,"data-drop":Zn===`field`||void 0,"data-held":!!w||void 0,onDragEnter:()=>{_||Ne(!0)},onDragOver:e=>e.preventDefault(),onDragLeave:()=>Ne(!1),onDrop:e=>{e.preventDefault(),e.stopPropagation(),Pe(),_||Te(e.dataTransfer)},children:[J(Ou,{className:`glyph`,"aria-hidden":`true`}),J(`input`,{ref:L,value:w,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Escape`&&T(``)},placeholder:e.formatMessage({id:`Add a magnet link, or search`,defaultMessage:`Add a magnet link, or search`}),"aria-label":e.formatMessage({id:`Add a magnet link, or search`,defaultMessage:`Add a magnet link, or search`}),spellCheck:!1,disabled:_}),w&&J(`button`,{className:`icon clear`,type:`button`,onMouseDown:G9,...R0(e.formatMessage({id:`Clear`,defaultMessage:`Clear`})),"aria-label":e.formatMessage({id:`Clear`,defaultMessage:`Clear`}),onClick:()=>{T(``),L.current?.focus()},children:J(Vu,{})}),J(`span`,{className:`sep`,"aria-hidden":`true`}),Y(`label`,{className:`icon file-button`,onMouseDown:G9,...R0(e.formatMessage({id:`Open a .torrent file`,defaultMessage:`Open a .torrent file`})),"aria-label":e.formatMessage({id:`Open a .torrent file`,defaultMessage:`Open a .torrent file`}),"aria-disabled":_||void 0,children:[J(uu,{}),J(`input`,{type:`file`,accept:`.torrent,application/x-bittorrent`,multiple:!0,disabled:_,onChange:e=>{let t=e.currentTarget.files;t?.length&&Se(t),e.currentTarget.value=``}})]}),J(`button`,{className:`icon go`,type:`submit`,onMouseDown:G9,...R0(e.formatMessage({id:`Add this magnet link`,defaultMessage:`Add this magnet link`})),"aria-label":e.formatMessage({id:`Add`,defaultMessage:`Add`}),disabled:_||!ln,children:J(Eu,{})})]})}),Ge.supported&&Y(`button`,{className:`tool create`,type:`button`,"aria-label":Gn,"aria-expanded":Ke,...R0(t?Gn:null),onClick:()=>Ke?Je():qe(!0),children:[J(Mu,{}),J(`span`,{children:Gn})]}),J(Sc,{className:`tool settings`,to:Fl(kl.SETTINGS),"aria-label":Kn,...R0(Kn),children:J(ku,{})}),J(W5,{onToast:K})]}),B&&J(a8,{torrent:H,dragging:Zn===`share`,onMagnet:Ce,onFiles:we,onClear:()=>U(null),onClose:De,onToast:K}),Ke&&J(O8,{create:Ge,onClose:Je,onShare:e=>{Je(),Ee(e)},onToast:K}),Ye.length>0&&Y(`div`,{className:`storage-warning surface`,role:`status`,children:[J(`strong`,{children:e.formatMessage({id:`{count, plural, one {A torrent you created needs access to its files again} other {{count} torrents you created need access to their files again}}`,defaultMessage:`{count, plural, one {A torrent you created needs access to its files again} other {{count} torrents you created need access to their files again}}`},{count:Ye.length})}),J(`div`,{className:`actions`,children:Ye.map(({entry:t,name:n})=>J(`button`,{type:`button`,onClick:()=>{Xe(t.infoHash).then(r=>{K(r?e.formatMessage({id:`Sharing {name} again`,defaultMessage:`Sharing {name} again`},{name:t.name??n}):e.formatMessage({id:`Ripple still cannot read {name}`,defaultMessage:`Ripple still cannot read {name}`},{name:n}))})},children:e.formatMessage({id:`Allow {name}`,defaultMessage:`Allow {name}`},{name:n})},t.infoHash))})]}),_&&Y(`div`,{className:`storage-warning surface`,role:`alert`,children:[J(`strong`,{children:e.formatMessage({id:`Ripple can't run in this window`,defaultMessage:`Ripple can't run in this window`})}),J(`span`,{children:e.formatMessage({id:`Open Ripple in a normal window, with site storage allowed.`,defaultMessage:`Open Ripple in a normal window, with site storage allowed.`})})]}),v&&Y(`div`,{className:`storage-warning surface`,role:`alert`,children:[J(`strong`,{children:e.formatMessage({id:`The download engine stopped`,defaultMessage:`The download engine stopped`})}),J(`button`,{onClick:()=>window.location.reload(),children:e.formatMessage({id:`Reload`,defaultMessage:`Reload`})})]}),A&&!_&&!v&&J(`div`,{className:`storage-warning surface offline`,role:`status`,children:J(`strong`,{children:e.formatMessage({id:`You're offline`,defaultMessage:`You're offline`})})}),!A&&zn>0&&!v&&J(`div`,{className:`storage-warning surface offline`,role:`status`,children:J(`strong`,{children:e.formatMessage({id:`{count, plural, one {A download hit a problem, retrying} other {{count} downloads hit a problem, retrying}}`,defaultMessage:`{count, plural, one {A download hit a problem, retrying} other {{count} downloads hit a problem, retrying}}`},{count:zn})})}),Vn&&Hn&&!_&&J(R3,{storage:Vn,relief:Un,onAct:()=>void Wn(),persist:Bn,onAskPersist:()=>void Bn.request()}),(n.length>0||Gq())&&Y(`section`,{className:`stats surface`,children:[Y(`div`,{className:`readouts`,children:[n.length>0&&Y(U9,{children:[J(F9,{dir:`down`,big:!0,bps:Xt,room:Qt,label:e.formatMessage({id:`Download#a speed`,defaultMessage:`Download`,description:`a speed`})}),J(F9,{dir:`up`,bps:Zt,room:Qt,label:e.formatMessage({id:`Upload#a speed`,defaultMessage:`Upload`,description:`a speed`})}),Y(`div`,{className:`stat rate`,children:[J(`label`,{children:e.formatMessage({id:`Peak down`,defaultMessage:`Peak down`})}),J(`strong`,{"data-room":Qt,children:r3(Kt)})]})]}),Y(U9,{children:[J(q0,{reachable:y,transport:b,quota:Ln}),n.length>0&&Y(Il,{children:[b!==`direct`&&J(fne,{reachable:y,inboundNow:i}),b!==`direct`&&a!==null&&J(pne,{nodes:a}),Vn&&J(lne,{storage:Vn,low:Hn}),Ln&&J(cne,{quota:Ln}),J(dne,{state:Rn})]})]})]}),n.length>0&&J(_ne,{history:Wt})]}),n.length>0&&J(Rte,{...Pn}),Y(`main`,{...cn,children:[x&&n.length===0&&J(X8,{onAnswer:S}),n.length===0?Y(`div`,{className:`empty`,children:[Y(`h1`,{children:[e.formatMessage({id:`Download. Stream.`,defaultMessage:`Download. Stream.`}),J(`br`,{}),J(`em`,{children:e.formatMessage({id:`In your browser.`,defaultMessage:`In your browser.`})})]}),Y(`div`,{className:`hints`,children:[J(`span`,{children:e.formatMessage({id:`Paste a magnet link above`,defaultMessage:`Paste a magnet link above`})}),J(`span`,{children:e.formatMessage({id:`Or drop a magnet or a .torrent anywhere`,defaultMessage:`Or drop a magnet or a .torrent anywhere`})})]})]}):dn.length===0?(y||!n.some(e=>e.state===`starting`))&&Y(`div`,{className:`empty`,children:[en&&!rn.length?e.formatMessage({id:`Nothing in {name}.`,defaultMessage:`Nothing in {name}.`},{name:N9(en.name)}):e.formatMessage({id:`Nothing matches this filter.`,defaultMessage:`Nothing matches this filter.`}),J(`div`,{className:`hints`,children:J(`button`,{type:`button`,className:`link`,onClick:()=>{Ct(`all`),nn(null),T(``)},children:e.formatMessage({id:`Show everything`,defaultMessage:`Show everything`})})})]}):yt===`table`?J(a9,{torrents:dn,transport:b,sortKey:xt.key,sortDir:xt.dir,onSort:Tt,selectedId:Ze,onSelect:$e,onOptions:et,picked:pn.picked,onPick:pn.toggle}):J(wne,{groups:fn,row:e=>J(Cne,{t:e,saving:O,onToggle:Fe,onSave:ct,onSaveZip:lt,onStart:Ie,onOptions:et,selected:e.id===Ze,onSelect:$e,checked:!!e.infoHash&&pn.picked.has(e.infoHash),onPick:pn.toggle,savedToUserStorage:!!dt&&ft&&Lt.has(K3(e)),rates:Jt[e.id],transport:b},e.id)}),In>0&&dn.length>0&&Y(`div`,{className:`hidden-note`,role:`status`,children:[e.formatMessage({id:`{count, plural, one {{count} torrent hidden} other {{count} torrents hidden}}`,defaultMessage:`{count, plural, one {{count} torrent hidden} other {{count} torrents hidden}}`},{count:In}),J(`button`,{type:`button`,className:`link`,onClick:()=>Ct(`all`),children:e.formatMessage({id:`Show#verb`,defaultMessage:`Show`,description:`verb`})})]})]}),Sn&&J($7,{count:pn.rows.length,canPause:R7(pn.rows).length>0,canResume:z7(pn.rows).length>0,finished:pn.rows.every(j1),canDownload:B7(pn.rows).length>0,onDownload:vn,onCopyMagnets:yn?()=>bn(yn):void 0,groups:Tn(pn.rows.map(e=>e.infoHash)),onGroup:(e,t)=>{let n=$t?.find(t=>t.id===e);n&&Cn(n,Nn(),t)},onNewGroup:()=>wn(Nn),onPause:hn,onResume:gn,onRemove:()=>{xn()},onClear:pn.clear}),rt&&J(D5,{t:rt,handle:Number.isFinite(Number(rt.id))?Number(rt.id):null,saving:it,onSave:e=>ct(rt,e),onClose:()=>Qe(null)}),fe&&J(c6,{name:fe.name,from:fe.from,external:fe.external,files:zt,choices:he??Z3({files:zt,location:ht}),onChoices:ge,folderName:dt?.name,folderReady:!!dt&&ft,storage:Vn,persist:Bn,onAskPersist:()=>void Bn.request(),onConfirm:Ht,onCancel:Vt,onNeverAsk:fe.external?void 0:()=>{de(!1);for(let e of ye.current.splice(0))e.external?ye.current.push(e):`infoHash`in e?e.bytes&&s(e.bytes):o(e.magnet)}},fe.infoHash),re&&J(Bte,{title:re.title,name:re.name,onCancel:()=>ie(null),onSave:e=>{ie(null),re.save(e)}}),ae&&J(Vte,{name:ae.name,count:ae.torrents.length,onCancel:()=>oe(null),onAdd:()=>Dn(ae)}),G&&(G.scope===`session`||jt)&&J(P6,{title:G.direction===`down`?G.scope===`session`?e.formatMessage({id:`Total download rate limit`,defaultMessage:`Total download rate limit`}):e.formatMessage({id:`Download rate limit`,defaultMessage:`Download rate limit`}):G.scope===`session`?e.formatMessage({id:`Total upload rate limit`,defaultMessage:`Total upload rate limit`}):e.formatMessage({id:`Upload rate limit`,defaultMessage:`Upload rate limit`}),subject:G.scope===`session`?e.formatMessage({id:`All torrents`,defaultMessage:`All torrents`}):jt?.name,value:G.scope===`session`?G.direction===`down`?W.down:W.up:G.direction===`down`?jt?.downloadLimit:jt?.uploadLimit,note:G.scope===`session`?null:zD(G.direction===`down`?jt?.downloadLimit:jt?.uploadLimit,G.direction===`down`?W.down:W.up,e),onCancel:()=>ne(null),onApply:Mt}),Y(`footer`,{children:[J(`a`,{href:`https://fkn.app`,target:`_blank`,rel:`noreferrer`,children:e.formatMessage({id:`Powered by FKN`,defaultMessage:`Powered by FKN`})}),J(Sc,{to:`/legal`,children:e.formatMessage({id:`Legal`,defaultMessage:`Legal`})}),J(Sc,{to:`/privacy`,children:e.formatMessage({id:`Privacy`,defaultMessage:`Privacy`})}),J(`a`,{className:`build`,href:`https://github.com/banou26/ripple/commit/d2ec0f9521476fccb7717a758d7777041b1d1585`,target:`_blank`,rel:`noreferrer`,...R0(e.formatMessage({id:`commit {hash}`,defaultMessage:`commit {hash}`},{hash:`d2ec0f9521476fccb7717a758d7777041b1d1585`})),children:sne}),J(`div`,{className:`controls`,children:Y(`div`,{className:`folder`,children:[J(`span`,{children:e.formatMessage({id:`Speed`,defaultMessage:`Speed`})}),J(`button`,{className:W.down>0?`on`:void 0,"aria-label":Yn,"data-arrow":e.formatMessage({id:`↓ {speed}`,defaultMessage:`↓ {speed}`},{speed:qn}),onClick:()=>ne({scope:`session`,direction:`down`}),children:J(`span`,{children:Yn})}),J(`button`,{className:W.up>0?`on`:void 0,"aria-label":Xn,"data-arrow":e.formatMessage({id:`↑ {speed}`,defaultMessage:`↑ {speed}`},{speed:Jn}),onClick:()=>ne({scope:`session`,direction:`up`}),children:J(`span`,{children:Xn})})]})})]}),E&&(0,T0.createPortal)(J(`div`,{role:`status`,className:`toast`,css:gne,children:E}),document.body)]})},Dne=mt`
|
|
6714
6714
|
position: relative;
|
|
6715
6715
|
/* vh minus the strip the broker reserved, same contract as the library page. A bare 100vh here
|
|
6716
6716
|
would still be a full viewport tall inside a root the reservation already shortened. */
|
|
@@ -6966,8 +6966,8 @@ This browser reports limited detail, so the cause above is a best guess.`:``)))}
|
|
|
6966
6966
|
text-align: match-parent;
|
|
6967
6967
|
}
|
|
6968
6968
|
|
|
6969
|
-
/* spacing pulls Arabic's joined letters apart */
|
|
6970
|
-
:lang(ar) {
|
|
6969
|
+
/* spacing pulls Arabic's joined letters apart, and breaks the line Hindi's letters hang from */
|
|
6970
|
+
:lang(ar), :lang(hi) {
|
|
6971
6971
|
letter-spacing: normal !important;
|
|
6972
6972
|
}
|
|
6973
6973
|
|