coursewatcher 1.3.1 → 2.0.0

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.
Files changed (47) hide show
  1. package/README.md +26 -23
  2. package/dist/app/cli/main.js +36 -0
  3. package/dist/app/server/create-app.js +151 -0
  4. package/dist/app/server/start-server.js +72 -0
  5. package/dist/modules/catalog/catalog-mappers.js +49 -0
  6. package/dist/modules/catalog/catalog-repository.js +168 -0
  7. package/dist/modules/catalog/catalog-service.js +76 -0
  8. package/dist/modules/notes/notes-repository.js +25 -0
  9. package/dist/modules/notes/notes-service.js +28 -0
  10. package/dist/modules/playback/playback-repository.js +32 -0
  11. package/dist/modules/playback/playback-service.js +89 -0
  12. package/dist/platform/config/app-config.js +24 -0
  13. package/dist/platform/config/package-info.js +21 -0
  14. package/dist/platform/database/database-manager.js +101 -0
  15. package/dist/platform/errors/app-error.js +30 -0
  16. package/dist/platform/logging/logger.js +21 -0
  17. package/dist/shared/contracts/api.js +2 -0
  18. package/dist/web/assets/api-client-hFlLSS3K.js +1 -0
  19. package/dist/web/assets/catalog-route-pOIhR3yd.js +1 -0
  20. package/dist/web/assets/index-CwspbIw1.js +10 -0
  21. package/dist/web/assets/index-VjwsJnuQ.css +1 -0
  22. package/dist/web/assets/jsx-runtime-C2ZT__TU.js +4 -0
  23. package/dist/web/assets/playback-route-Bmy_Z7k7.js +2 -0
  24. package/dist/web/assets/search-route-CeGVOVPT.js +1 -0
  25. package/dist/web/index.html +14 -0
  26. package/package.json +75 -57
  27. package/public/css/styles.css +0 -1375
  28. package/public/js/player.js +0 -359
  29. package/src/cli.js +0 -45
  30. package/src/controllers/video-controller.js +0 -189
  31. package/src/models/database.js +0 -169
  32. package/src/server.js +0 -179
  33. package/src/services/notes-service.js +0 -97
  34. package/src/services/progress-service.js +0 -169
  35. package/src/services/video-service.js +0 -354
  36. package/src/utils/config.js +0 -57
  37. package/src/utils/errors.js +0 -57
  38. package/src/utils/logger.js +0 -48
  39. package/views/layouts/main.ejs +0 -13
  40. package/views/pages/error.ejs +0 -25
  41. package/views/pages/index.ejs +0 -101
  42. package/views/pages/player.ejs +0 -161
  43. package/views/pages/search.ejs +0 -63
  44. package/views/partials/footer.ejs +0 -3
  45. package/views/partials/head.ejs +0 -8
  46. package/views/partials/header.ejs +0 -14
  47. package/views/partials/video-card.ejs +0 -36
@@ -0,0 +1,4 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function ee(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function M(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ee(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ee(a,u),c+=M(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ee(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(j(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function N(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function P(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var F=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},te={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=te,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:P}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,F)}catch(e){F(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),u=o(((e,t)=>{t.exports=l()})),d=c(u(),1),f=`modulepreload`,p=function(e){return`/`+e},m={},h=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}))))}r=o(t.map(t=>{if(t=p(t,n),t in m)return;m[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:f,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}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)})},g=e=>{throw TypeError(e)},_=(e,t,n)=>t.has(e)||g(`Cannot `+n),v=(e,t,n)=>(_(e,t,`read from private field`),n?n.call(e):t.get(e)),y=(e,t,n)=>t.has(e)?g(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),b=`popstate`;function x(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function S(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return D(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:O(t)}return A(t,n,null,e)}function C(e,t){if(e===!1||e==null)throw Error(t)}function w(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function T(){return Math.random().toString(36).substring(2,10)}function E(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function D(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?k(t):t,state:n,key:t&&t.key||r||T(),unstable_mask:i}}function O({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 k(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 A(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=x(e)?e:D(h.location,e,t);n&&n(r,e),l=u()+1;let d=E(r,l),f=h.createHref(r.unstable_mask||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=x(e)?e:D(h.location,e,t);n&&n(r,e),l=u();let i=E(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ee(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(b,d),c=e,()=>{i.removeEventListener(b,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 ee(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),C(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:O(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}var j,M=class{constructor(e){if(y(this,j,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(v(this,j).has(e))return v(this,j).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){v(this,j).set(e,t)}};j=new WeakMap;var N=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function P(e){return N.has(e)}var F=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function te(e){return F.has(e)}function ne(e){return e.index===!0}function I(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(C(e.index!==!0||!e.children,`Cannot specify children on an index route`),C(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),ne(e)){let n={...e,id:s};return r[s]=re(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=re(n,t(n)),e.children&&(n.children=I(e.children,t,o,r,i)),n}})}function re(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function ie(e,t,n=`/`){return ae(e,t,n,!1)}function ae(e,t,n,r){let i=H((typeof t==`string`?k(t):t).pathname||`/`,n);if(i==null)return null;let a=se(e);ce(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=V(i);o=he(a[e],t,r)}return o}function oe(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 se(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;C(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=U([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(C(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),se(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:pe(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of L(e.path))a(e,t,!0,n)}),t}function L(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=L(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 ce(e){e.sort((e,t)=>e.score===t.score?me(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var le=/^:[\w-]+$/,ue=3,R=2,de=1,fe=10,z=-2,B=e=>e===`*`;function pe(e,t){let n=e.split(`/`),r=n.length;return n.some(B)&&(r+=z),t&&(r+=R),n.filter(e=>!B(e)).reduce((e,t)=>e+(le.test(t)?ue:t===``?de:fe),r)}function me(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 he(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=ge({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=ge({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:U([a,u.pathname]),pathnameBase:ke(U([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=U([a,u.pathnameBase]))}return o}function ge(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=_e(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 n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function _e(e,t=!1,n=!0){w(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,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).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 V(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return w(!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 H(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 ve({basename:e,pathname:t}){return t===`/`?e:U([e,t])}var ye=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,be=e=>ye.test(e);function xe(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?k(e):e,a;return n?(n=De(n),a=n.startsWith(`/`)?Se(n.substring(1),`/`):Se(n,t)):a=t,{pathname:a,search:Ae(r),hash:je(i)}}function Se(e,t){let n=Oe(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Ce(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 we(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Te(e){let t=we(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ee(e,t,n,r=!1){let i;typeof e==`string`?i=k(e):(i={...e},C(!i.pathname||!i.pathname.includes(`?`),Ce(`?`,`pathname`,`search`,i)),C(!i.pathname||!i.pathname.includes(`#`),Ce(`#`,`pathname`,`hash`,i)),C(!i.search||!i.search.includes(`#`),Ce(`#`,`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=xe(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var De=e=>e.replace(/\/\/+/g,`/`),U=e=>De(e.join(`/`)),Oe=e=>e.replace(/\/+$/,``),ke=e=>Oe(e).replace(/^\/*/,`/`),Ae=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,je=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Me=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 Ne(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function W(e){return U(e.map(e=>e.route.path).filter(Boolean))||`/`}var G=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Pe(e,t){let n=e;if(typeof n!=`string`||!ye.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(G)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=H(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{w(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var Fe=Symbol(`Uninstrumented`);function Ie(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){let t=Object.keys(n);for(let r of t)e[r]&&n[r].push(e[r])}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=Re(n.lazy,t.lazy,()=>void 0);e&&(r.lazy=e)}if(typeof t.lazy==`object`){let e=t.lazy;[`middleware`,`loader`,`action`].forEach(t=>{let i=e[t],a=n[`lazy.${t}`];if(typeof i==`function`&&a.length>0){let e=Re(a,i,()=>void 0);e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return[`loader`,`action`].forEach(e=>{let i=t[e];if(typeof i==`function`&&n[e].length>0){let t=i[Fe]??i,a=Re(n[e],t,(...e)=>K(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[Fe]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[Fe]??e,r=Re(n.middleware,t,(...e)=>K(e[0]));return r?(r[Fe]=t,r):e})),r}function Le(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){let t=Object.keys(e);for(let r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){let t=e.navigate[Fe]??e.navigate,r=Re(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?O(n):`.`,...Be(e,r??{})}});r&&(r[Fe]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[Fe]??e.fetch,r=Re(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...Be(e,i??{})}});r&&(r[Fe]=t,e.fetch=r)}return e}function Re(e,t,n){return e.length===0?null:async(...r)=>{let i=await ze(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function ze(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error(`You cannot call instrumented handlers more than once`):o=ze(e,t,n,r-1),a=await o,C(a,`Expected a result`),a.type===`error`&&a.value instanceof Error?{status:`error`,error:a.value}:{status:`success`,error:void 0});try{await i(s,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}o||await s(),await o}else try{a={type:`success`,value:await n()}}catch(e){a={type:`error`,value:e}}return a||{type:`error`,value:Error(`No result assigned in instrumentation chain.`)}}function K(e){let{request:t,context:n,params:r,unstable_pattern:i}=e;return{request:Ve(t),params:{...r},unstable_pattern:i,context:He(n)}}function Be(e,t){return{currentUrl:O(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function Ve(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function He(e){if(We(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var Ue=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function We(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===Ue}var Ge=[`POST`,`PUT`,`PATCH`,`DELETE`],Ke=new Set(Ge),qe=[`GET`,...Ge],Je=new Set(qe),Ye=new Set([301,302,303,307,308]),Xe=new Set([307,308]),Ze={state:`idle`,location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Qe={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},$e={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},et=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),tt=`remix-router-transitions`,nt=Symbol(`ResetLoaderData`);function rt(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;C(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||et,a=i;if(e.unstable_instrumentations){let t=e.unstable_instrumentations;a=e=>({...i(e),...Ie(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=I(e.routes,a,void 0,o),c,l=e.basename||`/`;l.startsWith(`/`)||(l=`/${l}`);let u=e.dataStrategy||bt,d={unstable_passThroughRequests:!1,...e.future},f=null,p=new Set,m=null,h=null,g=null,_=e.hydrationData!=null,v=ie(s,e.history.location,l),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=q(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Ut(s);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&rt(v,s,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=rt(null,s,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>ct(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=lt(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let T,E={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:Ze,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},O=`POP`,A=null,j=!1,N,P=!1,F=new Map,te=null,ne=!1,re=!1,se=new Set,L=new Map,ce=0,le=-1,ue=new Map,R=new Set,de=new Map,fe=new Map,z=new Set,B=new Map,pe,me=null;function he(){if(f=e.history.listen(({action:t,location:n,delta:r})=>{if(pe){pe(),pe=void 0;return}w(B.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=Ke({currentLocation:E.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{pe=e});e.history.go(r*-1),Ge(i,{state:`blocked`,location:n,proceed(){Ge(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(E.blockers);e.set(i,$e),V({blockers:e})}}),A?.resolve(),A=null;return}return Se(t,n)}),n){dn(t,F);let e=()=>fn(t,F);t.addEventListener(`pagehide`,e),te=()=>t.removeEventListener(`pagehide`,e)}return E.initialized||Se(`POP`,E.location,{initialHydration:!0}),T}function ge(){f&&f(),te&&te(),p.clear(),N&&N.abort(),E.fetchers.forEach((e,t)=>Re(t)),E.blockers.forEach((e,t)=>We(t))}function _e(e){return p.add(e),()=>p.delete(e)}function V(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),E={...E,...e};let n=[],r=[];E.fetchers.forEach((e,t)=>{e.state===`idle`&&(z.has(t)?n.push(t):r.push(t))}),z.forEach(e=>{!E.fetchers.has(e)&&!L.has(e)&&n.push(e)}),[...p].forEach(r=>r(E,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Re(e)),r.forEach(e=>E.fetchers.delete(e))}function ve(t,n,{flushSync:r}={}){let i=E.actionData!=null&&E.navigation.formMethod!=null&&Y(E.navigation.formMethod)&&E.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?E.actionData:null;let o=n.loaderData?Bt(E.loaderData,n.loaderData,n.matches||[],n.errors):E.loaderData,l=E.blockers;l.size>0&&(l=new Map(l),l.forEach((e,t)=>l.set(t,$e)));let u=ne?!1:nt(t,n.matches||E.matches),d=j===!0||E.navigation.formMethod!=null&&Y(E.navigation.formMethod)&&t.state?._isRedirect!==!0;c&&=(s=c,void 0),ne||O===`POP`||(O===`PUSH`?e.history.push(t,t.state):O===`REPLACE`&&e.history.replace(t,t.state));let f;if(O===`POP`){let e=F.get(E.location.pathname);e&&e.has(t.pathname)?f={currentLocation:E.location,nextLocation:t}:F.has(t.pathname)&&(f={currentLocation:t,nextLocation:E.location})}else if(P){let e=F.get(E.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),F.set(E.location.pathname,e)),f={currentLocation:E.location,nextLocation:t}}V({...n,actionData:a,loaderData:o,historyAction:O,location:t,initialized:!0,renderFallback:!1,navigation:Ze,revalidation:`idle`,restoreScrollPosition:u,preventScrollReset:d,blockers:l},{viewTransitionOpts:f,flushSync:r===!0}),O=`POP`,j=!1,P=!1,ne=!1,re=!1,A?.resolve(),A=null,me?.resolve(),me=null}async function ye(t,n){if(A?.resolve(),A=null,typeof t==`number`){A||=pn();let n=A.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=ot(!1,at(E.location,E.matches,l,t,n?.fromRouteId,n?.relative),n),o;n?.unstable_mask&&(o={pathname:``,search:``,hash:``,...typeof n.unstable_mask==`string`?k(n.unstable_mask):{...E.location.unstable_mask,...n.unstable_mask}});let s=E.location,c=D(s,r,n&&n.state,void 0,o);c={...c,...e.history.encodeLocation(c)};let u=n&&n.replace!=null?n.replace:void 0,d=`PUSH`;u===!0?d=`REPLACE`:u===!1||i!=null&&Y(i.formMethod)&&i.formAction===E.location.pathname+E.location.search&&(d=`REPLACE`);let f=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,p=(n&&n.flushSync)===!0,m=Ke({currentLocation:s,nextLocation:c,historyAction:d});if(m){Ge(m,{state:`blocked`,location:c,proceed(){Ge(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:c}),ye(t,n)},reset(){let e=new Map(E.blockers);e.set(m,$e),V({blockers:e})}});return}await Se(d,c,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.unstable_defaultShouldRevalidate})}function xe(){me||=pn(),Me(),V({revalidation:`loading`});let e=me.promise;return E.navigation.state===`submitting`?e:E.navigation.state===`idle`?(Se(E.historyAction,E.location,{startUninterruptedRevalidation:!0}),e):(Se(O||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:P===!0}),e)}async function Se(t,n,r){N&&N.abort(),N=null,O=t,ne=(r&&r.startUninterruptedRevalidation)===!0,tt(E.location,E.matches),j=(r&&r.preventScrollReset)===!0,P=(r&&r.enableViewTransition)===!0;let i=c||s,a=r&&r.overrideNavigation,o=r?.initialHydration&&E.matches&&E.matches.length>0&&!y?E.matches:ie(i,n,l),u=(r&&r.flushSync)===!0;if(o&&E.initialized&&!re&&Kt(E.location,n)&&!(r&&r.submission&&Y(r.submission.formMethod))){ve(n,{matches:o},{flushSync:u});return}let d=rt(o,i,n.pathname);if(d.active&&d.matches&&(o=d.matches),!o){let{error:e,notFoundMatches:t,route:r}=qe(n.pathname);ve(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u});return}N=new AbortController;let f=Pt(e.history,n,N.signal,r&&r.submission),p=e.getContext?await e.getContext():new M,m;if(r&&r.pendingError)m=[Ht(o).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&Y(r.submission.formMethod)){let t=await Ce(f,n,r.submission,o,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(J(r)&&Ne(r.error)&&r.error.status===404){N=null,ve(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}});return}}o=t.matches||o,m=t.pendingActionResult,a=sn(n,r.submission),u=!1,d.active=!1,f=Pt(e.history,f.url,f.signal)}let{shortCircuited:h,matches:g,loaderData:_,errors:v}=await we(f,n,o,p,d.active,a,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,u,m,r&&r.callSiteDefaultShouldRevalidate);h||(N=null,ve(n,{matches:g||o,...Vt(m),loaderData:_,errors:v}))}async function Ce(t,n,i,c,u,d,f,p={}){if(Me(),V({navigation:cn(n,i)},{flushSync:p.flushSync===!0}),d){let e=await it(c,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}=Ut(s);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=Ht(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}else if(e.matches)c=e.matches;else{let{notFoundMatches:e,error:t,route:r}=qe(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let m,h=an(c,n);if(!h.route.action&&!h.route.lazy)m={type:`error`,error:q(405,{method:t.method,pathname:n.pathname,routeId:h.route.id})};else{let e=await Ae(t,n,Et(a,o,t,n,c,h,f?[]:r,u),u,null);if(m=e[h.route.id],!m){for(let t of c)if(e[t.route.id]){m=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(Zt(m)){let n;return n=p&&p.replace!=null?p.replace:Nt(m.response.headers.get(`Location`),new URL(t.url),l,e.history)===E.location.pathname+E.location.search,await ke(t,m,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(J(m)){let e=Ht(c,h.route.id);return(p&&p.replace)!==!0&&(O=`PUSH`),{matches:c,pendingActionResult:[e.route.id,m,h.route.id]}}return{matches:c,pendingActionResult:[h.route.id,m]}}async function we(t,n,i,u,d,f,p,m,h,g,_,v,y){let b=f||sn(n,p),x=p||m||on(b),S=!ne&&!g;if(d){if(S){let e=Te(v);V({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await it(i,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}=Ut(s);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=Ht(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=qe(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=c||s,{dsMatches:w,revalidatingFetchers:T}=st(t,u,a,o,e.history,E,i,x,n,g?[]:r,g===!0,re,se,z,de,R,C,l,e.patchRoutesOnNavigation!=null,v,y);if(le=++ce,!e.dataStrategy&&!w.some(e=>e.shouldLoad)&&!w.some(e=>e.route.middleware&&e.route.middleware.length>0)&&T.length===0){let e=Ve();return ve(n,{matches:i,loaderData:{},errors:v&&J(v[1])?{[v[0]]:v[1].error}:null,...Vt(v),...e?{fetchers:new Map(E.fetchers)}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=Te(v);t!==void 0&&(e.actionData=t)}T.length>0&&(e.fetchers=Ee(T)),V(e,{flushSync:_})}T.forEach(e=>{K(e.key),e.controller&&L.set(e.key,e.controller)});let D=()=>T.forEach(e=>K(e.key));N&&N.signal.addEventListener(`abort`,D);let{loaderResults:O,fetcherResults:k}=await je(w,T,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};N&&N.signal.removeEventListener(`abort`,D),T.forEach(e=>L.delete(e.key));let A=Wt(O);if(A)return await ke(t,A.result,!0,{replace:h}),{shortCircuited:!0};if(A=Wt(k),A)return R.add(A.key),await ke(t,A.result,!0,{replace:h}),{shortCircuited:!0};let{loaderData:ee,errors:j}=zt(E,i,O,v,T,k);g&&E.errors&&(j={...E.errors,...j});let M=Ve(),P=He(le),F=M||P||T.length>0;return{matches:i,loaderData:ee,errors:j,...F?{fetchers:new Map(E.fetchers)}:{}}}function Te(e){if(e&&!J(e[1]))return{[e[0]]:e[1].data};if(E.actionData)return Object.keys(E.actionData).length===0?null:E.actionData}function Ee(e){return e.forEach(e=>{let t=E.fetchers.get(e.key),n=ln(void 0,t?t.data:void 0);E.fetchers.set(e.key,n)}),new Map(E.fetchers)}async function De(t,n,r,i){K(t);let a=(i&&i.flushSync)===!0,o=c||s,u=at(E.location,E.matches,l,r,n,i?.relative),d=ie(o,u,l),f=rt(d,o,u);if(f.active&&f.matches&&(d=f.matches),!d){G(t,n,q(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=ot(!0,u,i);if(h){G(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new M,_=(i&&i.preventScrollReset)===!0;if(m&&Y(m.formMethod)){await U(t,n,p,d,g,f.active,a,_,m,i&&i.unstable_defaultShouldRevalidate);return}de.set(t,{routeId:n,path:p}),await Oe(t,n,p,d,g,f.active,a,_,m)}async function U(t,n,i,u,d,f,p,m,h,g){Me(),de.delete(t),W(t,un(h,E.fetchers.get(t)),{flushSync:p});let _=new AbortController,v=Pt(e.history,i,_.signal,h);if(f){let e=await it(u,new URL(v.url).pathname,v.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){G(t,n,e.error,{flushSync:p});return}else if(e.matches)u=e.matches;else{G(t,n,q(404,{pathname:i}),{flushSync:p});return}}let y=an(u,i);if(!y.route.action&&!y.route.lazy){G(t,n,q(405,{method:h.formMethod,pathname:i,routeId:n}),{flushSync:p});return}L.set(t,_);let b=ce,x=Et(a,o,v,i,u,y,r,d),S=await Ae(v,i,x,d,t),w=S[y.route.id];if(!w){for(let e of x)if(S[e.route.id]){w=S[e.route.id];break}}if(v.signal.aborted){L.get(t)===_&&L.delete(t);return}if(z.has(t)){if(Zt(w)||J(w)){W(t,X(void 0));return}}else{if(Zt(w))if(L.delete(t),le>b){W(t,X(void 0));return}else return R.add(t),W(t,ln(h)),ke(v,w,!1,{fetcherSubmission:h,preventScrollReset:m});if(J(w)){G(t,n,w.error);return}}let T=E.navigation.location||E.location,D=Pt(e.history,T,_.signal),k=c||s,A=E.navigation.state===`idle`?E.matches:ie(k,E.navigation.location,l);C(A,`Didn't find any matches after fetcher action`);let ee=++ce;ue.set(t,ee);let j=ln(h,w.data);E.fetchers.set(t,j);let{dsMatches:M,revalidatingFetchers:P}=st(D,d,a,o,e.history,E,A,h,T,r,!1,re,se,z,de,R,k,l,e.patchRoutesOnNavigation!=null,[y.route.id,w],g);P.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=E.fetchers.get(t),r=ln(void 0,n?n.data:void 0);E.fetchers.set(t,r),K(t),e.controller&&L.set(t,e.controller)}),V({fetchers:new Map(E.fetchers)});let F=()=>P.forEach(e=>K(e.key));_.signal.addEventListener(`abort`,F);let{loaderResults:te,fetcherResults:ne}=await je(M,P,D,T,d);if(_.signal.aborted)return;if(_.signal.removeEventListener(`abort`,F),ue.delete(t),L.delete(t),P.forEach(e=>L.delete(e.key)),E.fetchers.has(t)){let e=X(w.data);E.fetchers.set(t,e)}let I=Wt(te);if(I)return ke(D,I.result,!1,{preventScrollReset:m});if(I=Wt(ne),I)return R.add(I.key),ke(D,I.result,!1,{preventScrollReset:m});let{loaderData:ae,errors:oe}=zt(E,A,te,void 0,P,ne);He(ee),E.navigation.state===`loading`&&ee>le?(C(O,`Expected pending action`),N&&N.abort(),ve(E.navigation.location,{matches:A,loaderData:ae,errors:oe,fetchers:new Map(E.fetchers)})):(V({errors:oe,loaderData:Bt(E.loaderData,ae,A,oe),fetchers:new Map(E.fetchers)}),re=!1)}async function Oe(t,n,i,s,c,l,u,d,f){let p=E.fetchers.get(t);W(t,ln(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=Pt(e.history,i,m.signal);if(l){let e=await it(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){G(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{G(t,n,q(404,{pathname:i}),{flushSync:u});return}}let g=an(s,i);L.set(t,m);let _=ce,v=(await Ae(h,i,Et(a,o,h,i,s,g,r,c),c,t))[g.route.id];if(L.get(t)===m&&L.delete(t),!h.signal.aborted){if(z.has(t)){W(t,X(void 0));return}if(Zt(v))if(le>_){W(t,X(void 0));return}else{R.add(t),await ke(h,v,!1,{preventScrollReset:d});return}if(J(v)){G(t,n,v.error);return}W(t,X(v.data))}}async function ke(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:c,replace:u}={}){a||(A?.resolve(),A=null),i.response.headers.has(`X-Remix-Revalidate`)&&(re=!0);let d=i.response.headers.get(`Location`);C(d,`Expected a Location header on the redirect Response`),d=Nt(d,new URL(r.url),l,e.history);let f=D(E.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(be(d)){let n=ee(d,!0);e=n.origin!==t.location.origin||H(n.pathname,l)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}N=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:g}=E.navigation;!o&&!s&&m&&h&&g&&(o=on(E.navigation));let _=o||s;Xe.has(i.response.status)&&_&&Y(_.formMethod)?await Se(p,f,{submission:{..._,formAction:d},preventScrollReset:c||j,enableViewTransition:a?P:void 0}):await Se(p,f,{overrideNavigation:sn(f,o),fetcherSubmission:s,preventScrollReset:c||j,enableViewTransition:a?P:void 0})}async function Ae(e,t,n,r,i){let a,o={};try{a=await Dt(u,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!Y(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!E.loaderData.hasOwnProperty(e.route.id)&&(!E.errors||!E.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(Xt(r)){let i=r.result;o[t]={type:`redirect`,response:jt(i,e,t,n,l)}}else o[t]=await At(r);return o}async function je(e,t,n,r,i){let a=Ae(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Ae(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:q(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Me(){re=!0,de.forEach((e,t)=>{L.has(t)&&se.add(t),K(t)})}function W(e,t,n={}){E.fetchers.set(e,t),V({fetchers:new Map(E.fetchers)},{flushSync:(n&&n.flushSync)===!0})}function G(e,t,n,r={}){let i=Ht(E.matches,t);Re(e),V({errors:{[i.route.id]:n},fetchers:new Map(E.fetchers)},{flushSync:(r&&r.flushSync)===!0})}function Pe(e){return fe.set(e,(fe.get(e)||0)+1),z.has(e)&&z.delete(e),E.fetchers.get(e)||Qe}function Fe(e,t){K(e,t?.reason),W(e,X(null))}function Re(e){let t=E.fetchers.get(e);L.has(e)&&!(t&&t.state===`loading`&&ue.has(e))&&K(e),de.delete(e),ue.delete(e),R.delete(e),z.delete(e),se.delete(e),E.fetchers.delete(e)}function ze(e){let t=(fe.get(e)||0)-1;t<=0?(fe.delete(e),z.add(e)):fe.set(e,t),V({fetchers:new Map(E.fetchers)})}function K(e,t){let n=L.get(e);n&&(n.abort(t),L.delete(e))}function Be(e){for(let t of e){let e=X(Pe(t).data);E.fetchers.set(t,e)}}function Ve(){let e=[],t=!1;for(let n of R){let r=E.fetchers.get(n);C(r,`Expected fetcher: ${n}`),r.state===`loading`&&(R.delete(n),e.push(n),t=!0)}return Be(e),t}function He(e){let t=[];for(let[n,r]of ue)if(r<e){let e=E.fetchers.get(n);C(e,`Expected fetcher: ${n}`),e.state===`loading`&&(K(n),ue.delete(n),t.push(n))}return Be(t),t.length>0}function Ue(e,t){let n=E.blockers.get(e)||$e;return B.get(e)!==t&&B.set(e,t),n}function We(e){E.blockers.delete(e),B.delete(e)}function Ge(e,t){let n=E.blockers.get(e)||$e;C(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(E.blockers);r.set(e,t),V({blockers:r})}function Ke({currentLocation:e,nextLocation:t,historyAction:n}){if(B.size===0)return;B.size>1&&w(!1,`A router only supports one blocker at a time`);let r=Array.from(B.entries()),[i,a]=r[r.length-1],o=E.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function qe(e){let t=q(404,{pathname:e}),{matches:n,route:r}=Ut(c||s);return{notFoundMatches:n,route:r,error:t}}function Je(e,t,n){if(m=e,g=t,h=n||null,!_&&E.navigation===Ze){_=!0;let e=nt(E.location,E.matches);e!=null&&V({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Ye(e,t){return h&&h(e,t.map(e=>oe(e,E.loaderData)))||e.key}function tt(e,t){if(m&&g){let n=Ye(e,t);m[n]=g()}}function nt(e,t){if(m){let n=Ye(e,t),r=m[n];if(typeof r==`number`)return r}return null}function rt(t,n,r){if(e.patchRoutesOnNavigation){if(!t)return{active:!0,matches:ae(n,r,l,!0)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:ae(n,r,l,!0)}}return{active:!1,matches:null}}async function it(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let u=t;for(;;){let t=c==null,d=c||s,f=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:u,fetcherKey:i,patch:(e,t)=>{r.aborted||pt(e,t,d,f,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:u}}finally{t&&!r.aborted&&(s=[...s])}if(r.aborted)return{type:`aborted`};let p=ie(d,n,l),m=null;if(p&&(Object.keys(p[0].params).length===0||(m=ae(d,n,l,!0),!(m&&u.length<m.length&&ut(u,m.slice(0,u.length))))))return{type:`success`,matches:p};if(m||=ae(d,n,l,!0),!m||ut(u,m))return{type:`success`,matches:null};u=m}}function ut(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function dt(e){o={},c=I(e,a,void 0,o)}function ft(e,t,n=!1){let r=c==null;pt(e,t,c||s,o,a,n),r&&(s=[...s],V({}))}return T={get basename(){return l},get future(){return d},get state(){return E},get routes(){return s},get window(){return t},initialize:he,subscribe:_e,enableScrollRestoration:Je,navigate:ye,fetch:De,revalidate:xe,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Pe,resetFetcher:Fe,deleteFetcher:ze,dispose:ge,getBlocker:Ue,deleteBlocker:We,patchRoutes:ft,_internalFetchControllers:L,_internalSetRoutes:dt,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){V(e)}},e.unstable_instrumentations&&(T=Le(T,e.unstable_instrumentations.map(e=>e.router).filter(Boolean))),T}function it(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function at(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=Ee(r||`.`,Te(o),H(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=rn(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=ve({basename:n,pathname:c.pathname})),O(c)}function ot(e,t,n){if(!n||!it(n))return{path:t};if(n.formMethod&&!nn(n.formMethod))return{path:t,error:q(405,{method:n.formMethod})};let r=()=>({path:t,error:q(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=Gt(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!Y(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}
2
+ `,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}else if(n.formEncType===`application/json`){if(!Y(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()}}}C(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=It(n.formData),s=n.formData;else if(n.body instanceof FormData)o=It(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=Lt(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=Lt(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(Y(c.formMethod))return{path:t,submission:c};let l=k(t);return e&&l.search&&rn(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:O(l),submission:c}}function st(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b){let x=y?J(y[1])?y[1].error:y[1].data:void 0,S=i.createURL(a.location),C=i.createURL(c),w;if(u&&a.errors){let e=Object.keys(a.errors)[0];w=o.findIndex(t=>t.route.id===e)}else if(y&&J(y[1])){let e=y[0];w=o.findIndex(t=>t.route.id===e)-1}let T=y?y[1].statusCode:void 0,E=T&&T>=400,D={currentUrl:S,currentParams:a.matches[0]?.params||{},nextUrl:C,nextParams:o[0].params,...s,actionResult:x,actionStatus:T},O=W(o),k=o.map((i,o)=>{let{route:s}=i,f=null;if(w!=null&&o>w)f=!1;else if(s.lazy)f=!0;else if(!ct(s))f=!1;else if(u){let{shouldLoad:e}=lt(s,a.loaderData,a.errors);f=e}else ut(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return Tt(n,r,e,c,O,i,l,t,f);let p=!1;typeof b==`boolean`?p=b:E?p=!1:d||S.pathname+S.search===C.pathname+C.search?p=!0:S.search===C.search?dt(a.matches[o],i)&&(p=!0):p=!0;let m={...D,defaultShouldRevalidate:p};return Tt(n,r,e,c,O,i,l,t,ft(i,m),m,b)}),A=[];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=ie(g,e.path,_);if(!y){if(v&&m)return;A.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let x=an(y,e.path),S=new AbortController,C=Pt(i,e.path,S.signal),w=null;if(f.has(s))f.delete(s),w=Et(n,r,C,e.path,y,x,l,t);else if(m)d&&(w=Et(n,r,C,e.path,y,x,l,t));else{let i;i=typeof b==`boolean`?b:E?!1:d;let a={...D,defaultShouldRevalidate:i};ft(x,a)&&(w=Et(n,r,C,e.path,y,x,l,t,a))}w&&A.push({key:s,routeId:e.routeId,path:e.path,matches:w,match:x,request:C,controller:S})}),{dsMatches:k,revalidatingFetchers:A}}function ct(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function lt(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!ct(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function ut(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function dt(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function ft(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function pt(e,t,n,r,i,a){let o;if(e){let t=r[e];C(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=>mt(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=I(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]=I([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 mt(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?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>mt(e,t)))??!1:!1}var ht=new WeakMap,gt=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(C(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=ht.get(i);o||(o={},ht.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=P(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)w(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)w(!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},_t=new WeakMap;function vt(e,t,n,r,i){let a=n[e.id];if(C(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=_t.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{C(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=te(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?w(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?w(!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 _t.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=gt({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 yt(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 bt(e){return e.matches.some(e=>e.route.middleware)?xt(e,()=>yt(e)):yt(e)}function xt(e,t){return St(e,t,e=>{if(tn(e))throw e;return e},Jt,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=Ht(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function St(e,t,n,r,i){let{matches:a,...o}=e;return await Ct(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function Ct(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 Ct(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 wt(e,t,n,r,i){let a=gt({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=vt(r.route,Y(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Tt(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=wt(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?ft(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?ft(a,{...l,defaultShouldRevalidate:e}):ft(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!Y(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(Y(n.method)||!p)?Ot({request:n,path:r,unstable_pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function Et(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?Tt(e,t,n,r,W(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:wt(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function Dt(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,unstable_url:Ft(t,n),unstable_pattern:W(r),params:r[0].params,context:a,matches:r},c=o?()=>{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=s;return xt(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function Ot({request:e,path:t,unstable_pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=Y(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,unstable_url:Ft(e,t),unstable_pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a)if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw q(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}else if(t)c=await f(t);else{let t=new URL(e.url);throw q(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function kt(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 At(e){let{result:t,type:n}=e;if($t(t)){let e;try{e=await kt(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new Me(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?Qt(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:qt(t),statusCode:Ne(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:Ne(t)?t.status:void 0}:Qt(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 jt(e,t,n,r,i){let a=e.headers.get(`Location`);if(C(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!be(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=at(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var Mt=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Nt(e,t,n,r){if(be(e)){let r=e,i=r.startsWith(`//`)?new URL(t.protocol+r):new URL(r);if(Mt.includes(i.protocol))throw Error(`Invalid redirect location`);let a=H(i.pathname,n)!=null;if(i.origin===t.origin&&a)return De(i.pathname)+i.search+i.hash}try{let t=r.createURL(e);if(Mt.includes(t.protocol))throw Error(`Invalid redirect location`)}catch{}return e}function Pt(e,t,n,r){let i=e.createURL(Gt(t)).toString(),a={signal:n};if(r&&Y(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)):t===`text/plain`?a.body=r.text:t===`application/x-www-form-urlencoded`&&r.formData?a.body=It(r.formData):a.body=r.formData}return new Request(i,a)}function Ft(e,t){let n=new URL(e.url),r=typeof t==`string`?k(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);n.search=e.size?`?${e.toString()}`:``}else n.search=``;return n.hash=r.hash||``,n}function It(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function Lt(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Rt(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&J(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(C(!Zt(f),`Cannot handle redirect results in processLoaderData`),J(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=Ht(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=nt),c||(c=!0,s=Ne(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 zt(e,t,n,r,i,a){let{loaderData:o,errors:s}=Rt(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(C(o,`Did not find corresponding fetcher result`),J(o)){let t=Ht(e.matches,r?.route.id);s&&s[t.route.id]||(s={...s,[t.route.id]:o.error}),e.fetchers.delete(n)}else if(Zt(o))C(!1,`Unhandled fetcher revalidation redirect`);else{let t=X(o.data);e.fetchers.set(n,t)}}),{loaderData:o,errors:s}}function Bt(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==nt).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 Vt(e){return e?J(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Ht(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 Ut(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 q(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 Me(e||500,o,Error(s),!0)}function Wt(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(Zt(r))return{key:n,result:r}}}function Gt(e){return O({...typeof e==`string`?k(e):e,hash:``})}function Kt(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function qt(e){return new Me(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function Jt(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&Yt(t))}function Yt(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function Xt(e){return $t(e.result)&&Ye.has(e.result.status)}function J(e){return e.type===`error`}function Zt(e){return(e&&e.type)===`redirect`}function Qt(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function $t(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function en(e){return Ye.has(e)}function tn(e){return $t(e)&&en(e.status)&&e.headers.has(`Location`)}function nn(e){return Je.has(e.toUpperCase())}function Y(e){return Ke.has(e.toUpperCase())}function rn(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function an(e,t){let n=typeof t==`string`?k(t).search:t.search;if(e[e.length-1].route.index&&rn(n||``))return e[e.length-1];let r=we(e);return r[r.length-1]}function on(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 sn(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 cn(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 ln(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 un(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 X(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 dn(e,t){try{let n=e.sessionStorage.getItem(tt);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 fn(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(tt,JSON.stringify(n))}catch(e){w(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function pn(){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 mn=d.createContext(null);mn.displayName=`DataRouter`;var hn=d.createContext(null);hn.displayName=`DataRouterState`;var gn=d.createContext(!1);function _n(){return d.useContext(gn)}var vn=d.createContext({isTransitioning:!1});vn.displayName=`ViewTransition`;var yn=d.createContext(new Map);yn.displayName=`Fetchers`;var bn=d.createContext(null);bn.displayName=`Await`;var Z=d.createContext(null);Z.displayName=`Navigation`;var xn=d.createContext(null);xn.displayName=`Location`;var Q=d.createContext({outlet:null,matches:[],isDataRoute:!1});Q.displayName=`Route`;var Sn=d.createContext(null);Sn.displayName=`RouteError`;var Cn=`REACT_ROUTER_ERROR`,wn=`REDIRECT`,Tn=`ROUTE_ERROR_RESPONSE`;function En(e){if(e.startsWith(`${Cn}:${wn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Dn(e){if(e.startsWith(`${Cn}:${Tn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Me(t.status,t.statusText,t.data)}catch{}}function On(e,{relative:t}={}){C(kn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=d.useContext(Z),{hash:i,pathname:a,search:o}=In(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:U([n,a])),r.createHref({pathname:s,search:o,hash:i})}function kn(){return d.useContext(xn)!=null}function $(){return C(kn(),`useLocation() may be used only in the context of a <Router> component.`),d.useContext(xn).location}var An=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function jn(e){d.useContext(Z).static||d.useLayoutEffect(e)}function Mn(){let{isDataRoute:e}=d.useContext(Q);return e?tr():Nn()}function Nn(){C(kn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=d.useContext(mn),{basename:t,navigator:n}=d.useContext(Z),{matches:r}=d.useContext(Q),{pathname:i}=$(),a=JSON.stringify(Te(r)),o=d.useRef(!1);return jn(()=>{o.current=!0}),d.useCallback((r,s={})=>{if(w(o.current,An),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ee(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:U([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Pn=d.createContext(null);function Fn(e){let t=d.useContext(Q).outlet;return d.useMemo(()=>t&&d.createElement(Pn.Provider,{value:e},t),[t,e])}function In(e,{relative:t}={}){let{matches:n}=d.useContext(Q),{pathname:r}=$(),i=JSON.stringify(Te(n));return d.useMemo(()=>Ee(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ln(e,t,n){C(kn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=d.useContext(Z),{matches:i}=d.useContext(Q),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;rr(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (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.
3
+
4
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=$(),f;if(t){let e=typeof t==`string`?k(t):t;C(c===`/`||e.pathname?.startsWith(c),`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 "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=u;let p=f.pathname||`/`,m=p;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);m=`/`+p.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let h=ie(e,{pathname:m});w(l||h!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),w(h==null||h[h.length-1].route.element!==void 0||h[h.length-1].route.Component!==void 0||h[h.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.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 g=Wn(h&&h.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:U([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:U([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&g?d.createElement(xn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...f},navigationType:`POP`}},g):g}function Rn(){let e=er(),t=Ne(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=d.createElement(d.Fragment,null,d.createElement(`p`,null,`💿 Hey developer 👋`),d.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,d.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,d.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),d.createElement(d.Fragment,null,d.createElement(`h2`,null,`Unexpected Application Error!`),d.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?d.createElement(`pre`,{style:i},n):null,o)}var zn=d.createElement(Rn,null),Bn=class extends d.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.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Dn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:d.createElement(Q.Provider,{value:this.props.routeContext},d.createElement(Sn.Provider,{value:e,children:this.props.component}));return this.context?d.createElement(Hn,{error:e},t):t}};Bn.contextType=gn;var Vn=new WeakMap;function Hn({children:e,error:t}){let{basename:n}=d.useContext(Z);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=En(t.digest);if(e){let r=Vn.get(t);if(r)throw r;let i=Pe(e.location,n);if(G&&!Vn.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Vn.set(t,n),n}return d.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function Un({routeContext:e,match:t,children:n}){let r=d.useContext(mn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(Q.Provider,{value:e},n)}function Wn(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);C(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:W(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,f=!1,p=null,m=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,p=n.route.errorElement||zn,o&&(s<0&&c===0?(rr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):s===c&&(f=!0,m=n.route.hydrateFallbackElement||null)));let h=t.concat(i.slice(0,c+1)),g=()=>{let t;return t=u?p:f?m:n.route.Component?d.createElement(n.route.Component,null):n.route.element?n.route.element:e,d.createElement(Un,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?d.createElement(Bn,{location:r.location,revalidation:r.revalidation,component:p,error:u,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:l}):g()},null)}function Gn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Kn(e){let t=d.useContext(mn);return C(t,Gn(e)),t}function qn(e){let t=d.useContext(hn);return C(t,Gn(e)),t}function Jn(e){let t=d.useContext(Q);return C(t,Gn(e)),t}function Yn(e){let t=Jn(e),n=t.matches[t.matches.length-1];return C(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Xn(){return Yn(`useRouteId`)}function Zn(){return qn(`useNavigation`).navigation}function Qn(){let{matches:e,loaderData:t}=qn(`useMatches`);return d.useMemo(()=>e.map(e=>oe(e,t)),[e,t])}function $n(){let e=qn(`useLoaderData`),t=Yn(`useLoaderData`);return e.loaderData[t]}function er(){let e=d.useContext(Sn),t=qn(`useRouteError`),n=Yn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function tr(){let{router:e}=Kn(`useNavigate`),t=Yn(`useNavigate`),n=d.useRef(!1);return jn(()=>{n.current=!0}),d.useCallback(async(r,i={})=>{w(n.current,An),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var nr={};function rr(e,t,n){!t&&!nr[e]&&(nr[e]=!0,w(!1,n))}var ir={};function ar(e,t){!e&&!ir[t]&&(ir[t]=!0,console.warn(t))}var or=d.useOptimistic,sr=()=>void 0;function cr(e){return or?or(e):[e,sr]}function lr(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&w(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:d.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&w(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:d.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&w(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:d.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var ur=[`HydrateFallback`,`hydrateFallbackElement`],dr=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 fr({router:e,flushSync:t,onError:n,unstable_useTransitions:r}){r=_n()||r;let[i,a]=d.useState(e.state),[o,s]=cr(i),[c,l]=d.useState(),[u,f]=d.useState({isTransitioning:!1}),[p,m]=d.useState(),[h,g]=d.useState(),[_,v]=d.useState(),y=d.useRef(new Map),b=d.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:_})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},unstable_pattern:W(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),o.forEach(e=>y.current.delete(e)),ar(u===!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 b=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(ar(_==null||b,"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."),!_||!b){t&&u?t(()=>a(i)):r===!1?a(i):d.startTransition(()=>{r===!0&&s(e=>pr(e,i)),a(i)});return}if(t&&u){t(()=>{h&&(p?.resolve(),h.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:_.currentLocation,nextLocation:_.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{m(void 0),g(void 0),l(void 0),f({isTransitioning:!1})})}),t(()=>g(n));return}h?(p?.resolve(),h.skipTransition(),v({state:i,currentLocation:_.currentLocation,nextLocation:_.nextLocation})):(l(i),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}))},[e.window,t,h,p,r,s,n]);d.useLayoutEffect(()=>e.subscribe(b),[e,b]);let x=o.initialized;d.useLayoutEffect(()=>{!x&&e.state.initialized&&b(e.state,{deletedFetchers:[],flushSync:!1,newErrors:null})},[x,b,e.state]),d.useEffect(()=>{u.isTransitioning&&!u.flushSync&&m(new dr)},[u]),d.useEffect(()=>{if(p&&c&&e.window){let t=c,n=p.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):d.startTransition(()=>{r===!0&&s(e=>pr(e,t)),a(t)}),await n});i.finished.finally(()=>{m(void 0),g(void 0),l(void 0),f({isTransitioning:!1})}),g(i)}},[c,p,e.window,r,s]),d.useEffect(()=>{p&&c&&o.location.key===c.location.key&&p.resolve()},[p,h,o.location,c]),d.useEffect(()=>{!u.isTransitioning&&_&&(l(_.state),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}),v(void 0))},[u.isTransitioning,_]);let S=d.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]),C=e.basename||`/`,w=d.useMemo(()=>({router:e,navigator:S,static:!1,basename:C,onError:n}),[e,S,C,n]);return d.createElement(d.Fragment,null,d.createElement(mn.Provider,{value:w},d.createElement(hn.Provider,{value:o},d.createElement(yn.Provider,{value:y.current},d.createElement(vn.Provider,{value:u},d.createElement(_r,{basename:C,location:o.location,navigationType:o.historyAction,navigator:S,unstable_useTransitions:r},d.createElement(mr,{routes:e.routes,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function pr(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var mr=d.memo(hr);function hr({routes:e,future:t,state:n,isStatic:r,onError:i}){return Ln(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function gr(e){return Fn(e.context)}function _r({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){C(!kn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=d.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=k(n));let{pathname:l=`/`,search:u=``,hash:f=``,state:p=null,key:m=`default`,unstable_mask:h}=n,g=d.useMemo(()=>{let e=H(l,s);return e==null?null:{location:{pathname:e,search:u,hash:f,state:p,key:m,unstable_mask:h},navigationType:r}},[s,l,u,f,p,m,r,h]);return w(g!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${f}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:d.createElement(Z.Provider,{value:c},d.createElement(xn.Provider,{children:t,value:g}))}d.Component;var vr=`get`,yr=`application/x-www-form-urlencoded`;function br(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function xr(e){return br(e)&&e.tagName.toLowerCase()===`button`}function Sr(e){return br(e)&&e.tagName.toLowerCase()===`form`}function Cr(e){return br(e)&&e.tagName.toLowerCase()===`input`}function wr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Tr(e,t){return e.button===0&&(!t||t===`_self`)&&!wr(e)}var Er=null;function Dr(){if(Er===null)try{new FormData(document.createElement(`form`),0),Er=!1}catch{Er=!0}return Er}var Or=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function kr(e){return e!=null&&!Or.has(e)?(w(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yr}"`),null):e}function Ar(e,t){let n,r,i,a,o;if(Sr(e)){let o=e.getAttribute(`action`);r=o?H(o,t):null,n=e.getAttribute(`method`)||vr,i=kr(e.getAttribute(`enctype`))||yr,a=new FormData(e)}else if(xr(e)||Cr(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?H(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||vr,i=kr(e.getAttribute(`formenctype`))||kr(o.getAttribute(`enctype`))||yr,a=new FormData(o,e),!Dr()){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(br(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=vr,r=null,i=yr,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`);var jr={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Mr=/[&><\u2028\u2029]/g;function Nr(e){return e.replace(Mr,e=>jr[e])}function Pr(e,t){if(e===!1||e==null)throw Error(t)}function Fr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&H(i.pathname,t)===`/`?i.pathname=`${Oe(t)}/_root.${r}`:i.pathname=`${Oe(i.pathname)}.${r}`,i}async function Ir(e,t){if(e.id in t)return t[e.id];try{let n=await h(()=>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 Lr(e){return e!=null&&typeof e.page==`string`}function Rr(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 zr(e,t,n){return Wr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Ir(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Rr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Br(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,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 Vr(e,t,{includeHydrateFallback:n}={}){return Hr(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 Hr(e){return[...new Set(e)]}function Ur(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Wr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Lr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Ur(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Gr(){let e=d.useContext(mn);return Pr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Kr(){let e=d.useContext(hn);return Pr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var qr=d.createContext(void 0);qr.displayName=`FrameworkContext`;function Jr(){let e=d.useContext(qr);return Pr(e,`You must render this element inside a <HydratedRouter> element`),e}function Yr(e,t){let n=d.useContext(qr),[r,i]=d.useState(!1),[a,o]=d.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:f}=t,p=d.useRef(null);d.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),d.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,p,{onFocus:Xr(s,m),onBlur:Xr(c,h),onMouseEnter:Xr(l,m),onMouseLeave:Xr(u,h),onTouchStart:Xr(f,m)}]:[a,p,{}]:[!1,p,{}]}function Xr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Zr({page:e,...t}){let n=_n(),{router:r}=Gr(),i=d.useMemo(()=>ie(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?d.createElement($r,{page:e,matches:i,...t}):d.createElement(ei,{page:e,matches:i,...t}):null}function Qr(e){let{manifest:t,routeModules:n}=Jr(),[r,i]=d.useState([]);return d.useEffect(()=>{let r=!1;return zr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function $r({page:e,matches:t,...n}){let r=$(),{future:i}=Jr(),{basename:a}=Gr(),o=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Fr(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return d.createElement(d.Fragment,null,o.map(e=>d.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function ei({page:e,matches:t,...n}){let r=$(),{future:i,manifest:a,routeModules:o}=Jr(),{basename:s}=Gr(),{loaderData:c,matches:l}=Kr(),u=d.useMemo(()=>Br(e,t,l,a,r,`data`),[e,t,l,a,r]),f=d.useMemo(()=>Br(e,t,l,a,r,`assets`),[e,t,l,a,r]),p=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Fr(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),m=d.useMemo(()=>Vr(f,a),[f,a]),h=Qr(f);return d.createElement(d.Fragment,null,p.map(e=>d.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>d.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>d.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ti(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}d.Component;var ni=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ni&&(window.__reactRouterVersion=`7.14.1`)}catch{}function ri(e,t){return rt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:S({window:t?.window}),hydrationData:t?.hydrationData||ii(),routes:e,mapRouteProperties:lr,hydrationRouteProperties:ur,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function ii(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:ai(e.errors)}),e}function ai(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 Me(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}function oi({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=d.useState({action:n.action,location:n.location}),o=d.useCallback(e=>{r===!1?a(e):d.startTransition(()=>a(e))},[r]);return d.useLayoutEffect(()=>n.listen(o),[n,o]),d.createElement(_r,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}oi.displayName=`unstable_HistoryRouter`;var si=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ci=d.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:f,unstable_defaultShouldRevalidate:p,...m},h){let{basename:g,navigator:_,unstable_useTransitions:v}=d.useContext(Z),y=typeof l==`string`&&si.test(l),b=Pe(l,g);l=b.to;let x=On(l,{relative:r}),S=$(),C=null;if(o){let e=Ee(o,[],S.unstable_mask?S.unstable_mask.pathname:`/`,!0);g!==`/`&&(e.pathname=e.pathname===`/`?g:U([g,e.pathname])),C=_.createHref(e)}let[w,T,E]=Yr(n,m),D=hi(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:f,unstable_defaultShouldRevalidate:p,unstable_useTransitions:v});function O(t){e&&e(t),t.defaultPrevented||D(t)}let k=!(b.isExternal||i),A=d.createElement(`a`,{...m,...E,href:(k?C:void 0)||b.absoluteURL||x,onClick:k?O:e,ref:ti(h,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?d.createElement(d.Fragment,null,A,d.createElement(Zr,{page:x})):A});ci.displayName=`Link`;var li=d.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=In(a,{relative:c.relative}),f=$(),p=d.useContext(hn),{navigator:m,basename:h}=d.useContext(Z),g=p!=null&&Ti(u)&&o===!0,_=m.encodeLocation?m.encodeLocation(u).pathname:u.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=H(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 d.createElement(ci,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});li.displayName=`NavLink`;var ui=d.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=vr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:f,unstable_defaultShouldRevalidate:p,...m},h)=>{let{unstable_useTransitions:g}=d.useContext(Z),_=vi(),v=yi(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&si.test(s);return d.createElement(`form`,{ref:h,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,m=()=>_(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:f,unstable_defaultShouldRevalidate:p});g&&n!==!1?d.startTransition(()=>m()):m()},...m,"data-discover":!b&&e===`render`?`true`:void 0})});ui.displayName=`Form`;function di({getKey:e,storageKey:t,...n}){let r=d.useContext(qr),{basename:i}=d.useContext(Z),a=$(),o=Qn();Ci({getKey:e,storageKey:t});let s=d.useMemo(()=>{if(!r||!e)return null;let t=Si(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return d.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Nr(JSON.stringify(t||bi))}, ${Nr(JSON.stringify(s))})`}})}di.displayName=`ScrollRestoration`;function fi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pi(e){let t=d.useContext(mn);return C(t,fi(e)),t}function mi(e){let t=d.useContext(hn);return C(t,fi(e)),t}function hi(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=Mn(),f=$(),p=In(e,{relative:o});return d.useCallback(m=>{if(Tr(m,t)){m.preventDefault();let t=n===void 0?O(f)===O(p):n,h=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?d.startTransition(()=>h()):h()}},[f,u,p,n,r,i,t,e,a,o,s,c,l])}var gi=0,_i=()=>`__${String(++gi)}__`;function vi(){let{router:e}=pi(`useSubmit`),{basename:t}=d.useContext(Z),n=Xn(),r=e.fetch,i=e.navigate;return d.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ar(e,t);a.navigate===!1?await r(a.fetcherKey||_i(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function yi(e,{relative:t}={}){let{basename:n}=d.useContext(Z),r=d.useContext(Q);C(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...In(e||`.`,{relative:t})},o=$();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:U([n,a.pathname])),O(a)}var bi=`react-router-scroll-positions`,xi={};function Si(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:H(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Ci({getKey:e,storageKey:t}={}){let{router:n}=pi(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=mi(`useScrollRestoration`),{basename:a}=d.useContext(Z),o=$(),s=Qn(),c=Zn();d.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),wi(d.useCallback(()=>{if(c.state===`idle`){let t=Si(o,s,a,e);xi[t]=window.scrollY}try{sessionStorage.setItem(t||bi,JSON.stringify(xi))}catch(e){w(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(d.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||bi);e&&(xi=JSON.parse(e))}catch{}},[t]),d.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(xi,()=>window.scrollY,e?(t,n)=>Si(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),d.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{w(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function wi(e,t){let{capture:n}=t||{};d.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Ti(e,{relative:t}={}){let n=d.useContext(vn);C(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=pi(`useViewTransitionState`),i=In(e,{relative:t});if(!n.isTransitioning)return!1;let a=H(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=H(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ge(i.pathname,o)!=null||ge(i.pathname,a)!=null}var Ei=o((e=>{var t=Symbol.for(`react.transitional.element`);function n(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.jsx=n,e.jsxs=n})),Di=o(((e,t)=>{t.exports=Ei()}));export{ri as a,$ as c,h as d,u as f,fr as i,Mn as l,c as m,ci as n,Ne as o,o as p,gr as r,$n as s,Di as t,er as u};
@@ -0,0 +1,2 @@
1
+ import{f as e,l as t,m as n,n as r,s as i,t as a}from"./jsx-runtime-C2ZT__TU.js";import{a as o,o as s,r as c,s as l,t as u}from"./api-client-hFlLSS3K.js";function d(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function p(e){var t=f(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ee(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),e}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?te(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var re={addCSS:!0,thumbWidth:15,watch:!0};function ie(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}function _(e,t){if(e&&t){var n=new Event(t,{bubbles:!0});e.dispatchEvent(n)}}var v=function(e){return e==null?null:e.constructor},y=function(e,t){return!!(e&&t&&e instanceof t)},ae=function(e){return e==null},b=function(e){return v(e)===Object},oe=function(e){return v(e)===Number&&!Number.isNaN(e)},x=function(e){return v(e)===String},se=function(e){return v(e)===Boolean},ce=function(e){return v(e)===Function},le=function(e){return Array.isArray(e)},ue=function(e){return y(e,NodeList)},S={nullOrUndefined:ae,object:b,number:oe,string:x,boolean:se,function:ce,array:le,nodeList:ue,element:function(e){return y(e,Element)},event:function(e){return y(e,Event)},empty:function(e){return ae(e)||(x(e)||le(e)||ue(e))&&!e.length||b(e)&&!Object.keys(e).length}};function de(e){var t=`${e}`.match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}function fe(e,t){if(1>t){var n=de(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}var pe=function(){function e(t,n){m(this,e),S.element(t)?this.element=t:S.string(t)&&(this.element=document.querySelector(t)),S.element(this.element)&&S.empty(this.element.rangeTouch)&&(this.config=ne({},re,{},n),this.init())}return ee(e,[{key:`init`,value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect=`none`,this.element.style.webKitUserSelect=`none`,this.element.style.touchAction=`manipulation`),this.listeners(!0),this.element.rangeTouch=this)}},{key:`destroy`,value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect=``,this.element.style.webKitUserSelect=``,this.element.style.touchAction=``),this.listeners(!1),this.element.rangeTouch=null)}},{key:`listeners`,value:function(e){var t=this,n=e?`addEventListener`:`removeEventListener`;[`touchstart`,`touchmove`,`touchend`].forEach(function(e){t.element[n](e,function(e){return t.set(e)},!1)})}},{key:`get`,value:function(t){if(!e.enabled||!S.event(t))return null;var n,r=t.target,i=t.changedTouches[0],a=parseFloat(r.getAttribute(`min`))||0,o=parseFloat(r.getAttribute(`max`))||100,s=parseFloat(r.getAttribute(`step`))||1,c=r.getBoundingClientRect(),l=100/c.width*(this.config.thumbWidth/2)/100;return 0>(n=100/c.width*(i.clientX-c.left))?n=0:100<n&&(n=100),50>n?n-=(100-2*n)*l:50<n&&(n+=2*(n-50)*l),a+fe(n/100*(o-a),s)}},{key:`set`,value:function(t){e.enabled&&S.event(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),_(t.target,t.type===`touchend`?`change`:`input`))}}],[{key:`setup`,value:function(t){var n=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},r=null;if(S.empty(t)||S.string(t)?r=Array.from(document.querySelectorAll(S.string(t)?t:`input[type="range"]`)):S.element(t)?r=[t]:S.nodeList(t)?r=Array.from(t):S.array(t)&&(r=t.filter(S.element)),S.empty(r))return null;var i=ne({},re,{},n);return S.string(t)&&i.watch&&new MutationObserver(function(n){Array.from(n).forEach(function(n){Array.from(n.addedNodes).forEach(function(n){S.element(n)&&ie(n,t)&&new e(n,i)})})}).observe(document.body,{childList:!0,subtree:!0}),r.map(function(t){return new e(t,n)})}},{key:`enabled`,get:function(){return`ontouchstart`in document.documentElement}}]),e}(),C=e=>e==null?null:e.constructor,w=(e,t)=>!!(e&&t&&e instanceof t),me=e=>e==null,he=e=>C(e)===Object,ge=e=>C(e)===Number&&!Number.isNaN(e),_e=e=>C(e)===String,ve=e=>C(e)===Boolean,ye=e=>typeof e==`function`,be=e=>Array.isArray(e),xe=e=>w(e,WeakMap),Se=e=>w(e,NodeList),Ce=e=>C(e)===Text,we=e=>w(e,Event),Te=e=>w(e,KeyboardEvent),Ee=e=>w(e,window.TextTrackCue)||w(e,window.VTTCue),De=e=>w(e,TextTrack)||!me(e)&&_e(e.kind),Oe=e=>w(e,Promise)&&ye(e.then);function ke(e){return typeof e==`object`&&!!e&&e.nodeType===1&&typeof e.style==`object`&&typeof e.ownerDocument==`object`}function Ae(e){return me(e)||(_e(e)||be(e)||Se(e))&&!e.length||he(e)&&!Object.keys(e).length}function je(e){if(w(e,window.URL))return!0;if(!_e(e))return!1;let t=e;(!e.startsWith(`http://`)||!e.startsWith(`https://`))&&(t=`http://${e}`);try{return!Ae(new URL(t).hostname)}catch{return!1}}var T={nullOrUndefined:me,object:he,number:ge,string:_e,boolean:ve,function:ye,array:be,weakMap:xe,nodeList:Se,element:ke,textNode:Ce,event:we,keyboardEvent:Te,cue:Ee,track:De,promise:Oe,url:je,empty:Ae},Me=(()=>{let e=document.createElement(`span`),t={WebkitTransition:`webkitTransitionEnd`,MozTransition:`transitionend`,OTransition:`oTransitionEnd otransitionend`,transition:`transitionend`},n=Object.keys(t).find(t=>e.style[t]!==void 0);return T.string(n)?t[n]:!1})();function Ne(e,t){setTimeout(()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch{}},t)}function Pe(e){return JSON.parse(JSON.stringify(e))}function Fe(e,t){return t.split(`.`).reduce((e,t)=>e&&e[t],e)}function E(e={},...t){if(!t.length)return e;let n=t.shift();return T.object(n)?(Object.keys(n).forEach(t=>{T.object(n[t])?(Object.keys(e).includes(t)||Object.assign(e,{[t]:{}}),E(e[t],n[t])):Object.assign(e,{[t]:n[t]})}),E(e,...t)):e}function Ie(e,t){let n=e.length?e:[e];Array.from(n).reverse().forEach((e,n)=>{let r=n>0?t.cloneNode(!0):t,i=e.parentNode,a=e.nextSibling;r.appendChild(e),a?i.insertBefore(r,a):i.appendChild(r)})}function Le(e,t){!T.element(e)||T.empty(t)||Object.entries(t).filter(([,e])=>!T.nullOrUndefined(e)).forEach(([t,n])=>e.setAttribute(t,n))}function D(e,t,n){let r=document.createElement(e);return T.object(t)&&Le(r,t),T.string(n)&&(r.textContent=n),r}function Re(e,t){!T.element(e)||!T.element(t)||t.parentNode.insertBefore(e,t.nextSibling)}function ze(e,t,n,r){T.element(t)&&t.appendChild(D(e,n,r))}function O(e){if(T.nodeList(e)||T.array(e)){Array.from(e).forEach(O);return}!T.element(e)||!T.element(e.parentNode)||e.parentNode.removeChild(e)}function Be(e){if(!T.element(e))return;let{length:t}=e.childNodes;for(;t>0;)e.removeChild(e.lastChild),--t}function Ve(e,t){return!T.element(t)||!T.element(t.parentNode)||!T.element(e)?null:(t.parentNode.replaceChild(e,t),e)}function k(e,t){if(!T.string(e)||T.empty(e))return{};let n={},r=E({},t);return e.split(`,`).forEach(e=>{let t=e.trim(),i=t.replace(`.`,``),a=t.replace(/[[\]]/g,``).split(`=`),[o]=a,s=a.length>1?a[1].replace(/["']/g,``):``;switch(t.charAt(0)){case`.`:T.string(r.class)?n.class=`${r.class} ${i}`:n.class=i;break;case`#`:n.id=t.replace(`#`,``);break;case`[`:n[o]=s;break}}),E(r,n)}function A(e,t){if(!T.element(e))return;let n=t;T.boolean(n)||(n=!e.hidden),e.hidden=n}function j(e,t,n){if(T.nodeList(e))return Array.from(e).map(e=>j(e,t,n));if(T.element(e)){let r=`toggle`;return n!==void 0&&(r=n?`add`:`remove`),e.classList[r](t),e.classList.contains(t)}return!1}function He(e,t){return T.element(e)&&e.classList.contains(t)}function M(e,t){let{prototype:n}=Element;function r(){return Array.from(document.querySelectorAll(t)).includes(this)}return(n.matches||n.webkitMatchesSelector||n.mozMatchesSelector||n.msMatchesSelector||r).call(e,t)}function Ue(e,t){let{prototype:n}=Element;function r(){let e=this;do{if(M.matches(e,t))return e;e=e.parentElement||e.parentNode}while(e!==null&&e.nodeType===1);return null}return(n.closest||r).call(e,t)}function N(e){return this.elements.container.querySelectorAll(e)}function P(e){return this.elements.container.querySelector(e)}function We(e=null,t=!1){T.element(e)&&e.focus({preventScroll:!0,focusVisible:t})}var Ge={"audio/ogg":`vorbis`,"audio/wav":`1`,"video/webm":`vp8, vorbis`,"video/mp4":`avc1.42E01E, mp4a.40.2`,"video/ogg":`theora`},F={audio:`canPlayType`in document.createElement(`audio`),video:`canPlayType`in document.createElement(`video`),check(e,t){let n=F[e]||t!==`html5`;return{api:n,ui:n&&F.rangeInput}},pip:document.pictureInPictureEnabled&&!D(`video`).disablePictureInPicture,airplay:T.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:`playsInline`in document.createElement(`video`),mime(e){if(T.empty(e))return!1;let[t]=e.split(`/`),n=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(Ge).includes(n)&&(n+=`; codecs="${Ge[e]}"`);try{return!!(n&&this.media.canPlayType(n).replace(/no/,``))}catch{return!1}},textTracks:`textTracks`in document.createElement(`video`),rangeInput:(()=>{let e=document.createElement(`input`);return e.type=`range`,e.type===`range`})(),touch:`ontouchstart`in document.documentElement,transitions:Me!==!1,reducedMotion:`matchMedia`in window&&window.matchMedia(`(prefers-reduced-motion)`).matches},Ke=(()=>{let e=!1;try{let t=Object.defineProperty({},`passive`,{get(){return e=!0,null}});window.addEventListener(`test`,null,t),window.removeEventListener(`test`,null,t)}catch{}return e})();function I(e,t,n,r=!1,i=!0,a=!1){if(!e||!(`addEventListener`in e)||T.empty(t)||!T.function(n))return;let o=t.split(` `),s=a;Ke&&(s={passive:i,capture:a}),o.forEach(t=>{this&&this.eventListeners&&r&&this.eventListeners.push({element:e,type:t,callback:n,options:s}),e[r?`addEventListener`:`removeEventListener`](t,n,s)})}function L(e,t=``,n,r=!0,i=!1){I.call(this,e,t,n,!0,r,i)}function qe(e,t=``,n,r=!0,i=!1){I.call(this,e,t,n,!1,r,i)}function Je(e,t=``,n,r=!0,i=!1){let a=(...o)=>{qe(e,t,a,r,i),n.apply(this,o)};I.call(this,e,t,a,!0,r,i)}function R(e,t=``,n=!1,r={}){if(!T.element(e)||T.empty(t))return;let i=new CustomEvent(t,{bubbles:n,detail:{...r,plyr:this}});e.dispatchEvent(i)}function Ye(){this&&this.eventListeners&&(this.eventListeners.forEach(e=>{let{element:t,type:n,callback:r,options:i}=e;t.removeEventListener(n,r,i)}),this.eventListeners=[])}function Xe(){return new Promise(e=>this.ready?setTimeout(e,0):L.call(this,this.elements.container,`ready`,e)).then(()=>{})}function z(e){T.promise(e)&&e.then(null,()=>{})}function Ze(e){return T.array(e)?e.filter((t,n)=>e.indexOf(t)===n):e}function Qe(e,t){return!T.array(e)||!e.length?null:e.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e)}function $e(e){return!window||!window.CSS?!1:window.CSS.supports(e)}var et=[[1,1],[4,3],[3,4],[5,4],[4,5],[3,2],[2,3],[16,10],[10,16],[16,9],[9,16],[21,9],[9,21],[32,9],[9,32]].reduce((e,[t,n])=>({...e,[t/n]:[t,n]}),{});function tt(e){return!T.array(e)&&(!T.string(e)||!e.includes(`:`))?!1:(T.array(e)?e:e.split(`:`)).map(Number).every(T.number)}function nt(e){if(!T.array(e)||!e.every(T.number))return null;let[t,n]=e,r=(e,t)=>t===0?e:r(t,e%t),i=r(t,n);return[t/i,n/i]}function rt(e){let t=e=>tt(e)?e.split(`:`).map(Number):null,n=t(e);if(n===null&&(n=t(this.config.ratio)),n===null&&!T.empty(this.embed)&&T.array(this.embed.ratio)&&({ratio:n}=this.embed),n===null&&this.isHTML5){let{videoWidth:e,videoHeight:t}=this.media;n=[e,t]}return nt(n)}function B(e){if(!this.isVideo)return{};let{wrapper:t}=this.elements,n=rt.call(this,e);if(!T.array(n))return{};let[r,i]=nt(n),a=$e(`aspect-ratio: ${r}/${i}`),o=100/r*i;if(a?t.style.aspectRatio=`${r}/${i}`:t.style.paddingBottom=`${o}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){let e=100/this.media.offsetWidth*Number.parseInt(window.getComputedStyle(this.media).paddingBottom,10),n=(e-o)/(e/50);this.fullscreen.active?t.style.paddingBottom=null:this.media.style.transform=`translateY(-${n}%)`}else this.isHTML5&&t.classList.add(this.config.classNames.videoFixedRatio);return{padding:o,ratio:n}}function it(e,t,n=.05){let r=e/t,i=Qe(Object.keys(et),r);return Math.abs(i-r)<=n?et[i]:[e,t]}function at(){return[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)]}var V={getSources(){return this.isHTML5?Array.from(this.media.querySelectorAll(`source`)).filter(e=>{let t=e.getAttribute(`type`);return T.empty(t)?!0:F.mime.call(this,t)}):[]},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:V.getSources.call(this).map(e=>Number(e.getAttribute(`size`))).filter(Boolean)},setup(){if(!this.isHTML5)return;let e=this;e.options.speed=e.config.speed.options,T.empty(this.config.ratio)||B.call(e),Object.defineProperty(e.media,`quality`,{get(){let t=V.getSources.call(e).find(t=>t.getAttribute(`src`)===e.source);return t&&Number(t.getAttribute(`size`))},set(t){if(e.quality!==t){if(e.config.quality.forced&&T.function(e.config.quality.onChange))e.config.quality.onChange(t);else{let n=V.getSources.call(e).find(e=>Number(e.getAttribute(`size`))===t);if(!n)return;let{currentTime:r,paused:i,preload:a,readyState:o,playbackRate:s}=e.media;e.media.src=n.getAttribute(`src`),(a!==`none`||o)&&(e.once(`loadedmetadata`,()=>{e.speed=s,e.currentTime=r,i||z(e.play())}),e.media.load())}R.call(e,e.media,`qualitychange`,!1,{quality:t})}}})},cancelRequests(){this.isHTML5&&(O(V.getSources.call(this)),this.media.setAttribute(`src`,this.config.blankVideo),this.media.load(),this.debug.log(`Cancelled network requests`))}},H={isIE:!!window.document.documentMode,isEdge:/Edge/.test(navigator.userAgent),isWebKit:`WebkitAppearance`in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPadOS:navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,isIos:/iPad|iPhone|iPod/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1};function ot(e){return`${e}-${Math.floor(Math.random()*1e4)}`}function st(e,...t){return T.empty(e)?e:e.toString().replace(/\{(\d+)\}/g,(e,n)=>t[n].toString())}function ct(e,t){return e===0||t===0||Number.isNaN(e)||Number.isNaN(t)?0:(e/t*100).toFixed(2)}function U(e=``,t=``,n=``){return e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,`\\$1`),`g`),n.toString())}function lt(e=``){return e.toString().replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())}function ut(e=``){let t=e.toString();return t=U(t,`-`,` `),t=U(t,`_`,` `),t=lt(t),U(t,` `,``)}function dt(e=``){let t=e.toString();return t=ut(t),t.charAt(0).toLowerCase()+t.slice(1)}function ft(e){let t=document.createDocumentFragment(),n=document.createElement(`div`);return t.appendChild(n),n.innerHTML=e,t.firstChild.textContent}function pt(e){let t=document.createElement(`div`);return t.appendChild(e),t.innerHTML}var mt={pip:`PIP`,airplay:`AirPlay`,html5:`HTML5`,vimeo:`Vimeo`,youtube:`YouTube`},W={get(e=``,t={}){if(T.empty(e)||T.empty(t))return``;let n=Fe(t.i18n,e);if(T.empty(n))return Object.keys(mt).includes(e)?mt[e]:``;let r={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(r).forEach(([e,t])=>{n=U(n,e,t)}),n}},ht=class e{constructor(t){d(this,`get`,t=>{if(!e.supported||!this.enabled)return null;let n=window.localStorage.getItem(this.key);if(T.empty(n))return null;let r=JSON.parse(n);return T.string(t)&&t.length?r[t]:r}),d(this,`set`,t=>{if(!e.supported||!this.enabled||!T.object(t))return;let n=this.get();T.empty(n)&&(n={}),E(n,t);try{window.localStorage.setItem(this.key,JSON.stringify(n))}catch{}}),this.enabled=t.config.storage.enabled,this.key=t.config.storage.key}static get supported(){try{if(!(`localStorage`in window))return!1;let e=`___test`;return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}};function G(e,t=`text`,n=!1){return new Promise((r,i)=>{try{let i=new XMLHttpRequest;if(!(`withCredentials`in i))return;n&&(i.withCredentials=!0),i.addEventListener(`load`,()=>{if(t===`text`)try{r(JSON.parse(i.responseText))}catch{r(i.responseText)}else r(i.response)}),i.addEventListener(`error`,()=>{throw Error(i.status)}),i.open(`GET`,e,!0),i.responseType=t,i.send()}catch(e){i(e)}})}function gt(e,t){if(!T.string(e))return;let n=`cache`,r=T.string(t),i=!1,a=()=>document.getElementById(t)!==null,o=(e,t)=>{e.innerHTML=t,!(r&&a())&&document.body.insertAdjacentElement(`afterbegin`,e)};if(!r||!a()){let a=ht.supported,s=document.createElement(`div`);if(s.setAttribute(`hidden`,``),r&&s.setAttribute(`id`,t),a){let e=window.localStorage.getItem(`${n}-${t}`);i=e!==null,i&&o(s,JSON.parse(e).content)}G(e).then(e=>{if(!T.empty(e)){if(a)try{window.localStorage.setItem(`${n}-${t}`,JSON.stringify({content:e}))}catch{}o(s,e)}}).catch(()=>{})}}var _t=e=>Math.trunc(e/60/60%60,10),vt=e=>Math.trunc(e/60%60,10),yt=e=>Math.trunc(e%60,10);function bt(e=0,t=!1,n=!1){if(!T.number(e))return bt(void 0,t,n);let r=e=>`0${e}`.slice(-2),i=_t(e),a=vt(e),o=yt(e);return i=t||i>0?`${i}:`:``,`${n&&e>0?`-`:``}${i}${r(a)}:${r(o)}`}var K={getIconUrl(){let e=new URL(this.config.iconUrl,window.location),t=window.location.host?window.location.host:window.top.location.host,n=e.host!==t||H.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:n}},findElements(){try{return this.elements.controls=P.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:N.call(this,this.config.selectors.buttons.play),pause:P.call(this,this.config.selectors.buttons.pause),restart:P.call(this,this.config.selectors.buttons.restart),rewind:P.call(this,this.config.selectors.buttons.rewind),fastForward:P.call(this,this.config.selectors.buttons.fastForward),mute:P.call(this,this.config.selectors.buttons.mute),pip:P.call(this,this.config.selectors.buttons.pip),airplay:P.call(this,this.config.selectors.buttons.airplay),settings:P.call(this,this.config.selectors.buttons.settings),captions:P.call(this,this.config.selectors.buttons.captions),fullscreen:P.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=P.call(this,this.config.selectors.progress),this.elements.inputs={seek:P.call(this,this.config.selectors.inputs.seek),volume:P.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:P.call(this,this.config.selectors.display.buffer),currentTime:P.call(this,this.config.selectors.display.currentTime),duration:P.call(this,this.config.selectors.display.duration)},T.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(e){return this.debug.warn(`It looks like there is a problem with your custom controls HTML`,e),this.toggleNativeControls(!0),!1}},createIcon(e,t){let n=`http://www.w3.org/2000/svg`,r=K.getIconUrl.call(this),i=`${r.cors?``:r.url}#${this.config.iconPrefix}`,a=document.createElementNS(n,`svg`);Le(a,E(t,{"aria-hidden":`true`,focusable:`false`}));let o=document.createElementNS(n,`use`),s=`${i}-${e}`;return`href`in o&&o.setAttributeNS(`http://www.w3.org/1999/xlink`,`href`,s),o.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,s),a.appendChild(o),a},createLabel(e,t={}){let n=W.get(e,this.config);return D(`span`,{...t,class:[t.class,this.config.classNames.hidden].filter(Boolean).join(` `)},n)},createBadge(e){if(T.empty(e))return null;let t=D(`span`,{class:this.config.classNames.menu.value});return t.appendChild(D(`span`,{class:this.config.classNames.menu.badge},e)),t},createButton(e,t){let n=E({},t),r=dt(e),i={element:`button`,toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch([`element`,`icon`,`label`].forEach(e=>{Object.keys(n).includes(e)&&(i[e]=n[e],delete n[e])}),i.element===`button`&&!Object.keys(n).includes(`type`)&&(n.type=`button`),Object.keys(n).includes(`class`)?n.class.split(` `).includes(this.config.classNames.control)||E(n,{class:`${n.class} ${this.config.classNames.control}`}):n.class=this.config.classNames.control,e){case`play`:i.toggle=!0,i.label=`play`,i.labelPressed=`pause`,i.icon=`play`,i.iconPressed=`pause`;break;case`mute`:i.toggle=!0,i.label=`mute`,i.labelPressed=`unmute`,i.icon=`volume`,i.iconPressed=`muted`;break;case`captions`:i.toggle=!0,i.label=`enableCaptions`,i.labelPressed=`disableCaptions`,i.icon=`captions-off`,i.iconPressed=`captions-on`;break;case`fullscreen`:i.toggle=!0,i.label=`enterFullscreen`,i.labelPressed=`exitFullscreen`,i.icon=`enter-fullscreen`,i.iconPressed=`exit-fullscreen`;break;case`play-large`:n.class+=` ${this.config.classNames.control}--overlaid`,r=`play`,i.label=`play`,i.icon=`play`;break;default:T.empty(i.label)&&(i.label=r),T.empty(i.icon)&&(i.icon=e)}let a=D(i.element);return i.toggle?(a.appendChild(K.createIcon.call(this,i.iconPressed,{class:`icon--pressed`})),a.appendChild(K.createIcon.call(this,i.icon,{class:`icon--not-pressed`})),a.appendChild(K.createLabel.call(this,i.labelPressed,{class:`label--pressed`})),a.appendChild(K.createLabel.call(this,i.label,{class:`label--not-pressed`}))):(a.appendChild(K.createIcon.call(this,i.icon)),a.appendChild(K.createLabel.call(this,i.label))),E(n,k(this.config.selectors.buttons[r],n)),Le(a,n),r===`play`?(T.array(this.elements.buttons[r])||(this.elements.buttons[r]=[]),this.elements.buttons[r].push(a)):this.elements.buttons[r]=a,a},createRange(e,t){let n=D(`input`,E(k(this.config.selectors.inputs[e]),{type:`range`,min:0,max:100,step:.01,value:0,autocomplete:`off`,role:`slider`,"aria-label":W.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=n,K.updateRangeFill.call(this,n),pe.setup(n),n},createProgress(e,t){let n=D(`progress`,E(k(this.config.selectors.display[e]),{min:0,max:100,value:0,role:`progressbar`,"aria-hidden":!0},t));if(e!==`volume`){n.appendChild(D(`span`,null,`0`));let t={played:`played`,buffer:`buffered`}[e];n.textContent=`% ${(t?W.get(t,this.config):``).toLowerCase()}`}return this.elements.display[e]=n,n},createTime(e,t){let n=k(this.config.selectors.display[e],t),r=D(`div`,E(n,{class:`${n.class?n.class:``} ${this.config.classNames.display.time} `.trim(),"aria-label":W.get(e,this.config),role:`timer`}),`00:00`);return this.elements.display[e]=r,r},bindMenuItemShortcuts(e,t){L.call(this,e,`keydown keyup`,n=>{if(![` `,`ArrowUp`,`ArrowDown`,`ArrowRight`].includes(n.key)||(n.preventDefault(),n.stopPropagation(),n.type===`keydown`))return;let r=M(e,`[role="menuitemradio"]`);if(!r&&[` `,`ArrowRight`].includes(n.key))K.showMenuPanel.call(this,t,!0);else{let t;n.key!==` `&&(n.key===`ArrowDown`||r&&n.key===`ArrowRight`?(t=e.nextElementSibling,T.element(t)||(t=e.parentNode.firstElementChild)):(t=e.previousElementSibling,T.element(t)||(t=e.parentNode.lastElementChild)),We.call(this,t,!0))}},!1),L.call(this,e,`keyup`,e=>{e.key===`Return`&&K.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:e,list:t,type:n,title:r,badge:i=null,checked:a=!1}){let o=k(this.config.selectors.inputs[n]),s=D(`button`,E(o,{type:`button`,role:`menuitemradio`,class:`${this.config.classNames.control} ${o.class?o.class:``}`.trim(),"aria-checked":a,value:e})),c=D(`span`);c.innerHTML=r,T.element(i)&&c.appendChild(i),s.appendChild(c),Object.defineProperty(s,`checked`,{enumerable:!0,get(){return s.getAttribute(`aria-checked`)===`true`},set(e){e&&Array.from(s.parentNode.children).filter(e=>M(e,`[role="menuitemradio"]`)).forEach(e=>e.setAttribute(`aria-checked`,`false`)),s.setAttribute(`aria-checked`,e?`true`:`false`)}}),this.listeners.bind(s,`click keyup`,t=>{if(!(T.keyboardEvent(t)&&t.key!==` `)){switch(t.preventDefault(),t.stopPropagation(),s.checked=!0,n){case`language`:this.currentTrack=Number(e);break;case`quality`:this.quality=e;break;case`speed`:this.speed=Number.parseFloat(e);break}K.showMenuPanel.call(this,`home`,T.keyboardEvent(t))}},n,!1),K.bindMenuItemShortcuts.call(this,s,n),t.appendChild(s)},formatTime(e=0,t=!1){return T.number(e)?bt(e,_t(this.duration)>0,t):e},updateTimeDisplay(e=null,t=0,n=!1){!T.element(e)||!T.number(t)||(e.textContent=K.formatTime(t,n))},updateVolume(){this.supported.ui&&(T.element(this.elements.inputs.volume)&&K.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),T.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||this.volume===0))},setRange(e,t=0){T.element(e)&&(e.value=t,K.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!T.event(e))return;let t=0,n=(e,t)=>{let n=T.number(t)?t:0,r=T.element(e)?e:this.elements.display.buffer;if(T.element(r)){r.value=n;let e=r.getElementsByTagName(`span`)[0];T.element(e)&&(e.childNodes[0].nodeValue=n)}};if(e)switch(e.type){case`timeupdate`:case`seeking`:case`seeked`:t=ct(this.currentTime,this.duration),e.type===`timeupdate`&&K.setRange.call(this,this.elements.inputs.seek,t);break;case`playing`:case`progress`:n(this.elements.display.buffer,this.buffered*100);break}},updateRangeFill(e){let t=T.event(e)?e.target:e;if(!(!T.element(t)||t.getAttribute(`type`)!==`range`)){if(M(t,this.config.selectors.inputs.seek)){t.setAttribute(`aria-valuenow`,this.currentTime);let e=K.formatTime(this.currentTime),n=K.formatTime(this.duration),r=W.get(`seekLabel`,this.config);t.setAttribute(`aria-valuetext`,r.replace(`{currentTime}`,e).replace(`{duration}`,n))}else if(M(t,this.config.selectors.inputs.volume)){let e=t.value*100;t.setAttribute(`aria-valuenow`,e),t.setAttribute(`aria-valuetext`,`${e.toFixed(1)}%`)}else t.setAttribute(`aria-valuenow`,t.value);!H.isWebKit&&!H.isIPadOS||t.style.setProperty(`--value`,`${t.value/t.max*100}%`)}},updateSeekTooltip(e){if(!this.config.tooltips.seek||!T.element(this.elements.inputs.seek)||!T.element(this.elements.display.seekTooltip)||this.duration===0)return;let t=this.elements.display.seekTooltip,n=`${this.config.classNames.tooltip}--visible`,r=e=>j(t,n,e);if(this.touch){r(!1);return}let i=0,a=this.elements.progress.getBoundingClientRect();if(T.event(e)){let t=e.pageX-e.clientX;i=100/a.width*(e.pageX-a.left-t)}else if(He(t,n))i=Number.parseFloat(t.style.left,10);else return;i<0?i=0:i>100&&(i=100);let o=this.duration/100*i;t.textContent=K.formatTime(o);let s=this.config.markers?.points?.find(({time:e})=>e===Math.round(o));s&&t.insertAdjacentHTML(`afterbegin`,`${s.label}<br>`),t.style.left=`${i}%`,T.event(e)&&[`mouseenter`,`mouseleave`].includes(e.type)&&r(e.type===`mouseenter`)},timeUpdate(e){let t=!T.element(this.elements.display.duration)&&this.config.invertTime;K.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),!(e&&e.type===`timeupdate`&&this.media.seeking)&&K.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32){A(this.elements.display.currentTime,!0),A(this.elements.progress,!0);return}T.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute(`aria-valuemax`,this.duration);let e=T.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&K.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&K.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&K.setMarkers.call(this),K.updateSeekTooltip.call(this)},toggleMenuButton(e,t){A(this.elements.settings.buttons[e],!t)},updateSetting(e,t,n){let r=this.elements.settings.panels[e],i=null,a=t;if(e===`captions`)i=this.currentTrack;else{if(i=T.empty(n)?this[e]:n,T.empty(i)&&(i=this.config[e].default),!T.empty(this.options[e])&&!this.options[e].includes(i)){this.debug.warn(`Unsupported value of '${i}' for ${e}`);return}if(!this.config[e].options.includes(i)){this.debug.warn(`Disabled value of '${i}' for ${e}`);return}}if(T.element(a)||(a=r&&r.querySelector(`[role="menu"]`)),!T.element(a))return;let o=this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`);o.innerHTML=K.getLabel.call(this,e,i);let s=a&&a.querySelector(`[value="${i}"]`);T.element(s)&&(s.checked=!0)},getLabel(e,t){switch(e){case`speed`:return t===1?W.get(`normal`,this.config):`${t}&times;`;case`quality`:if(T.number(t)){let e=W.get(`qualityLabel.${t}`,this.config);return e.length?e:`${t}p`}return lt(t);case`captions`:return q.getLabel.call(this);default:return null}},setQualityMenu(e){if(!T.element(this.elements.settings.panels.quality))return;let t=`quality`,n=this.elements.settings.panels.quality.querySelector(`[role="menu"]`);T.array(e)&&(this.options.quality=Ze(e).filter(e=>this.config.quality.options.includes(e)));let r=!T.empty(this.options.quality)&&this.options.quality.length>1;if(K.toggleMenuButton.call(this,t,r),Be(n),K.checkMenu.call(this),!r)return;let i=e=>{let t=W.get(`qualityBadge.${e}`,this.config);return t.length?K.createBadge.call(this,t):null};this.options.quality.sort((e,t)=>{let n=this.config.quality.options;return n.indexOf(e)>n.indexOf(t)?1:-1}).forEach(e=>{K.createMenuItem.call(this,{value:e,list:n,type:t,title:K.getLabel.call(this,`quality`,e),badge:i(e)})}),K.updateSetting.call(this,t,n)},setCaptionsMenu(){if(!T.element(this.elements.settings.panels.captions))return;let e=`captions`,t=this.elements.settings.panels.captions.querySelector(`[role="menu"]`),n=q.getTracks.call(this),r=!!n.length;if(K.toggleMenuButton.call(this,e,r),Be(t),K.checkMenu.call(this),!r)return;let i=n.map((e,n)=>({value:n,checked:this.captions.toggled&&this.currentTrack===n,title:q.getLabel.call(this,e),badge:e.language&&K.createBadge.call(this,e.language.toUpperCase()),list:t,type:`language`}));i.unshift({value:-1,checked:!this.captions.toggled,title:W.get(`disabled`,this.config),list:t,type:`language`}),i.forEach(K.createMenuItem.bind(this)),K.updateSetting.call(this,e,t)},setSpeedMenu(){if(!T.element(this.elements.settings.panels.speed))return;let e=`speed`,t=this.elements.settings.panels.speed.querySelector(`[role="menu"]`);this.options.speed=this.options.speed.filter(e=>e>=this.minimumSpeed&&e<=this.maximumSpeed);let n=!T.empty(this.options.speed)&&this.options.speed.length>1;K.toggleMenuButton.call(this,e,n),Be(t),K.checkMenu.call(this),n&&(this.options.speed.forEach(n=>{K.createMenuItem.call(this,{value:n,list:t,type:e,title:K.getLabel.call(this,`speed`,n)})}),K.updateSetting.call(this,e,t))},checkMenu(){let{buttons:e}=this.elements.settings,t=!T.empty(e)&&Object.values(e).some(e=>!e.hidden);A(this.elements.settings.menu,!t)},focusFirstMenuItem(e,t=!1){if(this.elements.settings.popup.hidden)return;let n=e;T.element(n)||(n=Object.values(this.elements.settings.panels).find(e=>!e.hidden));let r=n.querySelector(`[role^="menuitem"]`);We.call(this,r,t)},toggleMenu(e){let{popup:t}=this.elements.settings,n=this.elements.buttons.settings;if(!T.element(t)||!T.element(n))return;let{hidden:r}=t,i=r;if(T.boolean(e))i=e;else if(T.keyboardEvent(e)&&e.key===`Escape`)i=!1;else if(T.event(e)){let r=T.function(e.composedPath)?e.composedPath()[0]:e.target,a=t.contains(r);if(a||!a&&e.target!==n&&i)return}n.setAttribute(`aria-expanded`,i),A(t,!i),j(this.elements.container,this.config.classNames.menu.open,i),i&&T.keyboardEvent(e)?K.focusFirstMenuItem.call(this,null,!0):!i&&!r&&We.call(this,n,T.keyboardEvent(e))},getMenuSize(e){let t=e.cloneNode(!0);t.style.position=`absolute`,t.style.opacity=0,t.removeAttribute(`hidden`),e.parentNode.appendChild(t);let n=t.scrollWidth,r=t.scrollHeight;return O(t),{width:n,height:r}},showMenuPanel(e=``,t=!1){let n=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!T.element(n))return;let r=n.parentNode,i=Array.from(r.children).find(e=>!e.hidden);if(F.transitions&&!F.reducedMotion){r.style.width=`${i.scrollWidth}px`,r.style.height=`${i.scrollHeight}px`;let e=K.getMenuSize.call(this,n),t=e=>{e.target!==r||![`width`,`height`].includes(e.propertyName)||(r.style.width=``,r.style.height=``,qe.call(this,r,Me,t))};L.call(this,r,Me,t),r.style.width=`${e.width}px`,r.style.height=`${e.height}px`}A(i,!0),A(n,!1),K.focusFirstMenuItem.call(this,n,t)},setDownloadUrl(){let e=this.elements.buttons.download;T.element(e)&&e.setAttribute(`href`,this.download)},create(e){let{bindMenuItemShortcuts:t,createButton:n,createProgress:r,createRange:i,createTime:a,setQualityMenu:o,setSpeedMenu:s,showMenuPanel:c}=K;this.elements.controls=null,T.array(this.config.controls)&&this.config.controls.includes(`play-large`)&&this.elements.container.appendChild(n.call(this,`play-large`));let l=D(`div`,k(this.config.selectors.controls.wrapper));this.elements.controls=l;let u={class:`plyr__controls__item`};return Ze(T.array(this.config.controls)?this.config.controls:[]).forEach(o=>{if(o===`restart`&&l.appendChild(n.call(this,`restart`,u)),o===`rewind`&&l.appendChild(n.call(this,`rewind`,u)),o===`play`&&l.appendChild(n.call(this,`play`,u)),o===`fast-forward`&&l.appendChild(n.call(this,`fast-forward`,u)),o===`progress`){let t=D(`div`,{class:`${u.class} plyr__progress__container`}),n=D(`div`,k(this.config.selectors.progress));if(n.appendChild(i.call(this,`seek`,{id:`plyr-seek-${e.id}`})),n.appendChild(r.call(this,`buffer`)),this.config.tooltips.seek){let e=D(`span`,{class:this.config.classNames.tooltip},`00:00`);n.appendChild(e),this.elements.display.seekTooltip=e}this.elements.progress=n,t.appendChild(this.elements.progress),l.appendChild(t)}if(o===`current-time`&&l.appendChild(a.call(this,`currentTime`,u)),o===`duration`&&l.appendChild(a.call(this,`duration`,u)),o===`mute`||o===`volume`){let{volume:t}=this.elements;if((!T.element(t)||!l.contains(t))&&(t=D(`div`,E({},u,{class:`${u.class} plyr__volume`.trim()})),this.elements.volume=t,l.appendChild(t)),o===`mute`&&t.appendChild(n.call(this,`mute`)),o===`volume`&&!H.isIos&&!H.isIPadOS){let n={max:1,step:.05,value:this.config.volume};t.appendChild(i.call(this,`volume`,E(n,{id:`plyr-volume-${e.id}`})))}}if(o===`captions`&&l.appendChild(n.call(this,`captions`,u)),o===`settings`&&!T.empty(this.config.settings)){let r=D(`div`,E({},u,{class:`${u.class} plyr__menu`.trim(),hidden:``}));r.appendChild(n.call(this,`settings`,{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));let i=D(`div`,{class:`plyr__menu__container`,id:`plyr-settings-${e.id}`,hidden:``}),a=D(`div`),o=D(`div`,{id:`plyr-settings-${e.id}-home`}),s=D(`div`,{role:`menu`});o.appendChild(s),a.appendChild(o),this.elements.settings.panels.home=o,this.config.settings.forEach(n=>{let r=D(`button`,E(k(this.config.selectors.buttons.settings),{type:`button`,class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:`menuitem`,"aria-haspopup":!0,hidden:``}));t.call(this,r,n),L.call(this,r,`click`,()=>{c.call(this,n,!1)});let i=D(`span`,null,W.get(n,this.config)),o=D(`span`,{class:this.config.classNames.menu.value});o.innerHTML=e[n],i.appendChild(o),r.appendChild(i),s.appendChild(r);let l=D(`div`,{id:`plyr-settings-${e.id}-${n}`,hidden:``}),u=D(`button`,{type:`button`,class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});u.appendChild(D(`span`,{"aria-hidden":!0},W.get(n,this.config))),u.appendChild(D(`span`,{class:this.config.classNames.hidden},W.get(`menuBack`,this.config))),L.call(this,l,`keydown`,e=>{e.key===`ArrowLeft`&&(e.preventDefault(),e.stopPropagation(),c.call(this,`home`,!0))},!1),L.call(this,u,`click`,()=>{c.call(this,`home`,!1)}),l.appendChild(u),l.appendChild(D(`div`,{role:`menu`})),a.appendChild(l),this.elements.settings.buttons[n]=r,this.elements.settings.panels[n]=l}),i.appendChild(a),r.appendChild(i),l.appendChild(r),this.elements.settings.popup=i,this.elements.settings.menu=r}if(o===`pip`&&F.pip&&l.appendChild(n.call(this,`pip`,u)),o===`airplay`&&F.airplay&&l.appendChild(n.call(this,`airplay`,u)),o===`download`){let e=E({},u,{element:`a`,href:this.download,target:`_blank`});this.isHTML5&&(e.download=``);let{download:t}=this.config.urls;!T.url(t)&&this.isEmbed&&E(e,{icon:`logo-${this.provider}`,label:this.provider}),l.appendChild(n.call(this,`download`,e))}o===`fullscreen`&&l.appendChild(n.call(this,`fullscreen`,u))}),this.isHTML5&&o.call(this,V.getQualityOptions.call(this)),s.call(this),l},inject(){if(this.config.loadSprite){let e=K.getIconUrl.call(this);e.cors&&gt(e.url,`sprite-plyr`)}this.id=Math.floor(Math.random()*1e4);let e=null;this.elements.controls=null;let t={id:this.id,seektime:this.config.seekTime,title:this.config.title},n=!0;T.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,t)),this.config.controls||(this.config.controls=[]),T.element(this.config.controls)||T.string(this.config.controls)?e=this.config.controls:(e=K.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:q.getLabel.call(this)}),n=!1),n&&T.string(this.config.controls)&&(e=(e=>{let n=e;return Object.entries(t).forEach(([e,t])=>{n=U(n,`{${e}}`,t)}),n})(e));let r;T.string(this.config.selectors.controls.container)&&(r=document.querySelector(this.config.selectors.controls.container)),T.element(r)||(r=this.elements.container);let i=T.element(e)?`insertAdjacentElement`:`insertAdjacentHTML`;if(r[i](`afterbegin`,e),T.element(this.elements.controls)||K.findElements.call(this),!T.empty(this.elements.buttons)){let e=e=>{let t=this.config.classNames.controlPressed;e.setAttribute(`aria-pressed`,`false`),Object.defineProperty(e,`pressed`,{configurable:!0,enumerable:!0,get(){return He(e,t)},set(n=!1){j(e,t,n),e.setAttribute(`aria-pressed`,n?`true`:`false`)}})};Object.values(this.elements.buttons).filter(Boolean).forEach(t=>{T.array(t)||T.nodeList(t)?Array.from(t).filter(Boolean).forEach(e):e(t)})}if(H.isEdge&&Ne(r),this.config.tooltips.controls){let{classNames:e,selectors:t}=this.config,n=`${t.controls.wrapper} ${t.labels} .${e.hidden}`,r=N.call(this,n);Array.from(r).forEach(e=>{j(e,this.config.classNames.hidden,!1),j(e,this.config.classNames.tooltip,!0)})}},setMediaMetadata(){try{`mediaSession`in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch{}},setMarkers(){if(!this.duration||this.elements.markers)return;let e=this.config.markers?.points?.filter(({time:e})=>e>0&&e<this.duration);if(!(e!=null&&e.length))return;let t=document.createDocumentFragment(),n=document.createDocumentFragment(),r=null,i=`${this.config.classNames.tooltip}--visible`,a=e=>j(r,i,e);e.forEach(e=>{let t=D(`span`,{class:this.config.classNames.marker},``),i=`${e.time/this.duration*100}%`;r&&(t.addEventListener(`mouseenter`,()=>{e.label||(r.style.left=i,r.innerHTML=e.label,a(!0))}),t.addEventListener(`mouseleave`,()=>{a(!1)})),t.addEventListener(`click`,()=>{this.currentTime=e.time}),t.style.left=i,n.appendChild(t)}),t.appendChild(n),this.config.tooltips.seek||(r=D(`span`,{class:this.config.classNames.tooltip},``),t.appendChild(r)),this.elements.markers={points:n,tip:r},this.elements.progress.appendChild(t)}};function xt(e,t=!0){let n=e;if(t){let e=document.createElement(`a`);e.href=n,n=e.href}try{return new URL(n)}catch{return null}}function St(e){let t=new URLSearchParams;return T.object(e)&&Object.entries(e).forEach(([e,n])=>{t.set(e,n)}),t}var q={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!F.textTracks){T.array(this.config.controls)&&this.config.controls.includes(`settings`)&&this.config.settings.includes(`captions`)&&K.setCaptionsMenu.call(this);return}if(T.element(this.elements.captions)||(this.elements.captions=D(`div`,k(this.config.selectors.captions)),this.elements.captions.setAttribute(`dir`,`auto`),Re(this.elements.captions,this.elements.wrapper)),H.isIE&&window.URL){let e=this.media.querySelectorAll(`track`);Array.from(e).forEach(e=>{let t=e.getAttribute(`src`),n=xt(t);n!==null&&n.hostname!==window.location.href.hostname&&[`http:`,`https:`].includes(n.protocol)&&G(t,`blob`).then(t=>{e.setAttribute(`src`,window.URL.createObjectURL(t))}).catch(()=>{O(e)})})}let e=Ze((navigator.languages||[navigator.language||navigator.userLanguage||`en`]).map(e=>e.split(`-`)[0])),t=(this.storage.get(`language`)||this.captions.language||this.config.captions.language||`auto`).toLowerCase();t===`auto`&&([t]=e);let n=this.storage.get(`captions`)||this.captions.active;if(T.boolean(n)||({active:n}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:n,language:t,languages:e}),this.isHTML5){let e=this.config.captions.update?`addtrack removetrack`:`removetrack`;L.call(this,this.media.textTracks,e,q.update.bind(this))}setTimeout(q.update.bind(this),0)},update(){let e=q.getTracks.call(this,!0),{active:t,language:n,meta:r,currentTrackNode:i}=this.captions,a=!!e.find(e=>e.language===n);this.isHTML5&&this.isVideo&&e.filter(e=>!r.get(e)).forEach(e=>{this.debug.log(`Track added`,e),r.set(e,{default:e.mode===`showing`}),e.mode===`showing`&&(e.mode=`hidden`),L.call(this,e,`cuechange`,()=>q.updateCues.call(this))}),(a&&this.language!==n||!e.includes(i))&&(q.setLanguage.call(this,n),q.toggle.call(this,t&&a)),this.elements&&j(this.elements.container,this.config.classNames.captions.enabled,!T.empty(e)),T.array(this.config.controls)&&this.config.controls.includes(`settings`)&&this.config.settings.includes(`captions`)&&K.setCaptionsMenu.call(this)},toggle(e,t=!0){if(!this.supported.ui)return;let{toggled:n}=this.captions,r=this.config.classNames.captions.active,i=T.nullOrUndefined(e)?!n:e;if(i!==n){if(t||(this.captions.active=i,this.storage.set({captions:i})),!this.language&&i&&!t){let e=q.getTracks.call(this),t=q.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);this.captions.language=t.language,q.set.call(this,e.indexOf(t));return}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=i),j(this.elements.container,r,i),this.captions.toggled=i,K.updateSetting.call(this,`captions`),R.call(this,this.media,i?`captionsenabled`:`captionsdisabled`)}setTimeout(()=>{i&&this.captions.toggled&&(this.captions.currentTrackNode.mode=`hidden`)})},set(e,t=!0){let n=q.getTracks.call(this);if(e===-1){q.toggle.call(this,!1,t);return}if(!T.number(e)){this.debug.warn(`Invalid caption argument`,e);return}if(!(e in n)){this.debug.warn(`Track not found`,e);return}if(this.captions.currentTrack!==e){this.captions.currentTrack=e;let r=n[e],{language:i}=r||{};this.captions.currentTrackNode=r,K.updateSetting.call(this,`captions`),t||(this.captions.language=i,this.storage.set({language:i})),this.isVimeo&&this.embed.enableTextTrack(i,null,!1),R.call(this,this.media,`languagechange`)}q.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&q.updateCues.call(this)},setLanguage(e,t=!0){if(!T.string(e)){this.debug.warn(`Invalid language argument`,e);return}let n=e.toLowerCase();this.captions.language=n;let r=q.getTracks.call(this),i=q.findTrack.call(this,[n]);q.set.call(this,r.indexOf(i),t)},getTracks(e=!1){return Array.from((this.media||{}).textTracks||[]).filter(t=>!this.isHTML5||e||this.captions.meta.has(t)).filter(e=>[`captions`,`subtitles`].includes(e.kind))},findTrack(e,t=!1){let n=q.getTracks.call(this),r=e=>Number((this.captions.meta.get(e)||{}).default),i=Array.from(n).sort((e,t)=>r(t)-r(e)),a;return e.every(e=>(a=i.find(t=>t.language===e),!a)),a||(t?i[0]:void 0)},getCurrentTrack(){return q.getTracks.call(this)[this.currentTrack]},getLabel(e){let t=e;return!T.track(t)&&F.textTracks&&this.captions.toggled&&(t=q.getCurrentTrack.call(this)),T.track(t)?T.empty(t.label)?T.empty(t.language)?W.get(`enabled`,this.config):e.language.toUpperCase():t.label:W.get(`disabled`,this.config)},updateCues(e){if(!this.supported.ui)return;if(!T.element(this.elements.captions)){this.debug.warn(`No captions element to render to`);return}if(!T.nullOrUndefined(e)&&!Array.isArray(e)){this.debug.warn(`updateCues: Invalid input`,e);return}let t=e;if(!t){let e=q.getCurrentTrack.call(this);t=Array.from((e||{}).activeCues||[]).map(e=>e.getCueAsHTML()).map(pt)}let n=t.map(e=>e.trim()).join(`
2
+ `);if(n!==this.elements.captions.innerHTML){Be(this.elements.captions);let e=D(`span`,k(this.config.selectors.caption));e.innerHTML=n,this.elements.captions.appendChild(e),R.call(this,this.media,`cuechange`)}}},Ct={enabled:!0,title:``,debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:`plyr`,iconUrl:`https://cdn.plyr.io/3.8.4/plyr.svg`,blankVideo:`https://cdn.plyr.io/static/blank.mp4`,quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:`auto`,update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:`plyr`},controls:[`play-large`,`play`,`progress`,`current-time`,`mute`,`volume`,`captions`,`settings`,`pip`,`airplay`,`fullscreen`],settings:[`captions`,`quality`,`speed`],i18n:{restart:`Restart`,rewind:`Rewind {seektime}s`,play:`Play`,pause:`Pause`,fastForward:`Forward {seektime}s`,seek:`Seek`,seekLabel:`{currentTime} of {duration}`,played:`Played`,buffered:`Buffered`,currentTime:`Current time`,duration:`Duration`,volume:`Volume`,mute:`Mute`,unmute:`Unmute`,enableCaptions:`Enable captions`,disableCaptions:`Disable captions`,download:`Download`,enterFullscreen:`Enter fullscreen`,exitFullscreen:`Exit fullscreen`,frameTitle:`Player for {title}`,captions:`Captions`,settings:`Settings`,pip:`PIP`,menuBack:`Go back to previous menu`,speed:`Speed`,normal:`Normal`,quality:`Quality`,loop:`Loop`,start:`Start`,end:`End`,all:`All`,reset:`Reset`,disabled:`Disabled`,enabled:`Enabled`,advertisement:`Ad`,qualityBadge:{2160:`4K`,1440:`HD`,1080:`HD`,720:`HD`,576:`SD`,480:`SD`}},urls:{download:null,vimeo:{sdk:`https://player.vimeo.com/api/player.js`,iframe:`https://player.vimeo.com/video/{0}?{1}`,api:`https://vimeo.com/api/oembed.json?url={0}`},youtube:{sdk:`https://www.youtube.com/iframe_api`,api:`https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}`},googleIMA:{sdk:`https://imasdk.googleapis.com/js/sdkloader/ima3.js`}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:`ended.progress.stalled.playing.waiting.canplay.canplaythrough.loadstart.loadeddata.loadedmetadata.timeupdate.volumechange.play.pause.error.seeking.seeked.emptied.ratechange.cuechange.download.enterfullscreen.exitfullscreen.captionsenabled.captionsdisabled.languagechange.controlshidden.controlsshown.ready.statechange.qualitychange.adsloaded.adscontentpause.adscontentresume.adstarted.adsmidpoint.adscomplete.adsallcomplete.adsimpression.adsclick`.split(`.`),selectors:{editable:`input, textarea, select, [contenteditable]`,container:`.plyr`,controls:{container:null,wrapper:`.plyr__controls`},labels:`[data-plyr]`,buttons:{play:`[data-plyr="play"]`,pause:`[data-plyr="pause"]`,restart:`[data-plyr="restart"]`,rewind:`[data-plyr="rewind"]`,fastForward:`[data-plyr="fast-forward"]`,mute:`[data-plyr="mute"]`,captions:`[data-plyr="captions"]`,download:`[data-plyr="download"]`,fullscreen:`[data-plyr="fullscreen"]`,pip:`[data-plyr="pip"]`,airplay:`[data-plyr="airplay"]`,settings:`[data-plyr="settings"]`,loop:`[data-plyr="loop"]`},inputs:{seek:`[data-plyr="seek"]`,volume:`[data-plyr="volume"]`,speed:`[data-plyr="speed"]`,language:`[data-plyr="language"]`,quality:`[data-plyr="quality"]`},display:{currentTime:`.plyr__time--current`,duration:`.plyr__time--duration`,buffer:`.plyr__progress__buffer`,loop:`.plyr__progress__loop`,volume:`.plyr__volume--display`},progress:`.plyr__progress`,captions:`.plyr__captions`,caption:`.plyr__caption`},classNames:{type:`plyr--{0}`,provider:`plyr--{0}`,video:`plyr__video-wrapper`,embed:`plyr__video-embed`,videoFixedRatio:`plyr__video-wrapper--fixed-ratio`,embedContainer:`plyr__video-embed__container`,poster:`plyr__poster`,posterEnabled:`plyr__poster-enabled`,ads:`plyr__ads`,control:`plyr__control`,controlPressed:`plyr__control--pressed`,playing:`plyr--playing`,paused:`plyr--paused`,stopped:`plyr--stopped`,loading:`plyr--loading`,hover:`plyr--hover`,tooltip:`plyr__tooltip`,cues:`plyr__cues`,marker:`plyr__progress__marker`,hidden:`plyr__sr-only`,hideControls:`plyr--hide-controls`,isTouch:`plyr--is-touch`,uiSupported:`plyr--full-ui`,noTransition:`plyr--no-transition`,display:{time:`plyr__time`},menu:{value:`plyr__menu__value`,badge:`plyr__badge`,open:`plyr--menu-open`},captions:{enabled:`plyr--captions-enabled`,active:`plyr--captions-active`},fullscreen:{enabled:`plyr--fullscreen-enabled`,fallback:`plyr--fullscreen-fallback`},pip:{supported:`plyr--pip-supported`,active:`plyr--pip-active`},airplay:{supported:`plyr--airplay-supported`,active:`plyr--airplay-active`},previewThumbnails:{thumbContainer:`plyr__preview-thumb`,thumbContainerShown:`plyr__preview-thumb--is-shown`,imageContainer:`plyr__preview-thumb__image-container`,timeContainer:`plyr__preview-thumb__time-container`,scrubbingContainer:`plyr__preview-scrubbing`,scrubbingContainerShown:`plyr__preview-scrubbing--is-shown`}},attributes:{embed:{provider:`data-plyr-provider`,id:`data-plyr-embed-id`,hash:`data-plyr-embed-hash`}},ads:{enabled:!1,publisherId:``,tagUrl:``},previewThumbnails:{enabled:!1,src:``,withCredentials:!1},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:``,artist:``,album:``,artwork:[]},markers:{enabled:!1,points:[]}},wt={active:`picture-in-picture`,inactive:`inline`},J={html5:`html5`,youtube:`youtube`,vimeo:`vimeo`},Tt={audio:`audio`,video:`video`};function Et(e){return/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?J.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?J.vimeo:null}function Dt(){}var Ot=class{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log(`Debugging enabled`)}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):Dt}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):Dt}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):Dt}},kt=class e{constructor(t){d(this,`onChange`,()=>{if(!this.supported)return;let e=this.player.elements.buttons.fullscreen;T.element(e)&&(e.pressed=this.active);let t=this.target===this.player.media?this.target:this.player.elements.container;R.call(this.player,t,this.active?`enterfullscreen`:`exitfullscreen`,!0)}),d(this,`toggleFallback`,(e=!1)=>{if(e?this.scrollPosition={x:window.scrollX??0,y:window.scrollY??0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=e?`hidden`:``,j(this.target,this.player.config.classNames.fullscreen.fallback,e),H.isIos){let t=document.head.querySelector(`meta[name="viewport"]`),n=`viewport-fit=cover`;t||(t=document.createElement(`meta`),t.setAttribute(`name`,`viewport`));let r=T.string(t.content)&&t.content.includes(n);e?(this.cleanupViewport=!r,r||(t.content+=`,${n}`)):this.cleanupViewport&&(t.content=t.content.split(`,`).filter(e=>e.trim()!==n).join(`,`))}this.onChange()}),d(this,`trapFocus`,e=>{if(H.isIos||H.isIPadOS||!this.active||e.key!==`Tab`)return;let t=document.activeElement,n=N.call(this.player,`a[href], button:not(:disabled), input:not(:disabled), [tabindex]`),[r]=n,i=n[n.length-1];t===i&&!e.shiftKey?(r.focus(),e.preventDefault()):t===r&&e.shiftKey&&(i.focus(),e.preventDefault())}),d(this,`update`,()=>{if(this.supported){let t;t=this.forceFallback?`Fallback (forced)`:e.nativeSupported?`Native`:`Fallback`,this.player.debug.log(`${t} fullscreen enabled`)}else this.player.debug.log(`Fullscreen not supported and fallback disabled`);j(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.supported)}),d(this,`enter`,()=>{this.supported&&(H.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!e.nativeSupported||this.forceFallback?this.toggleFallback(!0):this.prefix?T.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:`hide`}))}),d(this,`exit`,()=>{if(this.supported){if(H.isIos&&this.player.config.fullscreen.iosNative)this.player.isVimeo?this.player.embed.exitFullscreen():this.target.webkitEnterFullscreen(),z(this.player.play());else if(!e.nativeSupported||this.forceFallback)this.toggleFallback(!1);else if(!this.prefix)(document.cancelFullScreen||document.exitFullscreen).call(document);else if(!T.empty(this.prefix)){let e=this.prefix===`moz`?`Cancel`:`Exit`;document[`${this.prefix}${e}${this.property}`]()}}}),d(this,`toggle`,()=>{this.active?this.exit():this.enter()}),this.player=t,this.prefix=e.prefix,this.property=e.property,this.scrollPosition={x:0,y:0},this.forceFallback=t.config.fullscreen.fallback===`force`,this.player.elements.fullscreen=t.config.fullscreen.container&&Ue(this.player.elements.container,t.config.fullscreen.container),L.call(this.player,document,this.prefix===`ms`?`MSFullscreenChange`:`${this.prefix}fullscreenchange`,()=>{this.onChange()}),L.call(this.player,this.player.elements.container,`dblclick`,e=>{T.element(this.player.elements.controls)&&this.player.elements.controls.contains(e.target)||this.player.listeners.proxy(e,this.toggle,`fullscreen`)}),L.call(this,this.player.elements.container,`keydown`,e=>this.trapFocus(e)),this.update()}static get nativeSupported(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get useNative(){return e.nativeSupported&&!this.forceFallback}static get prefix(){if(T.function(document.exitFullscreen))return``;let e=``;return[`webkit`,`moz`,`ms`].some(t=>T.function(document[`${t}ExitFullscreen`])||T.function(document[`${t}CancelFullScreen`])?(e=t,!0):!1),e}static get property(){return this.prefix===`moz`?`FullScreen`:`Fullscreen`}get supported(){return[this.player.config.fullscreen.enabled,this.player.isVideo,e.nativeSupported||this.player.config.fullscreen.fallback,!this.player.isYouTube||e.nativeSupported||!H.isIos||this.player.config.playsinline&&!this.player.config.fullscreen.iosNative].every(Boolean)}get active(){if(!this.supported)return!1;if(!e.nativeSupported||this.forceFallback)return He(this.target,this.player.config.classNames.fullscreen.fallback);let t=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return t&&t.shadowRoot?t===this.target.getRootNode().host:t===this.target}get target(){return H.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen??this.player.elements.container}};function At(e,t=1){return new Promise((n,r)=>{let i=new Image,a=()=>{delete i.onload,delete i.onerror,(i.naturalWidth>=t?n:r)(i)};Object.assign(i,{onload:a,onerror:a,src:e})})}var Y={addStyleHook(){j(this.elements.container,this.config.selectors.container.replace(`.`,``),!0),j(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(e=!1){e&&this.isHTML5?this.media.setAttribute(`controls`,``):this.media.removeAttribute(`controls`)},build(){if(this.listeners.media(),!this.supported.ui){this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),Y.toggleNativeControls.call(this,!0);return}T.element(this.elements.controls)||(K.inject.call(this),this.listeners.controls()),Y.toggleNativeControls.call(this),this.isHTML5&&q.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,K.updateVolume.call(this),K.timeUpdate.call(this),K.durationUpdate.call(this),Y.checkPlaying.call(this),j(this.elements.container,this.config.classNames.pip.supported,F.pip&&this.isHTML5&&this.isVideo),j(this.elements.container,this.config.classNames.airplay.supported,F.airplay&&this.isHTML5),j(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{R.call(this,this.media,`ready`)},0),Y.setTitle.call(this),this.poster&&Y.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&K.durationUpdate.call(this),this.config.mediaMetadata&&K.setMediaMetadata.call(this)},setTitle(){let e=W.get(`play`,this.config);if(T.string(this.config.title)&&!T.empty(this.config.title)&&(e+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach(t=>{t.setAttribute(`aria-label`,e)}),this.isEmbed){let e=P.call(this,`iframe`);if(!T.element(e))return;let t=T.empty(this.config.title)?`video`:this.config.title,n=W.get(`frameTitle`,this.config);e.setAttribute(`title`,n.replace(`{title}`,t))}},togglePoster(e){j(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster(e,t=!0){return t&&this.poster?Promise.reject(Error(`Poster already set`)):(this.media.setAttribute(`data-poster`,e),this.elements.poster.removeAttribute(`hidden`),Xe.call(this).then(()=>At(e)).catch(t=>{throw e===this.poster&&Y.togglePoster.call(this,!1),t}).then(()=>{if(e!==this.poster)throw Error(`setPoster cancelled by later call to setPoster`)}).then(()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${e}')`,backgroundSize:``}),Y.togglePoster.call(this,!0),e)))},checkPlaying(e){j(this.elements.container,this.config.classNames.playing,this.playing),j(this.elements.container,this.config.classNames.paused,this.paused),j(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach(e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute(`aria-label`,W.get(this.playing?`pause`:`play`,this.config))}),!(T.event(e)&&e.type===`timeupdate`)&&Y.toggleControls.call(this)},checkLoading(e){this.loading=[`stalled`,`waiting`].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{j(this.elements.container,this.config.classNames.loading,this.loading),Y.toggleControls.call(this)},this.loading?250:0)},toggleControls(e){let{controls:t}=this.elements;if(t&&this.config.hideControls){let n=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(!!(e||this.loading||this.paused||t.pressed||t.hover||n))}},migrateStyles(){Object.values({...this.media.style}).filter(e=>!T.empty(e)&&T.string(e)&&e.startsWith(`--plyr`)).forEach(e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)}),T.empty(this.media.style)&&this.media.removeAttribute(`style`)}},jt=class{constructor(e){d(this,`firstTouch`,()=>{let{player:e}=this,{elements:t}=e;e.touch=!0,j(t.container,e.config.classNames.isTouch,!0)}),d(this,`global`,(e=!0)=>{let{player:t}=this;t.config.keyboard.global&&I.call(t,window,`keydown keyup`,this.handleKey,e,!1),I.call(t,document.body,`click`,this.toggleMenu,e),Je.call(t,document.body,`touchstart`,this.firstTouch)}),d(this,`container`,()=>{let{player:e}=this,{config:t,elements:n,timers:r}=e;!t.keyboard.global&&t.keyboard.focused&&L.call(e,n.container,`keydown keyup`,this.handleKey,!1),L.call(e,n.container,`mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen`,t=>{let{controls:i}=n;i&&t.type===`enterfullscreen`&&(i.pressed=!1,i.hover=!1);let a=[`touchstart`,`touchmove`,`mousemove`].includes(t.type),o=0;a&&(Y.toggleControls.call(e,!0),o=e.touch?3e3:2e3),clearTimeout(r.controls),r.controls=setTimeout(()=>Y.toggleControls.call(e,!1),o)});let i=()=>{if(!e.isVimeo||e.config.vimeo.premium)return;let t=n.wrapper,{active:r}=e.fullscreen,[i,a]=rt.call(e),o=$e(`aspect-ratio: ${i} / ${a}`);if(!r){o?(t.style.width=null,t.style.height=null):(t.style.maxWidth=null,t.style.margin=null);return}let[s,c]=at(),l=s/c>i/a;o?(t.style.width=l?`auto`:`100%`,t.style.height=l?`100%`:`auto`):(t.style.maxWidth=l?`${c/a*i}px`:null,t.style.margin=l?`0 auto`:null)},a=()=>{clearTimeout(r.resized),r.resized=setTimeout(i,50)};L.call(e,n.container,`enterfullscreen exitfullscreen`,t=>{let{target:r}=e.fullscreen;r===n.container&&(!e.isEmbed&&T.empty(e.config.ratio)||(i(),(t.type===`enterfullscreen`?L:qe).call(e,window,`resize`,a)))})}),d(this,`media`,()=>{let{player:e}=this,{elements:t}=e;if(L.call(e,e.media,`timeupdate seeking seeked`,t=>K.timeUpdate.call(e,t)),L.call(e,e.media,`durationchange loadeddata loadedmetadata`,t=>K.durationUpdate.call(e,t)),L.call(e,e.media,`ended`,()=>{e.isHTML5&&e.isVideo&&e.config.resetOnEnd&&(e.restart(),e.pause())}),L.call(e,e.media,`progress playing seeking seeked`,t=>K.updateProgress.call(e,t)),L.call(e,e.media,`volumechange`,t=>K.updateVolume.call(e,t)),L.call(e,e.media,`playing play pause ended emptied timeupdate`,t=>Y.checkPlaying.call(e,t)),L.call(e,e.media,`waiting canplay seeked playing`,t=>Y.checkLoading.call(e,t)),e.supported.ui&&e.config.clickToPlay&&!e.isAudio){let n=P.call(e,`.${e.config.classNames.video}`);if(!T.element(n))return;L.call(e,t.container,`click`,r=>{![t.container,n].includes(r.target)&&!n.contains(r.target)||e.touch&&e.config.hideControls||(e.ended?(this.proxy(r,e.restart,`restart`),this.proxy(r,()=>{z(e.play())},`play`)):this.proxy(r,()=>{z(e.togglePlay())},`play`))})}e.supported.ui&&e.config.disableContextMenu&&L.call(e,t.wrapper,`contextmenu`,e=>{e.preventDefault()},!1),L.call(e,e.media,`volumechange`,()=>{e.storage.set({volume:e.volume,muted:e.muted})}),L.call(e,e.media,`ratechange`,()=>{K.updateSetting.call(e,`speed`),e.storage.set({speed:e.speed})}),L.call(e,e.media,`qualitychange`,t=>{K.updateSetting.call(e,`quality`,null,t.detail.quality)}),L.call(e,e.media,`ready qualitychange`,()=>{K.setDownloadUrl.call(e)});let n=e.config.events.concat([`keyup`,`keydown`]).join(` `);L.call(e,e.media,n,n=>{let{detail:r={}}=n;n.type===`error`&&(r=e.media.error),R.call(e,t.container,n.type,!0,r)})}),d(this,`proxy`,(e,t,n)=>{let{player:r}=this,i=r.config.listeners[n],a=T.function(i),o=!0;a&&(o=i.call(r,e)),o!==!1&&T.function(t)&&t.call(r,e)}),d(this,`bind`,(e,t,n,r,i=!0)=>{let{player:a}=this,o=a.config.listeners[r],s=T.function(o);L.call(a,e,t,e=>this.proxy(e,n,r),i&&!s)}),d(this,`controls`,()=>{let{player:e}=this,{elements:t}=e,n=H.isIE?`change`:`input`;if(t.buttons.play&&Array.from(t.buttons.play).forEach(t=>{this.bind(t,`click`,()=>{z(e.togglePlay())},`play`)}),this.bind(t.buttons.restart,`click`,e.restart,`restart`),this.bind(t.buttons.rewind,`click`,()=>{e.lastSeekTime=Date.now(),e.rewind()},`rewind`),this.bind(t.buttons.fastForward,`click`,()=>{e.lastSeekTime=Date.now(),e.forward()},`fastForward`),this.bind(t.buttons.mute,`click`,()=>{e.muted=!e.muted},`mute`),this.bind(t.buttons.captions,`click`,()=>e.toggleCaptions()),this.bind(t.buttons.download,`click`,()=>{R.call(e,e.media,`download`)},`download`),this.bind(t.buttons.fullscreen,`click`,()=>{e.fullscreen.toggle()},`fullscreen`),this.bind(t.buttons.pip,`click`,()=>{e.pip=`toggle`},`pip`),this.bind(t.buttons.airplay,`click`,e.airplay,`airplay`),this.bind(t.buttons.settings,`click`,t=>{t.stopPropagation(),t.preventDefault(),K.toggleMenu.call(e,t)},null,!1),this.bind(t.buttons.settings,`keyup`,t=>{if([` `,`Enter`].includes(t.key)){if(t.key===`Enter`){K.focusFirstMenuItem.call(e,null,!0);return}t.preventDefault(),t.stopPropagation(),K.toggleMenu.call(e,t)}},null,!1),this.bind(t.settings.menu,`keydown`,t=>{t.key===`Escape`&&K.toggleMenu.call(e,t)}),this.bind(t.inputs.seek,`mousedown mousemove`,e=>{let n=t.progress.getBoundingClientRect(),r=e.pageX-e.clientX,i=100/n.width*(e.pageX-n.left-r);e.currentTarget.setAttribute(`seek-value`,i)}),this.bind(t.inputs.seek,`mousedown mouseup keydown keyup touchstart touchend`,t=>{let n=t.currentTarget,r=`play-on-seeked`;if(T.keyboardEvent(t)&&![`ArrowLeft`,`ArrowRight`].includes(t.key))return;e.lastSeekTime=Date.now();let i=n.hasAttribute(r),a=[`mouseup`,`touchend`,`keyup`].includes(t.type);i&&a?(n.removeAttribute(r),z(e.play())):!a&&e.playing&&(n.setAttribute(r,``),e.pause())}),H.isIos){let t=N.call(e,`input[type="range"]`);Array.from(t).forEach(e=>this.bind(e,n,e=>Ne(e.target)))}this.bind(t.inputs.seek,n,t=>{let n=t.currentTarget,r=n.getAttribute(`seek-value`);T.empty(r)&&(r=n.value),n.removeAttribute(`seek-value`),e.currentTime=r/n.max*e.duration},`seek`),this.bind(t.progress,`mouseenter mouseleave mousemove`,t=>K.updateSeekTooltip.call(e,t)),this.bind(t.progress,`mousemove touchmove`,t=>{let{previewThumbnails:n}=e;n&&n.loaded&&n.startMove(t)}),this.bind(t.progress,`mouseleave touchend click`,()=>{let{previewThumbnails:t}=e;t&&t.loaded&&t.endMove(!1,!0)}),this.bind(t.progress,`mousedown touchstart`,t=>{let{previewThumbnails:n}=e;n&&n.loaded&&n.startScrubbing(t)}),this.bind(t.progress,`mouseup touchend`,t=>{let{previewThumbnails:n}=e;n&&n.loaded&&n.endScrubbing(t)}),H.isWebKit&&Array.from(N.call(e,`input[type="range"]`)).forEach(t=>{this.bind(t,`input`,t=>K.updateRangeFill.call(e,t.target))}),e.config.toggleInvert&&!T.element(t.display.duration)&&this.bind(t.display.currentTime,`click`,()=>{e.currentTime!==0&&(e.config.invertTime=!e.config.invertTime,K.timeUpdate.call(e))}),this.bind(t.inputs.volume,n,t=>{e.volume=t.target.value},`volume`),this.bind(t.controls,`mouseenter mouseleave`,n=>{t.controls.hover=!e.touch&&n.type===`mouseenter`}),t.fullscreen&&Array.from(t.fullscreen.children).filter(e=>!e.contains(t.container)).forEach(n=>{this.bind(n,`mouseenter mouseleave`,n=>{t.controls&&(t.controls.hover=!e.touch&&n.type===`mouseenter`)})}),this.bind(t.controls,`mousedown mouseup touchstart touchend touchcancel`,e=>{t.controls.pressed=[`mousedown`,`touchstart`].includes(e.type)}),this.bind(t.controls,`focusin`,()=>{let{config:n,timers:r}=e;j(t.controls,n.classNames.noTransition,!0),Y.toggleControls.call(e,!0),setTimeout(()=>{j(t.controls,n.classNames.noTransition,!1)},0);let i=this.touch?3e3:4e3;clearTimeout(r.controls),r.controls=setTimeout(()=>Y.toggleControls.call(e,!1),i)}),this.bind(t.inputs.volume,`wheel`,t=>{let n=t.webkitDirectionInvertedFromDevice,[r,i]=[t.deltaX,-t.deltaY].map(e=>n?-e:e),a=Math.sign(Math.abs(r)>Math.abs(i)?r:i);e.increaseVolume(a/50);let{volume:o}=e.media;(a===1&&o<1||a===-1&&o>0)&&t.preventDefault()},`volume`,!1)}),this.player=e,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(e){let{player:t}=this,{elements:n}=t,{key:r,type:i,altKey:a,ctrlKey:o,metaKey:s,shiftKey:c}=e,l=i===`keydown`,u=l&&r===this.lastKey;if(a||o||s||c||!r)return;let d=e=>{t.currentTime=t.duration/10*e};if(l){let i=document.activeElement;if(T.element(i)){let{editable:r}=t.config.selectors,{seek:a}=n.inputs;if(i!==a&&M(i,r)||e.key===` `&&M(i,`button, [role^="menuitem"]`))return}switch([` `,`ArrowLeft`,`ArrowUp`,`ArrowRight`,`ArrowDown`,`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`c`,`f`,`k`,`l`,`m`].includes(r)&&(e.preventDefault(),e.stopPropagation()),r){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:u||d(Number.parseInt(r,10));break;case` `:case`k`:u||z(t.togglePlay());break;case`ArrowUp`:t.increaseVolume(.1);break;case`ArrowDown`:t.decreaseVolume(.1);break;case`m`:u||(t.muted=!t.muted);break;case`ArrowRight`:t.forward();break;case`ArrowLeft`:t.rewind();break;case`f`:t.fullscreen.toggle();break;case`c`:u||t.toggleCaptions();break;case`l`:t.loop=!t.loop;break}r===`Escape`&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=r}else this.lastKey=null}toggleMenu(e){K.toggleMenu.call(this.player,e)}};function Mt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var Nt={exports:{}},Pt=Nt.exports,Ft;function It(){return Ft?Nt.exports:(Ft=1,(function(e,t){(function(t,n){e.exports=n()})(Pt,function(){var e=function(){},t={},n={},r={};function i(e,t){e=e.push?e:[e];for(var i=[],a=e.length,o=a,s=function(e,n){n.length&&i.push(e),o--,o||t(i)},c,l,u;a--;){if(c=e[a],l=n[c],l){s(c,l);continue}u=r[c]=r[c]||[],u.push(s)}}function a(e,t){if(e){var i=r[e];if(n[e]=t,i)for(;i.length;)i[0](e,t),i.splice(0,1)}}function o(t,n){t.call&&(t={success:t}),n.length?(t.error||e)(n):(t.success||e)(t)}function s(t,n,r,i){var a=document,o=r.async,c=(r.numRetries||0)+1,l=r.before||e,u=t.replace(/[\?|#].*$/,``),d=t.replace(/^(css|img|module|nomodule)!/,``),f,p,m;if(i||=0,/(^css!|\.css$)/.test(u))m=a.createElement(`link`),m.rel=`stylesheet`,m.href=d,f=`hideFocus`in m,f&&m.relList&&(f=0,m.rel=`preload`,m.as=`style`);else if(/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(u))m=a.createElement(`img`),m.src=d;else if(m=a.createElement(`script`),m.src=d,m.async=o===void 0?!0:o,p=`noModule`in m,/^module!/.test(u)){if(!p)return n(t,`l`);m.type=`module`}else if(/^nomodule!/.test(u)&&p)return n(t,`l`);m.onload=m.onerror=m.onbeforeload=function(e){var a=e.type[0];if(f)try{m.sheet.cssText.length||(a=`e`)}catch(e){e.code!=18&&(a=`e`)}if(a==`e`){if(i+=1,i<c)return s(t,n,r,i)}else if(m.rel==`preload`&&m.as==`style`)return m.rel=`stylesheet`;n(t,a,e.defaultPrevented)},l(t,m)!==!1&&a.head.appendChild(m)}function c(e,t,n){e=e.push?e:[e];var r=e.length,i=r,a=[],o=function(e,n,i){if(n==`e`&&a.push(e),n==`b`)if(i)a.push(e);else return;r--,r||t(a)},c;for(c=0;c<i;c++)s(e[c],o,n)}function l(e,n,r){var i,s;if(n&&n.trim&&(i=n),s=(i?r:n)||{},i){if(i in t)throw`LoadJS`;t[i]=!0}function l(t,n){c(e,function(e){o(s,e),t&&o({success:t,error:n},e),a(i,e)},s)}if(s.returnPromise)return new Promise(l);l()}return l.ready=function(e,t){return i(e,function(e){o(t,e)}),l},l.done=function(e){a(e,[])},l.reset=function(){t={},n={},r={}},l.isDefined=function(e){return e in t},l})})(Nt),Nt.exports)}var Lt=Mt(It());function Rt(e){return new Promise((t,n)=>{Lt(e,{success:t,error:n})})}function zt(e){if(T.empty(e))return null;if(T.number(Number(e)))return e;let t=e.match(/^.*(vimeo.com\/|video\/)(\d+).*/);return t?t[2]:e}function Bt(e){let t=e.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*h=|\/)+([\d,a-f]+)/);return t&&t.length===5?t[4]:null}function X(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,R.call(this,this.media,e?`play`:`pause`))}var Vt={setup(){let e=this;j(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,B.call(e),T.object(window.Vimeo)?Vt.ready.call(e):Rt(e.config.urls.vimeo.sdk).then(()=>{Vt.ready.call(e)}).catch(t=>{e.debug.warn(`Vimeo SDK (player.js) failed to load`,t)})},ready(){let e=this,t=e.config.vimeo,{premium:n,referrerPolicy:r,...i}=t,a=e.media.getAttribute(`src`),o=``;T.empty(a)?(a=e.media.getAttribute(e.config.attributes.embed.id),o=e.media.getAttribute(e.config.attributes.embed.hash)):o=Bt(a);let s=o?{h:o}:{};n&&Object.assign(i,{controls:!1,sidedock:!1});let c=St({loop:e.config.loop.active,autoplay:e.autoplay,muted:e.muted,gesture:`media`,playsinline:e.config.playsinline,...s,...i}),l=zt(a),u=D(`iframe`),d=st(e.config.urls.vimeo.iframe,l,c);if(u.setAttribute(`src`,d),u.setAttribute(`allowfullscreen`,``),u.setAttribute(`allow`,[`autoplay`,`fullscreen`,`picture-in-picture`,`encrypted-media`,`accelerometer`,`gyroscope`].join(`; `)),T.empty(r)||u.setAttribute(`referrerPolicy`,r),n||!t.customControls)u.setAttribute(`data-poster`,e.poster),e.media=Ve(u,e.media);else{let t=D(`div`,{class:e.config.classNames.embedContainer,"data-poster":e.poster});t.appendChild(u),e.media=Ve(t,e.media)}t.customControls||G(st(e.config.urls.vimeo.api,d)).then(t=>{T.empty(t)||!t.thumbnail_url||Y.setPoster.call(e,t.thumbnail_url).catch(()=>{})}),e.embed=new window.Vimeo.Player(u,{autopause:e.config.autopause,muted:e.muted}),e.media.paused=!0,e.media.currentTime=0,e.supported.ui&&e.embed.disableTextTrack(),e.media.play=()=>(X.call(e,!0),e.embed.play()),e.media.pause=()=>(X.call(e,!1),e.embed.pause()),e.media.stop=()=>{e.pause(),e.currentTime=0};let{currentTime:f}=e.media;Object.defineProperty(e.media,`currentTime`,{get(){return f},set(t){let{embed:n,media:r,paused:i,volume:a}=e,o=i&&!n.hasPlayed;r.seeking=!0,R.call(e,r,`seeking`),Promise.resolve(o&&n.setVolume(0)).then(()=>n.setCurrentTime(t)).then(()=>o&&n.pause()).then(()=>o&&n.setVolume(a)).catch(()=>{})}});let p=e.config.speed.selected;Object.defineProperty(e.media,`playbackRate`,{get(){return p},set(t){e.embed.setPlaybackRate(t).then(()=>{p=t,R.call(e,e.media,`ratechange`)}).catch(()=>{e.options.speed=[1]})}});let{volume:m}=e.config;Object.defineProperty(e.media,`volume`,{get(){return m},set(t){e.embed.setVolume(t).then(()=>{m=t,R.call(e,e.media,`volumechange`)})}});let{muted:h}=e.config;Object.defineProperty(e.media,`muted`,{get(){return h},set(t){let n=T.boolean(t)?t:!1;e.embed.setMuted(n?!0:e.config.muted).then(()=>{h=n,R.call(e,e.media,`volumechange`)})}});let{loop:ee}=e.config;Object.defineProperty(e.media,`loop`,{get(){return ee},set(t){let n=T.boolean(t)?t:e.config.loop.active;e.embed.setLoop(n).then(()=>{ee=n})}});let g;e.embed.getVideoUrl().then(t=>{g=t,K.setDownloadUrl.call(e)}).catch(e=>{this.debug.warn(e)}),Object.defineProperty(e.media,`currentSrc`,{get(){return g}}),Object.defineProperty(e.media,`ended`,{get(){return e.currentTime===e.duration}}),Promise.all([e.embed.getVideoWidth(),e.embed.getVideoHeight()]).then(t=>{let[n,r]=t;e.embed.ratio=it(n,r),B.call(this)}),e.embed.setAutopause(e.config.autopause).then(t=>{e.config.autopause=t}),e.embed.getVideoTitle().then(t=>{e.config.title=t,Y.setTitle.call(this)}),e.embed.getCurrentTime().then(t=>{f=t,R.call(e,e.media,`timeupdate`)}),e.embed.getDuration().then(t=>{e.media.duration=t,R.call(e,e.media,`durationchange`)}),e.embed.getTextTracks().then(t=>{e.media.textTracks=t,q.setup.call(e)}),e.embed.on(`cuechange`,({cues:t=[]})=>{let n=t.map(e=>ft(e.text));q.updateCues.call(e,n)}),e.embed.on(`loaded`,()=>{e.embed.getPaused().then(t=>{X.call(e,!t),t||R.call(e,e.media,`playing`)}),T.element(e.embed.element)&&e.supported.ui&&e.embed.element.setAttribute(`tabindex`,-1)}),e.embed.on(`bufferstart`,()=>{R.call(e,e.media,`waiting`)}),e.embed.on(`bufferend`,()=>{R.call(e,e.media,`playing`)}),e.embed.on(`play`,()=>{X.call(e,!0),R.call(e,e.media,`playing`)}),e.embed.on(`pause`,()=>{X.call(e,!1)}),e.embed.on(`timeupdate`,t=>{e.media.seeking=!1,f=t.seconds,R.call(e,e.media,`timeupdate`)}),e.embed.on(`progress`,t=>{e.media.buffered=t.percent,R.call(e,e.media,`progress`),Number.parseInt(t.percent,10)===1&&R.call(e,e.media,`canplaythrough`),e.embed.getDuration().then(t=>{t!==e.media.duration&&(e.media.duration=t,R.call(e,e.media,`durationchange`))})}),e.embed.on(`seeked`,()=>{e.media.seeking=!1,R.call(e,e.media,`seeked`)}),e.embed.on(`ended`,()=>{e.media.paused=!0,R.call(e,e.media,`ended`)}),e.embed.on(`error`,t=>{e.media.error=t,R.call(e,e.media,`error`)}),t.customControls&&setTimeout(()=>Y.build.call(e),0)}};function Ht(e){if(T.empty(e))return null;let t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return t&&t[2]?t[2]:e}function Z(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,R.call(this,this.media,e?`play`:`pause`))}function Ut(e){if(e.noCookie)return`https://www.youtube-nocookie.com`;if(window.location.protocol===`http:`)return`http://www.youtube.com`}var Wt={setup(){if(j(this.elements.wrapper,this.config.classNames.embed,!0),T.object(window.YT)&&T.function(window.YT.Player))Wt.ready.call(this);else{let e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{T.function(e)&&e(),Wt.ready.call(this)},Rt(this.config.urls.youtube.sdk).catch(e=>{this.debug.warn(`YouTube API failed to load`,e)})}},getTitle(e){G(st(this.config.urls.youtube.api,e)).then(e=>{if(T.object(e)){let{title:t,height:n,width:r}=e;this.config.title=t,Y.setTitle.call(this),this.embed.ratio=it(r,n)}B.call(this)}).catch(()=>{B.call(this)})},ready(){let e=this,t=e.config.youtube,n=e.media&&e.media.getAttribute(`id`);if(!T.empty(n)&&n.startsWith(`youtube-`))return;let r=e.media.getAttribute(`src`);T.empty(r)&&(r=e.media.getAttribute(this.config.attributes.embed.id));let i=Ht(r);if(e.media=Ve(D(`div`,{id:ot(e.provider),"data-poster":t.customControls?e.poster:void 0}),e.media),t.customControls){let t=e=>`https://i.ytimg.com/vi/${i}/${e}default.jpg`;At(t(`maxres`),121).catch(()=>At(t(`sd`),121)).catch(()=>At(t(`hq`))).then(t=>Y.setPoster.call(e,t.src)).then(t=>{t.includes(`maxres`)||(e.elements.poster.style.backgroundSize=`cover`)}).catch(()=>{})}e.embed=new window.YT.Player(e.media,{videoId:i,host:Ut(t),playerVars:E({},{autoplay:+!!e.config.autoplay,hl:e.config.hl,controls:e.supported.ui&&t.customControls?0:1,disablekb:1,playsinline:e.config.playsinline&&!e.config.fullscreen.iosNative?1:0,cc_load_policy:+!!e.captions.active,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},t),events:{onError(t){if(!e.media.error){let n=t.data,r={2:`The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.`,5:`The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.`,100:`The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.`,101:`The owner of the requested video does not allow it to be played in embedded players.`,150:`The owner of the requested video does not allow it to be played in embedded players.`}[n]||`An unknown error occurred`;e.media.error={code:n,message:r},R.call(e,e.media,`error`)}},onPlaybackRateChange(t){let n=t.target;e.media.playbackRate=n.getPlaybackRate(),R.call(e,e.media,`ratechange`)},onReady(n){if(T.function(e.media.play))return;let r=n.target;Wt.getTitle.call(e,i),e.media.play=()=>{Z.call(e,!0),r.playVideo()},e.media.pause=()=>{Z.call(e,!1),r.pauseVideo()},e.media.stop=()=>{r.stopVideo()},e.media.duration=r.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,`currentTime`,{get(){return Number(r.getCurrentTime())},set(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,R.call(e,e.media,`seeking`),r.seekTo(t)}}),Object.defineProperty(e.media,`playbackRate`,{get(){return r.getPlaybackRate()},set(e){r.setPlaybackRate(e)}});let{volume:a}=e.config;Object.defineProperty(e.media,`volume`,{get(){return a},set(t){a=t,r.setVolume(a*100),R.call(e,e.media,`volumechange`)}});let{muted:o}=e.config;Object.defineProperty(e.media,`muted`,{get(){return o},set(t){let n=T.boolean(t)?t:o;o=n,r[n?`mute`:`unMute`](),r.setVolume(a*100),R.call(e,e.media,`volumechange`)}}),Object.defineProperty(e.media,`currentSrc`,{get(){return r.getVideoUrl()}}),Object.defineProperty(e.media,`ended`,{get(){return e.currentTime===e.duration}});let s=r.getAvailablePlaybackRates();e.options.speed=s.filter(t=>e.config.speed.options.includes(t)),e.supported.ui&&t.customControls&&e.media.setAttribute(`tabindex`,-1),R.call(e,e.media,`timeupdate`),R.call(e,e.media,`durationchange`),clearInterval(e.timers.buffering),e.timers.buffering=setInterval(()=>{e.media.buffered=r.getVideoLoadedFraction(),(e.media.lastBuffered===null||e.media.lastBuffered<e.media.buffered)&&R.call(e,e.media,`progress`),e.media.lastBuffered=e.media.buffered,e.media.buffered===1&&(clearInterval(e.timers.buffering),R.call(e,e.media,`canplaythrough`))},200),t.customControls&&setTimeout(()=>Y.build.call(e),50)},onStateChange(n){let r=n.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(n.data)&&(e.media.seeking=!1,R.call(e,e.media,`seeked`)),n.data){case-1:R.call(e,e.media,`timeupdate`),e.media.buffered=r.getVideoLoadedFraction(),R.call(e,e.media,`progress`);break;case 0:Z.call(e,!1),e.media.loop?(r.stopVideo(),r.playVideo()):R.call(e,e.media,`ended`);break;case 1:t.customControls&&!e.config.autoplay&&e.media.paused&&!e.embed.hasPlayed?e.media.pause():(Z.call(e,!0),R.call(e,e.media,`playing`),e.timers.playing=setInterval(()=>{R.call(e,e.media,`timeupdate`)},50),e.media.duration!==r.getDuration()&&(e.media.duration=r.getDuration(),R.call(e,e.media,`durationchange`)));break;case 2:e.muted||e.embed.unMute(),Z.call(e,!1);break;case 3:R.call(e,e.media,`waiting`);break}R.call(e,e.elements.container,`statechange`,!1,{code:n.data})}}})}},Gt={setup(){if(!this.media){this.debug.warn(`No media element found!`);return}j(this.elements.container,this.config.classNames.type.replace(`{0}`,this.type),!0),j(this.elements.container,this.config.classNames.provider.replace(`{0}`,this.provider),!0),this.isEmbed&&j(this.elements.container,this.config.classNames.type.replace(`{0}`,`video`),!0),this.isVideo&&(this.elements.wrapper=D(`div`,{class:this.config.classNames.video}),Ie(this.media,this.elements.wrapper),this.elements.poster=D(`div`,{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?V.setup.call(this):this.isYouTube?Wt.setup.call(this):this.isVimeo&&Vt.setup.call(this)}};function Kt(e){e.manager&&e.manager.destroy(),e.elements.displayContainer&&e.elements.displayContainer.destroy(),e.elements.container.remove()}var qt=class{constructor(e){d(this,`load`,()=>{this.enabled&&(!T.object(window.google)||!T.object(window.google.ima)?Rt(this.player.config.urls.googleIMA.sdk).then(()=>{this.ready()}).catch(()=>{this.trigger(`error`,Error(`Google IMA SDK failed to load`))}):this.ready())}),d(this,`ready`,()=>{this.enabled||Kt(this),this.startSafetyTimer(12e3,`ready()`),this.managerPromise.then(()=>{this.clearSafetyTimer(`onAdsManagerLoaded()`)}),this.listeners(),this.setupIMA()}),d(this,`setupIMA`,()=>{this.elements.container=D(`div`,{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e=>this.onAdsManagerLoaded(e),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,e=>this.onAdError(e),!1),this.requestAds()}),d(this,`requestAds`,()=>{let{container:e}=this.player.elements;try{let t=new google.ima.AdsRequest;t.adTagUrl=this.tagUrl,t.linearAdSlotWidth=e.offsetWidth,t.linearAdSlotHeight=e.offsetHeight,t.nonLinearAdSlotWidth=e.offsetWidth,t.nonLinearAdSlotHeight=e.offsetHeight,t.forceNonLinearFullSlot=!1,t.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(t)}catch(e){this.onAdError(e)}}),d(this,`pollCountdown`,(e=!1)=>{if(!e){clearInterval(this.countdownTimer),this.elements.container.removeAttribute(`data-badge-text`);return}this.countdownTimer=setInterval(()=>{let e=bt(Math.max(this.manager.getRemainingTime(),0)),t=`${W.get(`advertisement`,this.player.config)} - ${e}`;this.elements.container.setAttribute(`data-badge-text`,t)},100)}),d(this,`onAdsManagerLoaded`,e=>{if(!this.enabled)return;let t=new google.ima.AdsRenderingSettings;t.restoreCustomPlaybackStateOnAdBreakComplete=!0,t.enablePreloading=!0,this.manager=e.getAdsManager(this.player,t),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,e=>this.onAdError(e)),Object.keys(google.ima.AdEvent.Type).forEach(e=>{this.manager.addEventListener(google.ima.AdEvent.Type[e],e=>this.onAdEvent(e))}),this.trigger(`loaded`)}),d(this,`addCuePoints`,()=>{T.empty(this.cuePoints)||this.cuePoints.forEach(e=>{if(e!==0&&e!==-1&&e<this.player.duration){let t=this.player.elements.progress;if(T.element(t)){let n=100/this.player.duration*e,r=D(`span`,{class:this.player.config.classNames.cues});r.style.left=`${n.toString()}%`,t.appendChild(r)}}})}),d(this,`onAdEvent`,e=>{let{container:t}=this.player.elements,n=e.getAd(),r=e.getAdData();switch((e=>{R.call(this.player,this.player.media,`ads${e.replace(/_/g,``).toLowerCase()}`)})(e.type),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger(`loaded`),this.pollCountdown(!0),n.isLinear()||(n.width=t.offsetWidth,n.height=t.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:r.adError&&this.player.debug.warn(`Non-fatal ad error: ${r.adError.getMessage()}`);break}}),d(this,`onAdError`,e=>{this.cancel(),this.player.debug.warn(`Ads error`,e)}),d(this,`listeners`,()=>{let{container:e}=this.player.elements,t;this.player.on(`canplay`,()=>{this.addCuePoints()}),this.player.on(`ended`,()=>{this.loader.contentComplete()}),this.player.on(`timeupdate`,()=>{t=this.player.currentTime}),this.player.on(`seeked`,()=>{let e=this.player.currentTime;T.empty(this.cuePoints)||this.cuePoints.forEach((n,r)=>{t<n&&n<e&&(this.manager.discardAdBreak(),this.cuePoints.splice(r,1))})}),window.addEventListener(`resize`,()=>{this.manager&&this.manager.resize(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL)})}),d(this,`play`,()=>{let{container:e}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then(()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(e){this.onAdError(e)}}).catch(()=>{})}),d(this,`resumeContent`,()=>{this.elements.container.style.zIndex=``,this.playing=!1,z(this.player.media.play())}),d(this,`pauseContent`,()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}),d(this,`cancel`,()=>{this.initialized&&this.resumeContent(),this.trigger(`error`),this.loadAds()}),d(this,`loadAds`,()=>{this.managerPromise.then(()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise(e=>{this.on(`loaded`,e),this.player.debug.log(this.manager)}),this.initialized=!1,this.requestAds()}).catch(()=>{})}),d(this,`trigger`,(e,...t)=>{let n=this.events[e];T.array(n)&&n.forEach(e=>{T.function(e)&&e.apply(this,t)})}),d(this,`on`,(e,t)=>(T.array(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this)),d(this,`startSafetyTimer`,(e,t)=>{this.player.debug.log(`Safety timer invoked from: ${t}`),this.safetyTimer=setTimeout(()=>{this.cancel(),this.clearSafetyTimer(`startSafetyTimer()`)},e)}),d(this,`clearSafetyTimer`,e=>{T.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${e}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)}),this.player=e,this.config=e.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((e,t)=>{this.on(`loaded`,e),this.on(`error`,t)}),this.load()}get enabled(){let{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!T.empty(e.publisherId)||T.url(e.tagUrl))}get tagUrl(){let{config:e}=this;return T.url(e.tagUrl)?e.tagUrl:`https://go.aniview.com/api/adserver6/vast/?${St({AV_PUBLISHERID:`58c25bb0073ef448b1087ad6`,AV_CHANNELID:`5a0458dc28a06145e4519d21`,AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId})}`}};function Jt(e=0,t=0,n=255){return Math.min(Math.max(e,t),n)}function Yt(e){let t=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach(e=>{let n={};e.split(/\r\n|\n|\r/).forEach(e=>{if(!T.number(n.startTime)){let t=e.match(/(\d{2})?:?(\d{2}):(\d{2}).(\d{2,3})( ?--> ?)(\d{2})?:?(\d{2}):(\d{2}).(\d{2,3})/);t&&(n.startTime=Number(t[1]||0)*60*60+Number(t[2])*60+Number(t[3])+Number(`0.${t[4]}`),n.endTime=Number(t[6]||0)*60*60+Number(t[7])*60+Number(t[8])+Number(`0.${t[9]}`))}else if(!T.empty(e.trim())&&T.empty(n.text)){let t=e.trim().split(`#xywh=`);[n.text]=t,t[1]&&([n.x,n.y,n.w,n.h]=t[1].split(`,`))}}),n.text&&t.push(n)}),t}function Xt(e,t){let n=t.width/t.height,r={};return e>n?(r.width=t.width,r.height=1/e*t.width):(r.height=t.height,r.width=e*t.height),r}var Zt=class{constructor(e){d(this,`load`,()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then(()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.listeners(),this.loaded=!0)})}),d(this,`getThumbnails`,()=>new Promise(e=>{let{src:t}=this.player.config.previewThumbnails;if(T.empty(t))throw Error(`Missing previewThumbnails.src config attribute`);let n=()=>{this.thumbnails.sort((e,t)=>e.height-t.height),this.player.debug.log(`Preview thumbnails`,this.thumbnails),e()};if(T.function(t))t(e=>{this.thumbnails=e,n()});else{let e=(T.string(t)?[t]:t).map(e=>this.getThumbnail(e));Promise.all(e).then(n)}})),d(this,`getThumbnail`,e=>new Promise(t=>{G(e,void 0,this.player.config.previewThumbnails.withCredentials).then(n=>{let r={frames:Yt(n),height:null,urlPrefix:``};!r.frames[0].text.startsWith(`/`)&&!r.frames[0].text.startsWith(`http://`)&&!r.frames[0].text.startsWith(`https://`)&&(r.urlPrefix=e.substring(0,e.lastIndexOf(`/`)+1));let i=new Image;i.onload=()=>{r.height=i.naturalHeight,r.width=i.naturalWidth,this.thumbnails.push(r),t()},i.src=r.urlPrefix+r.frames[0].text})})),d(this,`startMove`,e=>{if(this.loaded&&!(!T.event(e)||![`touchmove`,`mousemove`].includes(e.type))&&this.player.media.duration){if(e.type===`touchmove`)this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{let t=this.player.elements.progress.getBoundingClientRect(),n=100/t.width*(e.pageX-t.left);this.seekTime=this.player.media.duration*(n/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=e.pageX,this.elements.thumb.time.textContent=bt(this.seekTime);let r=this.player.config.markers?.points?.find(({time:e})=>e===Math.round(this.seekTime));r&&this.elements.thumb.time.insertAdjacentHTML(`afterbegin`,`${r.label}<br>`)}this.showImageAtCurrentTime()}}),d(this,`endMove`,()=>{this.toggleThumbContainer(!1,!0)}),d(this,`startScrubbing`,e=>{(T.nullOrUndefined(e.button)||e.button===!1||e.button===0)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}),d(this,`endScrubbing`,()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):Je.call(this.player,this.player.media,`timeupdate`,()=>{this.mouseDown||this.toggleScrubbingContainer(!1)})}),d(this,`listeners`,()=>{this.player.on(`play`,()=>{this.toggleThumbContainer(!1,!0)}),this.player.on(`seeked`,()=>{this.toggleThumbContainer(!1)}),this.player.on(`timeupdate`,()=>{this.lastTime=this.player.media.currentTime})}),d(this,`render`,()=>{this.elements.thumb.container=D(`div`,{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=D(`div`,{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);let e=D(`div`,{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=D(`span`,{},`00:00`),e.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(e),T.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=D(`div`,{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}),d(this,`destroy`,()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}),d(this,`showImageAtCurrentTime`,()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();let e=this.thumbnails[0].frames.findIndex(e=>this.seekTime>=e.startTime&&this.seekTime<=e.endTime),t=e>=0,n=0;this.mouseDown||this.toggleThumbContainer(t),t&&(this.thumbnails.forEach((t,r)=>{this.loadedImages.includes(t.frames[e].text)&&(n=r)}),e!==this.showingThumb&&(this.showingThumb=e,this.loadImage(n)))}),d(this,`loadImage`,(e=0)=>{let t=this.showingThumb,n=this.thumbnails[e],{urlPrefix:r}=n,i=n.frames[t],a=n.frames[t].text,o=r+a;if(!this.currentImageElement||this.currentImageElement.dataset.filename!==a){this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);let n=new Image;n.src=o,n.dataset.index=t,n.dataset.filename=a,this.showingThumbFilename=a,this.player.debug.log(`Loading image: ${o}`),n.onload=()=>this.showImage(n,i,e,t,a,!0),this.loadingImage=n,this.removeOldImages(n)}else this.showImage(this.currentImageElement,i,e,t,a,!1),this.currentImageElement.dataset.index=t,this.removeOldImages(this.currentImageElement)}),d(this,`showImage`,(e,t,n,r,i,a=!0)=>{this.player.debug.log(`Showing thumb: ${i}. num: ${r}. qual: ${n}. newimg: ${a}`),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(i)||this.loadedImages.push(i)),this.preloadNearby(r,!0).then(this.preloadNearby(r,!1)).then(this.getHigherQuality(n,e,t,i))}),d(this,`removeOldImages`,e=>{Array.from(this.currentImageContainer.children).forEach(t=>{if(t.tagName.toLowerCase()!==`img`)return;let n=this.usingSprites?500:1e3;if(t.dataset.index!==e.dataset.index&&!t.dataset.deleting){t.dataset.deleting=!0;let{currentImageContainer:e}=this;setTimeout(()=>{e.removeChild(t),this.player.debug.log(`Removing thumb: ${t.dataset.filename}`)},n)}})}),d(this,`preloadNearby`,(e,t=!0)=>new Promise(n=>{setTimeout(()=>{let r=this.thumbnails[0].frames[e].text;if(this.showingThumbFilename===r){let i;i=t?this.thumbnails[0].frames.slice(e):this.thumbnails[0].frames.slice(0,e).reverse();let a=!1;i.forEach(e=>{let t=e.text;if(t!==r&&!this.loadedImages.includes(t)){a=!0,this.player.debug.log(`Preloading thumb filename: ${t}`);let{urlPrefix:e}=this.thumbnails[0],r=e+t,i=new Image;i.src=r,i.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${t}`),this.loadedImages.includes(t)||this.loadedImages.push(t),n()}}}),a||n()}},300)})),d(this,`getHigherQuality`,(e,t,n,r)=>{if(e<this.thumbnails.length-1){let i=t.naturalHeight;this.usingSprites&&(i=n.h),i<this.thumbContainerHeight&&setTimeout(()=>{this.showingThumbFilename===r&&(this.player.debug.log(`Showing higher quality thumb for: ${r}`),this.loadImage(e+1))},300)}}),d(this,`toggleThumbContainer`,(e=!1,t=!1)=>{let n=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(n,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)}),d(this,`toggleScrubbingContainer`,(e=!1)=>{let t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)}),d(this,`determineContainerAutoSizing`,()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}),d(this,`setThumbContainerSizeAndPos`,()=>{let{imageContainer:e}=this.elements.thumb;if(!this.sizeSpecifiedInCSS){let t=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);e.style.height=`${this.thumbContainerHeight}px`,e.style.width=`${t}px`}else if(e.clientHeight>20&&e.clientWidth<20){let t=Math.floor(e.clientHeight*this.thumbAspectRatio);e.style.width=`${t}px`}else if(e.clientHeight<20&&e.clientWidth>20){let t=Math.floor(e.clientWidth/this.thumbAspectRatio);e.style.height=`${t}px`}this.setThumbContainerPos()}),d(this,`setThumbContainerPos`,()=>{let e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),{container:n}=this.elements.thumb,r=t.left-e.left+10,i=t.right-e.left-n.clientWidth-10,a=this.mousePosX-e.left-n.clientWidth/2,o=Jt(a,r,i);n.style.left=`${o}px`,n.style.setProperty(`--preview-arrow-offset`,`${a-o}px`)}),d(this,`setScrubbingContainerSize`,()=>{let{width:e,height:t}=Xt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${e}px`,this.elements.scrubbing.container.style.height=`${t}px`}),d(this,`setImageSizeAndOffset`,(e,t)=>{if(!this.usingSprites)return;let n=this.thumbContainerHeight/t.h;e.style.height=`${e.naturalHeight*n}px`,e.style.width=`${e.naturalWidth*n}px`,e.style.left=`-${t.x*n}px`,e.style.top=`-${t.y*n}px`}),this.player=e,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes(`w`)}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){let{height:e}=Xt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}},Qt={insertElements(e,t){T.string(t)?ze(e,this.media,{src:t}):T.array(t)&&t.forEach(t=>{ze(e,this.media,t)})},change(e){if(!Fe(e,`sources.length`)){this.debug.warn(`Invalid source format`);return}V.cancelRequests.call(this),this.destroy(()=>{this.options.quality=[],O(this.media),this.media=null,T.element(this.elements.container)&&this.elements.container.removeAttribute(`class`);let{sources:t,type:n}=e,[{provider:r=J.html5,src:i}]=t,a=r===`html5`?n:`div`,o=r===`html5`?{}:{src:i};Object.assign(this,{provider:r,type:n,supported:F.check(n,r,this.config.playsinline),media:D(a,o)}),this.elements.container.appendChild(this.media),T.boolean(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute(`crossorigin`,``),this.config.autoplay&&this.media.setAttribute(`autoplay`,``),T.empty(e.poster)||(this.poster=e.poster),this.config.loop.active&&this.media.setAttribute(`loop`,``),this.config.muted&&this.media.setAttribute(`muted`,``),this.config.playsinline&&this.media.setAttribute(`playsinline`,``)),Y.addStyleHook.call(this),this.isHTML5&&Qt.insertElements.call(this,`source`,t),this.config.title=e.title,Gt.setup.call(this),this.isHTML5&&Object.keys(e).includes(`tracks`)&&Qt.insertElements.call(this,`track`,e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Y.build.call(this),this.isHTML5&&this.media.load(),T.empty(e.previewThumbnails)||(Object.assign(this.config.previewThumbnails,e.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Zt(this))),this.fullscreen.update()},!0)}},$t=class e{constructor(t,n){if(d(this,`play`,()=>T.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>z(this.media.play())),this.media.play()):null),d(this,`pause`,()=>!this.playing||!T.function(this.media.pause)?null:this.media.pause()),d(this,`togglePlay`,e=>(T.boolean(e)?e:!this.playing)?this.play():this.pause()),d(this,`stop`,()=>{this.isHTML5?(this.pause(),this.restart()):T.function(this.media.stop)&&this.media.stop()}),d(this,`restart`,()=>{this.currentTime=0}),d(this,`rewind`,e=>{this.currentTime-=T.number(e)?e:this.config.seekTime}),d(this,`forward`,e=>{this.currentTime+=T.number(e)?e:this.config.seekTime}),d(this,`increaseVolume`,e=>{this.volume=(this.media.muted?0:this.volume)+(T.number(e)?e:0)}),d(this,`decreaseVolume`,e=>{this.increaseVolume(-e)}),d(this,`airplay`,()=>{F.airplay&&this.media.webkitShowPlaybackTargetPicker()}),d(this,`toggleControls`,e=>{if(this.supported.ui&&!this.isAudio){let t=He(this.elements.container,this.config.classNames.hideControls),n=e===void 0?void 0:!e,r=j(this.elements.container,this.config.classNames.hideControls,n);if(r&&T.array(this.config.controls)&&this.config.controls.includes(`settings`)&&!T.empty(this.config.settings)&&K.toggleMenu.call(this,!1),r!==t){let e=r?`controlshidden`:`controlsshown`;R.call(this,this.media,e)}return!r}return!1}),d(this,`on`,(e,t)=>{L.call(this,this.elements.container,e,t)}),d(this,`once`,(e,t)=>{Je.call(this,this.elements.container,e,t)}),d(this,`off`,(e,t)=>{qe(this.elements.container,e,t)}),d(this,`destroy`,(e,t=!1)=>{if(!this.ready)return;let n=()=>{document.body.style.overflow=``,this.embed=null,t?(Object.keys(this.elements).length&&(O(this.elements.buttons.play),O(this.elements.captions),O(this.elements.controls),O(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),T.function(e)&&e()):(Ye.call(this),V.cancelRequests.call(this),Ve(this.elements.original,this.elements.container),R.call(this,this.elements.original,`destroyed`,!0),T.function(e)&&e.call(this.elements.original),this.ready=!1,setTimeout(()=>{this.elements=null,this.media=null},200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(Y.toggleNativeControls.call(this,!0),n()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),this.embed!==null&&T.function(this.embed.destroy)&&this.embed.destroy(),n()):this.isVimeo&&(this.embed!==null&&this.embed.unload().then(n),setTimeout(n,200))}),d(this,`supports`,e=>F.mime.call(this,e)),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=F.touch,this.media=t,T.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||T.nodeList(this.media)||T.array(this.media))&&(this.media=this.media[0]),this.config=E({},Ct,e.defaults,n||{},(()=>{try{return JSON.parse(this.media.getAttribute(`data-plyr-config`))}catch{return{}}})()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new Ot(this.config.debug),this.debug.log(`Config`,this.config),this.debug.log(`Support`,F),T.nullOrUndefined(this.media)||!T.element(this.media)){this.debug.error(`Setup failed: no suitable element passed`);return}if(this.media.plyr){this.debug.warn(`Target already setup`);return}if(!this.config.enabled){this.debug.error(`Setup failed: disabled by config`);return}if(!F.check().api){this.debug.error(`Setup failed: no support`);return}let r=this.media.cloneNode(!0);r.autoplay=!1,this.elements.original=r;let i=this.media.tagName.toLowerCase(),a=null,o=null;switch(i){case`div`:if(a=this.media.querySelector(`iframe`),T.element(a)){if(o=xt(a.getAttribute(`src`)),this.provider=Et(o.toString()),this.elements.container=this.media,this.media=a,this.elements.container.className=``,o.search.length){let e=[`1`,`true`];e.includes(o.searchParams.get(`autoplay`))&&(this.config.autoplay=!0),e.includes(o.searchParams.get(`loop`))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=e.includes(o.searchParams.get(`playsinline`)),this.config.youtube.hl=o.searchParams.get(`hl`)):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(T.empty(this.provider)||!Object.values(J).includes(this.provider)){this.debug.error(`Setup failed: Invalid provider`);return}this.type=Tt.video;break;case`video`:case`audio`:this.type=i,this.provider=J.html5,this.media.hasAttribute(`crossorigin`)&&(this.config.crossorigin=!0),this.media.hasAttribute(`autoplay`)&&(this.config.autoplay=!0),(this.media.hasAttribute(`playsinline`)||this.media.hasAttribute(`webkit-playsinline`))&&(this.config.playsinline=!0),this.media.hasAttribute(`muted`)&&(this.config.muted=!0),this.media.hasAttribute(`loop`)&&(this.config.loop.active=!0);break;default:this.debug.error(`Setup failed: unsupported type`);return}if(this.supported=F.check(this.type,this.provider),!this.supported.api){this.debug.error(`Setup failed: no support`);return}this.eventListeners=[],this.listeners=new jt(this),this.storage=new ht(this),this.media.plyr=this,T.element(this.elements.container)||(this.elements.container=D(`div`),Ie(this.media,this.elements.container)),Y.migrateStyles.call(this),Y.addStyleHook.call(this),Gt.setup.call(this),this.config.debug&&L.call(this,this.elements.container,this.config.events.join(` `),e=>{this.debug.log(`event: ${e.type}`)}),this.fullscreen=new kt(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Y.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new qt(this)),this.isHTML5&&this.config.autoplay&&this.once(`canplay`,()=>z(this.play())),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Zt(this))}get isHTML5(){return this.provider===J.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===J.youtube}get isVimeo(){return this.provider===J.vimeo}get isVideo(){return this.type===Tt.video}get isAudio(){return this.type===Tt.audio}get playing(){return!!(this.ready&&!this.paused&&!this.ended)}get paused(){return!!this.media.paused}get stopped(){return!!(this.paused&&this.currentTime===0)}get ended(){return!!this.media.ended}set currentTime(e){if(!this.duration)return;let t=T.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){let{buffered:e}=this.media;return T.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return!!this.media.seeking}get duration(){let e=Number.parseFloat(this.config.duration),t=(this.media||{}).duration,n=!T.number(t)||t===1/0?0:t;return e||n}set volume(e){let t=e;T.string(t)&&(t=Number(t)),T.number(t)||(t=this.storage.get(`volume`)),T.number(t)||({volume:t}=this.config),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!T.empty(e)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(e){let t=e;T.boolean(t)||(t=this.storage.get(`muted`)),T.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return!!this.media.muted}get hasAudio(){return!this.isHTML5||this.isAudio?!0:!!this.media.mozHasAudio||!!this.media.webkitAudioDecodedByteCount||!!(this.media.audioTracks&&this.media.audioTracks.length)}set speed(e){let t=null;T.number(e)&&(t=e),T.number(t)||(t=this.storage.get(`speed`)),T.number(t)||(t=this.config.speed.selected);let{minimumSpeed:n,maximumSpeed:r}=this;t=Jt(t,n,r),this.config.speed.selected=t,setTimeout(()=>{this.media&&(this.media.playbackRate=t)},0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){let t=this.config.quality,n=this.options.quality;if(!n.length)return;let r=[!T.empty(e)&&Number(e),this.storage.get(`quality`),t.selected,t.default].find(T.number),i=!0;if(!n.includes(r)){let e=Qe(n,r);this.debug.warn(`Unsupported quality option: ${r}, using ${e} instead`),r=e,i=!1}t.selected=r,this.media.quality=r,i&&this.storage.set({quality:r})}get quality(){return this.media.quality}set loop(e){let t=T.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return!!this.media.loop}set source(e){Qt.change.call(this,e)}get source(){return this.media.currentSrc}get download(){let{download:e}=this.config.urls;return T.url(e)?e:this.source}set download(e){T.url(e)&&(this.config.urls.download=e,K.setDownloadUrl.call(this))}set poster(e){if(!this.isVideo){this.debug.warn(`Poster can only be set for video`);return}Y.setPoster.call(this,e,!1).catch(()=>{})}get poster(){return this.isVideo?this.media.getAttribute(`poster`)||this.media.getAttribute(`data-poster`):null}get ratio(){if(!this.isVideo)return null;let e=nt(rt.call(this));return T.array(e)?e.join(`:`):e}set ratio(e){if(!this.isVideo){this.debug.warn(`Aspect ratio can only be set for video`);return}if(!T.string(e)||!tt(e)){this.debug.error(`Invalid aspect ratio specified (${e})`);return}this.config.ratio=nt(e),B.call(this)}set autoplay(e){this.config.autoplay=T.boolean(e)?e:this.config.autoplay}get autoplay(){return!!this.config.autoplay}toggleCaptions(e){q.toggle.call(this,e,!1)}set currentTrack(e){q.set.call(this,e,!1),q.setup.call(this)}get currentTrack(){let{toggled:e,currentTrack:t}=this.captions;return e?t:-1}set language(e){q.setLanguage.call(this,e,!1)}get language(){return(q.getCurrentTrack.call(this)||{}).language}set pip(e){if(!F.pip)return;let t=T.boolean(e)?e:!this.pip;T.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?wt.active:wt.inactive),T.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return F.pip?T.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===wt.active:null}setPreviewThumbnails(e){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,e),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Zt(this))}static supported(e,t){return F.check(e,t)}static loadSprite(e,t){return gt(e,t)}static setup(t,n={}){let r=null;return T.string(t)?r=Array.from(document.querySelectorAll(t)):T.nodeList(t)?r=Array.from(t):T.array(t)&&(r=t.filter(T.element)),T.empty(r)?null:r.map(t=>new e(t,n))}};$t.defaults=Pe(Ct);var Q=n(e());function en(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.tagName===`SELECT`:!1}var tn=5,nn=5;function rn(e){let n=t(),r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),c=(0,Q.useRef)(null),d=(0,Q.useRef)(e.video.id),f=(0,Q.useRef)(e.startPosition),p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),[h,ee]=(0,Q.useState)(!1),[g,te]=(0,Q.useState)(e.notes.content),[ne,re]=(0,Q.useState)(e.video.status),[ie,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{te(e.notes.content),re(e.video.status),_(``),y(null),d.current=e.video.id,f.current=e.startPosition},[e.notes.content,e.startPosition,e.video.id,e.video.status]);let ae=(0,Q.useEffectEvent)(async t=>{await l(e.video.id,t),re(t)}),b=(0,Q.useEffectEvent)(async()=>{let t=c.current;!t||Number.isNaN(t.currentTime)||Number.isNaN(t.duration)||(await s(e.video.id,t.currentTime,t.duration),f.current=t.currentTime)}),oe=(0,Q.useEffectEvent)(async()=>{try{await o(e.video.id,g),_(`Saved`)}catch{_(`Could not save notes`)}window.setTimeout(()=>_(``),1800)}),x=(0,Q.useEffectEvent)(()=>{m.current!==null&&(window.clearInterval(m.current),m.current=null),y(null)}),se=(0,Q.useEffectEvent)(()=>{e.adjacent.prev&&(x(),n(`/video/${e.adjacent.prev}`))}),ce=(0,Q.useEffectEvent)(()=>{e.adjacent.next&&(x(),n(`/video/${e.adjacent.next}`))}),le=(0,Q.useEffectEvent)(()=>{e.adjacent.next&&(x(),y(nn),m.current=window.setInterval(()=>{y(t=>t===null?null:t<=1?(window.clearInterval(m.current),m.current=null,n(`/video/${e.adjacent.next}`),null):t-1)},1e3))});(0,Q.useEffect)(()=>{let e=r.current,t=i.current;if(!e||!t)return;let n=document.createElement(`video`);n.controls=!0,n.playsInline=!0,n.preload=`metadata`,t.replaceChildren(n),a.current=n;let o=new $t(n,{fullscreen:{enabled:!0,fallback:!0,iosNative:!1,container:`.player-shell`},keyboard:{focused:!0,global:!0},controls:[`play-large`,`restart`,`rewind`,`play`,`fast-forward`,`progress`,`current-time`,`duration`,`mute`,`volume`,`settings`,`pip`,`airplay`,`fullscreen`],seekTime:5});c.current=o;let s=()=>{ee(document.fullscreenElement===e||e.classList.contains(`plyr--fullscreen-fallback`))};o.on(`enterfullscreen`,s),o.on(`exitfullscreen`,s),document.addEventListener(`fullscreenchange`,s),o.on(`pause`,()=>{b()}),o.on(`timeupdate`,()=>{let e=Math.floor(o.currentTime||0);Math.abs(e-f.current)<tn||p.current===null&&(p.current=window.setTimeout(()=>{b(),p.current=null},1e3))}),o.on(`ended`,()=>{b(),ae(`completed`),le()});let l=()=>{!o.currentTime||!o.duration||u(d.current,o.currentTime,o.duration)};return window.addEventListener(`beforeunload`,l),()=>{document.removeEventListener(`fullscreenchange`,s),window.removeEventListener(`beforeunload`,l),p.current!==null&&(window.clearTimeout(p.current),p.current=null),m.current!==null&&(window.clearInterval(m.current),m.current=null),o.destroy(),c.current=null,a.current=null,t.replaceChildren()}},[]),(0,Q.useEffect)(()=>{let t=a.current;if(!t)return;x();let n=()=>{e.startPosition>0&&(t.currentTime=e.startPosition),Promise.resolve(t.play()).catch(()=>void 0)};return t.pause(),t.src=`/api/videos/${e.video.id}/stream`,t.load(),t.addEventListener(`loadedmetadata`,n,{once:!0}),()=>{t.removeEventListener(`loadedmetadata`,n)}},[e.startPosition,e.video.id]),(0,Q.useEffect)(()=>{let e=e=>{if(!e.shiftKey||en(e.target))return;let t=e.key.toLowerCase();t===`p`&&(e.preventDefault(),se()),t===`n`&&(e.preventDefault(),ce())};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[]);async function ue(e){await ae(e)}async function S(){await oe()}return{autoplayCountdown:v,canGoNext:e.adjacent.next!==null,canGoPrevious:e.adjacent.prev!==null,cancelAutoplay:x,goToNextVideo:ce,goToPreviousVideo:se,handleNotesSave:S,handleStatusChange:ue,isShellFullscreen:h,notes:g,notesMessage:ie,playerHostRef:i,playerShellRef:r,setNotes:te,status:ne}}var $=a();async function an({params:e}){if(!e.videoId)throw Error(`Video id is required`);return c(e.videoId)}function on(){let e=i(),t=rn(e),n=e.queue.videos.find(t=>t.id===e.adjacent.next)??null;function a(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),t.handleNotesSave())}function o(e){switch(e){case`completed`:return`✓`;case`in-progress`:return`▶`;default:return`○`}}return(0,$.jsxs)(`div`,{className:`player-layout`,children:[(0,$.jsxs)(`section`,{className:`player-main`,children:[(0,$.jsxs)(`div`,{className:`section-header`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{children:e.video.title}),(0,$.jsx)(`p`,{children:e.queue.moduleName})]}),(0,$.jsx)(`span`,{className:`status-badge status-${t.status}`,children:t.status})]}),(0,$.jsxs)(`div`,{className:`player-shell`,ref:t.playerShellRef,children:[(0,$.jsxs)(`div`,{className:t.isShellFullscreen?`fullscreen-nav visible`:`fullscreen-nav`,"aria-hidden":!t.isShellFullscreen,children:[t.canGoPrevious?(0,$.jsx)(`div`,{className:`fullscreen-nav-zone previous`,children:(0,$.jsxs)(`button`,{"aria-label":`Previous video`,className:`fullscreen-nav-button previous`,onClick:()=>t.goToPreviousVideo(),type:`button`,children:[(0,$.jsx)(`span`,{className:`fullscreen-nav-icon`,children:`←`}),(0,$.jsx)(`span`,{className:`fullscreen-nav-label`,children:`Prev`})]})}):null,t.canGoNext?(0,$.jsx)(`div`,{className:`fullscreen-nav-zone next`,children:(0,$.jsxs)(`button`,{"aria-label":`Next video`,className:`fullscreen-nav-button next`,onClick:()=>t.goToNextVideo(),type:`button`,children:[(0,$.jsx)(`span`,{className:`fullscreen-nav-label`,children:`Next`}),(0,$.jsx)(`span`,{className:`fullscreen-nav-icon`,children:`→`})]})}):null]}),(0,$.jsxs)(`div`,{className:`player-frame`,children:[(0,$.jsx)(`div`,{className:`player-host`,ref:t.playerHostRef}),t.autoplayCountdown!==null&&n?(0,$.jsxs)(`div`,{className:`overlay-card`,children:[(0,$.jsxs)(`strong`,{children:[`Up next in `,t.autoplayCountdown,`s`]}),(0,$.jsx)(`span`,{children:n.title}),(0,$.jsxs)(`div`,{className:`notes-actions`,children:[(0,$.jsx)(`button`,{onClick:()=>t.cancelAutoplay(),type:`button`,children:`Cancel`}),(0,$.jsx)(r,{to:`/video/${n.id}`,children:`Play now`})]})]}):null]})]}),(0,$.jsxs)(`div`,{className:`player-nav`,children:[e.adjacent.prev?(0,$.jsx)(r,{to:`/video/${e.adjacent.prev}`,children:`Previous`}):(0,$.jsx)(`span`,{children:`Previous`}),(0,$.jsx)(r,{to:`/`,children:`Back to Course`}),e.adjacent.next?(0,$.jsx)(r,{to:`/video/${e.adjacent.next}`,children:`Next`}):(0,$.jsx)(`span`,{children:`Next`})]}),(0,$.jsxs)(`section`,{className:`status-panel stack`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Status`}),(0,$.jsx)(`p`,{children:`Completed videos restart at the beginning. Short videos never keep partial resume.`})]}),(0,$.jsx)(`div`,{className:`status-buttons`,children:[`unwatched`,`in-progress`,`completed`].map(e=>(0,$.jsx)(`button`,{className:t.status===e?`status-button active`:`status-button`,onClick:()=>void t.handleStatusChange(e),type:`button`,children:e},e))})]}),(0,$.jsxs)(`section`,{className:`notes-panel stack`,children:[(0,$.jsxs)(`div`,{className:`section-header`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Notes`}),(0,$.jsx)(`p`,{children:`Markdown-friendly notes that autosave on blur and with Ctrl/Cmd+S.`})]}),(0,$.jsx)(`span`,{className:`muted`,children:t.notesMessage})]}),(0,$.jsx)(`textarea`,{className:`notes-editor`,onBlur:()=>void t.handleNotesSave(),onChange:e=>t.setNotes(e.target.value),onKeyDown:a,placeholder:`Write notes for this lesson...`,value:t.notes}),(0,$.jsx)(`div`,{className:`notes-actions`,children:(0,$.jsx)(`button`,{onClick:()=>void t.handleNotesSave(),type:`button`,children:`Save Notes`})})]})]}),(0,$.jsxs)(`aside`,{className:`queue-panel`,children:[(0,$.jsx)(`div`,{className:`section-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Queue`}),(0,$.jsx)(`p`,{children:e.queue.moduleName})]})}),(0,$.jsx)(`div`,{className:`queue-list`,children:e.queue.videos.map((t,n)=>(0,$.jsxs)(r,{className:t.id===e.queue.currentId?`queue-item active`:`queue-item`,to:`/video/${t.id}`,children:[(0,$.jsxs)(`div`,{className:`queue-item-main`,children:[(0,$.jsx)(`span`,{className:`queue-index`,children:n+1}),(0,$.jsx)(`div`,{className:`queue-copy`,children:(0,$.jsx)(`strong`,{children:t.title})})]}),(0,$.jsx)(`span`,{"aria-label":t.status,className:`queue-status-icon status-${t.status}`,title:t.status,children:o(t.status)})]},t.id))})]})]})}export{on as PlaybackRoute,an as playbackLoader};
@@ -0,0 +1 @@
1
+ import{c as e,f as t,l as n,m as r,n as i,s as a,t as o}from"./jsx-runtime-C2ZT__TU.js";import{i as s}from"./api-client-hFlLSS3K.js";var c=r(t()),l=o();async function u({request:e}){let t=new URL(e.url).searchParams.get(`q`)??``;return{query:t,results:await s(t)}}function d(){let{query:t,results:r}=a(),o=e(),s=n(),[u,d]=(0,c.useState)(t),f=(0,c.useDeferredValue)(u.trim());(0,c.useEffect)(()=>{d(t)},[t]);let p=(0,c.useEffectEvent)(e=>{(new URLSearchParams(o.search).get(`q`)??``)!==e&&(0,c.startTransition)(()=>{s(e?`/search?q=${encodeURIComponent(e)}`:`/search`,{replace:!0})})});(0,c.useEffect)(()=>{let e=window.setTimeout(()=>p(f),200);return()=>window.clearTimeout(e)},[f,p]);let m=(0,c.useMemo)(()=>[...r].sort((e,t)=>e.moduleName===t.moduleName?e.title.localeCompare(t.title):(e.moduleName??`Videos`).localeCompare(t.moduleName??`Videos`)),[r]);return(0,l.jsxs)(`section`,{className:`panel stack`,children:[(0,l.jsxs)(`div`,{className:`section-header`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{children:`Search`}),(0,l.jsx)(`p`,{children:`Type to search across video titles and filenames.`})]}),(0,l.jsx)(`input`,{className:`inline-search`,onChange:e=>d(e.target.value),placeholder:`Start typing...`,type:`search`,value:u})]}),u&&f!==t?(0,l.jsx)(`p`,{className:`muted`,children:`Updating results...`}):null,m.length===0?(0,l.jsxs)(`div`,{className:`empty-state`,children:[(0,l.jsx)(`h2`,{children:t?`No matches yet`:`Start with a search query`}),(0,l.jsx)(`p`,{children:t?`Try a broader term or another lesson name.`:`Results appear as you type.`})]}):(0,l.jsx)(`div`,{className:`search-results`,children:m.map(e=>(0,l.jsxs)(i,{className:`search-result`,to:`/video/${e.id}`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h2`,{children:e.title}),(0,l.jsx)(`p`,{children:e.moduleName??`Videos`})]}),(0,l.jsx)(`span`,{className:`status-badge status-${e.status}`,children:e.status})]},e.id))})]})}export{d as SearchRoute,u as searchLoader};
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>CourseWatcher</title>
7
+ <script type="module" crossorigin src="/assets/index-CwspbIw1.js"></script>
8
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-C2ZT__TU.js">
9
+ <link rel="stylesheet" crossorigin href="/assets/index-VjwsJnuQ.css">
10
+ </head>
11
+ <body>
12
+ <div id="root"></div>
13
+ </body>
14
+ </html>