@camstack/addon-pipeline 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,150 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var a in e)t(r,a,{get:e[a],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,a,s,c)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var l=r(a),u=0,d=l.length,f;u<d;u++)f=l[u],!o.call(e,f)&&f!==s&&t(e,f,{get:(e=>a[e]).bind(null,f),enumerable:!(c=n(a,f))||c.enumerable});return e},u=(n,r,o)=>(o=n==null?{}:e(a(n)),l(r||!n||!n.__esModule?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var d=s((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,o=e[r];if(0<a(o,t))e[r]=t,e[n]=o,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,o=e.length,s=o>>>1;r<s;){var c=2*(r+1)-1,l=e[c],u=c+1,d=e[u];if(0>a(l,n))u<o&&0>a(d,l)?(e[r]=d,e[u]=n,r=u):(e[r]=l,e[c]=n,r=c);else if(u<o&&0>a(d,n))e[r]=d,e[u]=n,r=u;else break a}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,c=s.now();e.unstable_now=function(){return s.now()-c}}var l=[],u=[],d=1,f=null,p=3,m=!1,h=!1,g=!1,_=!1,v=typeof setTimeout==`function`?setTimeout:null,y=typeof clearTimeout==`function`?clearTimeout:null,b=typeof setImmediate<`u`?setImmediate:null;function x(e){for(var a=n(u);a!==null;){if(a.callback===null)r(u);else if(a.startTime<=e)r(u),a.sortIndex=a.expirationTime,t(l,a);else break;a=n(u)}}function S(e){if(g=!1,x(e),!h)if(n(l)!==null)h=!0,C||(C=!0,ee());else{var t=n(u);t!==null&&re(S,t.startTime-e)}}var C=!1,w=-1,T=5,E=-1;function D(){return _?!0:!(e.unstable_now()-E<T)}function O(){if(_=!1,C){var t=e.unstable_now();E=t;var a=!0;try{a:{h=!1,g&&(g=!1,y(w),w=-1),m=!0;var o=p;try{b:{for(x(t),f=n(l);f!==null&&!(f.expirationTime>t&&D());){var s=f.callback;if(typeof s==`function`){f.callback=null,p=f.priorityLevel;var c=s(f.expirationTime<=t);if(t=e.unstable_now(),typeof c==`function`){f.callback=c,x(t),a=!0;break b}f===n(l)&&r(l),x(t)}else r(l);f=n(l)}if(f!==null)a=!0;else{var d=n(u);d!==null&&re(S,d.startTime-t),a=!1}}break a}finally{f=null,p=o,m=!1}a=void 0}}finally{a?ee():C=!1}}}var ee;if(typeof b==`function`)ee=function(){b(O)};else if(typeof MessageChannel<`u`){var te=new MessageChannel,ne=te.port2;te.port1.onmessage=O,ee=function(){ne.postMessage(null)}}else ee=function(){v(O,0)};function re(t,n){w=v(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_next=function(e){switch(p){case 1:case 2:case 3:var t=3;break;default:t=p}var n=p;p=t;try{return e()}finally{p=n}},e.unstable_requestPaint=function(){_=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=p;p=e;try{return t()}finally{p=n}},e.unstable_scheduleCallback=function(r,a,o){var s=e.unstable_now();switch(typeof o==`object`&&o?(o=o.delay,o=typeof o==`number`&&0<o?s+o:s):o=s,r){case 1:var c=-1;break;case 2:c=250;break;case 5:c=1073741823;break;case 4:c=1e4;break;default:c=5e3}return c=o+c,r={id:d++,callback:a,priorityLevel:r,startTime:o,expirationTime:c,sortIndex:-1},o>s?(r.sortIndex=o,t(u,r),n(l)===null&&r===n(u)&&(g?(y(w),w=-1):g=!0,re(S,o-s))):(r.sortIndex=c,t(l,r),h||m||(h=!0,C||(C=!0,ee()))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}})),f=s(((e,t)=>{t.exports=d()})),p=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),a=Symbol.for(`react.strict_mode`),o=Symbol.for(`react.profiler`),s=Symbol.for(`react.consumer`),c=Symbol.for(`react.context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.memo`),f=Symbol.for(`react.lazy`),p=Symbol.for(`react.activity`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.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`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var a=r.ref;return{$$typeof:t,type:e,key:n,ref:a===void 0?null:a,props:r}}function O(e,t){return D(e.type,t,e.props)}function ee(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function te(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ne=/\/+/g;function re(e,t){return typeof e==`object`&&e&&e.key!=null?te(``+e.key):t.toString(36)}function ie(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(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 ae(e,r,a,o,s){var c=typeof e;(c===`undefined`||c===`boolean`)&&(e=null);var l=!1;if(e===null)l=!0;else switch(c){case`bigint`:case`string`:case`number`:l=!0;break;case`object`:switch(e.$$typeof){case t:case n:l=!0;break;case f:return l=e._init,ae(l(e._payload),r,a,o,s)}}if(l)return s=s(e),l=o===``?`.`+re(e,0):o,C(s)?(a=``,l!=null&&(a=l.replace(ne,`$&/`)+`/`),ae(s,r,a,``,function(e){return e})):s!=null&&(ee(s)&&(s=O(s,a+(s.key==null||e&&e.key===s.key?``:(``+s.key).replace(ne,`$&/`)+`/`)+l)),r.push(s)),1;l=0;var u=o===``?`.`:o+`:`;if(C(e))for(var d=0;d<e.length;d++)o=e[d],c=u+re(o,d),l+=ae(o,r,a,c,s);else if(d=h(e),typeof d==`function`)for(e=d.call(e),d=0;!(o=e.next()).done;)o=o.value,c=u+re(o,d++),l+=ae(o,r,a,c,s);else if(c===`object`){if(typeof e.then==`function`)return ae(ie(e),r,a,o,s);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 l}function k(e,t,n){if(e==null)return e;var r=[],a=0;return ae(e,r,``,``,function(e){return t.call(n,e,a++)}),r}function oe(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 A=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)},se={map:k,forEach:function(e,t,n){k(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return k(e,function(){t++}),t},toArray:function(e){return k(e,function(e){return e})||[]},only:function(e){if(!ee(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=p,e.Children=se,e.Component=y,e.Fragment=r,e.Profiler=o,e.PureComponent=x,e.StrictMode=a,e.Suspense=u,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.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=_({},e.props),a=e.key;if(t!=null)for(o in t.key!==void 0&&(a=``+t.key),t)!E.call(t,o)||o===`key`||o===`__self`||o===`__source`||o===`ref`&&t.ref===void 0||(r[o]=t[o]);var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];r.children=s}return D(e.type,a,r)},e.createContext=function(e){return e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:s,_context:e},e},e.createElement=function(e,t,n){var r,a={},o=null;if(t!=null)for(r in t.key!==void 0&&(o=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(a[r]=t[r]);var s=arguments.length-2;if(s===1)a.children=n;else if(1<s){for(var c=Array(s),l=0;l<s;l++)c[l]=arguments[l+2];a.children=c}if(e&&e.defaultProps)for(r in s=e.defaultProps,s)a[r]===void 0&&(a[r]=s[r]);return D(e,o,a)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:l,render:e}},e.isValidElement=ee,e.lazy=function(e){return{$$typeof:f,_payload:{_status:-1,_result:e},_init:oe}},e.memo=function(e,t){return{$$typeof:d,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=T.T,n={};T.T=n;try{var r=e(),a=T.S;a!==null&&a(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,A)}catch(e){A(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}},e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.2.7`})),m=s(((e,t)=>{t.exports=p()})),h=s((e=>{var t=m();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var a={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),o=typeof t.integrity==`string`?t.integrity:void 0,s=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:o,fetchPriority:s}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:o,fetchPriority:s,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.7`})),g=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=s((e=>{var t=f(),n=m(),r=g();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var c=o.alternate;if(c===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===c.child){for(c=o.child;c;){if(c===n)return u(o),e;if(c===r)return u(o),t;c=c.sibling}throw Error(a(188))}if(n.return!==r.return)n=o,r=c;else{for(var l=!1,d=o.child;d;){if(d===n){l=!0,n=o,r=c;break}if(d===r){l=!0,r=o,n=c;break}d=d.sibling}if(!l){for(d=c.child;d;){if(d===n){l=!0,n=c,r=o;break}if(d===r){l=!0,r=c,n=o;break}d=d.sibling}if(!l)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,_=Symbol.for(`react.element`),v=Symbol.for(`react.transitional.element`),y=Symbol.for(`react.portal`),b=Symbol.for(`react.fragment`),x=Symbol.for(`react.strict_mode`),S=Symbol.for(`react.profiler`),C=Symbol.for(`react.consumer`),w=Symbol.for(`react.context`),T=Symbol.for(`react.forward_ref`),E=Symbol.for(`react.suspense`),D=Symbol.for(`react.suspense_list`),O=Symbol.for(`react.memo`),ee=Symbol.for(`react.lazy`),te=Symbol.for(`react.activity`),ne=Symbol.for(`react.memo_cache_sentinel`),re=Symbol.iterator;function ie(e){return typeof e!=`object`||!e?null:(e=re&&e[re]||e[`@@iterator`],typeof e==`function`?e:null)}var ae=Symbol.for(`react.client.reference`);function k(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case b:return`Fragment`;case S:return`Profiler`;case x:return`StrictMode`;case E:return`Suspense`;case D:return`SuspenseList`;case te:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case y:return`Portal`;case w:return e.displayName||`Context`;case C:return(e._context.displayName||`Context`)+`.Consumer`;case T:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case O:return t=e.displayName||null,t===null?k(e.type)||`Memo`:t;case ee:t=e._payload,e=e._init;try{return k(e(t))}catch{}}return null}var oe=Array.isArray,A=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},le=[],ue=-1;function de(e){return{current:e}}function fe(e){0>ue||(e.current=le[ue],le[ue]=null,ue--)}function pe(e,t){ue++,le[ue]=e.current,e.current=t}var me=de(null),he=de(null),ge=de(null),_e=de(null);function ve(e,t){switch(pe(ge,t),pe(he,e),pe(me,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?of(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=of(t),e=sf(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}fe(me),pe(me,e)}function ye(){fe(me),fe(he),fe(ge)}function be(e){e.memoizedState!==null&&pe(_e,e);var t=me.current,n=sf(t,e.type);t!==n&&(pe(he,e),pe(me,n))}function xe(e){he.current===e&&(fe(me),fe(he)),_e.current===e&&(fe(_e),gp._currentValue=ce)}var Se,Ce;function we(e){if(Se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Se=t&&t[1]||``,Ce=-1<e.stack.indexOf(`
2
- at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
- `+Se+e+Ce}var Te=!1;function Ee(e,t){if(!e||Te)return``;Te=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var a=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);a&&a.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var o=r.DetermineComponentFrameRoot(),s=o[0],c=o[1];if(s&&c){var l=s.split(`
4
- `),u=c.split(`
5
- `);for(a=r=0;r<l.length&&!l[r].includes(`DetermineComponentFrameRoot`);)r++;for(;a<u.length&&!u[a].includes(`DetermineComponentFrameRoot`);)a++;if(r===l.length||a===u.length)for(r=l.length-1,a=u.length-1;1<=r&&0<=a&&l[r]!==u[a];)a--;for(;1<=r&&0<=a;r--,a--)if(l[r]!==u[a]){if(r!==1||a!==1)do if(r--,a--,0>a||l[r]!==u[a]){var d=`
6
- `+l[r].replace(` at new `,` at `);return e.displayName&&d.includes(`<anonymous>`)&&(d=d.replace(`<anonymous>`,e.displayName)),d}while(1<=r&&0<=a);break}}}finally{Te=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?we(n):``}function De(e,t){switch(e.tag){case 26:case 27:case 5:return we(e.type);case 16:return we(`Lazy`);case 13:return e.child!==t&&t!==null?we(`Suspense Fallback`):we(`Suspense`);case 19:return we(`SuspenseList`);case 0:case 15:return Ee(e.type,!1);case 11:return Ee(e.type.render,!1);case 1:return Ee(e.type,!0);case 31:return we(`Activity`);default:return``}}function Oe(e){try{var t=``,n=null;do t+=De(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
- Error generating stack: `+e.message+`
8
- `+e.stack}}var ke=Object.prototype.hasOwnProperty,Ae=t.unstable_scheduleCallback,je=t.unstable_cancelCallback,Me=t.unstable_shouldYield,Ne=t.unstable_requestPaint,Pe=t.unstable_now,Fe=t.unstable_getCurrentPriorityLevel,Ie=t.unstable_ImmediatePriority,Le=t.unstable_UserBlockingPriority,Re=t.unstable_NormalPriority,ze=t.unstable_LowPriority,Be=t.unstable_IdlePriority,Ve=t.log,He=t.unstable_setDisableYieldValue,Ue=null,We=null;function Ge(e){if(typeof Ve==`function`&&He(e),We&&typeof We.setStrictMode==`function`)try{We.setStrictMode(Ue,e)}catch{}}var Ke=Math.clz32?Math.clz32:Ye,qe=Math.log,Je=Math.LN2;function Ye(e){return e>>>=0,e===0?32:31-(qe(e)/Je|0)|0}var Xe=256,Ze=262144,Qe=4194304;function $e(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function et(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var a=0,o=e.suspendedLanes,s=e.pingedLanes;e=e.warmLanes;var c=r&134217727;return c===0?(c=r&~o,c===0?s===0?n||(n=r&~e,n!==0&&(a=$e(n))):a=$e(s):a=$e(c)):(r=c&~o,r===0?(s&=c,s===0?n||(n=c&~e,n!==0&&(a=$e(n))):a=$e(s)):a=$e(r)),a===0?0:t!==0&&t!==a&&(t&o)===0&&(o=a&-a,n=t&-t,o>=n||o===32&&n&4194048)?t:a}function tt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function nt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rt(){var e=Qe;return Qe<<=1,!(Qe&62914560)&&(Qe=4194304),e}function it(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function at(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ot(e,t,n,r,a,o){var s=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var c=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(n=s&~n;0<n;){var d=31-Ke(n),f=1<<d;c[d]=0,l[d]=-1;var p=u[d];if(p!==null)for(u[d]=null,d=0;d<p.length;d++){var m=p[d];m!==null&&(m.lane&=-536870913)}n&=~f}r!==0&&st(e,r,0),o!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=o&~(s&~t))}function st(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ke(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ct(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ke(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}function lt(e,t){var n=t&-t;return n=n&42?1:ut(n),(n&(e.suspendedLanes|t))===0?n:0}function ut(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function dt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ft(){var e=se.p;return e===0?(e=window.event,e===void 0?32:Mp(e.type)):e}function pt(e,t){var n=se.p;try{return se.p=e,t()}finally{se.p=n}}var mt=Math.random().toString(36).slice(2),ht=`__reactFiber$`+mt,gt=`__reactProps$`+mt,_t=`__reactContainer$`+mt,vt=`__reactEvents$`+mt,yt=`__reactListeners$`+mt,bt=`__reactHandles$`+mt,xt=`__reactResources$`+mt,St=`__reactMarker$`+mt;function Ct(e){delete e[ht],delete e[gt],delete e[vt],delete e[yt],delete e[bt]}function wt(e){var t=e[ht];if(t)return t;for(var n=e.parentNode;n;){if(t=n[_t]||n[ht]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=kf(e);e!==null;){if(n=e[ht])return n;e=kf(e)}return t}e=n,n=e.parentNode}return null}function Tt(e){if(e=e[ht]||e[_t]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Et(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function Dt(e){var t=e[xt];return t||=e[xt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ot(e){e[St]=!0}var kt=new Set,At={};function jt(e,t){Mt(e,t),Mt(e+`Capture`,t)}function Mt(e,t){for(At[e]=t,e=0;e<t.length;e++)kt.add(t[e])}var Nt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Pt={},Ft={};function It(e){return ke.call(Ft,e)?!0:ke.call(Pt,e)?!1:Nt.test(e)?Ft[e]=!0:(Pt[e]=!0,!1)}function Lt(e,t,n){if(It(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Rt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function zt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Bt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Vt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ht(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var a=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){n=``+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ut(e){if(!e._valueTracker){var t=Vt(e)?`checked`:`value`;e._valueTracker=Ht(e,t,``+e[t])}}function Wt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Vt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Gt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Kt=/[\n"\\]/g;function qt(e){return e.replace(Kt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Jt(e,t,n,r,a,o,s,c){e.name=``,s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.type=s:e.removeAttribute(`type`),t==null?s!==`submit`&&s!==`reset`||e.removeAttribute(`value`):s===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Bt(t)):e.value!==``+Bt(t)&&(e.value=``+Bt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Xt(e,s,Bt(n)):Xt(e,s,Bt(t)),a==null&&o!=null&&(e.defaultChecked=!!o),a!=null&&(e.checked=a&&typeof a!=`function`&&typeof a!=`symbol`),c!=null&&typeof c!=`function`&&typeof c!=`symbol`&&typeof c!=`boolean`?e.name=``+Bt(c):e.removeAttribute(`name`)}function Yt(e,t,n,r,a,o,s,c){if(o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.type=o),t!=null||n!=null){if(!(o!==`submit`&&o!==`reset`||t!=null)){Ut(e);return}n=n==null?``:``+Bt(n),t=t==null?n:``+Bt(t),c||t===e.value||(e.value=t),e.defaultValue=t}r??=a,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=c?e.checked:!!r,e.defaultChecked=!!r,s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`&&(e.name=s),Ut(e)}function Xt(e,t,n){t===`number`&&Gt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Zt(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t[`$`+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Bt(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function Qt(e,t,n){if(t!=null&&(t=``+Bt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Bt(n)}function $t(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(a(92));if(oe(r)){if(1<r.length)throw Error(a(93));r=r[0]}n=r}n??=``,t=n}n=Bt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ut(e)}function en(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var tn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function nn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||tn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function rn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(a(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var o in t)r=t[o],t.hasOwnProperty(o)&&n[o]!==r&&nn(e,o,r)}else for(var s in t)t.hasOwnProperty(s)&&nn(e,s,t[s])}function an(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var on=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),sn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function cn(e){return sn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function ln(){}var un=null;function dn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fn=null,pn=null;function mn(e){var t=Tt(e);if(t&&(e=t.stateNode)){var n=e[gt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Jt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+qt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=r[gt]||null;if(!o)throw Error(a(90));Jt(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Wt(r)}break a;case`textarea`:Qt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Zt(e,!!n.multiple,t,!1)}}}var hn=!1;function gn(e,t,n){if(hn)return e(t,n);hn=!0;try{return e(t)}finally{if(hn=!1,(fn!==null||pn!==null)&&(Iu(),fn&&(t=fn,e=pn,pn=fn=null,mn(t),e)))for(t=0;t<e.length;t++)mn(e[t])}}function _n(e,t){var n=e.stateNode;if(n===null)return null;var r=n[gt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(a(231,t,typeof n));return n}var vn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),yn=!1;if(vn)try{var bn={};Object.defineProperty(bn,"passive",{get:function(){yn=!0}}),window.addEventListener(`test`,bn,bn),window.removeEventListener(`test`,bn,bn)}catch{yn=!1}var xn=null,Sn=null,Cn=null;function wn(){if(Cn)return Cn;var e,t=Sn,n=t.length,r,a=`value`in xn?xn.value:xn.textContent,o=a.length;for(e=0;e<n&&t[e]===a[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===a[o-r];r++);return Cn=a.slice(e,1<r?1-r:void 0)}function Tn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function En(){return!0}function Dn(){return!1}function On(e){function t(t,n,r,a,o){for(var s in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=a,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(s)&&(t=e[s],this[s]=t?t(a):a[s]);return this.isDefaultPrevented=(a.defaultPrevented==null?!1===a.returnValue:a.defaultPrevented)?En:Dn,this.isPropagationStopped=Dn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=En)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=En)},persist:function(){},isPersistent:En}),t}var kn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},An=On(kn),jn=h({},kn,{view:0,detail:0}),Mn=On(jn),Nn,Pn,Fn,In=h({},jn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Fn&&(Fn&&e.type===`mousemove`?(Nn=e.screenX-Fn.screenX,Pn=e.screenY-Fn.screenY):Pn=Nn=0,Fn=e),Nn)},movementY:function(e){return`movementY`in e?e.movementY:Pn}}),Ln=On(In),Rn=On(h({},In,{dataTransfer:0})),zn=On(h({},jn,{relatedTarget:0})),Bn=On(h({},kn,{animationName:0,elapsedTime:0,pseudoElement:0})),Vn=On(h({},kn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Hn=On(h({},kn,{data:0})),Un={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Wn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Gn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Kn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Gn[e])?!!t[e]:!1}function qn(){return Kn}var Jn=On(h({},jn,{key:function(e){if(e.key){var t=Un[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Tn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Wn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qn,charCode:function(e){return e.type===`keypress`?Tn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Tn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Yn=On(h({},In,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Xn=On(h({},jn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qn})),Zn=On(h({},kn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Qn=On(h({},In,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),$n=On(h({},kn,{newState:0,oldState:0})),er=[9,13,27,32],tr=vn&&`CompositionEvent`in window,nr=null;vn&&`documentMode`in document&&(nr=document.documentMode);var rr=vn&&`TextEvent`in window&&!nr,ir=vn&&(!tr||nr&&8<nr&&11>=nr),ar=` `,or=!1;function sr(e,t){switch(e){case`keyup`:return er.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function cr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var lr=!1;function ur(e,t){switch(e){case`compositionend`:return cr(t);case`keypress`:return t.which===32?(or=!0,ar):null;case`textInput`:return e=t.data,e===ar&&or?null:e;default:return null}}function dr(e,t){if(lr)return e===`compositionend`||!tr&&sr(e,t)?(e=wn(),Cn=Sn=xn=null,lr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return ir&&t.locale!==`ko`?null:t.data;default:return null}}var fr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function pr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!fr[e.type]:t===`textarea`}function mr(e,t,n,r){fn?pn?pn.push(r):pn=[r]:fn=r,t=Ud(t,`onChange`),0<t.length&&(n=new An(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var hr=null,gr=null;function _r(e){Fd(e,0)}function vr(e){if(Wt(Et(e)))return e}function yr(e,t){if(e===`change`)return t}var br=!1;if(vn){var xr;if(vn){var Sr=`oninput`in document;if(!Sr){var Cr=document.createElement(`div`);Cr.setAttribute(`oninput`,`return;`),Sr=typeof Cr.oninput==`function`}xr=Sr}else xr=!1;br=xr&&(!document.documentMode||9<document.documentMode)}function wr(){hr&&(hr.detachEvent(`onpropertychange`,Tr),gr=hr=null)}function Tr(e){if(e.propertyName===`value`&&vr(gr)){var t=[];mr(t,gr,e,dn(e)),gn(_r,t)}}function Er(e,t,n){e===`focusin`?(wr(),hr=t,gr=n,hr.attachEvent(`onpropertychange`,Tr)):e===`focusout`&&wr()}function Dr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return vr(gr)}function Or(e,t){if(e===`click`)return vr(t)}function kr(e,t){if(e===`input`||e===`change`)return vr(t)}function Ar(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var jr=typeof Object.is==`function`?Object.is:Ar;function Mr(e,t){if(jr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!ke.call(t,a)||!jr(e[a],t[a]))return!1}return!0}function Nr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Pr(e,t){var n=Nr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Nr(n)}}function Fr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ir(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Gt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Gt(e.document)}return t}function Lr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Rr=vn&&`documentMode`in document&&11>=document.documentMode,zr=null,Br=null,Vr=null,Hr=!1;function Ur(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Hr||zr==null||zr!==Gt(r)||(r=zr,`selectionStart`in r&&Lr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vr&&Mr(Vr,r)||(Vr=r,r=Ud(Br,`onSelect`),0<r.length&&(t=new An(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=zr)))}function Wr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Gr={animationend:Wr(`Animation`,`AnimationEnd`),animationiteration:Wr(`Animation`,`AnimationIteration`),animationstart:Wr(`Animation`,`AnimationStart`),transitionrun:Wr(`Transition`,`TransitionRun`),transitionstart:Wr(`Transition`,`TransitionStart`),transitioncancel:Wr(`Transition`,`TransitionCancel`),transitionend:Wr(`Transition`,`TransitionEnd`)},Kr={},qr={};vn&&(qr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Gr.animationend.animation,delete Gr.animationiteration.animation,delete Gr.animationstart.animation),`TransitionEvent`in window||delete Gr.transitionend.transition);function Jr(e){if(Kr[e])return Kr[e];if(!Gr[e])return e;var t=Gr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in qr)return Kr[e]=t[n];return e}var Yr=Jr(`animationend`),Xr=Jr(`animationiteration`),Zr=Jr(`animationstart`),Qr=Jr(`transitionrun`),$r=Jr(`transitionstart`),ei=Jr(`transitioncancel`),ti=Jr(`transitionend`),ni=new Map,ri=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);ri.push(`scrollEnd`);function ii(e,t){ni.set(e,t),jt(t,[e])}var ai=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)},oi=[],si=0,ci=0;function li(){for(var e=si,t=ci=si=0;t<e;){var n=oi[t];oi[t++]=null;var r=oi[t];oi[t++]=null;var a=oi[t];oi[t++]=null;var o=oi[t];if(oi[t++]=null,r!==null&&a!==null){var s=r.pending;s===null?a.next=a:(a.next=s.next,s.next=a),r.pending=a}o!==0&&pi(n,a,o)}}function ui(e,t,n,r){oi[si++]=e,oi[si++]=t,oi[si++]=n,oi[si++]=r,ci|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function di(e,t,n,r){return ui(e,t,n,r),mi(e)}function fi(e,t){return ui(e,null,null,t),mi(e)}function pi(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var a=!1,o=e.return;o!==null;)o.childLanes|=n,r=o.alternate,r!==null&&(r.childLanes|=n),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(a=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,a&&t!==null&&(a=31-Ke(n),e=o.hiddenUpdates,r=e[a],r===null?e[a]=[t]:r.push(t),t.lane=n|536870912),o):null}function mi(e){if(50<Du)throw Du=0,Ou=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var hi={};function gi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _i(e,t,n,r){return new gi(e,t,n,r)}function vi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function yi(e,t){var n=e.alternate;return n===null?(n=_i(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function bi(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function xi(e,t,n,r,o,s){var c=0;if(r=e,typeof e==`function`)vi(e)&&(c=1);else if(typeof e==`string`)c=sp(e,n,me.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case te:return e=_i(31,n,t,o),e.elementType=te,e.lanes=s,e;case b:return Si(n.children,o,s,t);case x:c=8,o|=24;break;case S:return e=_i(12,n,t,o|2),e.elementType=S,e.lanes=s,e;case E:return e=_i(13,n,t,o),e.elementType=E,e.lanes=s,e;case D:return e=_i(19,n,t,o),e.elementType=D,e.lanes=s,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case w:c=10;break a;case C:c=9;break a;case T:c=11;break a;case O:c=14;break a;case ee:c=16,r=null;break a}c=29,n=Error(a(130,e===null?`null`:typeof e,``)),r=null}return t=_i(c,n,t,o),t.elementType=e,t.type=r,t.lanes=s,t}function Si(e,t,n,r){return e=_i(7,e,r,t),e.lanes=n,e}function Ci(e,t,n){return e=_i(6,e,null,t),e.lanes=n,e}function wi(e){var t=_i(18,null,null,0);return t.stateNode=e,t}function Ti(e,t,n){return t=_i(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ei=new WeakMap;function Di(e,t){if(typeof e==`object`&&e){var n=Ei.get(e);return n===void 0?(t={value:e,source:t,stack:Oe(t)},Ei.set(e,t),t):n}return{value:e,source:t,stack:Oe(t)}}var Oi=[],ki=0,Ai=null,ji=0,j=[],Mi=0,Ni=null,Pi=1,Fi=``;function Ii(e,t){Oi[ki++]=ji,Oi[ki++]=Ai,Ai=e,ji=t}function Li(e,t,n){j[Mi++]=Pi,j[Mi++]=Fi,j[Mi++]=Ni,Ni=e;var r=Pi;e=Fi;var a=32-Ke(r)-1;r&=~(1<<a),n+=1;var o=32-Ke(t)+a;if(30<o){var s=a-a%5;o=(r&(1<<s)-1).toString(32),r>>=s,a-=s,Pi=1<<32-Ke(t)+a|n<<a|r,Fi=o+e}else Pi=1<<o|n<<a|r,Fi=e}function Ri(e){e.return!==null&&(Ii(e,1),Li(e,1,0))}function zi(e){for(;e===Ai;)Ai=Oi[--ki],Oi[ki]=null,ji=Oi[--ki],Oi[ki]=null;for(;e===Ni;)Ni=j[--Mi],j[Mi]=null,Fi=j[--Mi],j[Mi]=null,Pi=j[--Mi],j[Mi]=null}function Bi(e,t){j[Mi++]=Pi,j[Mi++]=Fi,j[Mi++]=Ni,Pi=t.id,Fi=t.overflow,Ni=e}var Vi=null,Hi=null,Ui=!1,Wi=null,Gi=!1,Ki=Error(a(519));function qi(e){throw M(Di(Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ki}function Ji(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ht]=e,t[gt]=r,n){case`dialog`:Id(`cancel`,t),Id(`close`,t);break;case`iframe`:case`object`:case`embed`:Id(`load`,t);break;case`video`:case`audio`:for(n=0;n<Nd.length;n++)Id(Nd[n],t);break;case`source`:Id(`error`,t);break;case`img`:case`image`:case`link`:Id(`error`,t),Id(`load`,t);break;case`details`:Id(`toggle`,t);break;case`input`:Id(`invalid`,t),Yt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Id(`invalid`,t);break;case`textarea`:Id(`invalid`,t),$t(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Yd(t.textContent,n)?(r.popover!=null&&(Id(`beforetoggle`,t),Id(`toggle`,t)),r.onScroll!=null&&Id(`scroll`,t),r.onScrollEnd!=null&&Id(`scrollend`,t),r.onClick!=null&&(t.onclick=ln),t=!0):t=!1,t||qi(e,!0)}function Yi(e){for(Vi=e.return;Vi;)switch(Vi.tag){case 5:case 31:case 13:Gi=!1;return;case 27:case 3:Gi=!0;return;default:Vi=Vi.return}}function Xi(e){if(e!==Vi)return!1;if(!Ui)return Yi(e),Ui=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||cf(e.type,e.memoizedProps)),n=!n),n&&Hi&&qi(e),Yi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));Hi=Of(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));Hi=Of(e)}else t===27?(t=Hi,gf(e.type)?(e=Df,Df=null,Hi=e):Hi=t):Hi=Vi?Ef(e.stateNode.nextSibling):null;return!0}function Zi(){Hi=Vi=null,Ui=!1}function Qi(){var e=Wi;return e!==null&&(pu===null?pu=e:pu.push.apply(pu,e),Wi=null),e}function M(e){Wi===null?Wi=[e]:Wi.push(e)}var $i=de(null),ea=null,ta=null;function na(e,t,n){pe($i,t._currentValue),t._currentValue=n}function ra(e){e._currentValue=$i.current,fe($i)}function ia(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function aa(e,t,n,r){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var s=o.dependencies;if(s!==null){var c=o.child;s=s.firstContext;a:for(;s!==null;){var l=s;s=o;for(var u=0;u<t.length;u++)if(l.context===t[u]){s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),ia(s.return,n,e),r||(c=null);break a}s=l.next}}else if(o.tag===18){if(c=o.return,c===null)throw Error(a(341));c.lanes|=n,s=c.alternate,s!==null&&(s.lanes|=n),ia(c,n,e),c=null}else c=o.child;if(c!==null)c.return=o;else for(c=o;c!==null;){if(c===e){c=null;break}if(o=c.sibling,o!==null){o.return=c.return,c=o;break}c=c.return}o=c}}function oa(e,t,n,r){e=null;for(var o=t,s=!1;o!==null;){if(!s){if(o.flags&524288)s=!0;else if(o.flags&262144)break}if(o.tag===10){var c=o.alternate;if(c===null)throw Error(a(387));if(c=c.memoizedProps,c!==null){var l=o.type;jr(o.pendingProps.value,c.value)||(e===null?e=[l]:e.push(l))}}else if(o===_e.current){if(c=o.alternate,c===null)throw Error(a(387));c.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e===null?e=[gp]:e.push(gp))}o=o.return}e!==null&&aa(t,e,n,r),t.flags|=262144}function sa(e){for(e=e.firstContext;e!==null;){if(!jr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ca(e){ea=e,ta=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function la(e){return da(ea,e)}function ua(e,t){return ea===null&&ca(e),da(e,t)}function da(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ta===null){if(e===null)throw Error(a(308));ta=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ta=ta.next=t;return n}var fa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},pa=t.unstable_scheduleCallback,ma=t.unstable_NormalPriority,ha={$$typeof:w,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ga(){return{controller:new fa,data:new Map,refCount:0}}function _a(e){e.refCount--,e.refCount===0&&pa(ma,function(){e.controller.abort()})}var va=null,ya=0,ba=0,xa=null;function Sa(e,t){if(va===null){var n=va=[];ya=0,ba=Od(),xa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ya++,t.then(Ca,Ca),t}function Ca(){if(--ya===0&&va!==null){xa!==null&&(xa.status=`fulfilled`);var e=va;va=null,ba=0,xa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function N(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var wa=A.S;A.S=function(e,t){gu=Pe(),typeof t==`object`&&t&&typeof t.then==`function`&&Sa(e,t),wa!==null&&wa(e,t)};var Ta=de(null);function Ea(){var e=Ta.current;return e===null?Zl.pooledCache:e}function Da(e,t){t===null?pe(Ta,Ta.current):pe(Ta,t.pool)}function Oa(){var e=Ea();return e===null?null:{parent:ha._currentValue,pool:e}}var ka=Error(a(460)),Aa=Error(a(474)),ja=Error(a(542)),Ma={then:function(){}};function P(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Na(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(ln,ln),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,La(e),e;default:if(typeof t.status==`string`)t.then(ln,ln);else{if(e=Zl,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,La(e),e}throw Fa=t,ka}}function Pa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Fa=e,ka):e}}var Fa=null;function Ia(){if(Fa===null)throw Error(a(459));var e=Fa;return Fa=null,e}function La(e){if(e===ka||e===ja)throw Error(a(483))}var Ra=null,za=0;function Ba(e){var t=za;return za+=1,Ra===null&&(Ra=[]),Na(Ra,e,t)}function Va(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ha(e,t){throw t.$$typeof===_?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ua(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function o(e,t){return e=yi(e,t),e.index=0,e.sibling=null,e}function s(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function c(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function l(e,t,n,r){return t===null||t.tag!==6?(t=Ci(n,e.mode,r),t.return=e,t):(t=o(t,n),t.return=e,t)}function u(e,t,n,r){var a=n.type;return a===b?f(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===ee&&Pa(a)===t.type)?(t=o(t,n.props),Va(t,n),t.return=e,t):(t=xi(n.type,n.key,n.props,null,e.mode,r),Va(t,n),t.return=e,t)}function d(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Ti(n,e.mode,r),t.return=e,t):(t=o(t,n.children||[]),t.return=e,t)}function f(e,t,n,r,a){return t===null||t.tag!==7?(t=Si(n,e.mode,r,a),t.return=e,t):(t=o(t,n),t.return=e,t)}function p(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ci(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case v:return n=xi(t.type,t.key,t.props,null,e.mode,n),Va(n,t),n.return=e,n;case y:return t=Ti(t,e.mode,n),t.return=e,t;case ee:return t=Pa(t),p(e,t,n)}if(oe(t)||ie(t))return t=Si(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return p(e,Ba(t),n);if(t.$$typeof===w)return p(e,ua(e,t),n);Ha(e,t)}return null}function m(e,t,n,r){var a=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return a===null?l(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case v:return n.key===a?u(e,t,n,r):null;case y:return n.key===a?d(e,t,n,r):null;case ee:return n=Pa(n),m(e,t,n,r)}if(oe(n)||ie(n))return a===null?f(e,t,n,r,null):null;if(typeof n.then==`function`)return m(e,t,Ba(n),r);if(n.$$typeof===w)return m(e,t,ua(e,n),r);Ha(e,n)}return null}function h(e,t,n,r,a){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,l(t,e,``+r,a);if(typeof r==`object`&&r){switch(r.$$typeof){case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,a);case y:return e=e.get(r.key===null?n:r.key)||null,d(t,e,r,a);case ee:return r=Pa(r),h(e,t,n,r,a)}if(oe(r)||ie(r))return e=e.get(n)||null,f(t,e,r,a,null);if(typeof r.then==`function`)return h(e,t,n,Ba(r),a);if(r.$$typeof===w)return h(e,t,n,ua(t,r),a);Ha(t,r)}return null}function g(a,o,c,l){for(var u=null,d=null,f=o,g=o=0,_=null;f!==null&&g<c.length;g++){f.index>g?(_=f,f=null):_=f.sibling;var v=m(a,f,c[g],l);if(v===null){f===null&&(f=_);break}e&&f&&v.alternate===null&&t(a,f),o=s(v,o,g),d===null?u=v:d.sibling=v,d=v,f=_}if(g===c.length)return n(a,f),Ui&&Ii(a,g),u;if(f===null){for(;g<c.length;g++)f=p(a,c[g],l),f!==null&&(o=s(f,o,g),d===null?u=f:d.sibling=f,d=f);return Ui&&Ii(a,g),u}for(f=r(f);g<c.length;g++)_=h(f,a,g,c[g],l),_!==null&&(e&&_.alternate!==null&&f.delete(_.key===null?g:_.key),o=s(_,o,g),d===null?u=_:d.sibling=_,d=_);return e&&f.forEach(function(e){return t(a,e)}),Ui&&Ii(a,g),u}function _(o,c,l,u){if(l==null)throw Error(a(151));for(var d=null,f=null,g=c,_=c=0,v=null,y=l.next();g!==null&&!y.done;_++,y=l.next()){g.index>_?(v=g,g=null):v=g.sibling;var b=m(o,g,y.value,u);if(b===null){g===null&&(g=v);break}e&&g&&b.alternate===null&&t(o,g),c=s(b,c,_),f===null?d=b:f.sibling=b,f=b,g=v}if(y.done)return n(o,g),Ui&&Ii(o,_),d;if(g===null){for(;!y.done;_++,y=l.next())y=p(o,y.value,u),y!==null&&(c=s(y,c,_),f===null?d=y:f.sibling=y,f=y);return Ui&&Ii(o,_),d}for(g=r(g);!y.done;_++,y=l.next())y=h(g,o,_,y.value,u),y!==null&&(e&&y.alternate!==null&&g.delete(y.key===null?_:y.key),c=s(y,c,_),f===null?d=y:f.sibling=y,f=y);return e&&g.forEach(function(e){return t(o,e)}),Ui&&Ii(o,_),d}function x(e,r,s,l){if(typeof s==`object`&&s&&s.type===b&&s.key===null&&(s=s.props.children),typeof s==`object`&&s){switch(s.$$typeof){case v:a:{for(var u=s.key;r!==null;){if(r.key===u){if(u=s.type,u===b){if(r.tag===7){n(e,r.sibling),l=o(r,s.props.children),l.return=e,e=l;break a}}else if(r.elementType===u||typeof u==`object`&&u&&u.$$typeof===ee&&Pa(u)===r.type){n(e,r.sibling),l=o(r,s.props),Va(l,s),l.return=e,e=l;break a}n(e,r);break}else t(e,r);r=r.sibling}s.type===b?(l=Si(s.props.children,e.mode,l,s.key),l.return=e,e=l):(l=xi(s.type,s.key,s.props,null,e.mode,l),Va(l,s),l.return=e,e=l)}return c(e);case y:a:{for(u=s.key;r!==null;){if(r.key===u)if(r.tag===4&&r.stateNode.containerInfo===s.containerInfo&&r.stateNode.implementation===s.implementation){n(e,r.sibling),l=o(r,s.children||[]),l.return=e,e=l;break a}else{n(e,r);break}else t(e,r);r=r.sibling}l=Ti(s,e.mode,l),l.return=e,e=l}return c(e);case ee:return s=Pa(s),x(e,r,s,l)}if(oe(s))return g(e,r,s,l);if(ie(s)){if(u=ie(s),typeof u!=`function`)throw Error(a(150));return s=u.call(s),_(e,r,s,l)}if(typeof s.then==`function`)return x(e,r,Ba(s),l);if(s.$$typeof===w)return x(e,r,ua(e,s),l);Ha(e,s)}return typeof s==`string`&&s!==``||typeof s==`number`||typeof s==`bigint`?(s=``+s,r!==null&&r.tag===6?(n(e,r.sibling),l=o(r,s),l.return=e,e=l):(n(e,r),l=Ci(s,e.mode,l),l.return=e,e=l),c(e)):n(e,r)}return function(e,t,n,r){try{za=0;var a=x(e,t,n,r);return Ra=null,a}catch(t){if(t===ka||t===ja)throw t;var o=_i(29,t,null,e.mode);return o.lanes=r,o.return=e,o}}}var Wa=Ua(!0),Ga=Ua(!1),Ka=!1;function qa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ja(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ya(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Xa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Xl&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,t=mi(e),pi(e,null,n),t}return ui(e,r,t,n),mi(e)}function Za(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ct(e,n)}}function Qa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};o===null?a=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?a=o=t:o=o.next=t}else a=o=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var $a=!1;function eo(){if($a){var e=xa;if(e!==null)throw e}}function to(e,t,n,r){$a=!1;var a=e.updateQueue;Ka=!1;var o=a.firstBaseUpdate,s=a.lastBaseUpdate,c=a.shared.pending;if(c!==null){a.shared.pending=null;var l=c,u=l.next;l.next=null,s===null?o=u:s.next=u,s=l;var d=e.alternate;d!==null&&(d=d.updateQueue,c=d.lastBaseUpdate,c!==s&&(c===null?d.firstBaseUpdate=u:c.next=u,d.lastBaseUpdate=l))}if(o!==null){var f=a.baseState;s=0,d=u=l=null,c=o;do{var p=c.lane&-536870913,m=p!==c.lane;if(m?($l&p)===p:(r&p)===p){p!==0&&p===ba&&($a=!0),d!==null&&(d=d.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});a:{var g=e,_=c;p=t;var v=n;switch(_.tag){case 1:if(g=_.payload,typeof g==`function`){f=g.call(v,f,p);break a}f=g;break a;case 3:g.flags=g.flags&-65537|128;case 0:if(g=_.payload,p=typeof g==`function`?g.call(v,f,p):g,p==null)break a;f=h({},f,p);break a;case 2:Ka=!0}}p=c.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=a.callbacks,m===null?a.callbacks=[p]:m.push(p))}else m={lane:p,tag:c.tag,payload:c.payload,callback:c.callback,next:null},d===null?(u=d=m,l=f):d=d.next=m,s|=p;if(c=c.next,c===null){if(c=a.shared.pending,c===null)break;m=c,c=m.next,m.next=null,a.lastBaseUpdate=m,a.shared.pending=null}}while(1);d===null&&(l=f),a.baseState=l,a.firstBaseUpdate=u,a.lastBaseUpdate=d,o===null&&(a.shared.lanes=0),su|=s,e.lanes=s,e.memoizedState=f}}function no(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function ro(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)no(n[e],t)}var io=de(null),ao=de(0);function oo(e,t){e=au,pe(ao,e),pe(io,t),au=e|t.baseLanes}function so(){pe(ao,au),pe(io,io.current)}function co(){au=ao.current,fe(io),fe(ao)}var lo=de(null),uo=null;function fo(e){var t=e.alternate;pe(_o,_o.current&1),pe(lo,e),uo===null&&(t===null||io.current!==null||t.memoizedState!==null)&&(uo=e)}function po(e){pe(_o,_o.current),pe(lo,e),uo===null&&(uo=e)}function mo(e){e.tag===22?(pe(_o,_o.current),pe(lo,e),uo===null&&(uo=e)):ho(e)}function ho(){pe(_o,_o.current),pe(lo,lo.current)}function go(e){fe(lo),uo===e&&(uo=null),fe(_o)}var _o=de(0);function vo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Cf(n)||wf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var yo=0,bo=null,xo=null,So=null,Co=!1,wo=!1,To=!1,Eo=0,Do=0,Oo=null,ko=0;function Ao(){throw Error(a(321))}function jo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!jr(e[n],t[n]))return!1;return!0}function Mo(e,t,n,r,a,o){return yo=o,bo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Js:Ys,To=!1,o=n(r,a),To=!1,wo&&(o=Po(t,n,r,a)),No(e),o}function No(e){A.H=qs;var t=xo!==null&&xo.next!==null;if(yo=0,So=xo=bo=null,Co=!1,Do=0,Oo=null,t)throw Error(a(300));e===null||fc||(e=e.dependencies,e!==null&&sa(e)&&(fc=!0))}function Po(e,t,n,r){bo=e;var o=0;do{if(wo&&(Oo=null),Do=0,wo=!1,25<=o)throw Error(a(301));if(o+=1,So=xo=null,e.updateQueue!=null){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}A.H=Xs,s=t(n,r)}while(wo);return s}function Fo(){var e=A.H,t=e.useState()[0];return t=typeof t.then==`function`?Ho(t):t,e=e.useState()[0],(xo===null?null:xo.memoizedState)!==e&&(bo.flags|=1024),t}function Io(){var e=Eo!==0;return Eo=0,e}function Lo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Ro(e){if(Co){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Co=!1}yo=0,So=xo=bo=null,wo=!1,Do=Eo=0,Oo=null}function zo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return So===null?bo.memoizedState=So=e:So=So.next=e,So}function Bo(){if(xo===null){var e=bo.alternate;e=e===null?null:e.memoizedState}else e=xo.next;var t=So===null?bo.memoizedState:So.next;if(t!==null)So=t,xo=e;else{if(e===null)throw bo.alternate===null?Error(a(467)):Error(a(310));xo=e,e={memoizedState:xo.memoizedState,baseState:xo.baseState,baseQueue:xo.baseQueue,queue:xo.queue,next:null},So===null?bo.memoizedState=So=e:So=So.next=e}return So}function Vo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ho(e){var t=Do;return Do+=1,Oo===null&&(Oo=[]),e=Na(Oo,e,t),t=bo,(So===null?t.memoizedState:So.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Js:Ys),e}function Uo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Ho(e);if(e.$$typeof===w)return la(e)}throw Error(a(438,String(e)))}function Wo(e){var t=null,n=bo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=bo.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Vo(),bo.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ne;return t.index++,n}function Go(e,t){return typeof t==`function`?t(e):t}function Ko(e){return qo(Bo(),xo,e)}function qo(e,t,n){var r=e.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=n;var o=e.baseQueue,s=r.pending;if(s!==null){if(o!==null){var c=o.next;o.next=s.next,s.next=c}t.baseQueue=o=s,r.pending=null}if(s=e.baseState,o===null)e.memoizedState=s;else{t=o.next;var l=c=null,u=null,d=t,f=!1;do{var p=d.lane&-536870913;if(p===d.lane?(yo&p)===p:($l&p)===p){var m=d.revertLane;if(m===0)u!==null&&(u=u.next={lane:0,revertLane:0,gesture:null,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),p===ba&&(f=!0);else if((yo&m)===m){d=d.next,m===ba&&(f=!0);continue}else p={lane:0,revertLane:d.revertLane,gesture:null,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},u===null?(l=u=p,c=s):u=u.next=p,bo.lanes|=m,su|=m;p=d.action,To&&n(s,p),s=d.hasEagerState?d.eagerState:n(s,p)}else m={lane:p,revertLane:d.revertLane,gesture:d.gesture,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},u===null?(l=u=m,c=s):u=u.next=m,bo.lanes|=p,su|=p;d=d.next}while(d!==null&&d!==t);if(u===null?c=s:u.next=l,!jr(s,e.memoizedState)&&(fc=!0,f&&(n=xa,n!==null)))throw n;e.memoizedState=s,e.baseState=c,e.baseQueue=u,r.lastRenderedState=s}return o===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Jo(e){var t=Bo(),n=t.queue;if(n===null)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,s=t.memoizedState;if(o!==null){n.pending=null;var c=o=o.next;do s=e(s,c.action),c=c.next;while(c!==o);jr(s,t.memoizedState)||(fc=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function Yo(e,t,n){var r=bo,o=Bo(),s=Ui;if(s){if(n===void 0)throw Error(a(407));n=n()}else n=t();var c=!jr((xo||o).memoizedState,n);if(c&&(o.memoizedState=n,fc=!0),o=o.queue,ys(Qo.bind(null,r,o,e),[e]),o.getSnapshot!==t||c||So!==null&&So.memoizedState.tag&1){if(r.flags|=2048,ms(9,{destroy:void 0},Zo.bind(null,r,o,n,t),null),Zl===null)throw Error(a(349));s||yo&127||Xo(r,t,n)}return n}function Xo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=bo.updateQueue,t===null?(t=Vo(),bo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Zo(e,t,n,r){t.value=n,t.getSnapshot=r,$o(t)&&es(e)}function Qo(e,t,n){return n(function(){$o(t)&&es(e)})}function $o(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!jr(e,n)}catch{return!0}}function es(e){var t=fi(e,2);t!==null&&ju(t,e,2)}function ts(e){var t=zo();if(typeof e==`function`){var n=e;if(e=n(),To){Ge(!0);try{n()}finally{Ge(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:e},t}function ns(e,t,n,r){return e.baseState=n,qo(e,xo,typeof r==`function`?r:Go)}function rs(e,t,n,r,o){if(Ws(e))throw Error(a(485));if(e=t.action,e!==null){var s={payload:o,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){s.listeners.push(e)}};A.T===null?s.isTransition=!1:n(!0),r(s),n=t.pending,n===null?(s.next=t.pending=s,is(t,s)):(s.next=n.next,t.pending=n.next=s)}}function is(e,t){var n=t.action,r=t.payload,a=e.state;if(t.isTransition){var o=A.T,s={};A.T=s;try{var c=n(a,r),l=A.S;l!==null&&l(s,c),as(e,t,c)}catch(n){ss(e,t,n)}finally{o!==null&&s.types!==null&&(o.types=s.types),A.T=o}}else try{o=n(a,r),as(e,t,o)}catch(n){ss(e,t,n)}}function as(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){os(e,t,n)},function(n){return ss(e,t,n)}):os(e,t,n)}function os(e,t,n){t.status=`fulfilled`,t.value=n,cs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,is(e,n)))}function ss(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,cs(t),t=t.next;while(t!==r)}e.action=null}function cs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ls(e,t){return t}function us(e,t){if(Ui){var n=Zl.formState;if(n!==null){a:{var r=bo;if(Ui){if(Hi){b:{for(var a=Hi,o=Gi;a.nodeType!==8;){if(!o){a=null;break b}if(a=Ef(a.nextSibling),a===null){a=null;break b}}o=a.data,a=o===`F!`||o===`F`?a:null}if(a){Hi=Ef(a.nextSibling),r=a.data===`F!`;break a}}qi(r)}r=!1}r&&(t=n[0])}}return n=zo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ls,lastRenderedState:t},n.queue=r,n=Vs.bind(null,bo,r),r.dispatch=n,r=ts(!1),o=Us.bind(null,bo,!1,r.queue),r=zo(),a={state:t,dispatch:null,action:e,pending:null},r.queue=a,n=rs.bind(null,bo,a,o,n),a.dispatch=n,r.memoizedState=e,[t,n,!1]}function ds(e){return F(Bo(),xo,e)}function F(e,t,n){if(t=qo(e,t,ls)[0],e=Ko(Go)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Ho(t)}catch(e){throw e===ka?ja:e}else r=t;t=Bo();var a=t.queue,o=a.dispatch;return n!==t.memoizedState&&(bo.flags|=2048,ms(9,{destroy:void 0},fs.bind(null,a,n),null)),[r,o,e]}function fs(e,t){e.action=t}function ps(e){var t=Bo(),n=xo;if(n!==null)return F(t,n,e);Bo(),t=t.memoizedState,n=Bo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ms(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=bo.updateQueue,t===null&&(t=Vo(),bo.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function hs(){return Bo().memoizedState}function gs(e,t,n,r){var a=zo();bo.flags|=e,a.memoizedState=ms(1|t,{destroy:void 0},n,r===void 0?null:r)}function _s(e,t,n,r){var a=Bo();r=r===void 0?null:r;var o=a.memoizedState.inst;xo!==null&&r!==null&&jo(r,xo.memoizedState.deps)?a.memoizedState=ms(t,o,n,r):(bo.flags|=e,a.memoizedState=ms(1|t,o,n,r))}function vs(e,t){gs(8390656,8,e,t)}function ys(e,t){_s(2048,8,e,t)}function bs(e){bo.flags|=4;var t=bo.updateQueue;if(t===null)t=Vo(),bo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function xs(e){var t=Bo().memoizedState;return bs({ref:t,nextImpl:e}),function(){if(Xl&2)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Ss(e,t){return _s(4,2,e,t)}function Cs(e,t){return _s(4,4,e,t)}function ws(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ts(e,t,n){n=n==null?null:n.concat([e]),_s(4,4,ws.bind(null,t,e),n)}function Es(){}function Ds(e,t){var n=Bo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&jo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Os(e,t){var n=Bo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&jo(t,r[1]))return r[0];if(r=e(),To){Ge(!0);try{e()}finally{Ge(!1)}}return n.memoizedState=[r,t],r}function ks(e,t,n){return n===void 0||yo&1073741824&&!($l&261930)?e.memoizedState=t:(e.memoizedState=n,e=Au(),bo.lanes|=e,su|=e,n)}function As(e,t,n,r){return jr(n,t)?n:io.current===null?!(yo&42)||yo&1073741824&&!($l&261930)?(fc=!0,e.memoizedState=n):(e=Au(),bo.lanes|=e,su|=e,t):(e=ks(e,n,r),jr(e,t)||(fc=!0),e)}function js(e,t,n,r,a){var o=se.p;se.p=o!==0&&8>o?o:8;var s=A.T,c={};A.T=c,Us(e,!1,t,n);try{var l=a(),u=A.S;u!==null&&u(c,l),typeof l==`object`&&l&&typeof l.then==`function`?Hs(e,t,N(l,r),ku(e)):Hs(e,t,r,ku(e))}catch(n){Hs(e,t,{then:function(){},status:`rejected`,reason:n},ku())}finally{se.p=o,s!==null&&c.types!==null&&(s.types=c.types),A.T=s}}function Ms(){}function Ns(e,t,n,r){if(e.tag!==5)throw Error(a(476));var o=Ps(e).queue;js(e,o,t,ce,n===null?Ms:function(){return Fs(e),n(r)})}function Ps(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:ce},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Fs(e){var t=Ps(e);t.next===null&&(t=e.alternate.memoizedState),Hs(e,t.next.queue,{},ku())}function Is(){return la(gp)}function Ls(){return Bo().memoizedState}function Rs(){return Bo().memoizedState}function zs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=ku();e=Ya(n);var r=Xa(t,e,n);r!==null&&(ju(r,t,n),Za(r,t,n)),t={cache:ga()},e.payload=t;return}t=t.return}}function Bs(e,t,n){var r=ku();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ws(e)?Gs(t,n):(n=di(e,t,n,r),n!==null&&(ju(n,e,r),Ks(n,t,r)))}function Vs(e,t,n){Hs(e,t,n,ku())}function Hs(e,t,n,r){var a={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ws(e))Gs(t,a);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,c=o(s,n);if(a.hasEagerState=!0,a.eagerState=c,jr(c,s))return ui(e,t,a,0),Zl===null&&li(),!1}catch{}if(n=di(e,t,a,r),n!==null)return ju(n,e,r),Ks(n,t,r),!0}return!1}function Us(e,t,n,r){if(r={lane:2,revertLane:Od(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ws(e)){if(t)throw Error(a(479))}else t=di(e,n,r,2),t!==null&&ju(t,e,2)}function Ws(e){var t=e.alternate;return e===bo||t!==null&&t===bo}function Gs(e,t){wo=Co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ks(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ct(e,n)}}var qs={readContext:la,use:Uo,useCallback:Ao,useContext:Ao,useEffect:Ao,useImperativeHandle:Ao,useLayoutEffect:Ao,useInsertionEffect:Ao,useMemo:Ao,useReducer:Ao,useRef:Ao,useState:Ao,useDebugValue:Ao,useDeferredValue:Ao,useTransition:Ao,useSyncExternalStore:Ao,useId:Ao,useHostTransitionStatus:Ao,useFormState:Ao,useActionState:Ao,useOptimistic:Ao,useMemoCache:Ao,useCacheRefresh:Ao};qs.useEffectEvent=Ao;var Js={readContext:la,use:Uo,useCallback:function(e,t){return zo().memoizedState=[e,t===void 0?null:t],e},useContext:la,useEffect:vs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),gs(4194308,4,ws.bind(null,t,e),n)},useLayoutEffect:function(e,t){return gs(4194308,4,e,t)},useInsertionEffect:function(e,t){gs(4,2,e,t)},useMemo:function(e,t){var n=zo();t=t===void 0?null:t;var r=e();if(To){Ge(!0);try{e()}finally{Ge(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=zo();if(n!==void 0){var a=n(t);if(To){Ge(!0);try{n(t)}finally{Ge(!1)}}}else a=t;return r.memoizedState=r.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},r.queue=e,e=e.dispatch=Bs.bind(null,bo,e),[r.memoizedState,e]},useRef:function(e){var t=zo();return e={current:e},t.memoizedState=e},useState:function(e){e=ts(e);var t=e.queue,n=Vs.bind(null,bo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Es,useDeferredValue:function(e,t){return ks(zo(),e,t)},useTransition:function(){var e=ts(!1);return e=js.bind(null,bo,e.queue,!0,!1),zo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=bo,o=zo();if(Ui){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),Zl===null)throw Error(a(349));$l&127||Xo(r,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,vs(Qo.bind(null,r,s,e),[e]),r.flags|=2048,ms(9,{destroy:void 0},Zo.bind(null,r,s,n,t),null),n},useId:function(){var e=zo(),t=Zl.identifierPrefix;if(Ui){var n=Fi,r=Pi;n=(r&~(1<<32-Ke(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Eo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=ko++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Is,useFormState:us,useActionState:us,useOptimistic:function(e){var t=zo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Us.bind(null,bo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Wo,useCacheRefresh:function(){return zo().memoizedState=zs.bind(null,bo)},useEffectEvent:function(e){var t=zo(),n={impl:e};return t.memoizedState=n,function(){if(Xl&2)throw Error(a(440));return n.impl.apply(void 0,arguments)}}},Ys={readContext:la,use:Uo,useCallback:Ds,useContext:la,useEffect:ys,useImperativeHandle:Ts,useInsertionEffect:Ss,useLayoutEffect:Cs,useMemo:Os,useReducer:Ko,useRef:hs,useState:function(){return Ko(Go)},useDebugValue:Es,useDeferredValue:function(e,t){return As(Bo(),xo.memoizedState,e,t)},useTransition:function(){var e=Ko(Go)[0],t=Bo().memoizedState;return[typeof e==`boolean`?e:Ho(e),t]},useSyncExternalStore:Yo,useId:Ls,useHostTransitionStatus:Is,useFormState:ds,useActionState:ds,useOptimistic:function(e,t){return ns(Bo(),xo,e,t)},useMemoCache:Wo,useCacheRefresh:Rs};Ys.useEffectEvent=xs;var Xs={readContext:la,use:Uo,useCallback:Ds,useContext:la,useEffect:ys,useImperativeHandle:Ts,useInsertionEffect:Ss,useLayoutEffect:Cs,useMemo:Os,useReducer:Jo,useRef:hs,useState:function(){return Jo(Go)},useDebugValue:Es,useDeferredValue:function(e,t){var n=Bo();return xo===null?ks(n,e,t):As(n,xo.memoizedState,e,t)},useTransition:function(){var e=Jo(Go)[0],t=Bo().memoizedState;return[typeof e==`boolean`?e:Ho(e),t]},useSyncExternalStore:Yo,useId:Ls,useHostTransitionStatus:Is,useFormState:ps,useActionState:ps,useOptimistic:function(e,t){var n=Bo();return xo===null?(n.baseState=e,[e,n.queue.dispatch]):ns(n,xo,e,t)},useMemoCache:Wo,useCacheRefresh:Rs};Xs.useEffectEvent=xs;function Zs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Qs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ku(),a=Ya(r);a.payload=t,n!=null&&(a.callback=n),t=Xa(e,a,r),t!==null&&(ju(t,e,r),Za(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ku(),a=Ya(r);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Xa(e,a,r),t!==null&&(ju(t,e,r),Za(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ku(),r=Ya(n);r.tag=2,t!=null&&(r.callback=t),t=Xa(e,r,n),t!==null&&(ju(t,e,n),Za(t,e,n))}};function $s(e,t,n,r,a,o,s){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,o,s):t.prototype&&t.prototype.isPureReactComponent?!Mr(n,r)||!Mr(a,o):!0}function ec(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Qs.enqueueReplaceState(t,t.state,null)}function tc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var a in n===t&&(n=h({},n)),e)n[a]===void 0&&(n[a]=e[a]);return n}function nc(e){ai(e)}function rc(e){console.error(e)}function ic(e){ai(e)}function ac(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function oc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function sc(e,t,n){return n=Ya(n),n.tag=3,n.payload={element:null},n.callback=function(){ac(e,t)},n}function cc(e){return e=Ya(e),e.tag=3,e}function lc(e,t,n,r){var a=n.type.getDerivedStateFromError;if(typeof a==`function`){var o=r.value;e.payload=function(){return a(o)},e.callback=function(){oc(t,n,r)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch==`function`&&(e.callback=function(){oc(t,n,r),typeof a!=`function`&&(yu===null?yu=new Set([this]):yu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function uc(e,t,n,r,o){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&oa(t,n,o,!0),n=lo.current,n!==null){switch(n.tag){case 31:case 13:return uo===null?Uu():n.alternate===null&&ou===0&&(ou=3),n.flags&=-257,n.flags|=65536,n.lanes=o,r===Ma?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),cd(e,r,o)),!1;case 22:return n.flags|=65536,r===Ma?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),cd(e,r,o)),!1}throw Error(a(435,n.tag))}return cd(e,r,o),Uu(),!1}if(Ui)return t=lo.current,t===null?(r!==Ki&&(t=Error(a(423),{cause:r}),M(Di(t,n))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,r=Di(r,n),o=sc(e.stateNode,r,o),Qa(e,o),ou!==4&&(ou=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=o,r!==Ki&&(e=Error(a(422),{cause:r}),M(Di(e,n)))),!1;var s=Error(a(520),{cause:r});if(s=Di(s,n),fu===null?fu=[s]:fu.push(s),ou!==4&&(ou=2),t===null)return!0;r=Di(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,e=sc(n.stateNode,r,e),Qa(n,e),!1;case 1:if(t=n.type,s=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||s!==null&&typeof s.componentDidCatch==`function`&&(yu===null||!yu.has(s))))return n.flags|=65536,o&=-o,n.lanes|=o,o=cc(o),lc(o,e,n,r),Qa(n,o),!1}n=n.return}while(n!==null);return!1}var dc=Error(a(461)),fc=!1;function pc(e,t,n,r){t.child=e===null?Ga(t,null,n,r):Wa(t,e.child,n,r)}function mc(e,t,n,r,a){n=n.render;var o=t.ref;if(`ref`in r){var s={};for(var c in r)c!==`ref`&&(s[c]=r[c])}else s=r;return ca(t),r=Mo(e,t,n,s,o,a),c=Io(),e!==null&&!fc?(Lo(e,t,a),Rc(e,t,a)):(Ui&&c&&Ri(t),t.flags|=1,pc(e,t,r,a),t.child)}function hc(e,t,n,r,a){if(e===null){var o=n.type;return typeof o==`function`&&!vi(o)&&o.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=o,gc(e,t,o,r,a)):(e=xi(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!zc(e,a)){var s=o.memoizedProps;if(n=n.compare,n=n===null?Mr:n,n(s,r)&&e.ref===t.ref)return Rc(e,t,a)}return t.flags|=1,e=yi(o,r),e.ref=t.ref,e.return=t,t.child=e}function gc(e,t,n,r,a){if(e!==null){var o=e.memoizedProps;if(Mr(o,r)&&e.ref===t.ref)if(fc=!1,t.pendingProps=r=o,zc(e,a))e.flags&131072&&(fc=!0);else return t.lanes=e.lanes,Rc(e,t,a)}return wc(e,t,n,r,a)}function _c(e,t,n,r){var a=r.children,o=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(o=o===null?n:o.baseLanes|n,e!==null){for(r=t.child=e.child,a=0;r!==null;)a=a|r.lanes|r.childLanes,r=r.sibling;r=a&~o}else r=0,t.child=null;return yc(e,t,o,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Da(t,o===null?null:o.cachePool),o===null?so():oo(t,o),mo(t);else return r=t.lanes=536870912,yc(e,t,o===null?n:o.baseLanes|n,n,r)}else o===null?(e!==null&&Da(t,null),so(),ho(t)):(Da(t,o.cachePool),oo(t,o),ho(t),t.memoizedState=null);return pc(e,t,a,n),t.child}function vc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function yc(e,t,n,r,a){var o=Ea();return o=o===null?null:{parent:ha._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},e!==null&&Da(t,null),so(),mo(t),e!==null&&oa(e,t,r,!0),t.childLanes=a,null}function bc(e,t){return t=Nc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function xc(e,t,n){return Wa(t,e.child,null,n),e=bc(t,t.pendingProps),e.flags|=2,go(t),t.memoizedState=null,e}function Sc(e,t,n){var r=t.pendingProps,o=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Ui){if(r.mode===`hidden`)return e=bc(t,r),t.lanes=536870912,vc(null,e);if(po(t),(e=Hi)?(e=Sf(e,Gi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ni===null?null:{id:Pi,overflow:Fi},retryLane:536870912,hydrationErrors:null},n=wi(e),n.return=t,t.child=n,Vi=t,Hi=null)):e=null,e===null)throw qi(t);return t.lanes=536870912,null}return bc(t,r)}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(po(t),o)if(t.flags&256)t.flags&=-257,t=xc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(fc||oa(e,t,n,!1),o=(n&e.childLanes)!==0,fc||o){if(r=Zl,r!==null&&(c=lt(r,n),c!==0&&c!==s.retryLane))throw s.retryLane=c,fi(e,c),ju(r,e,c),dc;Uu(),t=xc(e,t,n)}else e=s.treeContext,Hi=Ef(c.nextSibling),Vi=t,Ui=!0,Wi=null,Gi=!1,e!==null&&Bi(t,e),t=bc(t,r),t.flags|=4096;return t}return e=yi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Cc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(a(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function wc(e,t,n,r,a){return ca(t),n=Mo(e,t,n,r,void 0,a),r=Io(),e!==null&&!fc?(Lo(e,t,a),Rc(e,t,a)):(Ui&&r&&Ri(t),t.flags|=1,pc(e,t,n,a),t.child)}function Tc(e,t,n,r,a,o){return ca(t),t.updateQueue=null,n=Po(t,r,n,a),No(e),r=Io(),e!==null&&!fc?(Lo(e,t,o),Rc(e,t,o)):(Ui&&r&&Ri(t),t.flags|=1,pc(e,t,n,o),t.child)}function Ec(e,t,n,r,a){if(ca(t),t.stateNode===null){var o=hi,s=n.contextType;typeof s==`object`&&s&&(o=la(s)),o=new n(r,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Qs,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=r,o.state=t.memoizedState,o.refs={},qa(t),s=n.contextType,o.context=typeof s==`object`&&s?la(s):hi,o.state=t.memoizedState,s=n.getDerivedStateFromProps,typeof s==`function`&&(Zs(t,n,s,r),o.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof o.getSnapshotBeforeUpdate==`function`||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(s=o.state,typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount(),s!==o.state&&Qs.enqueueReplaceState(o,o.state,null),to(t,r,o,a),eo(),o.state=t.memoizedState),typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){o=t.stateNode;var c=t.memoizedProps,l=tc(n,c);o.props=l;var u=o.context,d=n.contextType;s=hi,typeof d==`object`&&d&&(s=la(d));var f=n.getDerivedStateFromProps;d=typeof f==`function`||typeof o.getSnapshotBeforeUpdate==`function`,c=t.pendingProps!==c,d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(c||u!==s)&&ec(t,o,r,s),Ka=!1;var p=t.memoizedState;o.state=p,to(t,r,o,a),eo(),u=t.memoizedState,c||p!==u||Ka?(typeof f==`function`&&(Zs(t,n,f,r),u=t.memoizedState),(l=Ka||$s(t,n,l,r,p,u,s))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),o.props=r,o.state=u,o.context=s,r=l):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Ja(e,t),s=t.memoizedProps,d=tc(n,s),o.props=d,f=t.pendingProps,p=o.context,u=n.contextType,l=hi,typeof u==`object`&&u&&(l=la(u)),c=n.getDerivedStateFromProps,(u=typeof c==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==f||p!==l)&&ec(t,o,r,l),Ka=!1,p=t.memoizedState,o.state=p,to(t,r,o,a),eo();var m=t.memoizedState;s!==f||p!==m||Ka||e!==null&&e.dependencies!==null&&sa(e.dependencies)?(typeof c==`function`&&(Zs(t,n,c,r),m=t.memoizedState),(d=Ka||$s(t,n,d,r,p,m,l)||e!==null&&e.dependencies!==null&&sa(e.dependencies))?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,l),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,l)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=l,r=d):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return o=r,Cc(e,t),r=(t.flags&128)!=0,o||r?(o=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:o.render(),t.flags|=1,e!==null&&r?(t.child=Wa(t,e.child,null,a),t.child=Wa(t,null,n,a)):pc(e,t,n,a),t.memoizedState=o.state,e=t.child):e=Rc(e,t,a),e}function Dc(e,t,n,r){return Zi(),t.flags|=256,pc(e,t,n,r),t.child}var Oc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function kc(e){return{baseLanes:e,cachePool:Oa()}}function Ac(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=uu),e}function jc(e,t,n){var r=t.pendingProps,o=!1,s=(t.flags&128)!=0,c;if((c=s)||(c=e!==null&&e.memoizedState===null?!1:(_o.current&2)!=0),c&&(o=!0,t.flags&=-129),c=(t.flags&32)!=0,t.flags&=-33,e===null){if(Ui){if(o?fo(t):ho(t),(e=Hi)?(e=Sf(e,Gi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ni===null?null:{id:Pi,overflow:Fi},retryLane:536870912,hydrationErrors:null},n=wi(e),n.return=t,t.child=n,Vi=t,Hi=null)):e=null,e===null)throw qi(t);return wf(e)?t.lanes=32:t.lanes=536870912,null}var l=r.children;return r=r.fallback,o?(ho(t),o=t.mode,l=Nc({mode:`hidden`,children:l},o),r=Si(r,o,n,null),l.return=t,r.return=t,l.sibling=r,t.child=l,r=t.child,r.memoizedState=kc(n),r.childLanes=Ac(e,c,n),t.memoizedState=Oc,vc(null,r)):(fo(t),Mc(t,l))}var u=e.memoizedState;if(u!==null&&(l=u.dehydrated,l!==null)){if(s)t.flags&256?(fo(t),t.flags&=-257,t=Pc(e,t,n)):t.memoizedState===null?(ho(t),l=r.fallback,o=t.mode,r=Nc({mode:`visible`,children:r.children},o),l=Si(l,o,n,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,Wa(t,e.child,null,n),r=t.child,r.memoizedState=kc(n),r.childLanes=Ac(e,c,n),t.memoizedState=Oc,t=vc(null,r)):(ho(t),t.child=e.child,t.flags|=128,t=null);else if(fo(t),wf(l)){if(c=l.nextSibling&&l.nextSibling.dataset,c)var d=c.dgst;c=d,r=Error(a(419)),r.stack=``,r.digest=c,M({value:r,source:null,stack:null}),t=Pc(e,t,n)}else if(fc||oa(e,t,n,!1),c=(n&e.childLanes)!==0,fc||c){if(c=Zl,c!==null&&(r=lt(c,n),r!==0&&r!==u.retryLane))throw u.retryLane=r,fi(e,r),ju(c,e,r),dc;Cf(l)||Uu(),t=Pc(e,t,n)}else Cf(l)?(t.flags|=192,t.child=e.child,t=null):(e=u.treeContext,Hi=Ef(l.nextSibling),Vi=t,Ui=!0,Wi=null,Gi=!1,e!==null&&Bi(t,e),t=Mc(t,r.children),t.flags|=4096);return t}return o?(ho(t),l=r.fallback,o=t.mode,u=e.child,d=u.sibling,r=yi(u,{mode:`hidden`,children:r.children}),r.subtreeFlags=u.subtreeFlags&65011712,d===null?(l=Si(l,o,n,null),l.flags|=2):l=yi(d,l),l.return=t,r.return=t,r.sibling=l,t.child=r,vc(null,r),r=t.child,l=e.child.memoizedState,l===null?l=kc(n):(o=l.cachePool,o===null?o=Oa():(u=ha._currentValue,o=o.parent===u?o:{parent:u,pool:u}),l={baseLanes:l.baseLanes|n,cachePool:o}),r.memoizedState=l,r.childLanes=Ac(e,c,n),t.memoizedState=Oc,vc(e.child,r)):(fo(t),n=e.child,e=n.sibling,n=yi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(c=t.deletions,c===null?(t.deletions=[e],t.flags|=16):c.push(e)),t.child=n,t.memoizedState=null,n)}function Mc(e,t){return t=Nc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Nc(e,t){return e=_i(22,e,null,t),e.lanes=0,e}function Pc(e,t,n){return Wa(t,e.child,null,n),e=Mc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Fc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ia(e.return,t,n)}function Ic(e,t,n,r,a,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a,treeForkCount:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=a,s.treeForkCount=o)}function Lc(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;r=r.children;var s=_o.current,c=(s&2)!=0;if(c?(s=s&1|2,t.flags|=128):s&=1,pe(_o,s),pc(e,t,r,n),r=Ui?ji:0,!c&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fc(e,n,t);else if(e.tag===19)Fc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case`forwards`:for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&vo(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Ic(t,!1,a,n,o,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&vo(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Ic(t,!0,n,null,o,r);break;case`together`:Ic(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Rc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),su|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(oa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,n=yi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=yi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function zc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&sa(e))):!0}function Bc(e,t,n){switch(t.tag){case 3:ve(t,t.stateNode.containerInfo),na(t,ha,e.memoizedState.cache),Zi();break;case 27:case 5:be(t);break;case 4:ve(t,t.stateNode.containerInfo);break;case 10:na(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,po(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(fo(t),e=Rc(e,t,n),e===null?null:e.sibling):jc(e,t,n):(fo(t),t.flags|=128,null);fo(t);break;case 19:var a=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(oa(e,t,n,!1),(n&t.childLanes)!==0),a){if(r)return Lc(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),pe(_o,_o.current),r)break;return null;case 22:return t.lanes=0,_c(e,t,n,t.pendingProps);case 24:na(t,ha,e.memoizedState.cache)}return Rc(e,t,n)}function Vc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)fc=!0;else{if(!zc(e,n)&&!(t.flags&128))return fc=!1,Bc(e,t,n);fc=!!(e.flags&131072)}else fc=!1,Ui&&t.flags&1048576&&Li(t,ji,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Pa(t.elementType),t.type=e,typeof e==`function`)vi(e)?(r=tc(e,r),t.tag=1,t=Ec(null,t,e,r,n)):(t.tag=0,t=wc(null,t,e,r,n));else{if(e!=null){var o=e.$$typeof;if(o===T){t.tag=11,t=mc(null,t,e,r,n);break a}else if(o===O){t.tag=14,t=hc(null,t,e,r,n);break a}}throw t=k(e)||e,Error(a(306,t,``))}}return t;case 0:return wc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,o=tc(r,t.pendingProps),Ec(e,t,r,o,n);case 3:a:{if(ve(t,t.stateNode.containerInfo),e===null)throw Error(a(387));r=t.pendingProps;var s=t.memoizedState;o=s.element,Ja(e,t),to(t,r,null,n);var c=t.memoizedState;if(r=c.cache,na(t,ha,r),r!==s.cache&&aa(t,[ha],n,!0),eo(),r=c.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:c.cache},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){t=Dc(e,t,r,n);break a}else if(r!==o){o=Di(Error(a(424)),t),M(o),t=Dc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Hi=Ef(e.firstChild),Vi=t,Ui=!0,Wi=null,Gi=!0,n=Ga(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Zi(),r===o){t=Rc(e,t,n);break a}pc(e,t,r,n)}t=t.child}return t;case 26:return Cc(e,t),e===null?(n=qf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ui||(n=t.type,e=t.pendingProps,r=af(ge.current).createElement(n),r[ht]=t,r[gt]=e,Qd(r,n,e),Ot(r),t.stateNode=r):t.memoizedState=qf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return be(t),e===null&&Ui&&(r=t.stateNode=Af(t.type,t.pendingProps,ge.current),Vi=t,Gi=!0,o=Hi,gf(t.type)?(Df=o,Hi=Ef(r.firstChild)):Hi=o),pc(e,t,t.pendingProps.children,n),Cc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ui&&((o=r=Hi)&&(r=bf(r,t.type,t.pendingProps,Gi),r===null?o=!1:(t.stateNode=r,Vi=t,Hi=Ef(r.firstChild),Gi=!1,o=!0)),o||qi(t)),be(t),o=t.type,s=t.pendingProps,c=e===null?null:e.memoizedProps,r=s.children,cf(o,s)?r=null:c!==null&&cf(o,c)&&(t.flags|=32),t.memoizedState!==null&&(o=Mo(e,t,Fo,null,null,n),gp._currentValue=o),Cc(e,t),pc(e,t,r,n),t.child;case 6:return e===null&&Ui&&((e=n=Hi)&&(n=xf(n,t.pendingProps,Gi),n===null?e=!1:(t.stateNode=n,Vi=t,Hi=null,e=!0)),e||qi(t)),null;case 13:return jc(e,t,n);case 4:return ve(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Wa(t,null,r,n):pc(e,t,r,n),t.child;case 11:return mc(e,t,t.type,t.pendingProps,n);case 7:return pc(e,t,t.pendingProps,n),t.child;case 8:return pc(e,t,t.pendingProps.children,n),t.child;case 12:return pc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,na(t,t.type,r.value),pc(e,t,r.children,n),t.child;case 9:return o=t.type._context,r=t.pendingProps.children,ca(t),o=la(o),r=r(o),t.flags|=1,pc(e,t,r,n),t.child;case 14:return hc(e,t,t.type,t.pendingProps,n);case 15:return gc(e,t,t.type,t.pendingProps,n);case 19:return Lc(e,t,n);case 31:return Sc(e,t,n);case 22:return _c(e,t,n,t.pendingProps);case 24:return ca(t),r=la(ha),e===null?(o=Ea(),o===null&&(o=Zl,s=ga(),o.pooledCache=s,s.refCount++,s!==null&&(o.pooledCacheLanes|=n),o=s),t.memoizedState={parent:r,cache:o},qa(t),na(t,ha,o)):((e.lanes&n)!==0&&(Ja(e,t),to(t,null,null,n),eo()),o=e.memoizedState,s=t.memoizedState,o.parent===r?(r=s.cache,na(t,ha,r),r!==o.cache&&aa(t,[ha],n,!0)):(o={parent:r,cache:r},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),na(t,ha,r))),pc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function Hc(e){e.flags|=4}function Uc(e,t,n,r,a){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(a&335544128)===a)if(e.stateNode.complete)e.flags|=8192;else if(Bu())e.flags|=8192;else throw Fa=Ma,Aa}else e.flags&=-16777217}function Wc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!cp(t))if(Bu())e.flags|=8192;else throw Fa=Ma,Aa}function Gc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:rt(),e.lanes|=t,du|=t)}function Kc(e,t){if(!Ui)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function qc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&65011712,r|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Jc(e,t,n){var r=t.pendingProps;switch(zi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qc(t),null;case 1:return qc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ra(ha),ye(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Xi(t)?Hc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Qi())),qc(t),null;case 26:var o=t.type,s=t.memoizedState;return e===null?(Hc(t),s===null?(qc(t),Uc(t,o,null,r,n)):(qc(t),Wc(t,s))):s?s===e.memoizedState?(qc(t),t.flags&=-16777217):(Hc(t),qc(t),Wc(t,s)):(e=e.memoizedProps,e!==r&&Hc(t),qc(t),Uc(t,o,e,r,n)),null;case 27:if(xe(t),n=ge.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Hc(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return qc(t),null}e=me.current,Xi(t)?Ji(t,e):(e=Af(o,r,n),t.stateNode=e,Hc(t))}return qc(t),null;case 5:if(xe(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Hc(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return qc(t),null}if(s=me.current,Xi(t))Ji(t,s);else{var c=af(ge.current);switch(s){case 1:s=c.createElementNS(`http://www.w3.org/2000/svg`,o);break;case 2:s=c.createElementNS(`http://www.w3.org/1998/Math/MathML`,o);break;default:switch(o){case`svg`:s=c.createElementNS(`http://www.w3.org/2000/svg`,o);break;case`math`:s=c.createElementNS(`http://www.w3.org/1998/Math/MathML`,o);break;case`script`:s=c.createElement(`div`),s.innerHTML=`<script><\/script>`,s=s.removeChild(s.firstChild);break;case`select`:s=typeof r.is==`string`?c.createElement(`select`,{is:r.is}):c.createElement(`select`),r.multiple?s.multiple=!0:r.size&&(s.size=r.size);break;default:s=typeof r.is==`string`?c.createElement(o,{is:r.is}):c.createElement(o)}}s[ht]=t,s[gt]=r;a:for(c=t.child;c!==null;){if(c.tag===5||c.tag===6)s.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===t)break a;for(;c.sibling===null;){if(c.return===null||c.return===t)break a;c=c.return}c.sibling.return=c.return,c=c.sibling}t.stateNode=s;a:switch(Qd(s,o,r),o){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Hc(t)}}return qc(t),Uc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Hc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=ge.current,Xi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,o=Vi,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}e[ht]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Yd(e.nodeValue,n)),e||qi(t,!0)}else e=af(e).createTextNode(r),e[ht]=t,t.stateNode=e}return qc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Xi(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[ht]=t}else Zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;qc(t),e=!1}else n=Qi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(go(t),t):(go(t),null);if(t.flags&128)throw Error(a(558))}return qc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Xi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(a(318));if(o=t.memoizedState,o=o===null?null:o.dehydrated,!o)throw Error(a(317));o[ht]=t}else Zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;qc(t),o=!1}else o=Qi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(go(t),t):(go(t),null)}return go(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==o&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Gc(t,t.updateQueue),qc(t),null);case 4:return ye(),e===null&&zd(t.stateNode.containerInfo),qc(t),null;case 10:return ra(t.type),qc(t),null;case 19:if(fe(_o),r=t.memoizedState,r===null)return qc(t),null;if(o=(t.flags&128)!=0,s=r.rendering,s===null)if(o)Kc(r,!1);else{if(ou!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=vo(e),s!==null){for(t.flags|=128,Kc(r,!1),e=s.updateQueue,t.updateQueue=e,Gc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)bi(n,e),n=n.sibling;return pe(_o,_o.current&1|2),Ui&&Ii(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Pe()>_u&&(t.flags|=128,o=!0,Kc(r,!1),t.lanes=4194304)}else{if(!o)if(e=vo(s),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Gc(t,e),Kc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!s.alternate&&!Ui)return qc(t),null}else 2*Pe()-r.renderingStartTime>_u&&n!==536870912&&(t.flags|=128,o=!0,Kc(r,!1),t.lanes=4194304);r.isBackwards?(s.sibling=t.child,t.child=s):(e=r.last,e===null?t.child=s:e.sibling=s,r.last=s)}return r.tail===null?(qc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Pe(),e.sibling=null,n=_o.current,pe(_o,o?n&1|2:n&1),Ui&&Ii(t,r.treeForkCount),e);case 22:case 23:return go(t),co(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(qc(t),t.subtreeFlags&6&&(t.flags|=8192)):qc(t),n=t.updateQueue,n!==null&&Gc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&fe(Ta),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ra(ha),qc(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Yc(e,t){switch(zi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ra(ha),ye(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return xe(t),null;case 31:if(t.memoizedState!==null){if(go(t),t.alternate===null)throw Error(a(340));Zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(go(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fe(_o),null;case 4:return ye(),null;case 10:return ra(t.type),null;case 22:case 23:return go(t),co(),e!==null&&fe(Ta),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ra(ha),null;case 25:return null;default:return null}}function Xc(e,t){switch(zi(t),t.tag){case 3:ra(ha),ye();break;case 26:case 27:case 5:xe(t);break;case 4:ye();break;case 31:t.memoizedState!==null&&go(t);break;case 13:go(t);break;case 19:fe(_o);break;case 10:ra(t.type);break;case 22:case 23:go(t),co(),e!==null&&fe(Ta);break;case 24:ra(ha)}}function Zc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var a=r.next;n=a;do{if((n.tag&e)===e){r=void 0;var o=n.create,s=n.inst;r=o(),s.destroy=r}n=n.next}while(n!==a)}}catch(e){sd(t,t.return,e)}}function Qc(e,t,n){try{var r=t.updateQueue,a=r===null?null:r.lastEffect;if(a!==null){var o=a.next;r=o;do{if((r.tag&e)===e){var s=r.inst,c=s.destroy;if(c!==void 0){s.destroy=void 0,a=t;var l=n,u=c;try{u()}catch(e){sd(a,l,e)}}}r=r.next}while(r!==o)}}catch(e){sd(t,t.return,e)}}function $c(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ro(t,n)}catch(t){sd(e,e.return,t)}}}function el(e,t,n){n.props=tc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){sd(e,t,n)}}function tl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){sd(e,t,n)}}function nl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){sd(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){sd(e,t,n)}else n.current=null}function rl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){sd(e,e.return,t)}}function il(e,t,n){try{var r=e.stateNode;$d(r,e.type,n,t),r[gt]=t}catch(t){sd(e,e.return,t)}}function al(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&gf(e.type)||e.tag===4}function ol(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||al(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&gf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function sl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ln));else if(r!==4&&(r===27&&gf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(sl(e,t,n),e=e.sibling;e!==null;)sl(e,t,n),e=e.sibling}function cl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&gf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(cl(e,t,n),e=e.sibling;e!==null;)cl(e,t,n),e=e.sibling}function ll(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Qd(t,r,n),t[ht]=e,t[gt]=n}catch(t){sd(e,e.return,t)}}var ul=!1,dl=!1,fl=!1,pl=typeof WeakSet==`function`?WeakSet:Set,ml=null;function hl(e,t){if(e=e.containerInfo,nf=Tp,e=Ir(e),Lr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break a}var c=0,l=-1,u=-1,d=0,f=0,p=e,m=null;b:for(;;){for(var h;p!==n||o!==0&&p.nodeType!==3||(l=c+o),p!==s||r!==0&&p.nodeType!==3||(u=c+r),p.nodeType===3&&(c+=p.nodeValue.length),(h=p.firstChild)!==null;)m=p,p=h;for(;;){if(p===e)break b;if(m===n&&++d===o&&(l=c),m===s&&++f===r&&(u=c),(h=p.nextSibling)!==null)break;p=m,m=p.parentNode}p=h}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n||={start:0,end:0}}else n=null;for(rf={focusedElem:e,selectionRange:n},Tp=!1,ml=t;ml!==null;)if(t=ml,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ml=e;else for(;ml!==null;){switch(t=ml,s=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)o=e[n],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&s!==null){e=void 0,n=t,o=s.memoizedProps,s=s.memoizedState,r=n.stateNode;try{var g=tc(n.type,o);e=r.getSnapshotBeforeUpdate(g,s),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){sd(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)yf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:yf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,ml=e;break}ml=t.return}}function gl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:jl(e,n),r&4&&Zc(5,n);break;case 1:if(jl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){sd(n,n.return,e)}else{var a=tc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){sd(n,n.return,e)}}r&64&&$c(n),r&512&&tl(n,n.return);break;case 3:if(jl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{ro(e,t)}catch(e){sd(n,n.return,e)}}break;case 27:t===null&&r&4&&ll(n);case 26:case 5:jl(e,n),t===null&&r&4&&rl(n),r&512&&tl(n,n.return);break;case 12:jl(e,n);break;case 31:jl(e,n),r&4&&Sl(e,n);break;case 13:jl(e,n),r&4&&Cl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=dd.bind(null,n),Tf(e,n))));break;case 22:if(r=n.memoizedState!==null||ul,!r){t=t!==null&&t.memoizedState!==null||dl,a=ul;var o=dl;ul=r,(dl=t)&&!o?Nl(e,n,(n.subtreeFlags&8772)!=0):jl(e,n),ul=a,dl=o}break;case 30:break;default:jl(e,n)}}function _l(e){var t=e.alternate;t!==null&&(e.alternate=null,_l(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ct(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var vl=null,yl=!1;function bl(e,t,n){for(n=n.child;n!==null;)xl(e,t,n),n=n.sibling}function xl(e,t,n){if(We&&typeof We.onCommitFiberUnmount==`function`)try{We.onCommitFiberUnmount(Ue,n)}catch{}switch(n.tag){case 26:dl||nl(n,t),bl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:dl||nl(n,t);var r=vl,a=yl;gf(n.type)&&(vl=n.stateNode,yl=!1),bl(e,t,n),jf(n.stateNode),vl=r,yl=a;break;case 5:dl||nl(n,t);case 6:if(r=vl,a=yl,vl=null,bl(e,t,n),vl=r,yl=a,vl!==null)if(yl)try{(vl.nodeType===9?vl.body:vl.nodeName===`HTML`?vl.ownerDocument.body:vl).removeChild(n.stateNode)}catch(e){sd(n,t,e)}else try{vl.removeChild(n.stateNode)}catch(e){sd(n,t,e)}break;case 18:vl!==null&&(yl?(e=vl,_f(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Zp(e)):_f(vl,n.stateNode));break;case 4:r=vl,a=yl,vl=n.stateNode.containerInfo,yl=!0,bl(e,t,n),vl=r,yl=a;break;case 0:case 11:case 14:case 15:Qc(2,n,t),dl||Qc(4,n,t),bl(e,t,n);break;case 1:dl||(nl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&el(n,t,r)),bl(e,t,n);break;case 21:bl(e,t,n);break;case 22:dl=(r=dl)||n.memoizedState!==null,bl(e,t,n),dl=r;break;default:bl(e,t,n)}}function Sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Zp(e)}catch(e){sd(t,t.return,e)}}}function Cl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Zp(e)}catch(e){sd(t,t.return,e)}}function wl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new pl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new pl),t;default:throw Error(a(435,e.tag))}}function Tl(e,t){var n=wl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=fd.bind(null,e,t);t.then(r,r)}})}function El(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(gf(l.type)){vl=l.stateNode,yl=!1;break a}break;case 5:vl=l.stateNode,yl=!1;break a;case 3:case 4:vl=l.stateNode.containerInfo,yl=!0;break a}l=l.return}if(vl===null)throw Error(a(160));xl(s,c,o),vl=null,yl=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Ol(t,e),t=t.sibling}var Dl=null;function Ol(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:El(t,e),kl(e),r&4&&(Qc(3,e,e.return),Zc(3,e),Qc(5,e,e.return));break;case 1:El(t,e),kl(e),r&512&&(dl||n===null||nl(n,n.return)),r&64&&ul&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var o=Dl;if(El(t,e),kl(e),r&512&&(dl||n===null||nl(n,n.return)),r&4){var s=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,o=o.ownerDocument||o;b:switch(r){case`title`:s=o.getElementsByTagName(`title`)[0],(!s||s[St]||s[ht]||s.namespaceURI===`http://www.w3.org/2000/svg`||s.hasAttribute(`itemprop`))&&(s=o.createElement(r),o.head.insertBefore(s,o.querySelector(`head > title`))),Qd(s,r,n),s[ht]=e,Ot(s),r=s;break a;case`link`:var c=ap(`link`,`href`,o).get(r+(n.href||``));if(c){for(var l=0;l<c.length;l++)if(s=c[l],s.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&s.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&s.getAttribute(`title`)===(n.title==null?null:n.title)&&s.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){c.splice(l,1);break b}}s=o.createElement(r),Qd(s,r,n),o.head.appendChild(s);break;case`meta`:if(c=ap(`meta`,`content`,o).get(r+(n.content||``))){for(l=0;l<c.length;l++)if(s=c[l],s.getAttribute(`content`)===(n.content==null?null:``+n.content)&&s.getAttribute(`name`)===(n.name==null?null:n.name)&&s.getAttribute(`property`)===(n.property==null?null:n.property)&&s.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&s.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){c.splice(l,1);break b}}s=o.createElement(r),Qd(s,r,n),o.head.appendChild(s);break;default:throw Error(a(468,r))}s[ht]=e,Ot(s),r=s}e.stateNode=r}else op(o,e.type,e.stateNode);else e.stateNode=ep(o,r,e.memoizedProps);else s===r?r===null&&e.stateNode!==null&&il(e,e.memoizedProps,n.memoizedProps):(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,r===null?op(o,e.type,e.stateNode):ep(o,r,e.memoizedProps))}break;case 27:El(t,e),kl(e),r&512&&(dl||n===null||nl(n,n.return)),n!==null&&r&4&&il(e,e.memoizedProps,n.memoizedProps);break;case 5:if(El(t,e),kl(e),r&512&&(dl||n===null||nl(n,n.return)),e.flags&32){o=e.stateNode;try{en(o,``)}catch(t){sd(e,e.return,t)}}r&4&&e.stateNode!=null&&(o=e.memoizedProps,il(e,o,n===null?o:n.memoizedProps)),r&1024&&(fl=!0);break;case 6:if(El(t,e),kl(e),r&4){if(e.stateNode===null)throw Error(a(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){sd(e,e.return,t)}}break;case 3:if(ip=null,o=Dl,Dl=Pf(t.containerInfo),El(t,e),Dl=o,kl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Zp(t.containerInfo)}catch(t){sd(e,e.return,t)}fl&&(fl=!1,Al(e));break;case 4:r=Dl,Dl=Pf(e.stateNode.containerInfo),El(t,e),kl(e),Dl=r;break;case 12:El(t,e),kl(e);break;case 31:El(t,e),kl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 13:El(t,e),kl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(hu=Pe()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 22:o=e.memoizedState!==null;var u=n!==null&&n.memoizedState!==null,d=ul,f=dl;if(ul=d||o,dl=f||u,El(t,e),dl=f,ul=d,kl(e),r&8192)a:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(n===null||u||ul||dl||Ml(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){u=n=t;try{if(s=u.stateNode,o)c=s.style,typeof c.setProperty==`function`?c.setProperty(`display`,`none`,`important`):c.display=`none`;else{l=u.stateNode;var p=u.memoizedProps.style,m=p!=null&&p.hasOwnProperty(`display`)?p.display:null;l.style.display=m==null||typeof m==`boolean`?``:(``+m).trim()}}catch(e){sd(u,u.return,e)}}}else if(t.tag===6){if(n===null){u=t;try{u.stateNode.nodeValue=o?``:u.memoizedProps}catch(e){sd(u,u.return,e)}}}else if(t.tag===18){if(n===null){u=t;try{var h=u.stateNode;o?vf(h,!0):vf(u.stateNode,!1)}catch(e){sd(u,u.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,Tl(e,n))));break;case 19:El(t,e),kl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 30:break;case 21:break;default:El(t,e),kl(e)}}function kl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(al(r)){n=r;break}r=r.return}if(n==null)throw Error(a(160));switch(n.tag){case 27:var o=n.stateNode;cl(e,ol(e),o);break;case 5:var s=n.stateNode;n.flags&32&&(en(s,``),n.flags&=-33),cl(e,ol(e),s);break;case 3:case 4:var c=n.stateNode.containerInfo;sl(e,ol(e),c);break;default:throw Error(a(161))}}catch(t){sd(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Al(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Al(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function jl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)gl(e,t.alternate,t),t=t.sibling}function Ml(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Qc(4,t,t.return),Ml(t);break;case 1:nl(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&el(t,t.return,n),Ml(t);break;case 27:jf(t.stateNode);case 26:case 5:nl(t,t.return),Ml(t);break;case 22:t.memoizedState===null&&Ml(t);break;case 30:Ml(t);break;default:Ml(t)}e=e.sibling}}function Nl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,a=e,o=t,s=o.flags;switch(o.tag){case 0:case 11:case 15:Nl(a,o,n),Zc(4,o);break;case 1:if(Nl(a,o,n),r=o,a=r.stateNode,typeof a.componentDidMount==`function`)try{a.componentDidMount()}catch(e){sd(r,r.return,e)}if(r=o,a=r.updateQueue,a!==null){var c=r.stateNode;try{var l=a.shared.hiddenCallbacks;if(l!==null)for(a.shared.hiddenCallbacks=null,a=0;a<l.length;a++)no(l[a],c)}catch(e){sd(r,r.return,e)}}n&&s&64&&$c(o),tl(o,o.return);break;case 27:ll(o);case 26:case 5:Nl(a,o,n),n&&r===null&&s&4&&rl(o),tl(o,o.return);break;case 12:Nl(a,o,n);break;case 31:Nl(a,o,n),n&&s&4&&Sl(a,o);break;case 13:Nl(a,o,n),n&&s&4&&Cl(a,o);break;case 22:o.memoizedState===null&&Nl(a,o,n),tl(o,o.return);break;case 30:break;default:Nl(a,o,n)}t=t.sibling}}function Pl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&_a(n))}function Fl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_a(e))}function Il(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ll(e,t,n,r),t=t.sibling}function Ll(e,t,n,r){var a=t.flags;switch(t.tag){case 0:case 11:case 15:Il(e,t,n,r),a&2048&&Zc(9,t);break;case 1:Il(e,t,n,r);break;case 3:Il(e,t,n,r),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_a(e)));break;case 12:if(a&2048){Il(e,t,n,r),e=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){sd(t,t.return,e)}}else Il(e,t,n,r);break;case 31:Il(e,t,n,r);break;case 13:Il(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?o._visibility&2?Il(e,t,n,r):(o._visibility|=2,Rl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):o._visibility&2?Il(e,t,n,r):zl(e,t),a&2048&&Pl(s,t);break;case 24:Il(e,t,n,r),a&2048&&Fl(t.alternate,t);break;default:Il(e,t,n,r)}}function Rl(e,t,n,r,a){for(a&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var o=e,s=t,c=n,l=r,u=s.flags;switch(s.tag){case 0:case 11:case 15:Rl(o,s,c,l,a),Zc(8,s);break;case 23:break;case 22:var d=s.stateNode;s.memoizedState===null?(d._visibility|=2,Rl(o,s,c,l,a)):d._visibility&2?Rl(o,s,c,l,a):zl(o,s),a&&u&2048&&Pl(s.alternate,s);break;case 24:Rl(o,s,c,l,a),a&&u&2048&&Fl(s.alternate,s);break;default:Rl(o,s,c,l,a)}t=t.sibling}}function zl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,a=r.flags;switch(r.tag){case 22:zl(n,r),a&2048&&Pl(r.alternate,r);break;case 24:zl(n,r),a&2048&&Fl(r.alternate,r);break;default:zl(n,r)}t=t.sibling}}var Bl=8192;function Vl(e,t,n){if(e.subtreeFlags&Bl)for(e=e.child;e!==null;)Hl(e,t,n),e=e.sibling}function Hl(e,t,n){switch(e.tag){case 26:Vl(e,t,n),e.flags&Bl&&e.memoizedState!==null&&lp(n,Dl,e.memoizedState,e.memoizedProps);break;case 5:Vl(e,t,n);break;case 3:case 4:var r=Dl;Dl=Pf(e.stateNode.containerInfo),Vl(e,t,n),Dl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Bl,Bl=16777216,Vl(e,t,n),Bl=r):Vl(e,t,n));break;default:Vl(e,t,n)}}function Ul(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Wl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ml=r,ql(r,e)}Ul(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Gl(e),e=e.sibling}function Gl(e){switch(e.tag){case 0:case 11:case 15:Wl(e),e.flags&2048&&Qc(9,e,e.return);break;case 3:Wl(e);break;case 12:Wl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Kl(e)):Wl(e);break;default:Wl(e)}}function Kl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ml=r,ql(r,e)}Ul(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Qc(8,t,t.return),Kl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Kl(t));break;default:Kl(t)}e=e.sibling}}function ql(e,t){for(;ml!==null;){var n=ml;switch(n.tag){case 0:case 11:case 15:Qc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:_a(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ml=r;else a:for(n=e;ml!==null;){r=ml;var a=r.sibling,o=r.return;if(_l(r),r===n){ml=null;break a}if(a!==null){a.return=o,ml=a;break a}ml=o}}}var Jl={getCacheForType:function(e){var t=la(ha),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return la(ha).controller.signal}},Yl=typeof WeakMap==`function`?WeakMap:Map,Xl=0,Zl=null,Ql=null,$l=0,eu=0,tu=null,nu=!1,ru=!1,iu=!1,au=0,ou=0,su=0,cu=0,lu=0,uu=0,du=0,fu=null,pu=null,mu=!1,hu=0,gu=0,_u=1/0,vu=null,yu=null,bu=0,xu=null,Su=null,Cu=0,wu=0,Tu=null,Eu=null,Du=0,Ou=null;function ku(){return Xl&2&&$l!==0?$l&-$l:A.T===null?ft():Od()}function Au(){if(uu===0)if(!($l&536870912)||Ui){var e=Ze;Ze<<=1,!(Ze&3932160)&&(Ze=262144),uu=e}else uu=536870912;return e=lo.current,e!==null&&(e.flags|=32),uu}function ju(e,t,n){(e===Zl&&(eu===2||eu===9)||e.cancelPendingCommit!==null)&&(Ru(e,0),Fu(e,$l,uu,!1)),at(e,n),(!(Xl&2)||e!==Zl)&&(e===Zl&&(!(Xl&2)&&(cu|=n),ou===4&&Fu(e,$l,uu,!1)),bd(e))}function Mu(e,t,n){if(Xl&6)throw Error(a(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||tt(e,t),o=r?Ku(e,t):Wu(e,t,!0),s=r;do{if(o===0){ru&&!r&&Fu(e,t,0,!1);break}else{if(n=e.current.alternate,s&&!Pu(n)){o=Wu(e,t,!1),s=!1;continue}if(o===2){if(s=t,e.errorRecoveryDisabledLanes&s)var c=0;else c=e.pendingLanes&-536870913,c=c===0?c&536870912?536870912:0:c;if(c!==0){t=c;a:{var l=e;o=fu;var u=l.current.memoizedState.isDehydrated;if(u&&(Ru(l,c).flags|=256),c=Wu(l,c,!1),c!==2){if(iu&&!u){l.errorRecoveryDisabledLanes|=s,cu|=s,o=4;break a}s=pu,pu=o,s!==null&&(pu===null?pu=s:pu.push.apply(pu,s))}o=c}if(s=!1,o!==2)continue}}if(o===1){Ru(e,0),Fu(e,t,0,!0);break}a:{switch(r=e,s=o,s){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:Fu(r,t,uu,!nu);break a;case 2:pu=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(o=hu+300-Pe(),10<o)){if(Fu(r,t,uu,!nu),et(r,0,!0)!==0)break a;Cu=t,r.timeoutHandle=df(Nu.bind(null,r,n,pu,vu,mu,t,uu,cu,du,nu,s,`Throttled`,-0,0),o);break a}Nu(r,n,pu,vu,mu,t,uu,cu,du,nu,s,null,-0,0)}}break}while(1);bd(e)}function Nu(e,t,n,r,a,o,s,c,l,u,d,f,p,m){if(e.timeoutHandle=-1,f=t.subtreeFlags,f&8192||(f&16785408)==16785408){f={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ln},Hl(t,o,f);var h=(o&62914560)===o?hu-Pe():(o&4194048)===o?gu-Pe():0;if(h=dp(f,h),h!==null){Cu=o,e.cancelPendingCommit=h($u.bind(null,e,t,o,n,r,a,s,c,l,d,f,null,p,m)),Fu(e,o,s,!u);return}}$u(e,t,o,n,r,a,s,c,l)}function Pu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var a=n[r],o=a.getSnapshot;a=a.value;try{if(!jr(o(),a))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Fu(e,t,n,r){t&=~lu,t&=~cu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var a=t;0<a;){var o=31-Ke(a),s=1<<o;r[o]=-1,a&=~s}n!==0&&st(e,n,t)}function Iu(){return Xl&6?!0:(xd(0,!1),!1)}function Lu(){if(Ql!==null){if(eu===0)var e=Ql.return;else e=Ql,ta=ea=null,Ro(e),Ra=null,za=0,e=Ql;for(;e!==null;)Xc(e.alternate,e),e=e.return;Ql=null}}function Ru(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,ff(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Cu=0,Lu(),Zl=e,Ql=n=yi(e.current,null),$l=t,eu=0,tu=null,nu=!1,ru=tt(e,t),iu=!1,du=uu=lu=cu=su=ou=0,pu=fu=null,mu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var a=31-Ke(r),o=1<<a;t|=e[a],r&=~o}return au=t,li(),n}function zu(e,t){bo=null,A.H=qs,t===ka||t===ja?(t=Ia(),eu=3):t===Aa?(t=Ia(),eu=4):eu=t===dc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,tu=t,Ql===null&&(ou=1,ac(e,Di(t,e.current)))}function Bu(){var e=lo.current;return e===null?!0:($l&4194048)===$l?uo===null:($l&62914560)===$l||$l&536870912?e===uo:!1}function Vu(){var e=A.H;return A.H=qs,e===null?qs:e}function Hu(){var e=A.A;return A.A=Jl,e}function Uu(){ou=4,nu||($l&4194048)!==$l&&lo.current!==null||(ru=!0),!(su&134217727)&&!(cu&134217727)||Zl===null||Fu(Zl,$l,uu,!1)}function Wu(e,t,n){var r=Xl;Xl|=2;var a=Vu(),o=Hu();(Zl!==e||$l!==t)&&(vu=null,Ru(e,t)),t=!1;var s=ou;a:do try{if(eu!==0&&Ql!==null){var c=Ql,l=tu;switch(eu){case 8:Lu(),s=6;break a;case 3:case 2:case 9:case 6:lo.current===null&&(t=!0);var u=eu;if(eu=0,tu=null,Xu(e,c,l,u),n&&ru){s=0;break a}break;default:u=eu,eu=0,tu=null,Xu(e,c,l,u)}}Gu(),s=ou;break}catch(t){zu(e,t)}while(1);return t&&e.shellSuspendCounter++,ta=ea=null,Xl=r,A.H=a,A.A=o,Ql===null&&(Zl=null,$l=0,li()),s}function Gu(){for(;Ql!==null;)Ju(Ql)}function Ku(e,t){var n=Xl;Xl|=2;var r=Vu(),o=Hu();Zl!==e||$l!==t?(vu=null,_u=Pe()+500,Ru(e,t)):ru=tt(e,t);a:do try{if(eu!==0&&Ql!==null){t=Ql;var s=tu;b:switch(eu){case 1:eu=0,tu=null,Xu(e,t,s,1);break;case 2:case 9:if(P(s)){eu=0,tu=null,Yu(t);break}t=function(){eu!==2&&eu!==9||Zl!==e||(eu=7),bd(e)},s.then(t,t);break a;case 3:eu=7;break a;case 4:eu=5;break a;case 7:P(s)?(eu=0,tu=null,Yu(t)):(eu=0,tu=null,Xu(e,t,s,7));break;case 5:var c=null;switch(Ql.tag){case 26:c=Ql.memoizedState;case 5:case 27:var l=Ql;if(c?cp(c):l.stateNode.complete){eu=0,tu=null;var u=l.sibling;if(u!==null)Ql=u;else{var d=l.return;d===null?Ql=null:(Ql=d,Zu(d))}break b}}eu=0,tu=null,Xu(e,t,s,5);break;case 6:eu=0,tu=null,Xu(e,t,s,6);break;case 8:Lu(),ou=6;break a;default:throw Error(a(462))}}qu();break}catch(t){zu(e,t)}while(1);return ta=ea=null,A.H=r,A.A=o,Xl=n,Ql===null?(Zl=null,$l=0,li(),ou):0}function qu(){for(;Ql!==null&&!Me();)Ju(Ql)}function Ju(e){var t=Vc(e.alternate,e,au);e.memoizedProps=e.pendingProps,t===null?Zu(e):Ql=t}function Yu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Tc(n,t,t.pendingProps,t.type,void 0,$l);break;case 11:t=Tc(n,t,t.pendingProps,t.type.render,t.ref,$l);break;case 5:Ro(t);default:Xc(n,t),t=Ql=bi(t,au),t=Vc(n,t,au)}e.memoizedProps=e.pendingProps,t===null?Zu(e):Ql=t}function Xu(e,t,n,r){ta=ea=null,Ro(t),Ra=null,za=0;var a=t.return;try{if(uc(e,a,t,n,$l)){ou=1,ac(e,Di(n,e.current)),Ql=null;return}}catch(t){if(a!==null)throw Ql=a,t;ou=1,ac(e,Di(n,e.current)),Ql=null;return}t.flags&32768?(Ui||r===1?e=!0:ru||$l&536870912?e=!1:(nu=e=!0,(r===2||r===9||r===3||r===6)&&(r=lo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Qu(t,e)):Zu(t)}function Zu(e){var t=e;do{if(t.flags&32768){Qu(t,nu);return}e=t.return;var n=Jc(t.alternate,t,au);if(n!==null){Ql=n;return}if(t=t.sibling,t!==null){Ql=t;return}Ql=t=e}while(t!==null);ou===0&&(ou=5)}function Qu(e,t){do{var n=Yc(e.alternate,e);if(n!==null){n.flags&=32767,Ql=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ql=e;return}Ql=e=n}while(e!==null);ou=6,Ql=null}function $u(e,t,n,r,o,s,c,l,u){e.cancelPendingCommit=null;do id();while(bu!==0);if(Xl&6)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(s=t.lanes|t.childLanes,s|=ci,ot(e,n,s,c,l,u),e===Zl&&(Ql=Zl=null,$l=0),Su=t,xu=e,Cu=n,wu=s,Tu=o,Eu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,pd(Re,function(){return ad(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=A.T,A.T=null,o=se.p,se.p=2,c=Xl,Xl|=4;try{hl(e,t,n)}finally{Xl=c,se.p=o,A.T=r}}bu=1,ed(),td(),nd()}}function ed(){if(bu===1){bu=0;var e=xu,t=Su,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=A.T,A.T=null;var r=se.p;se.p=2;var a=Xl;Xl|=4;try{Ol(t,e);var o=rf,s=Ir(e.containerInfo),c=o.focusedElem,l=o.selectionRange;if(s!==c&&c&&c.ownerDocument&&Fr(c.ownerDocument.documentElement,c)){if(l!==null&&Lr(c)){var u=l.start,d=l.end;if(d===void 0&&(d=u),`selectionStart`in c)c.selectionStart=u,c.selectionEnd=Math.min(d,c.value.length);else{var f=c.ownerDocument||document,p=f&&f.defaultView||window;if(p.getSelection){var m=p.getSelection(),h=c.textContent.length,g=Math.min(l.start,h),_=l.end===void 0?g:Math.min(l.end,h);!m.extend&&g>_&&(s=_,_=g,g=s);var v=Pr(c,g),y=Pr(c,_);if(v&&y&&(m.rangeCount!==1||m.anchorNode!==v.node||m.anchorOffset!==v.offset||m.focusNode!==y.node||m.focusOffset!==y.offset)){var b=f.createRange();b.setStart(v.node,v.offset),m.removeAllRanges(),g>_?(m.addRange(b),m.extend(y.node,y.offset)):(b.setEnd(y.node,y.offset),m.addRange(b))}}}}for(f=[],m=c;m=m.parentNode;)m.nodeType===1&&f.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof c.focus==`function`&&c.focus(),c=0;c<f.length;c++){var x=f[c];x.element.scrollLeft=x.left,x.element.scrollTop=x.top}}Tp=!!nf,rf=nf=null}finally{Xl=a,se.p=r,A.T=n}}e.current=t,bu=2}}function td(){if(bu===2){bu=0;var e=xu,t=Su,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=A.T,A.T=null;var r=se.p;se.p=2;var a=Xl;Xl|=4;try{gl(e,t.alternate,t)}finally{Xl=a,se.p=r,A.T=n}}bu=3}}function nd(){if(bu===4||bu===3){bu=0,Ne();var e=xu,t=Su,n=Cu,r=Eu;t.subtreeFlags&10256||t.flags&10256?bu=5:(bu=0,Su=xu=null,rd(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(yu=null),dt(n),t=t.stateNode,We&&typeof We.onCommitFiberRoot==`function`)try{We.onCommitFiberRoot(Ue,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=A.T,a=se.p,se.p=2,A.T=null;try{for(var o=e.onRecoverableError,s=0;s<r.length;s++){var c=r[s];o(c.value,{componentStack:c.stack})}}finally{A.T=t,se.p=a}}Cu&3&&id(),bd(e),a=e.pendingLanes,n&261930&&a&42?e===Ou?Du++:(Du=0,Ou=e):Du=0,xd(0,!1)}}function rd(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,_a(t)))}function id(){return ed(),td(),nd(),ad()}function ad(){if(bu!==5)return!1;var e=xu,t=wu;wu=0;var n=dt(Cu),r=A.T,o=se.p;try{se.p=32>n?32:n,A.T=null,n=Tu,Tu=null;var s=xu,c=Cu;if(bu=0,Su=xu=null,Cu=0,Xl&6)throw Error(a(331));var l=Xl;if(Xl|=4,Gl(s.current),Ll(s,s.current,c,n),Xl=l,xd(0,!1),We&&typeof We.onPostCommitFiberRoot==`function`)try{We.onPostCommitFiberRoot(Ue,s)}catch{}return!0}finally{se.p=o,A.T=r,rd(e,t)}}function od(e,t,n){t=Di(n,t),t=sc(e.stateNode,t,2),e=Xa(e,t,2),e!==null&&(at(e,2),bd(e))}function sd(e,t,n){if(e.tag===3)od(e,e,n);else for(;t!==null;){if(t.tag===3){od(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(yu===null||!yu.has(r))){e=Di(n,e),n=cc(2),r=Xa(t,n,2),r!==null&&(lc(n,r,t,e),at(r,2),bd(r));break}}t=t.return}}function cd(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Yl;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(iu=!0,a.add(n),e=ld.bind(null,e,t,n),t.then(e,e))}function ld(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Zl===e&&($l&n)===n&&(ou===4||ou===3&&($l&62914560)===$l&&300>Pe()-hu?!(Xl&2)&&Ru(e,0):lu|=n,du===$l&&(du=0)),bd(e)}function ud(e,t){t===0&&(t=rt()),e=fi(e,t),e!==null&&(at(e,t),bd(e))}function dd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ud(e,n)}function fd(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),ud(e,n)}function pd(e,t){return Ae(e,t)}var md=null,hd=null,gd=!1,_d=!1,vd=!1,yd=0;function bd(e){e!==hd&&e.next===null&&(hd===null?md=hd=e:hd=hd.next=e),_d=!0,gd||(gd=!0,Dd())}function xd(e,t){if(!vd&&_d){vd=!0;do for(var n=!1,r=md;r!==null;){if(!t)if(e!==0){var a=r.pendingLanes;if(a===0)var o=0;else{var s=r.suspendedLanes,c=r.pingedLanes;o=(1<<31-Ke(42|e)+1)-1,o&=a&~(s&~c),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,Ed(r,o))}else o=$l,o=et(r,r===Zl?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(o&3)||tt(r,o)||(n=!0,Ed(r,o));r=r.next}while(n);vd=!1}}function Sd(){Cd()}function Cd(){_d=gd=!1;var e=0;yd!==0&&uf()&&(e=yd);for(var t=Pe(),n=null,r=md;r!==null;){var a=r.next,o=wd(r,t);o===0?(r.next=null,n===null?md=a:n.next=a,a===null&&(hd=n)):(n=r,(e!==0||o&3)&&(_d=!0)),r=a}bu!==0&&bu!==5||xd(e,!1),yd!==0&&(yd=0)}function wd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var s=31-Ke(o),c=1<<s,l=a[s];l===-1?((c&n)===0||(c&r)!==0)&&(a[s]=nt(c,t)):l<=t&&(e.expiredLanes|=c),o&=~c}if(t=Zl,n=$l,n=et(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(eu===2||eu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&je(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||tt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&je(r),dt(n)){case 2:case 8:n=Le;break;case 32:n=Re;break;case 268435456:n=Be;break;default:n=Re}return r=Td.bind(null,e),n=Ae(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&je(r),e.callbackPriority=2,e.callbackNode=null,2}function Td(e,t){if(bu!==0&&bu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(id()&&e.callbackNode!==n)return null;var r=$l;return r=et(e,e===Zl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Mu(e,r,t),wd(e,Pe()),e.callbackNode!=null&&e.callbackNode===n?Td.bind(null,e):null)}function Ed(e,t){if(id())return null;Mu(e,t,!0)}function Dd(){mf(function(){Xl&6?Ae(Ie,Sd):Cd()})}function Od(){if(yd===0){var e=ba;e===0&&(e=Xe,Xe<<=1,!(Xe&261888)&&(Xe=256)),yd=e}return yd}function kd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:cn(``+e)}function Ad(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function I(e,t,n,r,a){if(t===`submit`&&n&&n.stateNode===a){var o=kd((a[gt]||null).action),s=r.submitter;s&&(t=(t=s[gt]||null)?kd(t.formAction):s.getAttribute(`formAction`),t!==null&&(o=t,s=null));var c=new An(`action`,`action`,null,r,a);e.push({event:c,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(yd!==0){var e=s?Ad(a,s):new FormData(a);Ns(n,{pending:!0,data:e,method:a.method,action:o},null,e)}}else typeof o==`function`&&(c.preventDefault(),e=s?Ad(a,s):new FormData(a),Ns(n,{pending:!0,data:e,method:a.method,action:o},o,e))},currentTarget:a}]})}}for(var jd=0;jd<ri.length;jd++){var Md=ri[jd];ii(Md.toLowerCase(),`on`+(Md[0].toUpperCase()+Md.slice(1)))}ii(Yr,`onAnimationEnd`),ii(Xr,`onAnimationIteration`),ii(Zr,`onAnimationStart`),ii(`dblclick`,`onDoubleClick`),ii(`focusin`,`onFocus`),ii(`focusout`,`onBlur`),ii(Qr,`onTransitionRun`),ii($r,`onTransitionStart`),ii(ei,`onTransitionCancel`),ii(ti,`onTransitionEnd`),Mt(`onMouseEnter`,[`mouseout`,`mouseover`]),Mt(`onMouseLeave`,[`mouseout`,`mouseover`]),Mt(`onPointerEnter`,[`pointerout`,`pointerover`]),Mt(`onPointerLeave`,[`pointerout`,`pointerover`]),jt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),jt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),jt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),jt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),jt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),jt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Nd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Pd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Nd));function Fd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;a:{var o=void 0;if(t)for(var s=r.length-1;0<=s;s--){var c=r[s],l=c.instance,u=c.currentTarget;if(c=c.listener,l!==o&&a.isPropagationStopped())break a;o=c,a.currentTarget=u;try{o(a)}catch(e){ai(e)}a.currentTarget=null,o=l}else for(s=0;s<r.length;s++){if(c=r[s],l=c.instance,u=c.currentTarget,c=c.listener,l!==o&&a.isPropagationStopped())break a;o=c,a.currentTarget=u;try{o(a)}catch(e){ai(e)}a.currentTarget=null,o=l}}}}function Id(e,t){var n=t[vt];n===void 0&&(n=t[vt]=new Set);var r=e+`__bubble`;n.has(r)||(Bd(t,e,2,!1),n.add(r))}function Ld(e,t,n){var r=0;t&&(r|=4),Bd(n,e,r,t)}var Rd=`_reactListening`+Math.random().toString(36).slice(2);function zd(e){if(!e[Rd]){e[Rd]=!0,kt.forEach(function(t){t!==`selectionchange`&&(Pd.has(t)||Ld(t,!1,e),Ld(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Rd]||(t[Rd]=!0,Ld(`selectionchange`,!1,t))}}function Bd(e,t,n,r){switch(Mp(t)){case 2:var a=Ep;break;case 8:a=Dp;break;default:a=Op}n=a.bind(null,t,n,e),a=void 0,!yn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(a=!0),r?a===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:a}):a===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:a})}function Vd(e,t,n,r,a){var o=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var c=r.tag;if(c===3||c===4){var l=r.stateNode.containerInfo;if(l===a)break;if(c===4)for(c=r.return;c!==null;){var u=c.tag;if((u===3||u===4)&&c.stateNode.containerInfo===a)return;c=c.return}for(;l!==null;){if(c=wt(l),c===null)return;if(u=c.tag,u===5||u===6||u===26||u===27){r=o=c;continue a}l=l.parentNode}}r=r.return}gn(function(){var r=o,a=dn(n),c=[];a:{var l=ni.get(e);if(l!==void 0){var u=An,d=e;switch(e){case`keypress`:if(Tn(n)===0)break a;case`keydown`:case`keyup`:u=Jn;break;case`focusin`:d=`focus`,u=zn;break;case`focusout`:d=`blur`,u=zn;break;case`beforeblur`:case`afterblur`:u=zn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:u=Ln;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:u=Rn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:u=Xn;break;case Yr:case Xr:case Zr:u=Bn;break;case ti:u=Zn;break;case`scroll`:case`scrollend`:u=Mn;break;case`wheel`:u=Qn;break;case`copy`:case`cut`:case`paste`:u=Vn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:u=Yn;break;case`toggle`:case`beforetoggle`:u=$n}var f=(t&4)!=0,p=!f&&(e===`scroll`||e===`scrollend`),m=f?l===null?null:l+`Capture`:l;f=[];for(var h=r,g;h!==null;){var _=h;if(g=_.stateNode,_=_.tag,_!==5&&_!==26&&_!==27||g===null||m===null||(_=_n(h,m),_!=null&&f.push(Hd(h,_,g))),p)break;h=h.return}0<f.length&&(l=new u(l,d,null,n,a),c.push({event:l,listeners:f}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,u=e===`mouseout`||e===`pointerout`,l&&n!==un&&(d=n.relatedTarget||n.fromElement)&&(wt(d)||d[_t]))break a;if((u||l)&&(l=a.window===a?a:(l=a.ownerDocument)?l.defaultView||l.parentWindow:window,u?(d=n.relatedTarget||n.toElement,u=r,d=d?wt(d):null,d!==null&&(p=s(d),f=d.tag,d!==p||f!==5&&f!==27&&f!==6)&&(d=null)):(u=null,d=r),u!==d)){if(f=Ln,_=`onMouseLeave`,m=`onMouseEnter`,h=`mouse`,(e===`pointerout`||e===`pointerover`)&&(f=Yn,_=`onPointerLeave`,m=`onPointerEnter`,h=`pointer`),p=u==null?l:Et(u),g=d==null?l:Et(d),l=new f(_,h+`leave`,u,n,a),l.target=p,l.relatedTarget=g,_=null,wt(a)===r&&(f=new f(m,h+`enter`,d,n,a),f.target=g,f.relatedTarget=p,_=f),p=_,u&&d)b:{for(f=Wd,m=u,h=d,g=0,_=m;_;_=f(_))g++;_=0;for(var v=h;v;v=f(v))_++;for(;0<g-_;)m=f(m),g--;for(;0<_-g;)h=f(h),_--;for(;g--;){if(m===h||h!==null&&m===h.alternate){f=m;break b}m=f(m),h=f(h)}f=null}else f=null;u!==null&&Gd(c,l,u,f,!1),d!==null&&p!==null&&Gd(c,p,d,f,!0)}}a:{if(l=r?Et(r):window,u=l.nodeName&&l.nodeName.toLowerCase(),u===`select`||u===`input`&&l.type===`file`)var y=yr;else if(pr(l))if(br)y=kr;else{y=Dr;var b=Er}else u=l.nodeName,!u||u.toLowerCase()!==`input`||l.type!==`checkbox`&&l.type!==`radio`?r&&an(r.elementType)&&(y=yr):y=Or;if(y&&=y(e,r)){mr(c,y,n,a);break a}b&&b(e,l,r),e===`focusout`&&r&&l.type===`number`&&r.memoizedProps.value!=null&&Xt(l,`number`,l.value)}switch(b=r?Et(r):window,e){case`focusin`:(pr(b)||b.contentEditable===`true`)&&(zr=b,Br=r,Vr=null);break;case`focusout`:Vr=Br=zr=null;break;case`mousedown`:Hr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Hr=!1,Ur(c,n,a);break;case`selectionchange`:if(Rr)break;case`keydown`:case`keyup`:Ur(c,n,a)}var x;if(tr)b:{switch(e){case`compositionstart`:var S=`onCompositionStart`;break b;case`compositionend`:S=`onCompositionEnd`;break b;case`compositionupdate`:S=`onCompositionUpdate`;break b}S=void 0}else lr?sr(e,n)&&(S=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(S=`onCompositionStart`);S&&(ir&&n.locale!==`ko`&&(lr||S!==`onCompositionStart`?S===`onCompositionEnd`&&lr&&(x=wn()):(xn=a,Sn=`value`in xn?xn.value:xn.textContent,lr=!0)),b=Ud(r,S),0<b.length&&(S=new Hn(S,e,null,n,a),c.push({event:S,listeners:b}),x?S.data=x:(x=cr(n),x!==null&&(S.data=x)))),(x=rr?ur(e,n):dr(e,n))&&(S=Ud(r,`onBeforeInput`),0<S.length&&(b=new Hn(`onBeforeInput`,`beforeinput`,null,n,a),c.push({event:b,listeners:S}),b.data=x)),I(c,e,r,n,a)}Fd(c,t)})}function Hd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ud(e,t){for(var n=t+`Capture`,r=[];e!==null;){var a=e,o=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||o===null||(a=_n(e,n),a!=null&&r.unshift(Hd(e,a,o)),a=_n(e,t),a!=null&&r.push(Hd(e,a,o))),e.tag===3)return r;e=e.return}return[]}function Wd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Gd(e,t,n,r,a){for(var o=t._reactName,s=[];n!==null&&n!==r;){var c=n,l=c.alternate,u=c.stateNode;if(c=c.tag,l!==null&&l===r)break;c!==5&&c!==26&&c!==27||u===null||(l=u,a?(u=_n(n,o),u!=null&&s.unshift(Hd(n,u,l))):a||(u=_n(n,o),u!=null&&s.push(Hd(n,u,l)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var Kd=/\r\n?/g,qd=/\u0000|\uFFFD/g;function Jd(e){return(typeof e==`string`?e:``+e).replace(Kd,`
9
- `).replace(qd,``)}function Yd(e,t){return t=Jd(t),Jd(e)===t}function Xd(e,t,n,r,o,s){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||en(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&en(e,``+r);break;case`className`:Rt(e,`class`,r);break;case`tabIndex`:Rt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Rt(e,n,r);break;case`style`:rn(e,r,s);break;case`data`:if(t!==`object`){Rt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=cn(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof s==`function`&&(n===`formAction`?(t!==`input`&&Xd(e,t,`name`,o.name,o,null),Xd(e,t,`formEncType`,o.formEncType,o,null),Xd(e,t,`formMethod`,o.formMethod,o,null),Xd(e,t,`formTarget`,o.formTarget,o,null)):(Xd(e,t,`encType`,o.encType,o,null),Xd(e,t,`method`,o.method,o,null),Xd(e,t,`target`,o.target,o,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=cn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=ln);break;case`onScroll`:r!=null&&Id(`scroll`,e);break;case`onScrollEnd`:r!=null&&Id(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(o.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=cn(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Id(`beforetoggle`,e),Id(`toggle`,e),Lt(e,`popover`,r);break;case`xlinkActuate`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Lt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=on.get(n)||n,Lt(e,n,r))}}function Zd(e,t,n,r,o,s){switch(n){case`style`:rn(e,r,s);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(o.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?en(e,r):(typeof r==`number`||typeof r==`bigint`)&&en(e,``+r);break;case`onScroll`:r!=null&&Id(`scroll`,e);break;case`onScrollEnd`:r!=null&&Id(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=ln);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!At.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(o=n.endsWith(`Capture`),t=n.slice(2,o?n.length-7:void 0),s=e[gt]||null,s=s==null?null:s[n],typeof s==`function`&&e.removeEventListener(t,s,o),typeof r==`function`)){typeof s!=`function`&&s!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,o);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Lt(e,n,r)}}}function Qd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Id(`error`,e),Id(`load`,e);var r=!1,o=!1,s;for(s in n)if(n.hasOwnProperty(s)){var c=n[s];if(c!=null)switch(s){case`src`:r=!0;break;case`srcSet`:o=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Xd(e,t,s,c,n,null)}}o&&Xd(e,t,`srcSet`,n.srcSet,n,null),r&&Xd(e,t,`src`,n.src,n,null);return;case`input`:Id(`invalid`,e);var l=s=c=o=null,u=null,d=null;for(r in n)if(n.hasOwnProperty(r)){var f=n[r];if(f!=null)switch(r){case`name`:o=f;break;case`type`:c=f;break;case`checked`:u=f;break;case`defaultChecked`:d=f;break;case`value`:s=f;break;case`defaultValue`:l=f;break;case`children`:case`dangerouslySetInnerHTML`:if(f!=null)throw Error(a(137,t));break;default:Xd(e,t,r,f,n,null)}}Yt(e,s,l,u,d,c,o,!1);return;case`select`:for(o in Id(`invalid`,e),r=c=s=null,n)if(n.hasOwnProperty(o)&&(l=n[o],l!=null))switch(o){case`value`:s=l;break;case`defaultValue`:c=l;break;case`multiple`:r=l;default:Xd(e,t,o,l,n,null)}t=s,n=c,e.multiple=!!r,t==null?n!=null&&Zt(e,!!r,n,!0):Zt(e,!!r,t,!1);return;case`textarea`:for(c in Id(`invalid`,e),s=o=r=null,n)if(n.hasOwnProperty(c)&&(l=n[c],l!=null))switch(c){case`value`:r=l;break;case`defaultValue`:o=l;break;case`children`:s=l;break;case`dangerouslySetInnerHTML`:if(l!=null)throw Error(a(91));break;default:Xd(e,t,c,l,n,null)}$t(e,r,o,s);return;case`option`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Xd(e,t,u,r,n,null)}return;case`dialog`:Id(`beforetoggle`,e),Id(`toggle`,e),Id(`cancel`,e),Id(`close`,e);break;case`iframe`:case`object`:Id(`load`,e);break;case`video`:case`audio`:for(r=0;r<Nd.length;r++)Id(Nd[r],e);break;case`image`:Id(`error`,e),Id(`load`,e);break;case`details`:Id(`toggle`,e);break;case`embed`:case`source`:case`link`:Id(`error`,e),Id(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(d in n)if(n.hasOwnProperty(d)&&(r=n[d],r!=null))switch(d){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Xd(e,t,d,r,n,null)}return;default:if(an(t)){for(f in n)n.hasOwnProperty(f)&&(r=n[f],r!==void 0&&Zd(e,t,f,r,n,void 0));return}}for(l in n)n.hasOwnProperty(l)&&(r=n[l],r!=null&&Xd(e,t,l,r,n,null))}function $d(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var o=null,s=null,c=null,l=null,u=null,d=null,f=null;for(h in n){var p=n[h];if(n.hasOwnProperty(h)&&p!=null)switch(h){case`checked`:break;case`value`:break;case`defaultValue`:u=p;default:r.hasOwnProperty(h)||Xd(e,t,h,null,r,p)}}for(var m in r){var h=r[m];if(p=n[m],r.hasOwnProperty(m)&&(h!=null||p!=null))switch(m){case`type`:s=h;break;case`name`:o=h;break;case`checked`:d=h;break;case`defaultChecked`:f=h;break;case`value`:c=h;break;case`defaultValue`:l=h;break;case`children`:case`dangerouslySetInnerHTML`:if(h!=null)throw Error(a(137,t));break;default:h!==p&&Xd(e,t,m,h,r,p)}}Jt(e,c,l,u,d,f,s,o);return;case`select`:for(s in h=c=l=m=null,n)if(u=n[s],n.hasOwnProperty(s)&&u!=null)switch(s){case`value`:break;case`multiple`:h=u;default:r.hasOwnProperty(s)||Xd(e,t,s,null,r,u)}for(o in r)if(s=r[o],u=n[o],r.hasOwnProperty(o)&&(s!=null||u!=null))switch(o){case`value`:m=s;break;case`defaultValue`:l=s;break;case`multiple`:c=s;default:s!==u&&Xd(e,t,o,s,r,u)}t=l,n=c,r=h,m==null?!!r!=!!n&&(t==null?Zt(e,!!n,n?[]:``,!1):Zt(e,!!n,t,!0)):Zt(e,!!n,m,!1);return;case`textarea`:for(l in h=m=null,n)if(o=n[l],n.hasOwnProperty(l)&&o!=null&&!r.hasOwnProperty(l))switch(l){case`value`:break;case`children`:break;default:Xd(e,t,l,null,r,o)}for(c in r)if(o=r[c],s=n[c],r.hasOwnProperty(c)&&(o!=null||s!=null))switch(c){case`value`:m=o;break;case`defaultValue`:h=o;break;case`children`:break;case`dangerouslySetInnerHTML`:if(o!=null)throw Error(a(91));break;default:o!==s&&Xd(e,t,c,o,r,s)}Qt(e,m,h);return;case`option`:for(var g in n)if(m=n[g],n.hasOwnProperty(g)&&m!=null&&!r.hasOwnProperty(g))switch(g){case`selected`:e.selected=!1;break;default:Xd(e,t,g,null,r,m)}for(u in r)if(m=r[u],h=n[u],r.hasOwnProperty(u)&&m!==h&&(m!=null||h!=null))switch(u){case`selected`:e.selected=m&&typeof m!=`function`&&typeof m!=`symbol`;break;default:Xd(e,t,u,m,r,h)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var _ in n)m=n[_],n.hasOwnProperty(_)&&m!=null&&!r.hasOwnProperty(_)&&Xd(e,t,_,null,r,m);for(d in r)if(m=r[d],h=n[d],r.hasOwnProperty(d)&&m!==h&&(m!=null||h!=null))switch(d){case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(a(137,t));break;default:Xd(e,t,d,m,r,h)}return;default:if(an(t)){for(var v in n)m=n[v],n.hasOwnProperty(v)&&m!==void 0&&!r.hasOwnProperty(v)&&Zd(e,t,v,void 0,r,m);for(f in r)m=r[f],h=n[f],!r.hasOwnProperty(f)||m===h||m===void 0&&h===void 0||Zd(e,t,f,m,r,h);return}}for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!=null&&!r.hasOwnProperty(y)&&Xd(e,t,y,null,r,m);for(p in r)m=r[p],h=n[p],!r.hasOwnProperty(p)||m===h||m==null&&h==null||Xd(e,t,p,m,r,h)}function ef(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function tf(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var a=n[r],o=a.transferSize,s=a.initiatorType,c=a.duration;if(o&&c&&ef(s)){for(s=0,c=a.responseEnd,r+=1;r<n.length;r++){var l=n[r],u=l.startTime;if(u>c)break;var d=l.transferSize,f=l.initiatorType;d&&ef(f)&&(l=l.responseEnd,s+=d*(l<c?1:(c-u)/(l-u)))}if(--r,t+=8*(o+s)/(a.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var nf=null,rf=null;function af(e){return e.nodeType===9?e:e.ownerDocument}function of(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function sf(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function cf(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var lf=null;function uf(){var e=window.event;return e&&e.type===`popstate`?e===lf?!1:(lf=e,!0):(lf=null,!1)}var df=typeof setTimeout==`function`?setTimeout:void 0,ff=typeof clearTimeout==`function`?clearTimeout:void 0,pf=typeof Promise==`function`?Promise:void 0,mf=typeof queueMicrotask==`function`?queueMicrotask:pf===void 0?df:function(e){return pf.resolve(null).then(e).catch(hf)};function hf(e){setTimeout(function(){throw e})}function gf(e){return e===`head`}function _f(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(a),Zp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)jf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,jf(n);for(var o=n.firstChild;o;){var s=o.nextSibling,c=o.nodeName;o[St]||c===`SCRIPT`||c===`STYLE`||c===`LINK`&&o.rel.toLowerCase()===`stylesheet`||n.removeChild(o),o=s}}else n===`body`&&jf(e.ownerDocument.body);n=a}while(n);Zp(t)}function vf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function yf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:yf(n),Ct(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function bf(e,t,n,r){for(;e.nodeType===1;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var o=a.name==null?null:``+a.name;if(a.type===`hidden`&&e.getAttribute(`name`)===o)return e}else return e;else if(!e[St])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(o=e.getAttribute(`rel`),o===`stylesheet`&&e.hasAttribute(`data-precedence`)||o!==a.rel||e.getAttribute(`href`)!==(a.href==null||a.href===``?null:a.href)||e.getAttribute(`crossorigin`)!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute(`title`)!==(a.title==null?null:a.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(o=e.getAttribute(`src`),(o!==(a.src==null?null:a.src)||e.getAttribute(`type`)!==(a.type==null?null:a.type)||e.getAttribute(`crossorigin`)!==(a.crossOrigin==null?null:a.crossOrigin))&&o&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=Ef(e.nextSibling),e===null)break}return null}function xf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=Ef(e.nextSibling),e===null))return null;return e}function Sf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=Ef(e.nextSibling),e===null))return null;return e}function Cf(e){return e.data===`$?`||e.data===`$~`}function wf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function Tf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function Ef(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var Df=null;function Of(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return Ef(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function kf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function Af(e,t,n){switch(t=af(n),e){case`html`:if(e=t.documentElement,!e)throw Error(a(452));return e;case`head`:if(e=t.head,!e)throw Error(a(453));return e;case`body`:if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function jf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ct(e)}var Mf=new Map,Nf=new Set;function Pf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ff=se.d;se.d={f:If,r:Lf,D:Bf,C:Vf,L:Hf,m:Uf,X:Gf,S:Wf,M:Kf};function If(){var e=Ff.f(),t=Iu();return e||t}function Lf(e){var t=Tt(e);t!==null&&t.tag===5&&t.type===`form`?Fs(t):Ff.r(e)}var Rf=typeof document>`u`?null:document;function zf(e,t,n){var r=Rf;if(r&&typeof t==`string`&&t){var a=qt(t);a=`link[rel="`+e+`"][href="`+a+`"]`,typeof n==`string`&&(a+=`[crossorigin="`+n+`"]`),Nf.has(a)||(Nf.add(a),e={rel:e,crossOrigin:n,href:t},r.querySelector(a)===null&&(t=r.createElement(`link`),Qd(t,`link`,e),Ot(t),r.head.appendChild(t)))}}function Bf(e){Ff.D(e),zf(`dns-prefetch`,e,null)}function Vf(e,t){Ff.C(e,t),zf(`preconnect`,e,t)}function Hf(e,t,n){Ff.L(e,t,n);var r=Rf;if(r&&e&&t){var a=`link[rel="preload"][as="`+qt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(a+=`[imagesrcset="`+qt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(a+=`[imagesizes="`+qt(n.imageSizes)+`"]`)):a+=`[href="`+qt(e)+`"]`;var o=a;switch(t){case`style`:o=Jf(e);break;case`script`:o=Qf(e)}Mf.has(o)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Mf.set(o,e),r.querySelector(a)!==null||t===`style`&&r.querySelector(Yf(o))||t===`script`&&r.querySelector($f(o))||(t=r.createElement(`link`),Qd(t,`link`,e),Ot(t),r.head.appendChild(t)))}}function Uf(e,t){Ff.m(e,t);var n=Rf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,a=`link[rel="modulepreload"][as="`+qt(r)+`"][href="`+qt(e)+`"]`,o=a;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:o=Qf(e)}if(!Mf.has(o)&&(e=h({rel:`modulepreload`,href:e},t),Mf.set(o,e),n.querySelector(a)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector($f(o)))return}r=n.createElement(`link`),Qd(r,`link`,e),Ot(r),n.head.appendChild(r)}}}function Wf(e,t,n){Ff.S(e,t,n);var r=Rf;if(r&&e){var a=Dt(r).hoistableStyles,o=Jf(e);t||=`default`;var s=a.get(o);if(!s){var c={loading:0,preload:null};if(s=r.querySelector(Yf(o)))c.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Mf.get(o))&&np(e,n);var l=s=r.createElement(`link`);Ot(l),Qd(l,`link`,e),l._p=new Promise(function(e,t){l.onload=e,l.onerror=t}),l.addEventListener(`load`,function(){c.loading|=1}),l.addEventListener(`error`,function(){c.loading|=2}),c.loading|=4,tp(s,t,r)}s={type:`stylesheet`,instance:s,count:1,state:c},a.set(o,s)}}}function Gf(e,t){Ff.X(e,t);var n=Rf;if(n&&e){var r=Dt(n).hoistableScripts,a=Qf(e),o=r.get(a);o||(o=n.querySelector($f(a)),o||(e=h({src:e,async:!0},t),(t=Mf.get(a))&&rp(e,t),o=n.createElement(`script`),Ot(o),Qd(o,`link`,e),n.head.appendChild(o)),o={type:`script`,instance:o,count:1,state:null},r.set(a,o))}}function Kf(e,t){Ff.M(e,t);var n=Rf;if(n&&e){var r=Dt(n).hoistableScripts,a=Qf(e),o=r.get(a);o||(o=n.querySelector($f(a)),o||(e=h({src:e,async:!0,type:`module`},t),(t=Mf.get(a))&&rp(e,t),o=n.createElement(`script`),Ot(o),Qd(o,`link`,e),n.head.appendChild(o)),o={type:`script`,instance:o,count:1,state:null},r.set(a,o))}}function qf(e,t,n,r){var o=(o=ge.current)?Pf(o):null;if(!o)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Jf(n.href),n=Dt(o).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Jf(n.href);var s=Dt(o).hoistableStyles,c=s.get(e);if(c||(o=o.ownerDocument||o,c={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},s.set(e,c),(s=o.querySelector(Yf(e)))&&!s._p&&(c.instance=s,c.state.loading=5),Mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Mf.set(e,n),s||Zf(o,e,n,c.state))),t&&r===null)throw Error(a(528,``));return c}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Qf(n),n=Dt(o).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Jf(e){return`href="`+qt(e)+`"`}function Yf(e){return`link[rel="stylesheet"][`+e+`]`}function Xf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Zf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Qd(t,`link`,n),Ot(t),e.head.appendChild(t))}function Qf(e){return`[src="`+qt(e)+`"]`}function $f(e){return`script[async]`+e}function ep(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+qt(n.href)+`"]`);if(r)return t.instance=r,Ot(r),r;var o=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ot(r),Qd(r,`style`,o),tp(r,n.precedence,e),t.instance=r;case`stylesheet`:o=Jf(n.href);var s=e.querySelector(Yf(o));if(s)return t.state.loading|=4,t.instance=s,Ot(s),s;r=Xf(n),(o=Mf.get(o))&&np(r,o),s=(e.ownerDocument||e).createElement(`link`),Ot(s);var c=s;return c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),Qd(s,`link`,r),t.state.loading|=4,tp(s,n.precedence,e),t.instance=s;case`script`:return s=Qf(n.src),(o=e.querySelector($f(s)))?(t.instance=o,Ot(o),o):(r=n,(o=Mf.get(s))&&(r=h({},n),rp(r,o)),e=e.ownerDocument||e,o=e.createElement(`script`),Ot(o),Qd(o,`link`,r),e.head.appendChild(o),t.instance=o);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,tp(r,n.precedence,e));return t.instance}function tp(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),a=r.length?r[r.length-1]:null,o=a,s=0;s<r.length;s++){var c=r[s];if(c.dataset.precedence===t)o=c;else if(o!==a)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function np(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function rp(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var ip=null;function ap(e,t,n){if(ip===null){var r=new Map,a=ip=new Map;a.set(n,r)}else a=ip,r=a.get(n),r||(r=new Map,a.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var o=n[a];if(!(o[St]||o[ht]||e===`link`&&o.getAttribute(`rel`)===`stylesheet`)&&o.namespaceURI!==`http://www.w3.org/2000/svg`){var s=o.getAttribute(t)||``;s=e+s;var c=r.get(s);c?c.push(o):r.set(s,[o])}}return r}function op(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function sp(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function cp(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function lp(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var a=Jf(r.href),o=t.querySelector(Yf(a));if(o){t=o._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=fp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=o,Ot(o);return}o=t.ownerDocument||t,r=Xf(r),(a=Mf.get(a))&&np(r,a),o=o.createElement(`link`),Ot(o);var s=o;s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Qd(o,`link`,r),n.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=fp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var up=0;function dp(e,t){return e.stylesheets&&e.count===0&&mp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&mp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&up===0&&(up=62500*tf());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&mp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>up?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(a)}}:null}function fp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)mp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var pp=null;function mp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,pp=new Map,t.forEach(hp,e),pp=null,fp.call(e))}function hp(e,t){if(!(t.state.loading&4)){var n=pp.get(e);if(n)var r=n.get(null);else{n=new Map,pp.set(e,n);for(var a=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),o=0;o<a.length;o++){var s=a[o];(s.nodeName===`LINK`||s.getAttribute(`media`)!==`not all`)&&(n.set(s.dataset.precedence,s),r=s)}r&&n.set(null,r)}a=t.instance,s=a.getAttribute(`data-precedence`),o=n.get(s)||r,o===r&&n.set(null,a),n.set(s,a),this.count++,r=fp.bind(this),a.addEventListener(`load`,r),a.addEventListener(`error`,r),o?o.parentNode.insertBefore(a,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var gp={$$typeof:w,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function _p(e,t,n,r,a,o,s,c,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=it(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=it(0),this.hiddenUpdates=it(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=o,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function vp(e,t,n,r,a,o,s,c,l,u,d,f){return e=new _p(e,t,n,s,l,u,d,f,c),t=1,!0===o&&(t|=24),o=_i(3,null,null,t),e.current=o,o.stateNode=e,t=ga(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:r,isDehydrated:n,cache:t},qa(o),e}function yp(e){return e?(e=hi,e):hi}function bp(e,t,n,r,a,o){a=yp(a),r.context===null?r.context=a:r.pendingContext=a,r=Ya(t),r.payload={element:n},o=o===void 0?null:o,o!==null&&(r.callback=o),n=Xa(e,r,t),n!==null&&(ju(n,e,t),Za(n,e,t))}function xp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Sp(e,t){xp(e,t),(e=e.alternate)&&xp(e,t)}function Cp(e){if(e.tag===13||e.tag===31){var t=fi(e,67108864);t!==null&&ju(t,e,67108864),Sp(e,67108864)}}function wp(e){if(e.tag===13||e.tag===31){var t=ku();t=ut(t);var n=fi(e,t);n!==null&&ju(n,e,t),Sp(e,t)}}var Tp=!0;function Ep(e,t,n,r){var a=A.T;A.T=null;var o=se.p;try{se.p=2,Op(e,t,n,r)}finally{se.p=o,A.T=a}}function Dp(e,t,n,r){var a=A.T;A.T=null;var o=se.p;try{se.p=8,Op(e,t,n,r)}finally{se.p=o,A.T=a}}function Op(e,t,n,r){if(Tp){var a=kp(r);if(a===null)Vd(e,t,r,Ap,n),Vp(e,r);else if(Up(a,e,t,n,r))r.stopPropagation();else if(Vp(e,r),t&4&&-1<Bp.indexOf(e)){for(;a!==null;){var o=Tt(a);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var s=$e(o.pendingLanes);if(s!==0){var c=o;for(c.pendingLanes|=2,c.entangledLanes|=2;s;){var l=1<<31-Ke(s);c.entanglements[1]|=l,s&=~l}bd(o),!(Xl&6)&&(_u=Pe()+500,xd(0,!1))}}break;case 31:case 13:c=fi(o,2),c!==null&&ju(c,o,2),Iu(),Sp(o,2)}if(o=kp(r),o===null&&Vd(e,t,r,Ap,n),o===a)break;a=o}a!==null&&r.stopPropagation()}else Vd(e,t,r,null,n)}}function kp(e){return e=dn(e),jp(e)}var Ap=null;function jp(e){if(Ap=null,e=wt(e),e!==null){var t=s(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=c(t),e!==null)return e;e=null}else if(n===31){if(e=l(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ap=e,null}function Mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Fe()){case Ie:return 2;case Le:return 8;case Re:case ze:return 32;case Be:return 268435456;default:return 32}default:return 32}}var Np=!1,Pp=null,Fp=null,Ip=null,Lp=new Map,Rp=new Map,zp=[],Bp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Vp(e,t){switch(e){case`focusin`:case`focusout`:Pp=null;break;case`dragenter`:case`dragleave`:Fp=null;break;case`mouseover`:case`mouseout`:Ip=null;break;case`pointerover`:case`pointerout`:Lp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Rp.delete(t.pointerId)}}function Hp(e,t,n,r,a,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[a]},t!==null&&(t=Tt(t),t!==null&&Cp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function Up(e,t,n,r,a){switch(t){case`focusin`:return Pp=Hp(Pp,e,t,n,r,a),!0;case`dragenter`:return Fp=Hp(Fp,e,t,n,r,a),!0;case`mouseover`:return Ip=Hp(Ip,e,t,n,r,a),!0;case`pointerover`:var o=a.pointerId;return Lp.set(o,Hp(Lp.get(o)||null,e,t,n,r,a)),!0;case`gotpointercapture`:return o=a.pointerId,Rp.set(o,Hp(Rp.get(o)||null,e,t,n,r,a)),!0}return!1}function Wp(e){var t=wt(e.target);if(t!==null){var n=s(t);if(n!==null){if(t=n.tag,t===13){if(t=c(n),t!==null){e.blockedOn=t,pt(e.priority,function(){wp(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,pt(e.priority,function(){wp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Gp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=kp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);un=r,n.target.dispatchEvent(r),un=null}else return t=Tt(n),t!==null&&Cp(t),e.blockedOn=n,!1;t.shift()}return!0}function Kp(e,t,n){Gp(e)&&n.delete(t)}function qp(){Np=!1,Pp!==null&&Gp(Pp)&&(Pp=null),Fp!==null&&Gp(Fp)&&(Fp=null),Ip!==null&&Gp(Ip)&&(Ip=null),Lp.forEach(Kp),Rp.forEach(Kp)}function Jp(e,n){e.blockedOn===n&&(e.blockedOn=null,Np||(Np=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,qp)))}var Yp=null;function Xp(e){Yp!==e&&(Yp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Yp===e&&(Yp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],a=e[t+2];if(typeof r!=`function`){if(jp(r||n)===null)continue;break}var o=Tt(n);o!==null&&(e.splice(t,3),t-=3,Ns(o,{pending:!0,data:a,method:n.method,action:r},r,a))}}))}function Zp(e){function t(t){return Jp(t,e)}Pp!==null&&Jp(Pp,e),Fp!==null&&Jp(Fp,e),Ip!==null&&Jp(Ip,e),Lp.forEach(t),Rp.forEach(t);for(var n=0;n<zp.length;n++){var r=zp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<zp.length&&(n=zp[0],n.blockedOn===null);)Wp(n),n.blockedOn===null&&zp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var a=n[r],o=n[r+1],s=a[gt]||null;if(typeof o==`function`)s||Xp(n);else if(s){var c=null;if(o&&o.hasAttribute(`formAction`)){if(a=o,s=o[gt]||null)c=s.formAction;else if(jp(a)!==null)continue}else c=s.action;typeof c==`function`?n[r+1]=c:(n.splice(r,3),r-=3),Xp(n)}}}function Qp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return a=e})},focusReset:`manual`,scroll:`manual`})}function t(){a!==null&&(a(),a=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,a=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),a!==null&&(a(),a=null)}}}function $p(e){this._internalRoot=e}em.prototype.render=$p.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var n=t.current;bp(n,ku(),e,t,null,null)},em.prototype.unmount=$p.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;bp(e.current,2,null,e,null,null),Iu(),t[_t]=null}};function em(e){this._internalRoot=e}em.prototype.unstable_scheduleHydration=function(e){if(e){var t=ft();e={blockedOn:null,target:e,priority:t};for(var n=0;n<zp.length&&t!==0&&t<zp[n].priority;n++);zp.splice(n,0,e),n===0&&Wp(e)}};var tm=n.version;if(tm!==`19.2.7`)throw Error(a(527,tm,`19.2.7`));se.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var nm={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:A,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var rm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rm.isDisabled&&rm.supportsFiber)try{Ue=rm.inject(nm),We=rm}catch{}}e.createRoot=function(e,t){if(!o(e))throw Error(a(299));var n=!1,r=``,s=nc,c=rc,l=ic;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(c=t.onCaughtError),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=vp(e,1,!1,null,null,n,r,null,s,c,l,Qp),e[_t]=t.current,zd(e),new $p(t)}})),v=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=_()})),y=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var a=null;if(r!==void 0&&(a=``+r),n.key!==void 0&&(a=``+n.key),`key`in n)for(var o in r={},n)o!==`key`&&(r[o]=n[o]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:a,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),b=s(((e,t)=>{t.exports=y()})),x=u(v(),1),S=u(m(),1),C=u(b(),1);(0,S.createContext)(null);var w=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},T=new class extends w{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},E={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},D=new class{#e=E;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function O(e){setTimeout(e,0)}var ee=typeof window>`u`||`Deno`in globalThis;function te(){}function ne(e,t){return typeof e==`function`?e(t):e}function re(e){return typeof e==`number`&&e>=0&&e!==1/0}function ie(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ae(e,t){return typeof e==`function`?e(t):e}function k(e,t){return typeof e==`function`?e(t):e}function oe(e,t){let{type:n=`all`,exact:r,fetchStatus:a,predicate:o,queryKey:s,stale:c}=e;if(s){if(r){if(t.queryHash!==se(s,t.options))return!1}else if(!le(t.queryKey,s))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof c==`boolean`&&t.isStale()!==c||a&&a!==t.state.fetchStatus||o&&!o(t))}function A(e,t){let{exact:n,status:r,predicate:a,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(ce(t.options.mutationKey)!==ce(o))return!1}else if(!le(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function se(e,t){return(t?.queryKeyHashFn||ce)(e)}function ce(e){return JSON.stringify(e,(e,t)=>me(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function le(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>le(e[n],t[n])):!1}var ue=Object.prototype.hasOwnProperty;function de(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=pe(e)&&pe(t);if(!r&&!(me(e)&&me(t)))return t;let a=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),s=o.length,c=r?Array(s):{},l=0;for(let u=0;u<s;u++){let s=r?u:o[u],d=e[s],f=t[s];if(d===f){c[s]=d,(r?u<a:ue.call(e,s))&&l++;continue}if(d===null||f===null||typeof d!=`object`||typeof f!=`object`){c[s]=f;continue}let p=de(d,f,n+1);c[s]=p,p===d&&l++}return a===s&&l===a?e:c}function fe(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function pe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function me(e){if(!he(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!he(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function he(e){return Object.prototype.toString.call(e)===`[object Object]`}function ge(e){return new Promise(t=>{D.setTimeout(t,e)})}function _e(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:de(e,t)}function ve(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ye(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var be=Symbol();function xe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===be?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Se(e,t){return typeof e==`function`?e(...t):!!e}function Ce(e,t,n){let r=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??=t(),r?a:(r=!0,a.aborted?n():a.addEventListener(`abort`,n,{once:!0}),a))}),e}var we=(()=>{let e=()=>ee;return{isServer(){return e()},setIsServer(t){e=t}}})();function Te(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Ee=O;function De(){let e=[],t=0,n=e=>{e()},r=e=>{e()},a=Ee,o=r=>{t?e.push(r):a(()=>{n(r)})},s=()=>{let t=e;e=[],t.length&&a(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||s()}return n},batchCalls:e=>(...t)=>{o(()=>{e(...t)})},schedule:o,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{a=e}}}var Oe=De(),ke=new class extends w{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ae(e){return Math.min(1e3*2**e,3e4)}function je(e){return(e??`online`)===`online`?ke.isOnline():!0}var Me=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ne(e){let t=!1,n=0,r,a=Te(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new Me(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>T.isFocused()&&(e.networkMode===`always`||ke.isOnline())&&e.canRun(),d=()=>je(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),a.resolve(e))},p=e=>{o()||(r?.(),a.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())return;let r,a=n===0?e.initialPromise:void 0;try{r=a??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(o())return;let a=e.retry??(we.isServer()?0:3),s=e.retryDelay??Ae,c=typeof s==`function`?s(n,r):s,l=a===!0||typeof a==`number`&&n<a||typeof a==`function`&&a(n,r);if(t||!l){p(r);return}n++,e.onFail?.(n,r),ge(c).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(r?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var Pe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),re(this.gcTime)&&(this.#e=D.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(we.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(D.clearTimeout(this.#e),this.#e=void 0)}};function Fe(e){return{onFetch:(t,n)=>{let r=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],c={pages:[],pageParams:[]},l=0,u=async()=>{let n=!1,u=e=>{Ce(e,()=>t.signal,()=>n=!0)},d=xe(t.options,t.fetchOptions),f=async(e,r,a)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let o=await d((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:a?`backward`:`forward`,meta:t.options.meta};return u(e),e})()),{maxPages:s}=t.options,c=a?ye:ve;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(a&&o.length){let e=a===`backward`,t=e?Le:Ie,n={pages:o,pageParams:s};c=await f(n,t(r,n),e)}else{let t=e??o.length;do{let e=l===0?s[0]??r.initialPageParam:Ie(r,c);if(l>0&&e==null)break;c=await f(c,e),l++}while(l<t)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function Ie(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Le(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Re(e,t){return t?Ie(e,t)!=null:!1}function ze(e,t){return!t||!e.getPreviousPageParam?!1:Le(e,t)!=null}var Be=class extends Pe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ue(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ue(this.options);e.data!==void 0&&(this.setState(He(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=_e(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(te).catch(te):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>k(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===be||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ae(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!ie(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},a=()=>{let e=xe(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},o=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:a};return r(e),e})();(this.#e===`infinite`?Fe(this.options.pages):this.options.behavior)?.onFetch(o,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:o.fetchOptions?.meta}),this.#a=Ne({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof Me&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Me){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ve(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...He(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Oe.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ve(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:je(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function He(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ue(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var We=class extends w{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Te(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ke(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qe(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qe(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof k(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!fe(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Je(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||ae(this.options.staleTime,this.#t)!==ae(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Xe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(te)),t}#g(){this.#b();let e=ae(this.options.staleTime,this.#t);if(we.isServer()||this.#r.isStale||!re(e))return;let t=ie(this.#r.dataUpdatedAt,e)+1;this.#d=D.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(we.isServer()||k(this.options.enabled,this.#t)===!1||!re(this.#p)||this.#p===0)&&(this.#f=D.setInterval(()=>{(this.options.refetchIntervalInBackground||T.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(D.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(D.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,s=this.#a,c=e===n?this.#n:e.state,{state:l}=e,u={...l},d=!1,f;if(t._optimisticResults){let a=this.hasListeners(),o=!a&&Ke(e,t),s=a&&Je(e,n,t,r);(o||s)&&(u={...u,...Ve(l.data,e.options)}),t._optimisticResults===`isRestoring`&&(u.fetchStatus=`idle`)}let{error:p,errorUpdatedAt:m,status:h}=u;f=u.data;let g=!1;if(t.placeholderData!==void 0&&f===void 0&&h===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=a.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,f=_e(a?.data,e,t),d=!0)}if(t.select&&f!==void 0&&!g)if(a&&f===o?.data&&t.select===this.#c)f=this.#l;else try{this.#c=t.select,f=t.select(f),f=_e(a?.data,f,t),this.#l=f,this.#s=null}catch(e){this.#s=e}this.#s&&(p=this.#s,f=this.#l,m=Date.now(),h=`error`);let _=u.fetchStatus===`fetching`,v=h===`pending`,y=h===`error`,b=v&&_,x=f!==void 0,S={status:h,fetchStatus:u.fetchStatus,isPending:v,isSuccess:h===`success`,isError:y,isInitialLoading:b,isLoading:b,data:f,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:u.fetchStatus===`paused`,isPlaceholderData:d,isRefetchError:y&&x,isStale:Ye(e,t),refetch:this.refetch,promise:this.#o,isEnabled:k(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,a=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},o=()=>{a(this.#o=S.promise=Te())},s=this.#o;switch(s.status){case`pending`:e.queryHash===n.queryHash&&a(s);break;case`fulfilled`:(r||S.data!==s.value)&&o();break;case`rejected`:(!r||S.error!==s.reason)&&o();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!fe(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){Oe.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Ge(e,t){return k(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&k(t.retryOnMount,e)===!1)}function Ke(e,t){return Ge(e,t)||e.state.data!==void 0&&qe(e,t,t.refetchOnMount)}function qe(e,t,n){if(k(t.enabled,e)!==!1&&ae(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ye(e,t)}return!1}function Je(e,t,n,r){return(e!==t||k(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ye(e,n)}function Ye(e,t){return k(t.enabled,e)!==!1&&e.isStaleByTime(ae(t.staleTime,e))}function Xe(e,t){return!fe(e.getCurrentResult(),t)}var Ze=class extends We{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:a,isRefetching:o,isError:s,isRefetchError:c}=r,l=n.fetchMeta?.fetchMore?.direction,u=s&&l===`forward`,d=a&&l===`forward`,f=s&&l===`backward`,p=a&&l===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Re(t,n.data),hasPreviousPage:ze(t,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:c&&!u&&!f,isRefetching:o&&!d&&!p}}},Qe=class extends Pe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||$e(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Ne({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,a=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await this.#r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Oe.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function $e(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var et=class extends w{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Qe({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=tt(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=tt(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=tt(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=tt(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Oe.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>A(t,e))}findAll(e={}){return this.getAll().filter(t=>A(e,t))}notify(e){Oe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Oe.batch(()=>Promise.all(e.map(e=>e.continue().catch(te))))}};function tt(e){return e.options.scope?.id}var nt=class extends w{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),fe(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&ce(t.mutationKey)!==ce(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??$e();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){Oe.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function rt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function it(e,t,n){let r=e.slice(0);return r[t]=n,r}var at=class extends w{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Oe.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),a=e.length!==n.length,o=n.some((t,n)=>t!==e[n]),s=a||o,c=s?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!fe(e,n)});!s&&!c||(s&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(s&&(rt(e,n).forEach(e=>{e.destroy()}),rt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),a=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,a),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let a=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?a:n.observer.trackResult(a,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,a=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||a||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=de(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),a=t.get(r.queryHash)?.shift()??new We(this.#e,r);n.push({defaultedQueryOptions:r,observer:a})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=it(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&Oe.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},ot=class extends w{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,a=t.queryHash??se(r,t),o=this.get(a);return o||(o=new Be({client:e,queryKey:r,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Oe.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>oe(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>oe(e,t)):t}notify(e){Oe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Oe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Oe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},st=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ot,this.#t=e.mutationCache||new et,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=T.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ke.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ae(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),a=this.#e.get(r.queryHash)?.state.data,o=ne(t,a);if(o!==void 0)return this.#e.build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Oe.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Oe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Oe.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Oe.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(te).catch(te)}invalidateQueries(e,t={}){return Oe.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Oe.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(te)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(te)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ae(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(te).catch(te)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(te).catch(te)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ke.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ce(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{le(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ce(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{le(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=se(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===be&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},ct=S.createContext(void 0),lt=e=>{let t=S.useContext(ct);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ut=({client:e,children:t})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,C.jsx)(ct.Provider,{value:e,children:t})),dt=S.createContext(!1),ft=()=>S.useContext(dt);dt.Provider;function pt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var mt=S.createContext(pt()),ht=()=>S.useContext(mt),gt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Se(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},_t=e=>{S.useEffect(()=>{e.clearReset()},[e])},vt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||Se(n,[e.error,r])),yt=(e,t)=>t.state.data===void 0,bt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},xt=(e,t)=>e.isLoading&&e.isFetching&&!t,St=(e,t)=>e?.suspense&&t.isPending,Ct=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function wt({queries:e,...t},n){let r=lt(n),a=ft(),o=ht(),s=S.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=a?`isRestoring`:`optimistic`,t}),[e,r,a]);s.forEach(e=>{bt(e),gt(e,o,r.getQueryCache().get(e.queryHash))}),_t(o);let[c]=S.useState(()=>new at(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!a&&t.subscribed!==!1;S.useSyncExternalStore(S.useCallback(e=>f?c.subscribe(Oe.batchCalls(e)):te,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),S.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>St(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&St(n,e)?Ct(n,new We(r,n),o):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&vt({result:e,errorResetBoundary:o,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m?.error)throw m.error;return u(d())}function Tt(e,t,n){let r=ft(),a=ht(),o=lt(n),s=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let c=o.getQueryCache().get(s.queryHash),l=e.subscribed!==!1;s._optimisticResults=r?`isRestoring`:l?`optimistic`:void 0,bt(s),gt(s,a,c),_t(a);let u=!o.getQueryCache().get(s.queryHash),[d]=S.useState(()=>new t(o,s)),f=d.getOptimisticResult(s),p=!r&&l;if(S.useSyncExternalStore(S.useCallback(e=>{let t=p?d.subscribe(Oe.batchCalls(e)):te;return d.updateResult(),t},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),S.useEffect(()=>{d.setOptions(s)},[s,d]),St(s,f))throw Ct(s,d,a);if(vt({result:f,errorResetBoundary:a,throwOnError:s.throwOnError,query:c,suspense:s.suspense}))throw f.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(s,f),s.experimental_prefetchInRender&&!we.isServer()&&xt(f,r)&&(u?Ct(s,d,a):c?.promise)?.catch(te).finally(()=>{d.updateResult()}),s.notifyOnChangeProps?f:d.trackResult(f)}function Et(e,t){return Tt(e,We,t)}function Dt(e,t){return Tt({...e,enabled:!0,suspense:!0,throwOnError:yt,placeholderData:void 0},We,t)}function Ot(e,t){return Tt({...e,enabled:!0,suspense:!0,throwOnError:yt},Ze,t)}function kt(e,t){return wt({...e,queries:e.queries.map(e=>({...e,suspense:!0,throwOnError:yt,enabled:!0,placeholderData:void 0}))},t)}function At(e,t){let n=lt(t);n.getQueryState(e.queryKey)||n.prefetchQuery(e)}function jt(e,t){let n=lt(t);n.getQueryState(e.queryKey)||n.prefetchInfiniteQuery(e)}function Mt(e){return e}function Nt(e){return e}function Pt(e,t){let n=lt(t),[r]=S.useState(()=>new nt(n,e));S.useEffect(()=>{r.setOptions(e)},[r,e]);let a=S.useSyncExternalStore(S.useCallback(e=>r.subscribe(Oe.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=S.useCallback((e,t)=>{r.mutate(e,t).catch(te)},[r]);if(a.error&&Se(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function Ft(e,t){return Tt(e,Ze,t)}g();var It=Object.create,Lt=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,zt=Object.getOwnPropertyNames,Bt=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty,Ht=(e,t)=>function(){return t||(0,e[zt(e)[0]])((t={exports:{}}).exports,t),t.exports},Ut=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var a=zt(t),o=0,s=a.length,c;o<s;o++)c=a[o],!Vt.call(e,c)&&c!==n&&Lt(e,c,{get:(e=>t[e]).bind(null,c),enumerable:!(r=Rt(t,c))||r.enumerable});return e},Wt=(e,t,n)=>(n=e==null?{}:It(Bt(e)),Ut(t||!e||!e.__esModule?Lt(n,`default`,{value:e,enumerable:!0}):n,e)),Gt=Ht({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Kt=Ht({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=Gt().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t||`default`);if(n(a)!=`object`)return a;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),qt=Ht({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=Gt().default,r=Kt();function a(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}}),Jt=Ht({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=qt();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Yt=Ht({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=Jt();function r(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 a(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]==null?{}:arguments[t];t%2?r(Object(a),!0).forEach(function(t){n(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}});function Xt(e){let t={subscribe(t){let n=null,r=!1,a=!1,o=!1;function s(){if(n===null){o=!0;return}a||(a=!0,typeof n==`function`?n():n&&n.unsubscribe())}return n=e({next(e){var n;r||(n=t.next)==null||n.call(t,e)},error(e){var n;r||(r=!0,(n=t.error)==null||n.call(t,e),s())},complete(){var e;r||(r=!0,(e=t.complete)==null||e.call(t),s())}}),o&&s(),{unsubscribe:s}},pipe(...e){return e.reduce(Zt,t)}};return t}function Zt(e,t){return t(e)}function Qt(e){let t=new AbortController;return new Promise((n,r)=>{let a=!1;function o(){a||(a=!0,s.unsubscribe())}t.signal.addEventListener(`abort`,()=>{r(t.signal.reason)});let s=e.subscribe({next(e){a=!0,n(e),o()},error(e){r(e)},complete(){t.abort(),o()}})})}function $t(e){return e=>{let t=0,n=null,r=[];function a(){n||=e.subscribe({next(e){for(let n of r){var t;(t=n.next)==null||t.call(n,e)}},error(e){for(let n of r){var t;(t=n.error)==null||t.call(n,e)}},complete(){for(let t of r){var e;(e=t.complete)==null||e.call(t)}}})}function o(){if(t===0&&n){let e=n;n=null,e.unsubscribe()}}return Xt(e=>(t++,r.push(e),a(),{unsubscribe(){t--,o();let n=r.findIndex(t=>t===e);n>-1&&r.splice(n,1)}}))}}function en(e){let t=e,n=[],r=e=>{t!==void 0&&e.next(t),n.push(e)},a=e=>{n.splice(n.indexOf(e),1)},o=Xt(e=>(r(e),()=>{a(e)}));return o.next=e=>{if(t!==e){t=e;for(let t of n)t.next(e)}},o.get=()=>t,o}function tn(e){return Xt(t=>{function n(t=0,r=e.op){let a=e.links[t];if(!a)throw Error(`No more links to execute - did you forget to add an ending link?`);return a({op:r,next(e){return n(t+1,e)}})}return n().subscribe(t)})}function nn(e){return!!e&&!Array.isArray(e)&&typeof e==`object`}function rn(){return Object.create(null)}var an=typeof Symbol==`function`&&!!Symbol.asyncIterator;function on(e){return an&&nn(e)&&Symbol.asyncIterator in e}var sn=e=>e();function cn(e=0){return new Promise(t=>setTimeout(t,e))}var ln={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,PAYMENT_REQUIRED:-32002,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,PRECONDITION_REQUIRED:-32028,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};ln.BAD_GATEWAY,ln.SERVICE_UNAVAILABLE,ln.GATEWAY_TIMEOUT,ln.INTERNAL_SERVER_ERROR;var un=Object.create,dn=Object.defineProperty,fn=Object.getOwnPropertyDescriptor,pn=Object.getOwnPropertyNames,mn=Object.getPrototypeOf,hn=Object.prototype.hasOwnProperty,gn=(e,t)=>function(){return t||(0,e[pn(e)[0]])((t={exports:{}}).exports,t),t.exports},_n=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var a=pn(t),o=0,s=a.length,c;o<s;o++)c=a[o],!hn.call(e,c)&&c!==n&&dn(e,c,{get:(e=>t[e]).bind(null,c),enumerable:!(r=fn(t,c))||r.enumerable});return e},vn=(e,t,n)=>(n=e==null?{}:un(mn(e)),_n(t||!e||!e.__esModule?dn(n,`default`,{value:e,enumerable:!0}):n,e)),yn=()=>{},bn=e=>{Object.freeze&&Object.freeze(e)};function xn(e,t,n){let r=t.join(`.`);return n[r]??(n[r]=new Proxy(yn,{get(r,a){if(!(typeof a!=`string`||a===`then`))return xn(e,[...t,a],n)},apply(n,r,a){let o=t[t.length-1];if(o===`valueOf`||o===`toString`||o===`toJSON`)return`tRPC.proxy(${t.slice(0,-1).join(`.`)})`;let s={args:a,path:t};return o===`call`?s={args:a.length>=2?[a[1]]:[],path:t.slice(0,-1)}:o===`apply`&&(s={args:a.length>=2?a[1]:[],path:t.slice(0,-1)}),bn(s.args),bn(s.path),e(s)}})),n[r]}var Sn=e=>xn(e,[],rn()),Cn=e=>new Proxy(yn,{get(t,n){if(n!==`then`)return e(n)}}),wn=gn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Tn=gn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=wn().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t||`default`);if(n(a)!=`object`)return a;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),En=gn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=wn().default,r=Tn();function a(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}}),Dn=gn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=En();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),On=gn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=Dn();function r(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 a(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]==null?{}:arguments[t];t%2?r(Object(a),!0).forEach(function(t){n(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}});vn(On(),1),vn(Dn(),1);var kn=vn(On(),1);function An(e,t){if(`error`in e){let n=t.deserialize(e.error);return{ok:!1,error:(0,kn.default)((0,kn.default)({},e),{},{error:n})}}return{ok:!0,result:(0,kn.default)((0,kn.default)({},e.result),(!e.result.type||e.result.type===`data`)&&{type:`data`,data:t.deserialize(e.result.data)})}}var jn=class extends Error{constructor(){super(`Unable to transform response from server`)}};function Mn(e,t){let n;try{n=An(e,t)}catch{throw new jn}if(!n.ok&&(!nn(n.error.error)||typeof n.error.error.code!=`number`)||n.ok&&!nn(n.result))throw new jn;return n}vn(On(),1);var Nn=Wt(Jt(),1),Pn=Wt(Yt(),1);function Fn(e){return e instanceof Rn}function In(e){return nn(e)&&nn(e.error)&&typeof e.error.code==`number`&&typeof e.error.message==`string`}function Ln(e,t){return typeof e==`string`?e:nn(e)&&typeof e.message==`string`?e.message:t}var Rn=class e extends Error{constructor(t,n){var r,a;let o=n?.cause;super(t,{cause:o}),(0,Nn.default)(this,`cause`,void 0),(0,Nn.default)(this,`shape`,void 0),(0,Nn.default)(this,`data`,void 0),(0,Nn.default)(this,`meta`,void 0),this.meta=n?.meta,this.cause=o,this.shape=n==null||(r=n.result)==null?void 0:r.error,this.data=n==null||(a=n.result)==null?void 0:a.error.data,this.name=`TRPCClientError`,Object.setPrototypeOf(this,e.prototype)}static from(t,n={}){let r=t;return Fn(r)?(n.meta&&(r.meta=(0,Pn.default)((0,Pn.default)({},r.meta),n.meta)),r):In(r)?new e(r.error.message,(0,Pn.default)((0,Pn.default)({},n),{},{result:r,cause:n.cause})):new e(Ln(r,`Unknown error`),(0,Pn.default)((0,Pn.default)({},n),{},{cause:r}))}};function zn(e){let t=e;return t?`input`in t?t:{input:t,output:t}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}}}var Bn=e=>typeof e==`function`;function Vn(e){if(e)return e;if(typeof window<`u`&&Bn(window.fetch))return window.fetch;if(typeof globalThis<`u`&&Bn(globalThis.fetch))return globalThis.fetch;throw Error(`No fetch implementation found`)}var Hn=Wt(Yt());function Un(e){return{url:e.url.toString(),fetch:e.fetch,transformer:zn(e.transformer),methodOverride:e.methodOverride}}function Wn(e){let t={};for(let n=0;n<e.length;n++)t[n]=e[n];return t}var Gn={query:`GET`,mutation:`POST`,subscription:`PATCH`};function Kn(e){return`input`in e?e.transformer.input.serialize(e.input):Wn(e.inputs.map(t=>e.transformer.input.serialize(t)))}var qn=e=>{let t=e.url.split(`?`),n=t[0].replace(/\/$/,``)+`/`+e.path,r=[];if(t[1]&&r.push(t[1]),`inputs`in e&&r.push(`batch=1`),e.type===`query`||e.type===`subscription`){let t=Kn(e);t!==void 0&&e.methodOverride!==`POST`&&r.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return r.length&&(n+=`?`+r.join(`&`)),n},Jn=e=>{if(e.type===`query`&&e.methodOverride!==`POST`)return;let t=Kn(e);return t===void 0?void 0:JSON.stringify(t)},Yn=e=>$n((0,Hn.default)((0,Hn.default)({},e),{},{contentTypeHeader:`application/json`,getUrl:qn,getBody:Jn})),Xn=class extends Error{constructor(){let e=`AbortError`;super(e),this.name=e,this.message=e}},Zn=e=>{var t;if(e?.aborted)throw(t=e.throwIfAborted)==null||t.call(e),typeof DOMException<`u`?new DOMException(`AbortError`,`AbortError`):new Xn};async function Qn(e){Zn(e.signal);let t=e.getUrl(e),n=e.getBody(e),r=e.methodOverride??Gn[e.type],a=await(async()=>{let t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})(),o=(0,Hn.default)((0,Hn.default)((0,Hn.default)({},e.contentTypeHeader&&r!==`GET`?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[e.trpcAcceptHeaderKey??`trpc-accept`]:e.trpcAcceptHeader}:void 0),a);return Vn(e.fetch)(t,{method:r,signal:e.signal,body:n,headers:o})}async function $n(e){let t={},n=await Qn(e);t.response=n;let r=await n.json();return t.responseJSON=r,{json:r,meta:t}}function er(e){return e instanceof Uint8Array||e instanceof Blob}function tr(e){return e instanceof FormData}var nr=Wt(Yt(),1),rr=e=>{if(`input`in e){let{input:t}=e;if(tr(t)){if(e.type!==`mutation`&&e.methodOverride!==`POST`)throw Error(`FormData is only supported for mutations`);return $n((0,nr.default)((0,nr.default)({},e),{},{contentTypeHeader:void 0,getUrl:qn,getBody:()=>t}))}if(er(t)){if(e.type!==`mutation`&&e.methodOverride!==`POST`)throw Error(`Octet type input is only supported for mutations`);return $n((0,nr.default)((0,nr.default)({},e),{},{contentTypeHeader:`application/octet-stream`,getUrl:qn,getBody:()=>t}))}}return Yn(e)};function ir(e){let t=Un(e);return()=>n=>{let{op:r}=n;return Xt(n=>{let{path:a,input:o,type:s}=r;if(s===`subscription`)throw Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let c=rr((0,nr.default)((0,nr.default)({},t),{},{type:s,path:a,input:o,signal:r.signal,headers(){return e.headers?typeof e.headers==`function`?e.headers({op:r}):e.headers:{}}})),l;return c.then(e=>{l=e.meta;let r=Mn(e.json,t.transformer.output);if(!r.ok){n.error(Rn.from(r.error,{meta:l}));return}n.next({context:e.meta,result:r.result}),n.complete()}).catch(e=>{n.error(Rn.from(e,{meta:l}))}),()=>{}})}}Wt(Yt(),1),Wt(Yt(),1);var ar={encode:e=>JSON.stringify(e),decode:e=>{if(typeof e!=`string`)throw Error(`jsonEncoder received binary data. JSON uses text frames. Use a binary encoder for binary data.`);return JSON.parse(e)}},or={enabled:!1,closeMs:0},sr={enabled:!1,pongTimeoutMs:1e3,intervalMs:5e3},cr=e=>e===0?0:Math.min(1e3*2**e,3e4),lr=(e,...t)=>typeof e==`function`?e(...t):e,ur=Wt(Jt(),1),dr=class e extends Error{constructor(t){super(t.message,{cause:t.cause}),this.name=`TRPCWebSocketClosedError`,Object.setPrototypeOf(this,e.prototype)}},fr=class{constructor(e,t){this.onTimeout=e,this.timeoutMs=t,(0,ur.default)(this,`timeout`,void 0)}reset(){this.timeout&&=(clearTimeout(this.timeout),setTimeout(this.onTimeout,this.timeoutMs))}start(){clearTimeout(this.timeout),this.timeout=setTimeout(this.onTimeout,this.timeoutMs)}stop(){clearTimeout(this.timeout),this.timeout=void 0}};function pr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function mr(e){let t=await lr(e.url);return e.connectionParams?t+`${t.includes(`?`)?`&`:`?`}connectionParams=1`:t}async function hr(e,t){let n={method:`connectionParams`,data:await lr(e)};return t.encode(n)}var gr=Wt(Jt(),1),_r=class{constructor(){(0,gr.default)(this,`outgoingRequests`,[]),(0,gr.default)(this,`pendingRequests`,{})}register(e,t){let{promise:n,resolve:r}=pr();return this.outgoingRequests.push({id:String(e.id),message:e,end:n,callbacks:{next:t.next,complete:()=>{t.complete(),r()},error:e=>{t.error(e),r()}}}),()=>{this.delete(e.id),t.complete(),r()}}delete(e){e!==null&&(this.outgoingRequests=this.outgoingRequests.filter(({id:t})=>t!==String(e)),delete this.pendingRequests[String(e)])}flush(){let e=this.outgoingRequests;this.outgoingRequests=[];for(let t of e)this.pendingRequests[t.id]=t;return e}getPendingRequests(){return Object.values(this.pendingRequests)}getPendingRequest(e){return e===null?null:this.pendingRequests[String(e)]}getOutgoingRequests(){return this.outgoingRequests}getRequests(){return[...this.getOutgoingRequests().map(e=>({state:`outgoing`,message:e.message,end:e.end,callbacks:e.callbacks})),...this.getPendingRequests().map(e=>({state:`pending`,message:e.message,end:e.end,callbacks:e.callbacks}))]}hasPendingRequests(){return this.getPendingRequests().length>0}hasPendingSubscriptions(){return this.getPendingRequests().some(e=>e.message.method===`subscription`)}hasOutgoingRequests(){return this.outgoingRequests.length>0}},vr=Wt(Jt(),1);function yr(e){let{promise:t,resolve:n,reject:r}=pr();return e.addEventListener(`open`,()=>{e.removeEventListener(`error`,r),n()}),e.addEventListener(`error`,r),t}function br(e,{intervalMs:t,pongTimeoutMs:n}){let r,a;function o(){r=setTimeout(()=>{e.send(`PING`),a=setTimeout(()=>{e.close()},n)},t)}function s(){clearTimeout(r),o()}function c(){clearTimeout(a),s()}e.addEventListener(`open`,o),e.addEventListener(`message`,({data:e})=>{clearTimeout(r),o(),e===`PONG`&&c()}),e.addEventListener(`close`,()=>{clearTimeout(r),clearTimeout(a)})}var xr=class e{constructor(t){if((0,vr.default)(this,`id`,++e.connectCount),(0,vr.default)(this,`WebSocketPonyfill`,void 0),(0,vr.default)(this,`urlOptions`,void 0),(0,vr.default)(this,`keepAliveOpts`,void 0),(0,vr.default)(this,`encoder`,void 0),(0,vr.default)(this,`wsObservable`,en(null)),(0,vr.default)(this,`openPromise`,null),this.WebSocketPonyfill=t.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive,this.encoder=t.encoder}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var t=this;if(t.openPromise)return t.openPromise;t.id=++e.connectCount,t.openPromise=mr(t.urlOptions).then(e=>new t.WebSocketPonyfill(e)).then(async e=>{t.ws=e,e.binaryType=`arraybuffer`,e.addEventListener(`message`,function({data:e}){e===`PING`&&this.send(`PONG`)}),t.keepAliveOpts.enabled&&br(e,t.keepAliveOpts),e.addEventListener(`close`,()=>{t.ws===e&&(t.ws=null)}),await yr(e),t.urlOptions.connectionParams&&e.send(await hr(t.urlOptions.connectionParams,t.encoder))});try{await t.openPromise}finally{t.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var t;(t=e.ws)==null||t.close()}}};(0,vr.default)(xr,`connectCount`,0);function Sr(e){return e.isOpen()?{id:e.id,state:`open`,ws:e.ws}:e.isClosed()?{id:e.id,state:`closed`,ws:e.ws}:e.ws?{id:e.id,state:`connecting`,ws:e.ws}:null}var Cr=Wt(Jt(),1),wr=Wt(Yt(),1),Tr=class{constructor(e){(0,Cr.default)(this,`connectionState`,void 0),(0,Cr.default)(this,`allowReconnect`,!1),(0,Cr.default)(this,`requestManager`,new _r),(0,Cr.default)(this,`activeConnection`,void 0),(0,Cr.default)(this,`reconnectRetryDelay`,void 0),(0,Cr.default)(this,`inactivityTimeout`,void 0),(0,Cr.default)(this,`callbacks`,void 0),(0,Cr.default)(this,`lazyMode`,void 0),(0,Cr.default)(this,`encoder`,void 0),(0,Cr.default)(this,`reconnecting`,null),this.encoder=e.experimental_encoder??ar,this.callbacks={onOpen:e.onOpen,onClose:e.onClose,onError:e.onError};let t=(0,wr.default)((0,wr.default)({},or),e.lazy);this.inactivityTimeout=new fr(()=>{if(this.requestManager.hasOutgoingRequests()||this.requestManager.hasPendingRequests()){this.inactivityTimeout.reset();return}this.close().catch(()=>null)},t.closeMs),this.activeConnection=new xr({WebSocketPonyfill:e.WebSocket,urlOptions:e,keepAlive:(0,wr.default)((0,wr.default)({},sr),e.keepAlive),encoder:this.encoder}),this.activeConnection.wsObservable.subscribe({next:e=>{e&&this.setupWebSocketListeners(e)}}),this.reconnectRetryDelay=e.retryDelayMs??cr,this.lazyMode=t.enabled,this.connectionState=en({type:`state`,state:t.enabled?`idle`:`connecting`,error:null}),this.lazyMode||this.open().catch(()=>null)}async open(){var e=this;e.allowReconnect=!0,e.connectionState.get().state===`idle`&&e.connectionState.next({type:`state`,state:`connecting`,error:null});try{await e.activeConnection.open()}catch(t){return e.reconnect(new dr({message:`Initialization error`,cause:t})),e.reconnecting}}async close(){var e=this;e.allowReconnect=!1,e.inactivityTimeout.stop();let t=[];for(let n of e.requestManager.getRequests())n.message.method===`subscription`?n.callbacks.complete():n.state===`outgoing`?n.callbacks.error(Rn.from(new dr({message:`Closed before connection was established`}))):t.push(n.end);await Promise.all(t).catch(()=>null),await e.activeConnection.close().catch(()=>null),e.connectionState.next({type:`state`,state:`idle`,error:null})}request({op:{id:e,type:t,path:n,input:r,signal:a},transformer:o,lastEventId:s}){return Xt(c=>{let l=this.batchSend({id:e,method:t,params:{input:o.input.serialize(r),path:n,lastEventId:s}},(0,wr.default)((0,wr.default)({},c),{},{next(e){let t=Mn(e,o.output);if(!t.ok){c.error(Rn.from(t.error));return}c.next({result:t.result})}}));return()=>{l(),t===`subscription`&&this.activeConnection.isOpen()&&this.send({id:e,method:`subscription.stop`}),a?.removeEventListener(`abort`,l)}})}get connection(){return Sr(this.activeConnection)}reconnect(e){var t=this;if(this.connectionState.next({type:`state`,state:`connecting`,error:Rn.from(e)}),this.reconnecting)return;let n=async e=>{try{await cn(t.reconnectRetryDelay(e)),t.allowReconnect&&(await t.activeConnection.close(),await t.activeConnection.open(),t.requestManager.hasPendingRequests()&&t.send(t.requestManager.getPendingRequests().map(({message:e})=>e))),t.reconnecting=null}catch{await n(e+1)}};this.reconnecting=n(0)}setupWebSocketListeners(e){var t=this;let n=e=>{let t=this.requestManager.getPendingRequests();for(let{message:n,callbacks:r}of t)n.method!==`subscription`&&(r.error(Rn.from(e??new dr({message:`WebSocket closed`,cause:e}))),this.requestManager.delete(n.id))};e.addEventListener(`open`,()=>{sn(async()=>{var e,n;t.lazyMode&&t.inactivityTimeout.start(),(e=(n=t.callbacks).onOpen)==null||e.call(n),t.connectionState.next({type:`state`,state:`pending`,error:null})}).catch(t=>{e.close(3e3),n(t)})}),e.addEventListener(`message`,({data:e})=>{if(this.inactivityTimeout.reset(),[`PING`,`PONG`].includes(e))return;let t=this.encoder.decode(e);if(`method`in t){this.handleIncomingRequest(t);return}this.handleResponseMessage(t)}),e.addEventListener(`close`,e=>{var t,r;n(e),(t=(r=this.callbacks).onClose)==null||t.call(r,e),(!this.lazyMode||this.requestManager.hasPendingSubscriptions())&&this.reconnect(new dr({message:`WebSocket closed`,cause:e}))}),e.addEventListener(`error`,e=>{var t,r;n(e),(t=(r=this.callbacks).onError)==null||t.call(r,e),this.reconnect(new dr({message:`WebSocket closed`,cause:e}))})}handleResponseMessage(e){let t=this.requestManager.getPendingRequest(e.id);if(!t)return;t.callbacks.next(e);let n=!0;`result`in e&&t.message.method===`subscription`&&(e.result.type===`data`&&(t.message.params.lastEventId=e.result.id),e.result.type!==`stopped`&&(n=!1)),n&&(t.callbacks.complete(),this.requestManager.delete(e.id))}handleIncomingRequest(e){e.method===`reconnect`&&this.reconnect(new dr({message:`Server requested reconnect`}))}send(e){if(!this.activeConnection.isOpen())throw Error(`Active connection is not open`);let t=e instanceof Array?e:[e];this.activeConnection.ws.send(this.encoder.encode(t.length===1?t[0]:t))}batchSend(e,t){var n=this;return this.inactivityTimeout.reset(),sn(async()=>{n.activeConnection.isOpen()||await n.open(),await cn(0),n.requestManager.hasOutgoingRequests()&&n.send(n.requestManager.flush().map(({message:e})=>e))}).catch(n=>{this.requestManager.delete(e.id),t.error(Rn.from(n))}),this.requestManager.register(e,t)}};function Er(e){return new Tr(e)}function Dr(e){let{client:t}=e,n=zn(e.transformer);return()=>({op:e})=>Xt(r=>{let a=e.type===`subscription`?t.connectionState.subscribe({next(t){r.next({result:t,context:e.context})}}):null,o=t.request({op:e,transformer:n}).subscribe(r);return()=>{o.unsubscribe(),a?.unsubscribe()}})}var Or=Wt(Jt(),1),kr=Wt(Yt(),1),Ar=class{constructor(e){(0,Or.default)(this,`links`,void 0),(0,Or.default)(this,`runtime`,void 0),(0,Or.default)(this,`requestId`,void 0),this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}$request(e){return tn({links:this.links,op:(0,kr.default)((0,kr.default)({},e),{},{context:e.context??{},id:++this.requestId})}).pipe($t())}async requestAsPromise(e){var t=this;try{return(await Qt(t.$request(e))).result.data}catch(e){throw Rn.from(e)}}query(e,t,n){return this.requestAsPromise({type:`query`,path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:`mutation`,path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:`subscription`,path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(e){switch(e.result.type){case`state`:var t;(t=n.onConnectionStateChange)==null||t.call(n,e.result);break;case`started`:var r;(r=n.onStarted)==null||r.call(n,{context:e.context});break;case`stopped`:var a;(a=n.onStopped)==null||a.call(n);break;case`data`:case void 0:var o;(o=n.onData)==null||o.call(n,e.result.data);break}},error(e){var t;(t=n.onError)==null||t.call(n,e)},complete(){var e;(e=n.onComplete)==null||e.call(n)}})}},jr=Symbol.for(`trpc_untypedClient`),Mr={query:`query`,mutate:`mutation`,subscribe:`subscription`},Nr=e=>Mr[e];function Pr(e){let t=Sn(({path:t,args:n})=>{let r=[...t],a=Nr(r.pop()),o=r.join(`.`);return e[a](o,...n)});return Cn(n=>n===jr?e:t[n])}function Fr(e){return Pr(new Ar(e))}function Ir(e){return e[jr]}Wt(Yt(),1),Wt(Yt(),1),Wt(Ht({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(e){var t,n,a,o=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,a=Symbol.iterator);o--;){if(n&&(t=e[n])!=null)return t.call(e);if(a&&(t=e[a])!=null)return new r(t.call(e));n=`@@asyncIterator`,a=`@@iterator`}throw TypeError(`Object is not async iterable`)}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return r=function(e){this.s=e,this.n=e.next},r.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new r(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}})(),1),Wt(Yt(),1);var Lr=Ht({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function n(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var a=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);a&&(r=function(){try{a.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,a=this.e,o=0;function s(){for(;r=n.pop();)try{if(!r.a&&o===1)return o=0,n.push(r),Promise.resolve().then(s);if(r.d){var e=r.d.call(r.v);if(r.a)return o|=2,Promise.resolve(e).then(s,c)}else o|=1}catch(e){return c(e)}if(o===1)return a===t?Promise.resolve():Promise.reject(a);if(a!==t)throw a}function c(n){return a=a===t?n:new e(n,a),s()}return s()}}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Rr=Ht({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){function n(e,t){this.v=e,this.k=t}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),zr=Ht({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=Rr();function r(e){return new n(e,0)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Br=Ht({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=Rr();function r(e){return function(){return new a(e.apply(this,arguments))}}function a(e){var t,r;function a(t,r){try{var s=e[t](r),c=s.value,l=c instanceof n;Promise.resolve(l?c.v:c).then(function(n){if(l){var r=t===`return`?`return`:`next`;if(!c.k||n.done)return a(r,n);n=e[r](n).value}o(s.done?`return`:`normal`,n)},function(e){a(`throw`,e)})}catch(e){o(`throw`,e)}}function o(e,n){switch(e){case`return`:t.resolve({value:n,done:!0});break;case`throw`:t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?a(t.key,t.arg):r=null}this._invoke=function(e,n){return new Promise(function(o,s){var c={key:e,arg:n,resolve:o,reject:s,next:null};r?r=r.next=c:(t=r=c,a(e,n))})},typeof e.return!=`function`&&(this.return=void 0)}a.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},a.prototype.next=function(e){return this._invoke(`next`,e)},a.prototype.throw=function(e){return this._invoke(`throw`,e)},a.prototype.return=function(e){return this._invoke(`return`,e)},t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}});Wt(Lr(),1),Wt(zr(),1),Wt(Br(),1),Wt(Yt(),1);var Vr=Object.create,Hr=Object.defineProperty,Ur=Object.getOwnPropertyDescriptor,Wr=Object.getOwnPropertyNames,Gr=Object.getPrototypeOf,Kr=Object.prototype.hasOwnProperty,qr=(e,t)=>function(){return t||(0,e[Wr(e)[0]])((t={exports:{}}).exports,t),t.exports},Jr=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var a=Wr(t),o=0,s=a.length,c;o<s;o++)c=a[o],!Kr.call(e,c)&&c!==n&&Hr(e,c,{get:(e=>t[e]).bind(null,c),enumerable:!(r=Ur(t,c))||r.enumerable});return e},Yr=(e,t,n)=>(n=e==null?{}:Vr(Gr(e)),Jr(t||!e||!e.__esModule?Hr(n,`default`,{value:e,enumerable:!0}):n,e)),Xr=qr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(e,t){function n(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Zr=qr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(e,t){var n=Xr();function r(e,t){if(e==null)return{};var r,a,o=n(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)r=s[a],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Qr=qr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),$r=qr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=Qr().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t||`default`);if(n(a)!=`object`)return a;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),ei=qr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=Qr().default,r=$r();function a(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}}),ti=qr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=ei();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),ni=qr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=ti();function r(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 a(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]==null?{}:arguments[t];t%2?r(Object(a),!0).forEach(function(t){n(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}}),ri=Yr(Zr(),1),ii=Yr(ni(),1),ai=[`cursor`,`direction`];function oi(e,t,n){let r=e.flatMap(e=>e.split(`.`));if(!t&&(!n||n===`any`))return r.length?[r]:[];if(n===`infinite`&&nn(t)&&(`direction`in t||`cursor`in t)){let{cursor:e,direction:n}=t;return[r,{input:(0,ri.default)(t,ai),type:`infinite`}]}return[r,(0,ii.default)((0,ii.default)({},t!==void 0&&t!==be&&{input:t}),n&&n!==`any`&&{type:n})]}function si(e){return oi(e,void 0,`any`)}function ci(e){return Sn(({path:t,args:n})=>{let r=[...t],a=r.pop();if(a===`useMutation`)return e[a](r,...n);if(a===`_def`)return{path:r};let[o,...s]=n,c=s[0]??{};return e[a](r,o,c)})}var li=[`client`,`ssrContext`,`ssrState`,`abortOnUnmount`],ui=S.createContext?.call(S,null),di=e=>{switch(e){case`queryOptions`:case`fetch`:case`ensureData`:case`prefetch`:case`getData`:case`setData`:case`setQueriesData`:return`query`;case`infiniteQueryOptions`:case`fetchInfinite`:case`prefetchInfinite`:case`getInfiniteData`:case`setInfiniteData`:return`infinite`;case`setMutationDefaults`:case`getMutationDefaults`:case`isMutating`:case`cancel`:case`invalidate`:case`refetch`:case`reset`:return`any`}};function fi(e){return Sn(t=>{let n=[...t.path],r=n.pop(),a=[...t.args],o=a.shift(),s=oi(n,o,di(r));return{infiniteQueryOptions:()=>e.infiniteQueryOptions(n,s,a[0]),queryOptions:()=>e.queryOptions(n,s,...a),fetch:()=>e.fetchQuery(s,...a),fetchInfinite:()=>e.fetchInfiniteQuery(s,a[0]),prefetch:()=>e.prefetchQuery(s,...a),prefetchInfinite:()=>e.prefetchInfiniteQuery(s,a[0]),ensureData:()=>e.ensureQueryData(s,...a),invalidate:()=>e.invalidateQueries(s,...a),reset:()=>e.resetQueries(s,...a),refetch:()=>e.refetchQueries(s,...a),cancel:()=>e.cancelQuery(s,...a),setData:()=>{e.setQueryData(s,a[0],a[1])},setQueriesData:()=>e.setQueriesData(s,a[0],a[1],a[2]),setInfiniteData:()=>{e.setInfiniteQueryData(s,a[0],a[1])},getData:()=>e.getQueryData(s),getInfiniteData:()=>e.getInfiniteQueryData(s),setMutationDefaults:()=>e.setMutationDefaults(si(n),o),getMutationDefaults:()=>e.getMutationDefaults(si(n)),isMutating:()=>e.isMutating({mutationKey:si(n)})}[r]()})}function pi(e){let t=Pr(e.client),n=fi(e);return Cn(r=>{let a=r;return a===`client`?t:li.includes(a)?e[a]:n[r]})}var mi=Yr(ni(),1);function hi(e){let t=e instanceof Ar?e:Ir(e);return Sn(e=>{let n=e.path,r=n.join(`.`),[a,o]=e.args;return(0,mi.default)({queryKey:oi(n,a,`query`),queryFn:()=>t.query(r,a,o?.trpc)},o)})}var gi=Yr(ni(),1);function _i(e,t,n){let r=e[0],a=e[1]?.input;return n&&(a=(0,gi.default)((0,gi.default)((0,gi.default)({},a??{}),n.pageParam?{cursor:n.pageParam}:{}),{},{direction:n.direction})),[r.join(`.`),a,t?.trpc]}var vi=Yr(qr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(e){var t,n,a,o=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,a=Symbol.iterator);o--;){if(n&&(t=e[n])!=null)return t.call(e);if(a&&(t=e[a])!=null)return new r(t.call(e));n=`@@asyncIterator`,a=`@@iterator`}throw TypeError(`Object is not async iterable`)}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return r=function(e){this.s=e,this.n=e.next},r.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new r(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}})(),1);function yi(e){return{path:e.path.join(`.`)}}function bi(e){let t=yi(e);return S.useMemo(()=>t,[t])}async function xi(e,t,n){let r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:`success`});let a=[];var o=!1,s=!1,c;try{for(var l=(0,vi.default)(e),u;o=!(u=await l.next()).done;o=!1){let e=u.value;a.push(e),r.setState({data:[...a]})}}catch(e){s=!0,c=e}finally{try{o&&l.return!=null&&await l.return()}finally{if(s)throw c}}return a}var Si=Yr(ni(),1);function Ci(e){let{client:t,queryClient:n}=e,r=t instanceof Ar?t:Ir(t);return{infiniteQueryOptions:(e,t,n)=>{let a=t[1]?.input===be;return Object.assign(Nt((0,Si.default)((0,Si.default)({},n),{},{initialData:n?.initialData,queryKey:t,queryFn:a?be:async e=>{var a;let o=(0,Si.default)((0,Si.default)({},n),{},{trpc:(0,Si.default)((0,Si.default)({},n?.trpc),!(n==null||(a=n.trpc)==null)&&a.abortOnUnmount?{signal:e.signal}:{signal:null})});return await r.query(..._i(t,o,{direction:e.direction,pageParam:e.pageParam}))},initialPageParam:n?.initialCursor??null})),{trpc:yi({path:e})})},queryOptions:(e,t,a)=>{let o=t[1]?.input===be;return Object.assign(Mt((0,Si.default)((0,Si.default)({},a),{},{initialData:a?.initialData,queryKey:t,queryFn:o?be:async e=>{var o;let s=(0,Si.default)((0,Si.default)({},a),{},{trpc:(0,Si.default)((0,Si.default)({},a?.trpc),!(a==null||(o=a.trpc)==null)&&o.abortOnUnmount?{signal:e.signal}:{signal:null})}),c=await r.query(..._i(t,s));return on(c)?xi(c,n,t):c}})),{trpc:yi({path:e})})},fetchQuery:(e,t)=>n.fetchQuery((0,Si.default)((0,Si.default)({},t),{},{queryKey:e,queryFn:()=>r.query(..._i(e,t))})),fetchInfiniteQuery:(e,t)=>n.fetchInfiniteQuery((0,Si.default)((0,Si.default)({},t),{},{queryKey:e,queryFn:({pageParam:n,direction:a})=>r.query(..._i(e,t,{pageParam:n,direction:a})),initialPageParam:t?.initialCursor??null})),prefetchQuery:(e,t)=>n.prefetchQuery((0,Si.default)((0,Si.default)({},t),{},{queryKey:e,queryFn:()=>r.query(..._i(e,t))})),prefetchInfiniteQuery:(e,t)=>n.prefetchInfiniteQuery((0,Si.default)((0,Si.default)({},t),{},{queryKey:e,queryFn:({pageParam:n,direction:a})=>r.query(..._i(e,t,{pageParam:n,direction:a})),initialPageParam:t?.initialCursor??null})),ensureQueryData:(e,t)=>n.ensureQueryData((0,Si.default)((0,Si.default)({},t),{},{queryKey:e,queryFn:()=>r.query(..._i(e,t))})),invalidateQueries:(e,t,r)=>n.invalidateQueries((0,Si.default)((0,Si.default)({},t),{},{queryKey:e}),r),resetQueries:(e,t,r)=>n.resetQueries((0,Si.default)((0,Si.default)({},t),{},{queryKey:e}),r),refetchQueries:(e,t,r)=>n.refetchQueries((0,Si.default)((0,Si.default)({},t),{},{queryKey:e}),r),cancelQuery:(e,t)=>n.cancelQueries({queryKey:e},t),setQueryData:(e,t,r)=>n.setQueryData(e,t,r),setQueriesData:(e,t,r,a)=>n.setQueriesData((0,Si.default)((0,Si.default)({},t),{},{queryKey:e}),r,a),getQueryData:e=>n.getQueryData(e),setInfiniteQueryData:(e,t,r)=>n.setQueryData(e,t,r),getInfiniteQueryData:e=>n.getQueryData(e),setMutationDefaults:(t,a)=>{let o=t[0];return n.setMutationDefaults(t,typeof a==`function`?a({canonicalMutationFn:t=>r.mutation(..._i([o,{input:t}],e))}):a)},getMutationDefaults:e=>n.getMutationDefaults(e),isMutating:e=>n.isMutating((0,Si.default)((0,Si.default)({},e),{},{exact:!0}))}}var wi=Yr(ni()),Ti=(e,t)=>new Proxy(e,{get(e,n){return t(n),e[n]}});function Ei(e){var t;let n=(e==null||(t=e.overrides)==null||(t=t.useMutation)==null?void 0:t.onSuccess)??(e=>e.originalFn()),r=e?.context??ui,a=Fr,o=e=>{let{abortOnUnmount:t=!1,queryClient:n,ssrContext:a}=e,[o,s]=S.useState(e.ssrState??!1),c=e.client instanceof Ar?e.client:Ir(e.client),l=S.useMemo(()=>Ci({client:c,queryClient:n}),[c,n]),u=S.useMemo(()=>(0,wi.default)({abortOnUnmount:t,queryClient:n,client:c,ssrContext:a??null,ssrState:o},l),[t,c,l,n,a,o]);return S.useEffect(()=>{s(e=>e?`mounted`:!1)},[]),(0,C.jsx)(r.Provider,{value:u,children:e.children})};function s(){let e=S.useContext(r);if(!e)throw Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");return e}function c(e,t){let{queryClient:n,ssrState:r}=s();return r&&r!==`mounted`&&n.getQueryCache().find({queryKey:e})?.state.status===`error`?(0,wi.default)({retryOnMount:!1},t):t}function l(t,n,r){var a,o;let{abortOnUnmount:l,client:u,ssrState:d,queryClient:f,prefetchQuery:p}=s(),m=oi(t,n,`query`),h=f.getQueryDefaults(m),g=n===be;typeof window>`u`&&d===`prepass`&&(r==null||(a=r.trpc)==null?void 0:a.ssr)!==!1&&(r?.enabled??h?.enabled)!==!1&&!g&&!f.getQueryCache().find({queryKey:m})&&p(m,r);let _=c(m,(0,wi.default)((0,wi.default)({},h),r)),v=(r==null||(o=r.trpc)==null?void 0:o.abortOnUnmount)??e?.abortOnUnmount??l,y=Et((0,wi.default)((0,wi.default)({},_),{},{queryKey:m,queryFn:g?n:async e=>{let t=(0,wi.default)((0,wi.default)({},_),{},{trpc:(0,wi.default)((0,wi.default)({},_?.trpc),v?{signal:e.signal}:{signal:null})}),n=await u.query(..._i(m,t));return on(n)?xi(n,f,m):n}}),f);return y.trpc=bi({path:t}),y}function u(t,n,r){var a;let o=s(),c=oi(t,n,`query`),l=n===be,u=(r==null||(a=r.trpc)==null?void 0:a.abortOnUnmount)??e?.abortOnUnmount??o.abortOnUnmount;At((0,wi.default)((0,wi.default)({},r),{},{queryKey:c,queryFn:l?n:e=>{let t={trpc:(0,wi.default)((0,wi.default)({},r?.trpc),u?{signal:e.signal}:{})};return o.client.query(..._i(c,t))}}))}function d(t,n,r){var a;let o=s(),c=oi(t,n,`query`),l=(r==null||(a=r.trpc)==null?void 0:a.abortOnUnmount)??e?.abortOnUnmount??o.abortOnUnmount,u=Dt((0,wi.default)((0,wi.default)({},r),{},{queryKey:c,queryFn:e=>{let t=(0,wi.default)((0,wi.default)({},r),{},{trpc:(0,wi.default)((0,wi.default)({},r?.trpc),l?{signal:e.signal}:{signal:null})});return o.client.query(..._i(c,t))}}),o.queryClient);return u.trpc=bi({path:t}),[u.data,u]}function f(e,t){let{client:r,queryClient:a}=s(),o=si(e),c=a.defaultMutationOptions(a.getMutationDefaults(o)),l=Pt((0,wi.default)((0,wi.default)({},t),{},{mutationKey:o,mutationFn:n=>r.mutation(..._i([e,{input:n}],t)),onSuccess(...e){return n({originalFn:()=>{var n,r;return(t==null||(n=t.onSuccess)==null?void 0:n.call(t,...e))??(c==null||(r=c.onSuccess)==null?void 0:r.call(c,...e))},queryClient:a,meta:t?.meta??c?.meta??{}})}}),a);return l.trpc=bi({path:e}),l}let p={data:void 0,error:null,status:`idle`},m={data:void 0,error:null,status:`connecting`};function h(e,t,n){let r=n?.enabled??t!==be,a=ce(oi(e,t,`any`)),{client:o}=s(),c=S.useRef(n);S.useEffect(()=>{c.current=n});let[l]=S.useState(new Set([])),u=S.useCallback(e=>{l.add(e)},[l]),d=S.useRef(null),f=S.useCallback(e=>{let t=g.current,n=g.current=e(t),r=!1;for(let e of l)if(t[e]!==n[e]){r=!0;break}r&&v(Ti(n,u))},[u,l]),h=S.useCallback(()=>{var n;if((n=d.current)==null||n.unsubscribe(),!r){f(()=>(0,wi.default)((0,wi.default)({},p),{},{reset:h}));return}f(()=>(0,wi.default)((0,wi.default)({},m),{},{reset:h})),d.current=o.subscription(e.join(`.`),t??void 0,{onStarted:()=>{var e,t;(e=(t=c.current).onStarted)==null||e.call(t),f(e=>(0,wi.default)((0,wi.default)({},e),{},{status:`pending`,error:null}))},onData:e=>{var t,n;(t=(n=c.current).onData)==null||t.call(n,e),f(t=>(0,wi.default)((0,wi.default)({},t),{},{status:`pending`,data:e,error:null}))},onError:e=>{var t,n;(t=(n=c.current).onError)==null||t.call(n,e),f(t=>(0,wi.default)((0,wi.default)({},t),{},{status:`error`,error:e}))},onConnectionStateChange:e=>{f(t=>{switch(e.state){case`idle`:return(0,wi.default)((0,wi.default)({},t),{},{status:e.state,error:null,data:void 0});case`connecting`:return(0,wi.default)((0,wi.default)({},t),{},{error:e.error,status:e.state});case`pending`:return t}})},onComplete:()=>{var e,t;(e=(t=c.current).onComplete)==null||e.call(t),f(e=>(0,wi.default)((0,wi.default)({},e),{},{status:`idle`,error:null,data:void 0}))}})},[o,a,r,f]);S.useEffect(()=>(h(),()=>{var e;(e=d.current)==null||e.unsubscribe()}),[h]);let g=S.useRef(r?(0,wi.default)((0,wi.default)({},m),{},{reset:h}):(0,wi.default)((0,wi.default)({},p),{},{reset:h})),[_,v]=S.useState(Ti(g.current,u));return _}function g(e,t,n){var r,a;let{client:o,ssrState:l,prefetchInfiniteQuery:u,queryClient:d,abortOnUnmount:f}=s(),p=oi(e,t,`infinite`),m=d.getQueryDefaults(p),h=t===be;typeof window>`u`&&l===`prepass`&&(n==null||(r=n.trpc)==null?void 0:r.ssr)!==!1&&(n?.enabled??m?.enabled)!==!1&&!h&&!d.getQueryCache().find({queryKey:p})&&u(p,(0,wi.default)((0,wi.default)({},m),n));let g=c(p,(0,wi.default)((0,wi.default)({},m),n)),_=(n==null||(a=n.trpc)==null?void 0:a.abortOnUnmount)??f,v=Ft((0,wi.default)((0,wi.default)({},g),{},{initialPageParam:n.initialCursor??null,persister:n.persister,queryKey:p,queryFn:h?t:e=>{let t=(0,wi.default)((0,wi.default)({},g),{},{trpc:(0,wi.default)((0,wi.default)({},g?.trpc),_?{signal:e.signal}:{signal:null})});return o.query(..._i(p,t,{pageParam:e.pageParam??n.initialCursor,direction:e.direction}))}}),d);return v.trpc=bi({path:e}),v}function _(e,t,n){var r;let a=s(),o=oi(e,t,`infinite`),l=a.queryClient.getQueryDefaults(o),u=t===be,d=c(o,(0,wi.default)((0,wi.default)({},l),n)),f=(n==null||(r=n.trpc)==null?void 0:r.abortOnUnmount)??a.abortOnUnmount;jt((0,wi.default)((0,wi.default)({},n),{},{initialPageParam:n.initialCursor??null,queryKey:o,queryFn:u?t:e=>{let t=(0,wi.default)((0,wi.default)({},d),{},{trpc:(0,wi.default)((0,wi.default)({},d?.trpc),f?{signal:e.signal}:{})});return a.client.query(..._i(o,t,{pageParam:e.pageParam??n.initialCursor,direction:e.direction}))}}))}function v(e,t,n){var r;let a=s(),o=oi(e,t,`infinite`),l=a.queryClient.getQueryDefaults(o),u=c(o,(0,wi.default)((0,wi.default)({},l),n)),d=(n==null||(r=n.trpc)==null?void 0:r.abortOnUnmount)??a.abortOnUnmount,f=Ot((0,wi.default)((0,wi.default)({},n),{},{initialPageParam:n.initialCursor??null,queryKey:o,queryFn:e=>{let t=(0,wi.default)((0,wi.default)({},u),{},{trpc:(0,wi.default)((0,wi.default)({},u?.trpc),d?{signal:e.signal}:{})});return a.client.query(..._i(o,t,{pageParam:e.pageParam??n.initialCursor,direction:e.direction}))}}),a.queryClient);return f.trpc=bi({path:e}),[f.data,f]}return{Provider:o,createClient:a,useContext:s,useUtils:s,useQuery:l,usePrefetchQuery:u,useSuspenseQuery:d,useQueries:(e,t)=>{let{ssrState:n,queryClient:r,prefetchQuery:a,client:o}=s(),c=e(hi(o));if(typeof window>`u`&&n===`prepass`)for(let e of c){let t=e;t.trpc?.ssr!==!1&&!r.getQueryCache().find({queryKey:t.queryKey})&&a(t.queryKey,t)}return wt({queries:c.map(e=>(0,wi.default)((0,wi.default)({},e),{},{queryKey:e.queryKey})),combine:t?.combine},r)},useSuspenseQueries:e=>{let{queryClient:t,client:n}=s(),r=kt({queries:e(hi(n)).map(e=>(0,wi.default)((0,wi.default)({},e),{},{queryFn:e.queryFn,queryKey:e.queryKey}))},t);return[r.map(e=>e.data),r]},useMutation:f,useSubscription:h,useInfiniteQuery:g,usePrefetchInfiniteQuery:_,useSuspenseInfiniteQuery:v}}function Di(e){let t=ci(e);return Cn(n=>n===`useContext`||n===`useUtils`?()=>{let t=e.useUtils();return S.useMemo(()=>pi(t),[t])}:e.hasOwnProperty(n)?e[n]:t[n])}function Oi(e){return Di(Ei(e))}var ki=Math.PI/180;function Ai(){return typeof window<`u`&&({}.toString.call(window)===`[object Window]`||{}.toString.call(window)===`[object global]`)}var ji=typeof global<`u`?global:typeof window<`u`?window:typeof WorkerGlobalScope<`u`?self:{},j={_global:ji,version:`10.3.0`,isBrowser:Ai(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return j.angleDeg?e*ki:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:`web`,legacyTextRendering:!1,pixelRatio:typeof window<`u`&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return j.DD.isDragging},isTransforming(){return j.Transformer?.isTransforming()??!1},isDragReady(){return!!j.DD.node},releaseCanvasOnDestroy:!0,document:ji.document,_injectGlobal(e){ji.Konva!==void 0&&console.error(`Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.`),ji.Konva=e}},Mi=e=>{j[e.prototype.getClassName()]=e};j._injectGlobal(j);var Ni=`Konva.js unsupported environment.
10
-
11
- Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
12
-
13
- To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.
14
-
15
- bash: npm install canvas
16
- js: import "konva/canvas-backend";
17
-
18
- or
19
-
20
- bash: npm install skia-canvas
21
- js: import "konva/skia-backend";
22
- `,Pi=()=>{if(typeof document>`u`)throw Error(Ni)},Fi=class e{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new e(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){let t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,a=this.m[1]*t+this.m[3]*n,o=this.m[0]*-n+this.m[2]*t,s=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=a,this.m[2]=o,this.m[3]=s,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){let n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,a=this.m[2]+this.m[0]*e,o=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=a,this.m[3]=o,this}multiply(e){let t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],o=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],s=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=a,this.m[4]=o,this.m[5]=s,this}invert(){let e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,a=this.m[0]*e,o=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),s=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=a,this.m[4]=o,this.m[5]=s,this}getMatrix(){return this.m}decompose(){let e=this.m[0],t=this.m[1],n=this.m[2],r=this.m[3],a=this.m[4],o=this.m[5],s=e*r-t*n,c={x:a,y:o,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||t!=0){let a=Math.sqrt(e*e+t*t);c.rotation=t>0?Math.acos(e/a):-Math.acos(e/a),c.scaleX=a,c.scaleY=s/a,c.skewX=(e*n+t*r)/s,c.skewY=0}else if(n!=0||r!=0){let a=Math.sqrt(n*n+r*r);c.rotation=Math.PI/2-(r>0?Math.acos(-n/a):-Math.acos(n/a)),c.scaleX=s/a,c.scaleY=a,c.skewX=0,c.skewY=(e*n+t*r)/s}return c.rotation=M._getRotation(c.rotation),c}},Ii=`[object Array]`,Li=`[object Number]`,Ri=`[object String]`,zi=`[object Boolean]`,Bi=Math.PI/180,Vi=180/Math.PI,Hi=`#`,Ui=``,Wi=`0`,Gi=`Konva warning: `,Ki=`Konva error: `,qi=`rgb(`,Ji={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},Yi=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Xi=[],Zi=null,Qi=typeof requestAnimationFrame<`u`&&requestAnimationFrame||function(e){setTimeout(e,16)},M={_isElement(e){return!!(e&&e.nodeType==1)},_isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},_isPlainObject(e){return!!e&&e.constructor===Object},_isArray(e){return Object.prototype.toString.call(e)===Ii},_isNumber(e){return Object.prototype.toString.call(e)===Li&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===Ri},_isBoolean(e){return Object.prototype.toString.call(e)===zi},isObject(e){return e instanceof Object},isValidSelector(e){if(typeof e!=`string`)return!1;let t=e[0];return t===`#`||t===`.`||t===t.toUpperCase()},_sign(e){return e===0||e>0?1:-1},requestAnimFrame(e){Xi.push(e),Xi.length===1&&Qi(function(){let e=Xi;Xi=[],e.forEach(function(e){e()})})},createCanvasElement(){Pi();let e=document.createElement(`canvas`);try{e.style=e.style||{}}catch{}return e},createImageElement(){return Pi(),document.createElement(`img`)},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){let n=M.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex(e,t,n){return((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)},_hexToRgb(e){e=e.replace(Hi,Ui);let t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:t&255}},getRandomColor(){let e=(Math.random()*16777215<<0).toString(16);for(;e.length<6;)e=Wi+e;return Hi+e},isCanvasFarblingActive(){if(Zi!==null)return Zi;if(typeof document>`u`)return Zi=!1,!1;let e=this.createCanvasElement();e.width=10,e.height=10;let t=e.getContext(`2d`,{willReadFrequently:!0});t.clearRect(0,0,10,10),t.fillStyle=`#282828`,t.fillRect(0,0,10,10);let n=t.getImageData(0,0,10,10).data,r=!1;for(let e=0;e<100;e++)if(n[e*4]!==40||n[e*4+1]!==40||n[e*4+2]!==40||n[e*4+3]!==255){r=!0;break}return Zi=r,this.releaseCanvas(e),Zi},getHitColor(){let e=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(e):e},getHitColorKey(e,t,n){return this.isCanvasFarblingActive()&&(e=Math.round(e/5)*5,t=Math.round(t/5)*5,n=Math.round(n/5)*5),Hi+this._rgbToHex(e,t,n)},getSnappedHexColor(e){let t=this._hexToRgb(e);return Hi+this._rgbToHex(Math.round(t.r/5)*5,Math.round(t.g/5)*5,Math.round(t.b/5)*5)},getRGB(e){let t;return e in Ji?(t=Ji[e],{r:t[0],g:t[1],b:t[2]}):e[0]===Hi?this._hexToRgb(e.substring(1)):e.substr(0,4)===qi?(t=Yi.exec(e.replace(/ /g,``)),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA(e){return e||=`black`,M._namedColorToRBA(e)||M._hex3ColorToRGBA(e)||M._hex4ColorToRGBA(e)||M._hex6ColorToRGBA(e)||M._hex8ColorToRGBA(e)||M._rgbColorToRGBA(e)||M._rgbaColorToRGBA(e)||M._hslColorToRGBA(e)},_namedColorToRBA(e){let t=Ji[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(e.indexOf(`rgb(`)===0){e=e.match(/rgb\(([^)]+)\)/)[1];let t=e.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(e.indexOf(`rgba(`)===0){e=e.match(/rgba\(([^)]+)\)/)[1];let t=e.split(/ *, */).map((e,t)=>e.slice(-1)===`%`?t===3?parseInt(e)/100:parseInt(e)/100*255:Number(e));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if(e[0]===`#`&&e.length===9)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e[0]===`#`&&e.length===7)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e[0]===`#`&&e.length===5)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e[0]===`#`&&e.length===4)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){let[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,a=Number(n[1])/100,o=Number(n[2])/100,s,c,l;if(a===0)return l=o*255,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};s=o<.5?o*(1+a):o+a-o*a;let u=2*o-s,d=[0,0,0];for(let e=0;e<3;e++)c=r+1/3*-(e-1),c<0&&c++,c>1&&c--,l=6*c<1?u+(s-u)*6*c:2*c<1?s:3*c<2?u+(s-u)*(2/3-c)*6:u,d[e]=l*255;return{r:Math.round(d[0]),g:Math.round(d[1]),b:Math.round(d[2]),a:1}}},haveIntersection(e,t){return!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y)},cloneObject(e){let t={};for(let n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray(e){return e.slice(0)},degToRad(e){return e*Bi},radToDeg(e){return e*Vi},_degToRad(e){return M.warn(`Util._degToRad is removed. Please use public Util.degToRad instead.`),M.degToRad(e)},_radToDeg(e){return M.warn(`Util._radToDeg is removed. Please use public Util.radToDeg instead.`),M.radToDeg(e)},_getRotation(e){return j.angleDeg?M.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw Error(Ki+e)},error(e){console.error(Ki+e)},warn(e){j.showWarnings&&console.warn(Gi+e)},each(e,t){for(let n in e)t(n,e[n])},_inRange(e,t,n){return t<=e&&e<n},_getProjectionToSegment(e,t,n,r,a,o){let s,c,l,u=(e-n)*(e-n)+(t-r)*(t-r);if(u==0)s=e,c=t,l=(a-n)*(a-n)+(o-r)*(o-r);else{let d=((a-e)*(n-e)+(o-t)*(r-t))/u;d<0?(s=e,c=t,l=(e-a)*(e-a)+(t-o)*(t-o)):d>1?(s=n,c=r,l=(n-a)*(n-a)+(r-o)*(r-o)):(s=e+d*(n-e),c=t+d*(r-t),l=(s-a)*(s-a)+(c-o)*(c-o))}return[s,c,l]},_getProjectionToLine(e,t,n){let r=M.cloneObject(e),a=Number.MAX_VALUE;return t.forEach(function(o,s){if(!n&&s===t.length-1)return;let c=t[(s+1)%t.length],l=M._getProjectionToSegment(o.x,o.y,c.x,c.y,e.x,e.y),u=l[0],d=l[1],f=l[2];f<a&&(r.x=u,r.y=d,a=f)}),r},_prepareArrayForTween(e,t,n){let r=[],a=[];if(e.length>t.length){let n=t;t=e,e=n}for(let t=0;t<e.length;t+=2)r.push({x:e[t],y:e[t+1]});for(let e=0;e<t.length;e+=2)a.push({x:t[e],y:t[e+1]});let o=[];return a.forEach(function(e){let t=M._getProjectionToLine(e,r,n);o.push(t.x),o.push(t.y)}),o},_prepareToStringify(e){let t;e.visitedByCircularReferenceRemoval=!0;for(let n in e)if(e.hasOwnProperty(n)&&e[n]&&typeof e[n]==`object`){if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||M._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(M._prepareToStringify(e[n])===null)if(t.configurable)delete e[n];else return null}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(let n in t)e[n]=t[n];return e},_getFirstPointerId(e){return e.touches?e.changedTouches[0].identifier:e.pointerId||999},releaseCanvas(...e){j.releaseCanvasOnDestroy&&e.forEach(e=>{e.width=0,e.height=0})},drawRoundedRectPath(e,t,n,r){let a=t<0?t:0,o=n<0?n:0;t=Math.abs(t),n=Math.abs(n);let s=0,c=0,l=0,u=0;typeof r==`number`?s=c=l=u=Math.min(r,t/2,n/2):(s=Math.min(r[0]||0,t/2,n/2),c=Math.min(r[1]||0,t/2,n/2),u=Math.min(r[2]||0,t/2,n/2),l=Math.min(r[3]||0,t/2,n/2)),e.moveTo(a+s,o),e.lineTo(a+t-c,o),e.arc(a+t-c,o+c,c,Math.PI*3/2,0,!1),e.lineTo(a+t,o+n-u),e.arc(a+t-u,o+n-u,u,0,Math.PI/2,!1),e.lineTo(a+l,o+n),e.arc(a+l,o+n-l,l,Math.PI/2,Math.PI,!1),e.lineTo(a,o+s),e.arc(a+s,o+s,s,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,t,n,r,a){r=Math.abs(r);for(let o=0;o<n;o++){let s=t[(o-1+n)%n],c=t[o],l=t[(o+1)%n],u={x:c.x-s.x,y:c.y-s.y},d={x:l.x-c.x,y:l.y-c.y},f=Math.hypot(u.x,u.y),p=Math.hypot(d.x,d.y),m;m=typeof a==`number`?a:o<a.length?a[o]:0,m=r*Math.cos(Math.PI/n)*Math.min(1,m/r*2);let h={x:u.x/f,y:u.y/f},g={x:d.x/p,y:d.y/p},_={x:c.x-h.x*m,y:c.y-h.y*m},v={x:c.x+g.x*m,y:c.y+g.y*m};o===0?e.moveTo(_.x,_.y):e.lineTo(_.x,_.y),e.arcTo(c.x,c.y,v.x,v.y,m)}}};function $i(e){let t=[],n=e.length,r=M;for(let a=0;a<n;a++){let n=e[a];r._isNumber(n)?n=Math.round(n*1e3)/1e3:r._isString(n)||(n+=``),t.push(n)}return t}var ea=`,`,ta=`(`,na=`)`,ra=`([`,ia=`])`,aa=`;`,oa=`()`,sa=`=`,ca=`arc.arcTo.beginPath.bezierCurveTo.clearRect.clip.closePath.createLinearGradient.createPattern.createRadialGradient.drawImage.ellipse.fill.fillText.getImageData.createImageData.lineTo.moveTo.putImageData.quadraticCurveTo.rect.roundRect.restore.rotate.save.scale.setLineDash.setTransform.stroke.strokeText.transform.translate`.split(`.`),la=[`fillStyle`,`strokeStyle`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`,`letterSpacing`,`lineCap`,`lineDashOffset`,`lineJoin`,`lineWidth`,`miterLimit`,`direction`,`font`,`textAlign`,`textBaseline`,`globalAlpha`,`globalCompositeOperation`,`imageSmoothingEnabled`,`filter`],ua=100,da=null;function fa(){if(da!==null)return da;try{let e=M.createCanvasElement().getContext(`2d`);return e?!!e&&`filter`in e:(da=!1,!1)}catch{return da=!1,!1}}var pa=class{constructor(e){this.canvas=e,j.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){let n=this.traceArr,r=n.length,a=``,o,s,c,l;for(o=0;o<r;o++)s=n[o],c=s.method,c?(l=s.args,a+=c,e?a+=oa:M._isArray(l[0])?a+=ra+l.join(ea)+ia:(t&&(l=l.map(e=>typeof e==`number`?Math.floor(e):e)),a+=ta+l.join(ea)+na)):(a+=s.property,e||(a+=sa+s.val)),a+=aa;return a}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=ua&&t.shift()}reset(){let e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){let t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){let t=e.attrs.lineCap;t&&this.setAttr(`lineCap`,t)}_applyOpacity(e){let t=e.getAbsoluteOpacity();t!==1&&this.setAttr(`globalAlpha`,t)}_applyLineJoin(e){let t=e.attrs.lineJoin;t&&this.setAttr(`lineJoin`,t)}_applyMiterLimit(e){let t=e.attrs.miterLimit;t!=null&&this.setAttr(`miterLimit`,t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,a,o){this._context.arc(e,t,n,r,a,o)}arcTo(e,t,n,r,a){this._context.arcTo(e,t,n,r,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,a,o){this._context.bezierCurveTo(e,t,n,r,a,o)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){let n=arguments;if(n.length===2)return this._context.createImageData(e,t);if(n.length===1)return this._context.createImageData(e)}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,a,o){return this._context.createRadialGradient(e,t,n,r,a,o)}drawImage(e,t,n,r,a,o,s,c,l){let u=arguments,d=this._context;u.length===3?d.drawImage(e,t,n):u.length===5?d.drawImage(e,t,n,r,a):u.length===9&&d.drawImage(e,t,n,r,a,o,s,c,l)}ellipse(e,t,n,r,a,o,s,c){this._context.ellipse(e,t,n,r,a,o,s,c)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}roundRect(e,t,n,r,a){this._context.roundRect(e,t,n,r,a)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):`mozDash`in this._context?this._context.mozDash=e:`webkitLineDash`in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,a,o){this._context.setTransform(e,t,n,r,a,o)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,a,o){this._context.transform(e,t,n,r,a,o)}translate(e,t){this._context.translate(e,t)}_enableTrace(){let e=this,t=ca.length,n=this.setAttr,r,a,o=function(t){let n=e[t],r;e[t]=function(){return a=$i(Array.prototype.slice.call(arguments,0)),r=n.apply(e,arguments),e._trace({method:t,args:a}),r}};for(r=0;r<t;r++)o(ca[r]);e.setAttr=function(){n.apply(e,arguments);let t=arguments[0],r=arguments[1];(t===`shadowOffsetX`||t===`shadowOffsetY`||t===`shadowBlur`)&&(r/=this.canvas.getPixelRatio()),e._trace({property:t,val:r})}}_applyGlobalCompositeOperation(e){let t=e.attrs.globalCompositeOperation;!t||t===`source-over`||this.setAttr(`globalCompositeOperation`,t)}};la.forEach(function(e){Object.defineProperty(pa.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var ma=class extends pa{constructor(e,{willReadFrequently:t=!1}={}){super(e),this._context=e._canvas.getContext(`2d`,{willReadFrequently:t})}_fillColor(e){let t=e.fill();this.setAttr(`fillStyle`,t),e._fillFunc(this)}_fillPattern(e){this.setAttr(`fillStyle`,e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){let t=e._getLinearGradient();t&&(this.setAttr(`fillStyle`,t),e._fillFunc(this))}_fillRadialGradient(e){let t=e._getRadialGradient();t&&(this.setAttr(`fillStyle`,t),e._fillFunc(this))}_fill(e){let t=e.fill(),n=e.getFillPriority();if(t&&n===`color`){this._fillColor(e);return}let r=e.getFillPatternImage();if(r&&n===`pattern`){this._fillPattern(e);return}let a=e.getFillLinearGradientColorStops();if(a&&n===`linear-gradient`){this._fillLinearGradient(e);return}let o=e.getFillRadialGradientColorStops();if(o&&n===`radial-gradient`){this._fillRadialGradient(e);return}t?this._fillColor(e):r?this._fillPattern(e):a?this._fillLinearGradient(e):o&&this._fillRadialGradient(e)}_strokeLinearGradient(e){let t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),a=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(let e=0;e<r.length;e+=2)a.addColorStop(r[e],r[e+1]);this.setAttr(`strokeStyle`,a)}}_stroke(e){let t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();let e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr(`lineDashOffset`,e.dashOffset())),this.setAttr(`lineWidth`,e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr(`shadowColor`,`rgba(0,0,0,0)`),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr(`strokeStyle`,e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){let t=e.getShadowRGBA()??`black`,n=e.getShadowBlur()??5,r=e.getShadowOffset()??{x:0,y:0},a=e.getAbsoluteScale(),o=this.canvas.getPixelRatio(),s=a.x*o,c=a.y*o;this.setAttr(`shadowColor`,t),this.setAttr(`shadowBlur`,n*Math.min(Math.abs(s),Math.abs(c))),this.setAttr(`shadowOffsetX`,r.x*s),this.setAttr(`shadowOffsetY`,r.y*c)}},ha=class extends pa{constructor(e){super(e),this._context=e._canvas.getContext(`2d`,{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr(`fillStyle`,e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){let t=e.getStrokeScaleEnabled();if(!t){this.save();let e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(e);let n=e.hitStrokeWidth(),r=n===`auto`?e.strokeWidth():n;this.setAttr(`lineWidth`,r),this.setAttr(`strokeStyle`,e.colorKey),e._strokeFuncHit(this),t||this.restore()}}},ga;function _a(){if(ga)return ga;let e=M.createCanvasElement(),t=e.getContext(`2d`);return ga=(function(){return(j._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),M.releaseCanvas(e),ga}var va=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;let t=(e||{}).pixelRatio||j.pixelRatio||_a();this.pixelRatio=t,this._canvas=M.createCanvasElement(),this._canvas.style.padding=`0`,this._canvas.style.margin=`0`,this._canvas.style.border=`0`,this._canvas.style.background=`transparent`,this._canvas.style.position=`absolute`,this._canvas.style.top=`0`,this._canvas.style.left=`0`}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){let t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+`px`;let t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+`px`;let t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch{try{return this._canvas.toDataURL()}catch(e){return M.error(`Unable to get data URL. `+e.message+` For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html.`),``}}}},ya=class extends va{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new ma(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},ba=class extends va{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new ha(this),this.setSize(e.width,e.height)}},xa={get isDragging(){let e=!1;return xa._dragElements.forEach(t=>{t.dragStatus===`dragging`&&(e=!0)}),e},justDragged:!1,get node(){let e;return xa._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){let t=[];xa._dragElements.forEach((n,r)=>{let{node:a}=n,o=a.getStage();o.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=M._getFirstPointerId(e));let s=o._changedPointerPositions.find(e=>e.id===n.pointerId);if(s){if(n.dragStatus!==`dragging`){let t=a.dragDistance();if(Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y))<t||(a.startDrag({evt:e}),!a.isDragging()))return}a._setDragPosition(e,n),t.push(a)}}),t.forEach(t=>{t.getStage()&&t.fire(`dragmove`,{type:`dragmove`,target:t,evt:e},!0)})},_endDragBefore(e){let t=[];xa._dragElements.forEach(n=>{let{node:r}=n,a=r.getStage();if(e&&a.setPointersPositions(e),!a._changedPointerPositions.find(e=>e.id===n.pointerId))return;(n.dragStatus===`dragging`||n.dragStatus===`stopped`)&&(xa.justDragged=!0,j._mouseListenClick=!1,j._touchListenClick=!1,j._pointerListenClick=!1,n.dragStatus=`stopped`);let o=n.node.getLayer()||n.node instanceof j.Stage&&n.node;o&&t.indexOf(o)===-1&&t.push(o)}),t.forEach(e=>{e.draw()})},_endDragAfter(e){xa._dragElements.forEach((t,n)=>{t.dragStatus===`stopped`&&t.node.fire(`dragend`,{type:`dragend`,target:t.node,evt:e},!0),t.dragStatus!==`dragging`&&xa._dragElements.delete(n)})}};j.isBrowser&&(window.addEventListener(`mouseup`,xa._endDragBefore,!0),window.addEventListener(`touchend`,xa._endDragBefore,!0),window.addEventListener(`touchcancel`,xa._endDragBefore,!0),window.addEventListener(`mousemove`,xa._drag),window.addEventListener(`touchmove`,xa._drag),window.addEventListener(`mouseup`,xa._endDragAfter,!1),window.addEventListener(`touchend`,xa._endDragAfter,!1),window.addEventListener(`touchcancel`,xa._endDragAfter,!1));function Sa(e){return M._isString(e)?`"`+e+`"`:Object.prototype.toString.call(e)===`[object Number]`||M._isBoolean(e)?e:Object.prototype.toString.call(e)}function Ca(e){return e>255?255:e<0?0:Math.round(e)}function N(){if(j.isUnminified)return function(e,t){return M._isNumber(e)||M.warn(Sa(e)+` is a not valid value for "`+t+`" attribute. The value should be a number.`),e}}function wa(e){if(j.isUnminified)return function(t,n){let r=M._isNumber(t),a=M._isArray(t)&&t.length==e;return!r&&!a&&M.warn(Sa(t)+` is a not valid value for "`+n+`" attribute. The value should be a number or Array<number>(`+e+`)`),t}}function Ta(){if(j.isUnminified)return function(e,t){return M._isNumber(e)||e===`auto`||M.warn(Sa(e)+` is a not valid value for "`+t+`" attribute. The value should be a number or "auto".`),e}}function Ea(){if(j.isUnminified)return function(e,t){return M._isString(e)||M.warn(Sa(e)+` is a not valid value for "`+t+`" attribute. The value should be a string.`),e}}function Da(){if(j.isUnminified)return function(e,t){let n=M._isString(e),r=Object.prototype.toString.call(e)===`[object CanvasGradient]`||e&&e.addColorStop;return n||r||M.warn(Sa(e)+` is a not valid value for "`+t+`" attribute. The value should be a string or a native gradient.`),e}}function Oa(){if(j.isUnminified)return function(e,t){let n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(M._isArray(e)?e.forEach(function(e){M._isNumber(e)||M.warn(`"`+t+`" attribute has non numeric element `+e+`. Make sure that all elements are numbers.`)}):M.warn(Sa(e)+` is a not valid value for "`+t+`" attribute. The value should be a array of numbers.`)),e}}function ka(){if(j.isUnminified)return function(e,t){return e===!0||e===!1||M.warn(Sa(e)+` is a not valid value for "`+t+`" attribute. The value should be a boolean.`),e}}function Aa(e){if(j.isUnminified)return function(t,n){return t==null||M.isObject(t)||M.warn(Sa(t)+` is a not valid value for "`+n+`" attribute. The value should be an object with properties `+e),t}}var ja=`get`,Ma=`set`,P={addGetterSetter(e,t,n,r,a){P.addGetter(e,t,n),P.addSetter(e,t,r,a),P.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){let r=ja+M._capitalize(t);e.prototype[r]=e.prototype[r]||function(){let e=this.attrs[t];return e===void 0?n:e}},addSetter(e,t,n,r){let a=Ma+M._capitalize(t);e.prototype[a]||P.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){let a=Ma+M._capitalize(t);e.prototype[a]=function(e){return n&&e!=null&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,a){let o=n.length,s=M._capitalize,c=ja+s(t),l=Ma+s(t);e.prototype[c]=function(){let e={};for(let r=0;r<o;r++){let a=n[r];e[a]=this.getAttr(t+s(a))}return e};let u=Aa(n);e.prototype[l]=function(e){let o=this.attrs[t];r&&(e=r.call(this,e,t)),u&&u.call(this,e,t);for(let n in e)e.hasOwnProperty(n)&&this._setAttr(t+s(n),e[n]);return e||n.forEach(e=>{this._setAttr(t+s(e),void 0)}),this._fireChangeEvent(t,o,e),a&&a.call(this),this},P.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){let n=M._capitalize(t),r=Ma+n,a=ja+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[a]()}},addDeprecatedGetterSetter(e,t,n,r){M.error(`Adding deprecated `+t);let a=ja+M._capitalize(t),o=t+` property is deprecated and will be removed soon. Look at Konva change log for more information.`;e.prototype[a]=function(){M.error(o);let e=this.attrs[t];return e===void 0?n:e},P.addSetter(e,t,r,function(){M.error(o)}),P.addOverloadedGetterSetter(e,t)},backCompat(e,t){M.each(t,function(t,n){let r=e.prototype[n],a=ja+M._capitalize(t),o=Ma+M._capitalize(t);function s(){r.apply(this,arguments),M.error(`"`+t+`" method is deprecated and will be removed soon. Use ""`+n+`" instead.`)}e.prototype[t]=s,e.prototype[a]=s,e.prototype[o]=s})},afterSetFilter(){this._filterUpToDate=!1}};function Na(e){let t=/(\w+)\(([^)]+)\)/g,n;for(;(n=t.exec(e))!==null;){let[,e,t]=n;switch(e){case`blur`:{let e=parseFloat(t.replace(`px`,``));return function(t){this.blurRadius(e*.5);let n=j.Filters;n&&n.Blur&&n.Blur.call(this,t)}}case`brightness`:{let e=t.includes(`%`)?parseFloat(t)/100:parseFloat(t);return function(t){this.brightness(e);let n=j.Filters;n&&n.Brightness&&n.Brightness.call(this,t)}}case`contrast`:{let e=parseFloat(t);return function(t){let n=100*(Math.sqrt(e)-1);this.contrast(n);let r=j.Filters;r&&r.Contrast&&r.Contrast.call(this,t)}}case`grayscale`:return function(e){let t=j.Filters;t&&t.Grayscale&&t.Grayscale.call(this,e)};case`sepia`:return function(e){let t=j.Filters;t&&t.Sepia&&t.Sepia.call(this,e)};case`invert`:return function(e){let t=j.Filters;t&&t.Invert&&t.Invert.call(this,e)};default:M.warn(`CSS filter "${e}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var Pa=`absoluteOpacity`,Fa=`allEventListeners`,Ia=`absoluteTransform`,La=`absoluteScale`,Ra=`canvas`,za=`Change`,Ba=`children`,Va=`konva`,Ha=`listening`,Ua=`mouseenter`,Wa=`mouseleave`,Ga=`pointerenter`,Ka=`pointerleave`,qa=`touchenter`,Ja=`touchleave`,Ya=`set`,Xa=`Shape`,Za=` `,Qa=`stage`,$a=`transform`,eo=`Stage`,to=`visible`,no=[`xChange.konva`,`yChange.konva`,`scaleXChange.konva`,`scaleYChange.konva`,`skewXChange.konva`,`skewYChange.konva`,`rotationChange.konva`,`offsetXChange.konva`,`offsetYChange.konva`,`transformsEnabledChange.konva`].join(Za),ro=1,io=class e{constructor(e){this._id=ro++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===$a||e===Ia)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,t){let n=this._cache.get(e);return(n===void 0||(e===$a||e===Ia)&&n.dirty===!0)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){let n=t.map(e=>e+`Change.konva`).join(Za);this.on(n,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(Ra)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Ia&&this.fire(`absoluteTransformChange`)}clearCache(){if(this._cache.has(Ra)){let{scene:e,filter:t,hit:n}=this._cache.get(Ra);M.releaseCanvas(e._canvas,t._canvas,n._canvas),this._cache.delete(Ra)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){let t=e||{},n={};(t.x===void 0||t.y===void 0||t.width===void 0||t.height===void 0)&&(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let r=Math.ceil(t.width||n.width),a=Math.ceil(t.height||n.height),o=t.pixelRatio,s=t.x===void 0?Math.floor(n.x):t.x,c=t.y===void 0?Math.floor(n.y):t.y,l=t.offset||0,u=t.drawBorder||!1,d=t.hitCanvasPixelRatio||1;if(!r||!a){M.error(`Can not cache the node. Width or height of the node equals 0. Caching is skipped.`);return}let f=+(Math.abs(Math.round(n.x)-s)>.5),p=+(Math.abs(Math.round(n.y)-c)>.5);r+=l*2+f,a+=l*2+p,s-=l,c-=l;let m=new ya({pixelRatio:o,width:r,height:a}),h=new ya({pixelRatio:o,width:0,height:0,willReadFrequently:!0}),g=new ba({pixelRatio:d,width:r,height:a}),_=m.getContext(),v=g.getContext(),y=new ya({width:m.width/m.pixelRatio+Math.abs(s),height:m.height/m.pixelRatio+Math.abs(c),pixelRatio:m.pixelRatio}),b=y.getContext();return g.isCache=!0,m.isCache=!0,this._cache.delete(Ra),this._filterUpToDate=!1,t.imageSmoothingEnabled===!1&&(m.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),_.save(),v.save(),b.save(),_.translate(-s,-c),v.translate(-s,-c),b.translate(-s,-c),y.x=s,y.y=c,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Pa),this._clearSelfAndDescendantCache(La),this.drawScene(m,this,y),this.drawHit(g,this),this._isUnderCache=!1,_.restore(),v.restore(),u&&(_.save(),_.beginPath(),_.rect(0,0,r,a),_.closePath(),_.setAttr(`strokeStyle`,`red`),_.setAttr(`lineWidth`,5),_.stroke(),_.restore()),M.releaseCanvas(y._canvas),this._cache.set(Ra,{scene:m,filter:h,hit:g,x:s,y:c}),this._requestDraw(),this}isCached(){return this._cache.has(Ra)}getClientRect(e){throw Error(`abstract "getClientRect" method call`)}_transformedRect(e,t){let n=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],r=1/0,a=1/0,o=-1/0,s=-1/0,c=this.getAbsoluteTransform(t);return n.forEach(function(e){let t=c.point(e);r===void 0&&(r=o=t.x,a=s=t.y),r=Math.min(r,t.x),a=Math.min(a,t.y),o=Math.max(o,t.x),s=Math.max(s,t.y)}),{x:r,y:a,width:o-r,height:s-a}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);let t=this._getCanvasCache();e.translate(t.x,t.y);let n=this._getCachedSceneCanvas(),r=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/r,n.height/r),e.restore()}_drawCachedHitCanvas(e){let t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),t=this._getCanvasCache(),n=t.scene,r=t.filter,a=r.getContext(),o,s,c,l;if(!e||e.length===0)return n;if(this._filterUpToDate)return r;let u=!0;for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&fa(),typeof e[t]!=`string`||!fa()){u=!1;break}let d=n.pixelRatio;if(r.setSize(n.width/n.pixelRatio,n.height/n.pixelRatio),u){let t=e.join(` `);return a.save(),a.setAttr(`filter`,t),a.drawImage(n._canvas,0,0,n.getWidth()/d,n.getHeight()/d),a.restore(),this._filterUpToDate=!0,r}try{for(o=e.length,a.clear(),a.drawImage(n._canvas,0,0,n.getWidth()/d,n.getHeight()/d),s=a.getImageData(0,0,r.getWidth(),r.getHeight()),c=0;c<o;c++)l=e[c],typeof l==`string`&&(l=Na(l)),l.call(this,s),a.putImageData(s,0,0)}catch(e){M.error(`Unable to apply filter. `+e.message+` This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.`)}return this._filterUpToDate=!0,r}on(...e){let t=e[0],n=e[1];if(e[2],this._cache&&this._cache.delete(Fa),e.length===3)return this._delegate.apply(this,e);let r=t.split(Za);for(let e=0;e<r.length;e++){let t=r[e].split(`.`),a=t[0],o=t[1]||``;this.eventListeners[a]||(this.eventListeners[a]=[]),this.eventListeners[a].push({name:o,handler:n})}return this}off(e,t){let n=(e||``).split(Za),r=n.length,a,o,s,c,l,u;if(this._cache&&this._cache.delete(Fa),!e)for(o in this.eventListeners)this._off(o);for(a=0;a<r;a++)if(s=n[a],c=s.split(`.`),l=c[0],u=c[1],l)this.eventListeners[l]&&this._off(l,u,t);else for(o in this.eventListeners)this._off(o,u,t);return this}dispatchEvent(e){let t={target:this,type:e.type,evt:e};return this.fire(e.type,t),this}addEventListener(e,t){return this.on(e,function(e){t.call(this,e.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,t,n){let r=this;return this.on(e,function(e){let a=e.target.findAncestors(t,!0,r);for(let t=0;t<a.length;t++)e=M.cloneObject(e),e.currentTarget=a[t],n.call(a[t],e)}),this}remove(){return this.isDragging()&&this.stopDrag(),xa._dragElements.delete(this._id),xa._dragElements.forEach((e,t)=>{this.isAncestorOf(e.node)&&xa._dragElements.delete(t)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Ia),this._clearSelfAndDescendantCache(Pa),this._clearSelfAndDescendantCache(La),this._clearSelfAndDescendantCache(Qa),this._clearSelfAndDescendantCache(to),this._clearSelfAndDescendantCache(Ha)}_remove(){this._clearCaches();let e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){let t=`get`+M._capitalize(e);return M._isFunction(this[t])?this[t]():this.attrs[e]}getAncestors(){let e=this.getParent(),t=[];for(;e;)t.push(e),e=e.getParent();return t}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{let t,n;if(!e)return this;for(t in e)t!==Ba&&(n=Ya+M._capitalize(t),M._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))}),this}isListening(){return this._getCache(Ha,this._isListening)}_isListening(e){if(!this.listening())return!1;let t=this.getParent();return t&&t!==e&&this!==e?t._isListening(e):!0}isVisible(){return this._getCache(to,this._isVisible)}_isVisible(e){if(!this.visible())return!1;let t=this.getParent();return t&&t!==e&&this!==e?t._isVisible(e):!0}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);let n=this.getLayer(),r=!1;xa._dragElements.forEach(e=>{e.dragStatus===`dragging`&&(e.node.nodeType===`Stage`||e.node.getLayer()===n)&&(r=!0)});let a=!t&&!j.hitOnDragEnabled&&(r||j.isTransforming());return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),t=this,n=0,r,a,o,s;function c(l){for(r=[],a=l.length,o=0;o<a;o++)s=l[o],n++,s.nodeType!==Xa&&(r=r.concat(s.getChildren().slice())),s._id===t._id&&(o=a);r.length>0&&r[0].getDepth()<=e&&c(r)}let l=this.getStage();return t.nodeType!==eo&&l&&c(l.getChildren()),n}getDepth(){let e=0,t=this.parent;for(;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache($a),this._clearSelfAndDescendantCache(Ia)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){let e=this.getStage();if(!e)return null;let t=e.getPointerPosition();if(!t)return null;let n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);let r=this.getAbsoluteTransform(e).getMatrix(),a=new Fi,o=this.offset();return a.m=r.slice(),a.translate(o.x,o.y),a.getTranslation()}setAbsolutePosition(e){let{x:t,y:n,...r}=this._clearTransform();this.attrs.x=t,this.attrs.y=n,this._clearCache($a);let a=this._getAbsoluteTransform().copy();return a.invert(),a.translate(e.x,e.y),e={x:this.attrs.x+a.getTranslation().x,y:this.attrs.y+a.getTranslation().y},this._setTransform(r),this.setPosition({x:e.x,y:e.y}),this._clearCache($a),this._clearSelfAndDescendantCache(Ia),this}_setTransform(e){let t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){let e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let t=e.x,n=e.y,r=this.x(),a=this.y();return t!==void 0&&(r+=t),n!==void 0&&(a+=n),this.setPosition({x:r,y:a}),this}_eachAncestorReverse(e,t){let n=[],r=this.getParent(),a,o;if(!(t&&t._id===this._id)){for(n.unshift(this);r&&(!t||r._id!==t._id);)n.unshift(r),r=r.parent;for(a=n.length,o=0;o<a;o++)e(n[o])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return M.warn(`Node has no parent. moveToTop function is ignored.`),!1;let e=this.index;return e<this.parent.getChildren().length-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return M.warn(`Node has no parent. moveUp function is ignored.`),!1;let e=this.index;return e<this.parent.getChildren().length-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return M.warn(`Node has no parent. moveDown function is ignored.`),!1;let e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return M.warn(`Node has no parent. moveToBottom function is ignored.`),!1;let e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return M.warn(`Node has no parent. zIndex parameter is ignored.`),this;(e<0||e>=this.parent.children.length)&&M.warn(`Unexpected value `+e+` for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to `+(this.parent.children.length-1)+`.`);let t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Pa,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),t,n,r,a,o,s={attrs:{},className:this.getClassName()};for(t in e)n=e[t],o=M.isObject(n)&&!M._isPlainObject(n)&&!M._isArray(n),!o&&(r=typeof this[t]==`function`&&this[t],delete e[t],a=r?r.call(this):null,e[t]=n,a!==n&&(s.attrs[t]=n));return M._prepareToStringify(s)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){let r=[];t&&this._isMatch(e)&&r.push(this);let a=this.parent;for(;a;){if(a===n)return r;a._isMatch(e)&&r.push(a),a=a.parent}return r}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if(typeof e==`function`)return e(this);let t=e.replace(/ /g,``).split(`,`),n=t.length,r,a;for(r=0;r<n;r++)if(a=t[r],M.isValidSelector(a)||(M.warn(`Selector "`+a+`" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".`),M.warn(`If you have a custom shape with such className, please change it to start with upper letter like "Triangle".`),M.warn(`Konva is awesome, right?`)),a.charAt(0)===`#`){if(this.id()===a.slice(1))return!0}else if(a.charAt(0)===`.`){if(this.hasName(a.slice(1)))return!0}else if(this.className===a||this.nodeType===a)return!0;return!1}getLayer(){let e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(Qa,this._getStage)}_getStage(){let e=this.getParent();return e?e.getStage():null}fire(e,t={},n){return t.target=t.target||this,n?this._fireAndBubble(e,t):this._fire(e,t),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Ia,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let t;if(e)return t=new Fi,this._eachAncestorReverse(function(e){let n=e.transformsEnabled();n===`all`?t.multiply(e.getTransform()):n===`position`&&t.translate(e.x()-e.offsetX(),e.y()-e.offsetY())},e),t;{t=this._cache.get(Ia)||new Fi,this.parent?this.parent.getAbsoluteTransform().copyInto(t):t.reset();let e=this.transformsEnabled();if(e===`all`)t.multiply(this.getTransform());else if(e===`position`){let e=this.attrs.x||0,n=this.attrs.y||0,r=this.attrs.offsetX||0,a=this.attrs.offsetY||0;t.translate(e-r,n-a)}return t.dirty=!1,t}}getAbsoluteScale(e){let t=this;for(;t;)t._isUnderCache&&(e=t),t=t.getParent();let n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache($a,this._getTransform)}_getTransform(){let e=this._cache.get($a)||new Fi;e.reset();let t=this.x(),n=this.y(),r=j.getAngle(this.rotation()),a=this.attrs.scaleX??1,o=this.attrs.scaleY??1,s=this.attrs.skewX||0,c=this.attrs.skewY||0,l=this.attrs.offsetX||0,u=this.attrs.offsetY||0;return(t!==0||n!==0)&&e.translate(t,n),r!==0&&e.rotate(r),(s!==0||c!==0)&&e.skew(s,c),(a!==1||o!==1)&&e.scale(a,o),(l!==0||u!==0)&&e.translate(-1*l,-1*u),e.dirty=!1,e}clone(e){let t=M.cloneObject(this.attrs),n,r,a,o,s;for(n in e)t[n]=e[n];let c=new this.constructor(t);for(n in this.eventListeners)for(r=this.eventListeners[n],a=r.length,o=0;o<a;o++)s=r[o],s.name.indexOf(Va)<0&&(c.eventListeners[n]||(c.eventListeners[n]=[]),c.eventListeners[n].push(s));return c}_toKonvaCanvas(e){e||={};let t=this.getClientRect(),n=this.getStage(),r=e.x===void 0?Math.floor(t.x):e.x,a=e.y===void 0?Math.floor(t.y):e.y,o=e.pixelRatio||1,s=new ya({width:e.width||Math.ceil(t.width)||(n?n.width():0),height:e.height||Math.ceil(t.height)||(n?n.height():0),pixelRatio:o}),c=s.getContext(),l=new ya({width:s.width/s.pixelRatio+Math.abs(r),height:s.height/s.pixelRatio+Math.abs(a),pixelRatio:s.pixelRatio});return e.imageSmoothingEnabled===!1&&(c._context.imageSmoothingEnabled=!1),c.save(),(r||a)&&c.translate(-1*r,-1*a),this.drawScene(s,void 0,l),c.restore(),s}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e||={};let t=e.mimeType||null,n=e.quality||null,r=this._toKonvaCanvas(e).toDataURL(t,n);return e.callback&&e.callback(r),r}toImage(e){return new Promise((t,n)=>{try{let n=e?.callback;n&&delete e.callback,M._urlToImage(this.toDataURL(e),function(e){t(e),n?.(e)})}catch(e){n(e)}})}toBlob(e){return new Promise((t,n)=>{try{let n=e?.callback;n&&delete e.callback,this.toCanvas(e).toBlob(e=>{t(e),n?.(e)},e?.mimeType,e?.quality)}catch(e){n(e)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance===void 0?this.parent?this.parent.getDragDistance():j.dragDistance:this.attrs.dragDistance}_off(e,t,n){let r=this.eventListeners[e],a,o,s;for(a=0;a<r.length;a++)if(o=r[a].name,s=r[a].handler,(o!==`konva`||t===`konva`)&&(!t||o===t)&&(!n||n===s)){if(r.splice(a,1),r.length===0){delete this.eventListeners[e];break}a--}}_fireChangeEvent(e,t,n){this._fire(e+za,{oldVal:t,newVal:n})}addName(e){if(!this.hasName(e)){let t=this.name(),n=t?t+` `+e:e;this.name(n)}return this}hasName(e){if(!e)return!1;let t=this.name();return t?(t||``).split(/\s/g).indexOf(e)!==-1:!1}removeName(e){let t=(this.name()||``).split(/\s/g),n=t.indexOf(e);return n!==-1&&(t.splice(n,1),this.name(t.join(` `))),this}setAttr(e,t){let n=this[Ya+M._capitalize(e)];return M._isFunction(n)?n.call(this,t):this._setAttr(e,t),this}_requestDraw(){j.autoDrawEnabled&&(this.getLayer()||this.getStage())?.batchDraw()}_setAttr(e,t){let n=this.attrs[e];n===t&&!M.isObject(t)||(t==null?delete this.attrs[e]:this.attrs[e]=t,this._shouldFireChangeEvents&&this._fireChangeEvent(e,n,t),this._requestDraw())}_setComponentAttr(e,t,n){let r;n!==void 0&&(r=this.attrs[e],r||(this.attrs[e]=this.getAttr(e)),this.attrs[e][t]=n,this._fireChangeEvent(e,r,n))}_fireAndBubble(e,t,n){t&&this.nodeType===Xa&&(t.target=this);let r=[Ua,Wa,Ga,Ka,qa,Ja];if(!(r.indexOf(e)!==-1&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||this.nodeType===`Stage`&&!n))){this._fire(e,t);let a=r.indexOf(e)!==-1&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(t&&!t.cancelBubble||!t)&&this.parent&&this.parent.isListening()&&!a&&(n&&n.parent?this._fireAndBubble.call(this.parent,e,t,n):this._fireAndBubble.call(this.parent,e,t))}}_getProtoListeners(t){let{nodeType:n}=this,r=e.protoListenerMap.get(n)||{},a=r?.[t];if(a===void 0){a=[];let o=Object.getPrototypeOf(this);for(;o;){let e=o.eventListeners?.[t]??[];a.push(...e),o=Object.getPrototypeOf(o)}r[t]=a,e.protoListenerMap.set(n,r)}return a}_fire(e,t){t||={},t.currentTarget=this,t.type=e;let n=this._getProtoListeners(e);if(n){let e=n.slice();for(let n=0;n<e.length;n++)e[n].handler.call(this,t)}let r=this.eventListeners[e];if(r){let n=r.slice(),a=n.length;for(let e=0;e<n.length;e++)n[e].handler.call(this,t);let o=this.eventListeners[e];if(o)for(let e=a;e<o.length;e++)o[e].handler.call(this,t)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){let t=e?e.pointerId:void 0,n=this.getStage(),r=this.getAbsolutePosition();if(!n)return;let a=n._getPointerById(t)||n._changedPointerPositions[0]||r;xa._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-r.x,y:a.y-r.y},dragStatus:`ready`,pointerId:t,startEvent:e})}startDrag(e,t=!0){xa._dragElements.has(this._id)||this._createDragElement(e);let n=xa._dragElements.get(this._id);n.dragStatus=`dragging`,this.fire(`dragstart`,{type:`dragstart`,target:this,evt:n.startEvent&&n.startEvent.evt||e&&e.evt},t)}_setDragPosition(e,t){let n=this.getStage()._getPointerById(t.pointerId);if(!n)return;let r={x:n.x-t.offset.x,y:n.y-t.offset.y},a=this.dragBoundFunc();if(a!==void 0){let t=a.call(this,r,e);t?r=t:M.warn(`dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.`)}(!this._lastPos||this._lastPos.x!==r.x||this._lastPos.y!==r.y)&&(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}stopDrag(e){let t=xa._dragElements.get(this._id);t&&(t.dragStatus=`stopped`),xa._endDragBefore(e),xa._endDragAfter(e)}setDraggable(e){this._setAttr(`draggable`,e),this._dragChange()}isDragging(){let e=xa._dragElements.get(this._id);return e?e.dragStatus===`dragging`:!1}_listenDrag(){this._dragCleanup(),this.on(`mousedown.konva touchstart.konva`,function(e){if(!(e.evt.button===void 0||j.dragButtons.indexOf(e.evt.button)>=0)||this.isDragging())return;let t=!1;xa._dragElements.forEach(e=>{this.isAncestorOf(e.node)&&(t=!0)}),t||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;let e=xa._dragElements.get(this._id),t=e&&e.dragStatus===`dragging`,n=e&&e.dragStatus===`ready`;t?this.stopDrag():n&&xa._dragElements.delete(this._id)}}_dragCleanup(){this.off(`mousedown.konva`),this.off(`touchstart.konva`)}isClientRectOnScreen(e={x:0,y:0}){let t=this.getStage();if(!t)return!1;let n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return M.haveIntersection(n,this.getClientRect())}static create(e,t){return M._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(t,n){let r=e.prototype.getClassName.call(t),a=t.children,o,s,c;n&&(t.attrs.container=n),j[r]||(M.warn(`Can not find a node with class name "`+r+`". Fallback to "Shape".`),r=`Shape`);let l=j[r];if(o=new l(t.attrs),a)for(s=a.length,c=0;c<s;c++)o.add(e._createNode(a[c]));return o}};io.protoListenerMap=new Map,io.prototype.nodeType=`Node`,io.prototype._attrsAffectingSize=[],io.prototype.eventListeners={},io.prototype.on(no,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache($a),this._clearSelfAndDescendantCache(Ia)}),io.prototype.on(`visibleChange.konva`,function(){this._clearSelfAndDescendantCache(to)}),io.prototype.on(`listeningChange.konva`,function(){this._clearSelfAndDescendantCache(Ha)}),io.prototype.on(`opacityChange.konva`,function(){this._clearSelfAndDescendantCache(Pa)});var ao=P.addGetterSetter;ao(io,`zIndex`),ao(io,`absolutePosition`),ao(io,`position`),ao(io,`x`,0,N()),ao(io,`y`,0,N()),ao(io,`globalCompositeOperation`,`source-over`,Ea()),ao(io,`opacity`,1,N()),ao(io,`name`,``,Ea()),ao(io,`id`,``,Ea()),ao(io,`rotation`,0,N()),P.addComponentsGetterSetter(io,`scale`,[`x`,`y`]),ao(io,`scaleX`,1,N()),ao(io,`scaleY`,1,N()),P.addComponentsGetterSetter(io,`skew`,[`x`,`y`]),ao(io,`skewX`,0,N()),ao(io,`skewY`,0,N()),P.addComponentsGetterSetter(io,`offset`,[`x`,`y`]),ao(io,`offsetX`,0,N()),ao(io,`offsetY`,0,N()),ao(io,`dragDistance`,void 0,N()),ao(io,`width`,0,N()),ao(io,`height`,0,N()),ao(io,`listening`,!0,ka()),ao(io,`preventDefault`,!0,ka()),ao(io,`filters`,void 0,function(e){return this._filterUpToDate=!1,e}),ao(io,`visible`,!0,ka()),ao(io,`transformsEnabled`,`all`,Ea()),ao(io,`size`),ao(io,`dragBoundFunc`),ao(io,`draggable`,!1,ka()),P.backCompat(io,{rotateDeg:`rotate`,setRotationDeg:`setRotation`,getRotationDeg:`getRotation`});var oo=class extends io{constructor(){super(...arguments),this.children=[]}getChildren(e){let t=this.children||[];return e?t.filter(e):t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let t=0;t<e.length;t++)this.add(e[t]);return this}let t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire(`add`,{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){let t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){let n=[];return this._descendants(r=>{let a=r._isMatch(e);return a&&n.push(r),!!(a&&t)}),n}_descendants(e){let t=!1,n=this.getChildren();for(let r of n)if(t=e(r),t||r.hasChildren()&&(t=r._descendants(e),t))return!0;return!1}toObject(){let e=io.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(t=>{e.children.push(t.toObject())}),e}isAncestorOf(e){let t=e.getParent();for(;t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){let t=io.prototype.clone.call(this,e);return this.getChildren().forEach(function(e){t.add(e.clone())}),t}getAllIntersections(e){let t=[];return this.find(`Shape`).forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),!this.isCached()&&((t=this.children)==null||t.forEach(function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)==null||e.forEach(function(e,t){e.index=t}),this._requestDraw()}drawScene(e,t,n){let r=this.getLayer(),a=e||r&&r.getCanvas(),o=a&&a.getContext(),s=this._getCanvasCache(),c=s&&s.scene,l=a&&a.isCache;if(!this.isVisible()&&!l)return this;if(c){o.save();let e=this.getAbsoluteTransform(t).getMatrix();o.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren(`drawScene`,a,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;let n=this.getLayer(),r=e||n&&n.hitCanvas,a=r&&r.getContext(),o=this._getCanvasCache();if(o&&o.hit){a.save();let e=this.getAbsoluteTransform(t).getMatrix();a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren(`drawHit`,r,t);return this}_drawChildren(e,t,n,r){var a;let o=t&&t.getContext(),s=this.clipWidth(),c=this.clipHeight(),l=this.clipFunc(),u=typeof s==`number`&&typeof c==`number`||l,d=n===this;if(u){o.save();let e=this.getAbsoluteTransform(n),t=e.getMatrix();o.transform(t[0],t[1],t[2],t[3],t[4],t[5]),o.beginPath();let r;if(l)r=l.call(this,o,this);else{let e=this.clipX(),t=this.clipY();o.rect(e||0,t||0,s,c)}o.clip.apply(o,r),t=e.copy().invert().getMatrix(),o.transform(t[0],t[1],t[2],t[3],t[4],t[5])}let f=!d&&this.globalCompositeOperation()!==`source-over`&&e===`drawScene`;f&&(o.save(),o._applyGlobalCompositeOperation(this)),(a=this.children)==null||a.forEach(function(a){a[e](t,n,r)}),f&&o.restore(),u&&o.restore()}getClientRect(e={}){var t;let n=e.skipTransform,r=e.relativeTo,a,o,s,c,l={x:1/0,y:1/0,width:0,height:0},u=this;(t=this.children)==null||t.forEach(function(t){if(!t.visible())return;let n=t.getClientRect({relativeTo:u,skipShadow:e.skipShadow,skipStroke:e.skipStroke});n.width===0&&n.height===0||(a===void 0?(a=n.x,o=n.y,s=n.x+n.width,c=n.y+n.height):(a=Math.min(a,n.x),o=Math.min(o,n.y),s=Math.max(s,n.x+n.width),c=Math.max(c,n.y+n.height)))});let d=this.find(`Shape`),f=!1;for(let e=0;e<d.length;e++)if(d[e]._isVisible(this)){f=!0;break}return l=f&&a!==void 0?{x:a,y:o,width:s-a,height:c-o}:{x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,r)}};P.addComponentsGetterSetter(oo,`clip`,[`x`,`y`,`width`,`height`]),P.addGetterSetter(oo,`clipX`,void 0,N()),P.addGetterSetter(oo,`clipY`,void 0,N()),P.addGetterSetter(oo,`clipWidth`,void 0,N()),P.addGetterSetter(oo,`clipHeight`,void 0,N()),P.addGetterSetter(oo,`clipFunc`);var so=new Map,co=j._global.PointerEvent!==void 0;function lo(e){return so.get(e)}function uo(e){return{evt:e,pointerId:e.pointerId}}function fo(e,t){return so.get(e)===t}function po(e,t){mo(e),t.getStage()&&(so.set(e,t),co&&t._fire(`gotpointercapture`,uo(new PointerEvent(`gotpointercapture`))))}function mo(e,t){let n=so.get(e);if(!n)return;let r=n.getStage();r&&r.content,so.delete(e),co&&n._fire(`lostpointercapture`,uo(new PointerEvent(`lostpointercapture`)))}var ho=`Stage`,go=`string`,_o=`px`,vo=`mouseout`,yo=`mouseleave`,bo=`mouseover`,xo=`mouseenter`,So=`mousemove`,Co=`mousedown`,wo=`mouseup`,To=`pointermove`,Eo=`pointerdown`,Do=`pointerup`,Oo=`pointercancel`,ko=`lostpointercapture`,Ao=`pointerout`,jo=`pointerleave`,Mo=`pointerover`,No=`pointerenter`,Po=`contextmenu`,Fo=`touchstart`,Io=`touchend`,Lo=`touchmove`,Ro=`touchcancel`,zo=`wheel`,Bo=5,Vo=[[xo,`_pointerenter`],[Co,`_pointerdown`],[So,`_pointermove`],[wo,`_pointerup`],[yo,`_pointerleave`],[Fo,`_pointerdown`],[Lo,`_pointermove`],[Io,`_pointerup`],[Ro,`_pointercancel`],[bo,`_pointerover`],[zo,`_wheel`],[Po,`_contextmenu`],[Eo,`_pointerdown`],[To,`_pointermove`],[Do,`_pointerup`],[Oo,`_pointercancel`],[jo,`_pointerleave`],[ko,`_lostpointercapture`]],Ho={mouse:{[Ao]:vo,[jo]:yo,[Mo]:bo,[No]:xo,[To]:So,[Eo]:Co,[Do]:wo,[Oo]:`mousecancel`,pointerclick:`click`,pointerdblclick:`dblclick`},touch:{[Ao]:`touchout`,[jo]:`touchleave`,[Mo]:`touchover`,[No]:`touchenter`,[To]:Lo,[Eo]:Fo,[Do]:Io,[Oo]:Ro,pointerclick:`tap`,pointerdblclick:`dbltap`},pointer:{[Ao]:Ao,[jo]:jo,[Mo]:Mo,[No]:No,[To]:To,[Eo]:Eo,[Do]:Do,[Oo]:Oo,pointerclick:`pointerclick`,pointerdblclick:`pointerdblclick`}},Uo=e=>e.indexOf(`pointer`)>=0?`pointer`:e.indexOf(`touch`)>=0?`touch`:`mouse`,Wo=e=>{let t=Uo(e);if(t===`pointer`)return j.pointerEventsEnabled&&Ho.pointer;if(t===`touch`)return Ho.touch;if(t===`mouse`)return Ho.mouse};function Go(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&M.warn(`Stage does not support clipping. Please use clip for Layers or Groups.`),e}var Ko=`Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);`,qo=[],Jo=class extends oo{constructor(e){super(Go(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),qo.push(this),this.on(`widthChange.konva heightChange.konva`,this._resizeDOM),this.on(`visibleChange.konva`,this._checkVisibility),this.on(`clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva`,()=>{Go(this.attrs)}),this._checkVisibility()}_validateAdd(e){let t=e.getType()===`Layer`,n=e.getType()===`FastLayer`;t||n||M.throw(`You may only add layers to the stage.`)}_checkVisibility(){if(!this.content)return;let e=this.visible()?``:`none`;this.content.style.display=e}setContainer(e){if(typeof e===go){let t;if(e.charAt(0)===`.`){let t=e.slice(1);e=document.getElementsByClassName(t)[0]}else t=e.charAt(0)===`#`?e.slice(1):e,e=document.getElementById(t);if(!e)throw`Can not find container in document with id `+t}return this._setAttr(`container`,e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){let e=this.children,t=e.length;for(let n=0;n<t;n++)e[n].clear();return this}clone(e){return e||={},e.container=typeof document<`u`&&document.createElement(`div`),oo.prototype.clone.call(this,e)}destroy(){super.destroy();let e=this.content;e&&M._isInDocument(e)&&this.container().removeChild(e);let t=qo.indexOf(this);return t>-1&&qo.splice(t,1),M.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){let e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(M.warn(Ko),null)}_getPointerById(e){return this._pointerPositions.find(t=>t.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();let t=new ya({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach(function(t){if(!t.isVisible())return;let r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}),t}getIntersection(e){if(!e)return null;let t=this.children,n=t.length-1;for(let r=n;r>=0;r--){let n=t[r].getIntersection(e);if(n)return n}return null}_resizeDOM(){let e=this.width(),t=this.height();this.content&&(this.content.style.width=e+_o,this.content.style.height=t+_o),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach(n=>{n.setSize({width:e,height:t}),n.draw()})}add(e,...t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}super.add(e);let n=this.children.length;return n>Bo&&M.warn(`The stage has `+n+` layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group.`),e.setSize({width:this.width(),height:this.height()}),e.draw(),j.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return fo(e,this)}setPointerCapture(e){po(e,this)}releaseCapture(e){mo(e,this)}getLayers(){return this.children}_bindContentEvents(){j.isBrowser&&Vo.forEach(([e,t])=>{this.content.addEventListener(e,e=>{this[t](e)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);let t=Wo(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);let t=Wo(e.type);t&&this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+`targetShape`];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){let t=Wo(e.type),n=Uo(e.type);if(!t)return;this.setPointersPositions(e);let r=this._getTargetShape(n),a=!(j.isDragging()||j.isTransforming())||j.hitOnDragEnabled;r&&a?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+`targetShape`]=null):a&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){let t=Wo(e.type),n=Uo(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(a=>{let o=this.getIntersection(a);if(xa.justDragged=!1,j[`_`+n+`ListenClick`]=!0,!o||!o.isListening()){this[n+`ClickStartShape`]=void 0;return}j.capturePointerEventsEnabled&&o.setPointerCapture(a.id),this[n+`ClickStartShape`]=o,o._fireAndBubble(t.pointerdown,{evt:e,pointerId:a.id}),r=!0;let s=e.type.indexOf(`touch`)>=0;o.preventDefault()&&e.cancelable&&s&&e.preventDefault()}),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){let t=Wo(e.type),n=Uo(e.type);if(!t)return;let r=e.type.indexOf(`touch`)>=0||e.pointerType===`touch`;if(j.isDragging()&&xa.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(j.isDragging()||j.isTransforming())||j.hitOnDragEnabled))return;let a={},o=!1,s=this._getTargetShape(n);this._changedPointerPositions.forEach(r=>{let c=lo(r.id)||this.getIntersection(r),l=r.id,u={evt:e,pointerId:l},d=s!==c;if(d&&s&&(s._fireAndBubble(t.pointerout,{...u},c),s._fireAndBubble(t.pointerleave,{...u},c)),c){if(a[c._id])return;a[c._id]=!0}c&&c.isListening()?(o=!0,d&&(c._fireAndBubble(t.pointerover,{...u},s),c._fireAndBubble(t.pointerenter,{...u},s),this[n+`targetShape`]=c),c._fireAndBubble(t.pointermove,{...u})):s&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:l}),this[n+`targetShape`]=null)}),o||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){let t=Wo(e.type),n=Uo(e.type);if(!t)return;this.setPointersPositions(e);let r=this[n+`ClickStartShape`],a=this[n+`ClickEndShape`],o={},s=!1;this._changedPointerPositions.forEach(c=>{let l=lo(c.id)||this.getIntersection(c);if(l){if(l.releaseCapture(c.id),o[l._id])return;o[l._id]=!0}let u=c.id,d={evt:e,pointerId:u},f=!1;j[`_`+n+`InDblClickWindow`]?(f=!0,clearTimeout(this[n+`DblTimeout`])):xa.justDragged||(j[`_`+n+`InDblClickWindow`]=!0,clearTimeout(this[n+`DblTimeout`])),this[n+`DblTimeout`]=setTimeout(function(){j[`_`+n+`InDblClickWindow`]=!1},j.dblClickWindow),l&&l.isListening()?(s=!0,this[n+`ClickEndShape`]=l,l._fireAndBubble(t.pointerup,{...d}),j[`_`+n+`ListenClick`]&&r&&r===l&&(l._fireAndBubble(t.pointerclick,{...d}),f&&a&&a===l&&l._fireAndBubble(t.pointerdblclick,{...d}))):(this[n+`ClickEndShape`]=null,s||=(this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),!0),j[`_`+n+`ListenClick`]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:u}),f&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:u}))}),s||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),j[`_`+n+`ListenClick`]=!1,e.cancelable&&n!==`touch`&&n!==`pointer`&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);let t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Po,{evt:e}):this._fire(Po,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);let t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(zo,{evt:e}):this._fire(zo,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);let t=lo(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(Do,uo(e)),mo(e.pointerId)}_lostpointercapture(e){mo(e.pointerId)}setPointersPositions(e){let t=this._getContentPosition(),n=null,r=null;e||=window.event,e.touches===void 0?(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:M._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:M._getFirstPointerId(e)}]):(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}))}_setPointerPosition(e){M.warn(`Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.`),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};let e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new ya({width:this.width(),height:this.height()}),this.bufferHitCanvas=new ba({pixelRatio:1,width:this.width(),height:this.height()}),!j.isBrowser)return;let e=this.container();if(!e)throw`Stage has no container. A container is required.`;e.innerHTML=``,this.content=document.createElement(`div`),this.content.style.position=`relative`,this.content.style.userSelect=`none`,this.content.className=`konvajs-content`,this.content.setAttribute(`role`,`presentation`),e.appendChild(this.content),this._resizeDOM()}cache(){return M.warn(`Cache function is not allowed for stage. You may use cache only for layers, groups and shapes.`),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}};Jo.prototype.nodeType=ho,Mi(Jo),P.addGetterSetter(Jo,`container`),j.isBrowser&&document.addEventListener(`visibilitychange`,()=>{qo.forEach(e=>{e.batchDraw()})});var Yo=`hasShadow`,Xo=`shadowRGBA`,Zo=`patternImage`,Qo=`linearGradient`,$o=`radialGradient`,es;function ts(){return es||(es=M.createCanvasElement().getContext(`2d`),es)}var ns={};function rs(e){let t=this.attrs.fillRule;t?e.fill(t):e.fill()}function is(e){e.stroke()}function as(e){let t=this.attrs.fillRule;t?e.fill(t):e.fill()}function os(e){e.stroke()}function ss(){this._clearCache(Yo)}function cs(){this._clearCache(Xo)}function ls(){this._clearCache(Zo)}function us(){this._clearCache(Qo)}function ds(){this._clearCache($o)}var F=class extends io{constructor(e){super(e);let t,n=0;for(;t=M.getHitColor(),!(t&&!(t in ns));)if(n++,n>=1e4){M.warn(`Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it.`),t=M.getRandomColor();break}this.colorKey=t,ns[t]=this}getContext(){return M.warn(`shape.getContext() method is deprecated. Please do not use it.`),this.getLayer().getContext()}getCanvas(){return M.warn(`shape.getCanvas() method is deprecated. Please do not use it.`),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(Yo,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Zo,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){let e=ts().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||`repeat`);if(e&&e.setTransform){let t=new Fi;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(j.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());let n=t.getMatrix(),r=typeof DOMMatrix>`u`?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(Qo,this.__getLinearGradient)}__getLinearGradient(){let e=this.fillLinearGradientColorStops();if(e){let t=ts(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),a=t.createLinearGradient(n.x,n.y,r.x,r.y);for(let t=0;t<e.length;t+=2)a.addColorStop(e[t],e[t+1]);return a}}_getRadialGradient(){return this._getCache($o,this.__getRadialGradient)}__getRadialGradient(){let e=this.fillRadialGradientColorStops();if(e){let t=ts(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),a=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius());for(let t=0;t<e.length;t+=2)a.addColorStop(e[t],e[t+1]);return a}}getShadowRGBA(){return this._getCache(Xo,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;let e=M.colorToRGBA(this.shadowColor());if(e)return`rgba(`+e.r+`,`+e.g+`,`+e.b+`,`+e.a*(this.shadowOpacity()||1)+`)`}hasFill(){return this._calculate(`hasFill`,[`fillEnabled`,`fill`,`fillPatternImage`,`fillLinearGradientColorStops`,`fillRadialGradientColorStops`],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate(`hasStroke`,[`strokeEnabled`,`strokeWidth`,`stroke`,`strokeLinearGradientColorStops`],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){let e=this.hitStrokeWidth();return e===`auto`?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){let t=this.getStage();if(!t)return!1;let n=t.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return io.prototype.destroy.call(this),delete ns[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){if(!(this.attrs.perfectDrawEnabled??!0))return!1;let t=e||this.hasFill(),n=this.hasStroke(),r=this.getAbsoluteOpacity()!==1;if(t&&n&&r)return!0;let a=this.hasShadow(),o=this.shadowForStrokeEnabled();return!!(t&&n&&a&&o)}setStrokeHitEnabled(e){M.warn(`strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead.`),e?this.hitStrokeWidth(`auto`):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){let e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}let r=e.skipTransform,a=e.relativeTo||t&&this.getStage()||void 0,o=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,c=o.width+s,l=o.height+s,u=!e.skipShadow&&this.hasShadow(),d=u?this.shadowOffsetX():0,f=u?this.shadowOffsetY():0,p=c+Math.abs(d),m=l+Math.abs(f),h=u&&this.shadowBlur()||0,g={width:p+h*2,height:m+h*2,x:-(s/2+h)+Math.min(d,0)+o.x,y:-(s/2+h)+Math.min(f,0)+o.y};return r?g:this._transformedRect(g,a)}drawScene(e,t,n){let r=this.getLayer(),a=(e||r.getCanvas()).getContext(),o=this._getCanvasCache(),s=this.getSceneFunc(),c=this.hasShadow(),l,u=t===this;if(!this.isVisible()&&!u)return this;if(o){a.save();let e=this.getAbsoluteTransform(t).getMatrix();return a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(a),a.restore(),this}if(!s)return this;if(a.save(),this._useBufferCanvas()){l=this.getStage();let e=n||l.bufferCanvas,r=e.getContext();n?(r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.width,e.height),r.restore()):r.clear(),r.save(),r._applyLineJoin(this),r._applyMiterLimit(this);let o=this.getAbsoluteTransform(t).getMatrix();r.transform(o[0],o[1],o[2],o[3],o[4],o[5]),s.call(this,r,this),r.restore();let d=e.pixelRatio;c&&a._applyShadow(this),u||(a._applyOpacity(this),a._applyGlobalCompositeOperation(this)),a.drawImage(e._canvas,e.x||0,e.y||0,e.width/d,e.height/d)}else{if(a._applyLineJoin(this),a._applyMiterLimit(this),!u){let e=this.getAbsoluteTransform(t).getMatrix();a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),a._applyOpacity(this),a._applyGlobalCompositeOperation(this)}c&&a._applyShadow(this),s.call(this,a,this)}return a.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;let r=this.getLayer(),a=e||r.hitCanvas,o=a&&a.getContext(),s=this.hitFunc()||this.sceneFunc(),c=this._getCanvasCache(),l=c&&c.hit;if(this.colorKey||M.warn(`Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()`),l){o.save();let e=this.getAbsoluteTransform(t).getMatrix();return o.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),o._applyLineJoin(this),o._applyMiterLimit(this),this!==t){let e=this.getAbsoluteTransform(t).getMatrix();o.transform(e[0],e[1],e[2],e[3],e[4],e[5])}return s.call(this,o,this),o.restore(),this}drawHitFromCache(e=0){let t=this._getCanvasCache(),n=this._getCachedSceneCanvas(),r=t.hit,a=r.getContext(),o=r.getWidth(),s=r.getHeight();a.clear(),a.drawImage(n._canvas,0,0,o,s);try{let t=a.getImageData(0,0,o,s),n=t.data,r=n.length,c=M._hexToRgb(this.colorKey);for(let t=0;t<r;t+=4)n[t+3]>e?(n[t]=c.r,n[t+1]=c.g,n[t+2]=c.b,n[t+3]=255):n[t+3]=0;a.putImageData(t,0,0)}catch(e){M.error(`Unable to draw hit graph from cached scene canvas. `+e.message)}return this}hasPointerCapture(e){return fo(e,this)}setPointerCapture(e){po(e,this)}releaseCapture(e){mo(e,this)}};F.prototype._fillFunc=rs,F.prototype._strokeFunc=is,F.prototype._fillFuncHit=as,F.prototype._strokeFuncHit=os,F.prototype._centroid=!1,F.prototype.nodeType=`Shape`,Mi(F),F.prototype.eventListeners={},F.prototype.on(`shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva`,ss),F.prototype.on(`shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva`,cs),F.prototype.on(`fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva`,ls),F.prototype.on(`fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva`,us),F.prototype.on(`fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva`,ds),P.addGetterSetter(F,`stroke`,void 0,Da()),P.addGetterSetter(F,`strokeWidth`,2,N()),P.addGetterSetter(F,`fillAfterStrokeEnabled`,!1),P.addGetterSetter(F,`hitStrokeWidth`,`auto`,Ta()),P.addGetterSetter(F,`strokeHitEnabled`,!0,ka()),P.addGetterSetter(F,`perfectDrawEnabled`,!0,ka()),P.addGetterSetter(F,`shadowForStrokeEnabled`,!0,ka()),P.addGetterSetter(F,`lineJoin`),P.addGetterSetter(F,`lineCap`),P.addGetterSetter(F,`miterLimit`),P.addGetterSetter(F,`sceneFunc`),P.addGetterSetter(F,`hitFunc`),P.addGetterSetter(F,`dash`),P.addGetterSetter(F,`dashOffset`,0,N()),P.addGetterSetter(F,`shadowColor`,void 0,Ea()),P.addGetterSetter(F,`shadowBlur`,0,N()),P.addGetterSetter(F,`shadowOpacity`,1,N()),P.addComponentsGetterSetter(F,`shadowOffset`,[`x`,`y`]),P.addGetterSetter(F,`shadowOffsetX`,0,N()),P.addGetterSetter(F,`shadowOffsetY`,0,N()),P.addGetterSetter(F,`fillPatternImage`),P.addGetterSetter(F,`fill`,void 0,Da()),P.addGetterSetter(F,`fillPatternX`,0,N()),P.addGetterSetter(F,`fillPatternY`,0,N()),P.addGetterSetter(F,`fillLinearGradientColorStops`),P.addGetterSetter(F,`strokeLinearGradientColorStops`),P.addGetterSetter(F,`fillRadialGradientStartRadius`,0),P.addGetterSetter(F,`fillRadialGradientEndRadius`,0),P.addGetterSetter(F,`fillRadialGradientColorStops`),P.addGetterSetter(F,`fillPatternRepeat`,`repeat`),P.addGetterSetter(F,`fillEnabled`,!0),P.addGetterSetter(F,`strokeEnabled`,!0),P.addGetterSetter(F,`shadowEnabled`,!0),P.addGetterSetter(F,`dashEnabled`,!0),P.addGetterSetter(F,`strokeScaleEnabled`,!0),P.addGetterSetter(F,`fillPriority`,`color`),P.addComponentsGetterSetter(F,`fillPatternOffset`,[`x`,`y`]),P.addGetterSetter(F,`fillPatternOffsetX`,0,N()),P.addGetterSetter(F,`fillPatternOffsetY`,0,N()),P.addComponentsGetterSetter(F,`fillPatternScale`,[`x`,`y`]),P.addGetterSetter(F,`fillPatternScaleX`,1,N()),P.addGetterSetter(F,`fillPatternScaleY`,1,N()),P.addComponentsGetterSetter(F,`fillLinearGradientStartPoint`,[`x`,`y`]),P.addComponentsGetterSetter(F,`strokeLinearGradientStartPoint`,[`x`,`y`]),P.addGetterSetter(F,`fillLinearGradientStartPointX`,0),P.addGetterSetter(F,`strokeLinearGradientStartPointX`,0),P.addGetterSetter(F,`fillLinearGradientStartPointY`,0),P.addGetterSetter(F,`strokeLinearGradientStartPointY`,0),P.addComponentsGetterSetter(F,`fillLinearGradientEndPoint`,[`x`,`y`]),P.addComponentsGetterSetter(F,`strokeLinearGradientEndPoint`,[`x`,`y`]),P.addGetterSetter(F,`fillLinearGradientEndPointX`,0),P.addGetterSetter(F,`strokeLinearGradientEndPointX`,0),P.addGetterSetter(F,`fillLinearGradientEndPointY`,0),P.addGetterSetter(F,`strokeLinearGradientEndPointY`,0),P.addComponentsGetterSetter(F,`fillRadialGradientStartPoint`,[`x`,`y`]),P.addGetterSetter(F,`fillRadialGradientStartPointX`,0),P.addGetterSetter(F,`fillRadialGradientStartPointY`,0),P.addComponentsGetterSetter(F,`fillRadialGradientEndPoint`,[`x`,`y`]),P.addGetterSetter(F,`fillRadialGradientEndPointX`,0),P.addGetterSetter(F,`fillRadialGradientEndPointY`,0),P.addGetterSetter(F,`fillPatternRotation`,0),P.addGetterSetter(F,`fillRule`,void 0,Ea()),P.backCompat(F,{dashArray:`dash`,getDashArray:`getDash`,setDashArray:`getDash`,drawFunc:`sceneFunc`,getDrawFunc:`getSceneFunc`,setDrawFunc:`setSceneFunc`,drawHitFunc:`hitFunc`,getDrawHitFunc:`getHitFunc`,setDrawHitFunc:`setHitFunc`});var fs=`beforeDraw`,ps=`draw`,ms=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],hs=ms.length,gs=class extends oo{constructor(e){super(e),this.canvas=new ya,this.hitCanvas=new ba({pixelRatio:1}),this._waitingForDraw=!1,this.on(`visibleChange.konva`,this._checkVisibility),this._checkVisibility(),this.on(`imageSmoothingEnabledChange.konva`,this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);let t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){io.prototype.moveToTop.call(this);let e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!io.prototype.moveUp.call(this))return!1;let e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(io.prototype.moveDown.call(this)){let e=this.getStage();if(e){let t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(io.prototype.moveToBottom.call(this)){let e=this.getStage();if(e){let t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){let e=this.getNativeCanvasElement();return io.prototype.remove.call(this),e&&e.parentNode&&M._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){let t=e.getType();t!==`Group`&&t!==`Shape`&&M.throw(`You may only add groups and shapes to a layer.`)}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x===void 0?this.x():e.x,e.y=e.y===void 0?this.y():e.y,io.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display=`block`:this.canvas._canvas.style.display=`none`}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){M.warn(`Can not change width of layer. Use "stage.width(value)" function instead.`)}getHeight(){if(this.parent)return this.parent.height()}setHeight(){M.warn(`Can not change height of layer. Use "stage.height(value)" function instead.`)}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,M.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let t=1,n=!1;for(;;){for(let r=0;r<hs;r++){let a=ms[r],o=this._getIntersection({x:e.x+a.x*t,y:e.y+a.y*t}),s=o.shape;if(s)return s;if(n=!!o.antialiased,!o.antialiased)break}if(n)t+=1;else return null}}_getIntersection(e){let t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(r===255){let e=ns[M.getHitColorKey(n[0],n[1],n[2])];return e?{shape:e}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(e,t,n){let r=this.getLayer(),a=e||r&&r.getCanvas();return this._fire(fs,{node:this}),this.clearBeforeDraw()&&a.getContext().clear(),oo.prototype.drawScene.call(this,a,t,n),this._fire(ps,{node:this}),this}drawHit(e,t){let n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),oo.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){M.warn(`hitGraphEnabled method is deprecated. Please use layer.listening() instead.`),this.listening(e)}getHitGraphEnabled(e){return M.warn(`hitGraphEnabled method is deprecated. Please use layer.listening() instead.`),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;let e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return M.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};gs.prototype.nodeType=`Layer`,Mi(gs),P.addGetterSetter(gs,`imageSmoothingEnabled`,!0),P.addGetterSetter(gs,`clearBeforeDraw`,!0),P.addGetterSetter(gs,`hitGraphEnabled`,!0,ka());var _s=class extends gs{constructor(e){super(e),this.listening(!1),M.warn(`Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.`)}};_s.prototype.nodeType=`FastLayer`,Mi(_s);var vs=class extends oo{_validateAdd(e){let t=e.getType();t!==`Group`&&t!==`Shape`&&M.throw(`You may only add groups and shapes to groups.`)}};vs.prototype.nodeType=`Group`,Mi(vs);var ys=(function(){return ji.performance&&ji.performance.now?function(){return ji.performance.now()}:function(){return new Date().getTime()}})(),bs=class e{constructor(t,n){this.id=e.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:ys(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(e){let t=[];return e&&(t=Array.isArray(e)?e:[e]),this.layers=t,this}getLayers(){return this.layers}addLayer(e){let t=this.layers,n=t.length;for(let r=0;r<n;r++)if(t[r]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){let t=e.animations,n=t.length;for(let e=0;e<n;e++)if(t[e].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=ys(),e._addAnimation(this),this}stop(){return e._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){let t=e.id,n=this.animations,r=n.length;for(let e=0;e<r;e++)if(n[e].id===t){this.animations.splice(e,1);break}}static _runFrames(){let e={},t=this.animations;for(let n=0;n<t.length;n++){let r=t[n],a=r.layers,o=r.func;r._updateFrameObject(ys());let s=a.length,c;if(c=o?o.call(r,r.frame)!==!1:!0,c)for(let t=0;t<s;t++){let n=a[t];n._id!==void 0&&(e[n._id]=n)}}for(let t in e)e.hasOwnProperty(t)&&e[t].batchDraw()}static _animationLoop(){let t=e;t.animations.length?(t._runFrames(),M.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,M.requestAnimFrame(this._animationLoop))}};bs.animations=[],bs.animIdCounter=0,bs.animRunning=!1;var xs={node:1,duration:1,easing:1,onFinish:1,yoyo:1},Ss=1,Cs=2,ws=3,Ts=[`fill`,`stroke`,`shadowColor`],Es=0,Ds=class{constructor(e,t,n,r,a,o,s){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=o,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=a-this.begin,this.pause()}fire(e){let t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=Cs,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire(`onPlay`)}reverse(){this.state=ws,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire(`onReverse`)}seek(e){this.pause(),this._time=e,this.update(),this.fire(`onSeek`)}reset(){this.pause(),this._time=0,this.update(),this.fire(`onReset`)}finish(){this.pause(),this._time=this.duration,this.update(),this.fire(`onFinish`)}update(){this.setPosition(this.getPosition(this._time)),this.fire(`onUpdate`)}onEnterFrame(){let e=this.getTimer()-this._startTime;this.state===Cs?this.setTime(e):this.state===ws&&this.setTime(this.duration-e)}pause(){this.state=Ss,this.fire(`onPause`)}getTimer(){return new Date().getTime()}},Os=class e{constructor(t){let n=this,r=t.node,a=r._id,o=t.easing||ks.Linear,s=!!t.yoyo,c,l;c=t.duration===void 0?.3:t.duration===0?.001:t.duration,this.node=r,this._id=Es++;let u=r.getLayer()||(r instanceof j.Stage?r.getLayers():null);for(l in u||M.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new bs(function(){n.tween.onEnterFrame()},u),this.tween=new Ds(l,function(e){n._tweenFunc(e)},o,0,1,c*1e3,s),this._addListeners(),e.attrs[a]||(e.attrs[a]={}),e.attrs[a][this._id]||(e.attrs[a][this._id]={}),e.tweens[a]||(e.tweens[a]={}),t)xs[l]===void 0&&this._addAttr(l,t[l]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,n){let r=this.node,a=r._id,o,s,c,l,u,d=e.tweens[a][t];d&&delete e.attrs[a][d][t];let f=r.getAttr(t);if(M._isArray(n))if(o=[],s=Math.max(n.length,f.length),t===`points`&&n.length!==f.length&&(n.length>f.length?(l=f,f=M._prepareArrayForTween(f,n,r.closed())):(c=n,n=M._prepareArrayForTween(n,f,r.closed()))),t.indexOf(`fill`)===0)for(let e=0;e<s;e++)if(e%2==0)o.push(n[e]-f[e]);else{let t=M.colorToRGBA(f[e]);u=M.colorToRGBA(n[e]),f[e]=t,o.push({r:u.r-t.r,g:u.g-t.g,b:u.b-t.b,a:u.a-t.a})}else for(let e=0;e<s;e++)o.push(n[e]-f[e]);else Ts.indexOf(t)===-1?o=n-f:(f=M.colorToRGBA(f),u=M.colorToRGBA(n),o={r:u.r-f.r,g:u.g-f.g,b:u.b-f.b,a:u.a-f.a});e.attrs[a][this._id][t]={start:f,diff:o,end:n,trueEnd:c,trueStart:l},e.tweens[a][t]=this._id}_tweenFunc(t){let n=this.node,r=e.attrs[n._id][this._id],a,o,s,c,l,u,d,f;for(a in r){if(o=r[a],s=o.start,c=o.diff,f=o.end,M._isArray(s))if(l=[],d=Math.max(s.length,f.length),a.indexOf(`fill`)===0)for(u=0;u<d;u++)u%2==0?l.push((s[u]||0)+c[u]*t):l.push(`rgba(`+Math.round(s[u].r+c[u].r*t)+`,`+Math.round(s[u].g+c[u].g*t)+`,`+Math.round(s[u].b+c[u].b*t)+`,`+(s[u].a+c[u].a*t)+`)`);else for(u=0;u<d;u++)l.push((s[u]||0)+c[u]*t);else l=Ts.indexOf(a)===-1?s+c*t:`rgba(`+Math.round(s.r+c.r*t)+`,`+Math.round(s.g+c.g*t)+`,`+Math.round(s.b+c.b*t)+`,`+(s.a+c.a*t)+`)`;n.setAttr(a,l)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{let t=this.node,n=e.attrs[t._id][this._id];n.points&&n.points.trueEnd&&t.setAttr(`points`,n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{let t=this.node,n=e.attrs[t._id][this._id];n.points&&n.points.trueStart&&t.points(n.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){let t=this.node._id,n=this._id,r=e.tweens[t];this.pause(),this.anim&&this.anim.stop();for(let n in r)delete e.tweens[t][n];delete e.attrs[t][n],e.tweens[t]&&(Object.keys(e.tweens[t]).length===0&&delete e.tweens[t],Object.keys(e.attrs[t]).length===0&&delete e.attrs[t])}};Os.attrs={},Os.tweens={},io.prototype.to=function(e){let t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new Os(e).play()};var ks={BackEaseIn(e,t,n,r){return n*(e/=r)*e*(2.70158*e-1.70158)+t},BackEaseOut(e,t,n,r){return n*((e=e/r-1)*e*(2.70158*e+1.70158)+1)+t},BackEaseInOut(e,t,n,r){let a=1.70158;return(e/=r/2)<1?n/2*(e*e*(((a*=1.525)+1)*e-a))+t:n/2*((e-=2)*e*(((a*=1.525)+1)*e+a)+2)+t},ElasticEaseIn(e,t,n,r,a,o){let s=0;return e===0?t:(e/=r)===1?t+n:(o||=r*.3,!a||a<Math.abs(n)?(a=n,s=o/4):s=o/(2*Math.PI)*Math.asin(n/a),-(a*2**(10*--e)*Math.sin((e*r-s)*(2*Math.PI)/o))+t)},ElasticEaseOut(e,t,n,r,a,o){let s=0;return e===0?t:(e/=r)===1?t+n:(o||=r*.3,!a||a<Math.abs(n)?(a=n,s=o/4):s=o/(2*Math.PI)*Math.asin(n/a),a*2**(-10*e)*Math.sin((e*r-s)*(2*Math.PI)/o)+n+t)},ElasticEaseInOut(e,t,n,r,a,o){let s=0;return e===0?t:(e/=r/2)==2?t+n:(o||=.3*1.5*r,!a||a<Math.abs(n)?(a=n,s=o/4):s=o/(2*Math.PI)*Math.asin(n/a),e<1?-.5*(a*2**(10*--e)*Math.sin((e*r-s)*(2*Math.PI)/o))+t:a*2**(-10*--e)*Math.sin((e*r-s)*(2*Math.PI)/o)*.5+n+t)},BounceEaseOut(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},BounceEaseIn(e,t,n,r){return n-ks.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?ks.BounceEaseIn(e*2,0,n,r)*.5+t:ks.BounceEaseOut(e*2-r,0,n,r)*.5+n*.5+t},EaseIn(e,t,n,r){return n*(e/=r)*e+t},EaseOut(e,t,n,r){return-n*(e/=r)*(e-2)+t},EaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},StrongEaseIn(e,t,n,r){return n*(e/=r)*e*e*e*e+t},StrongEaseOut(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t},StrongEaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},Linear(e,t,n,r){return n*e/r+t}},As=M._assign(j,{Util:M,Transform:Fi,Node:io,Container:oo,Stage:Jo,stages:qo,Layer:gs,FastLayer:_s,Group:vs,DD:xa,Shape:F,shapes:ns,Animation:bs,Tween:Os,Easings:ks,Context:pa,Canvas:va}),js=class extends F{_sceneFunc(e){let t=j.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){let e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=j.getAngle(n?360-this.angle():this.angle()),a=Math.cos(Math.min(r,Math.PI)),o=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),s=Math.sin(Math.min(r,Math.PI/2)),c=a*(a>0?e:t),l=1*t,u=o*(o>0?e:t),d=s*(s>0?t:e);return{x:c,y:n?-1*d:u,width:l-c,height:d-u}}};js.prototype._centroid=!0,js.prototype.className=`Arc`,js.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`,`angle`,`clockwise`],Mi(js),P.addGetterSetter(js,`innerRadius`,0,N()),P.addGetterSetter(js,`outerRadius`,0,N()),P.addGetterSetter(js,`angle`,0,N()),P.addGetterSetter(js,`clockwise`,!1,ka());function Ms(e,t,n,r,a,o,s){let c=Math.sqrt((n-e)**2+(r-t)**2),l=Math.sqrt((a-n)**2+(o-r)**2),u=s*c/(c+l),d=s*l/(c+l);return[n-u*(a-e),r-u*(o-t),n+d*(a-e),r+d*(o-t)]}function Ns(e,t){let n=e.length,r=[];for(let a=2;a<n-2;a+=2){let n=Ms(e[a-2],e[a-1],e[a],e[a+1],e[a+2],e[a+3],t);isNaN(n[0])||(r.push(n[0]),r.push(n[1]),r.push(e[a]),r.push(e[a+1]),r.push(n[2]),r.push(n[3]))}return r}function Ps(e){let t=[[e[0],e[2],e[4],e[6]],[e[1],e[3],e[5],e[7]]],n=[];for(let e of t){let t=-3*e[0]+9*e[1]-9*e[2]+3*e[3];if(t!==0){let r=6*e[0]-12*e[1]+6*e[2],a=-3*e[0]+3*e[1],o=r*r-4*t*a;if(o>=0){let e=Math.sqrt(o);n.push((-r+e)/(2*t)),n.push((-r-e)/(2*t))}}}return n.filter(e=>e>0&&e<1).flatMap(e=>t.map(t=>{let n=1-e;return n*n*n*t[0]+3*n*n*e*t[1]+3*n*e*e*t[2]+e*e*e*t[3]}))}var Fs=class extends F{constructor(e){super(e),this.on(`pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva`,function(){this._clearCache(`tensionPoints`)})}_sceneFunc(e){let t=this.points(),n=t.length,r=this.tension(),a=this.closed(),o=this.bezier();if(!n)return;let s=0;if(e.beginPath(),e.moveTo(t[0],t[1]),r!==0&&n>4){let r=this.getTensionPoints(),o=r.length;for(s=a?0:4,a||e.quadraticCurveTo(r[0],r[1],r[2],r[3]);s<o-2;)e.bezierCurveTo(r[s++],r[s++],r[s++],r[s++],r[s++],r[s++]);a||e.quadraticCurveTo(r[o-2],r[o-1],t[n-2],t[n-1])}else if(o)for(s=2;s<n;)e.bezierCurveTo(t[s++],t[s++],t[s++],t[s++],t[s++],t[s++]);else for(s=2;s<n;s+=2)e.lineTo(t[s],t[s+1]);a?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache(`tensionPoints`,this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():Ns(this.points(),this.tension())}_getTensionPointsClosed(){let e=this.points(),t=e.length,n=this.tension(),r=Ms(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),a=Ms(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),o=Ns(e,n);return[r[2],r[3]].concat(o,[a[0],a[1],e[t-2],e[t-1],a[2],a[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};e=this.tension()===0?this.bezier()?[e[0],e[1],...Ps(this.points()),e[e.length-2],e[e.length-1]]:this.points():[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]];let t=e[0],n=e[0],r=e[1],a=e[1],o,s;for(let c=0;c<e.length/2;c++)o=e[c*2],s=e[c*2+1],t=Math.min(t,o),n=Math.max(n,o),r=Math.min(r,s),a=Math.max(a,s);return{x:t,y:r,width:n-t,height:a-r}}};Fs.prototype.className=`Line`,Fs.prototype._attrsAffectingSize=[`points`,`bezier`,`tension`],Mi(Fs),P.addGetterSetter(Fs,`closed`,!1),P.addGetterSetter(Fs,`bezier`,!1),P.addGetterSetter(Fs,`tension`,0,N()),P.addGetterSetter(Fs,`points`,[],Oa());var Is=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],Ls=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],Rs=[[1],[1,1],[1,2,1],[1,3,3,1]],zs=(e,t,n)=>{let r,a,o=n/2;r=0;for(let n=0;n<20;n++)a=o*Is[20][n]+o,r+=Ls[20][n]*Vs(e,t,a);return o*r},Bs=(e,t,n)=>{n===void 0&&(n=1);let r=e[0]-2*e[1]+e[2],a=t[0]-2*t[1]+t[2],o=2*e[1]-2*e[0],s=2*t[1]-2*t[0],c=4*(r*r+a*a),l=4*(r*o+a*s),u=o*o+s*s;if(c===0)return n*Math.sqrt((e[2]-e[0])**2+(t[2]-t[0])**2);let d=l/(2*c),f=u/c,p=n+d,m=f-d*d,h=p*p+m>0?Math.sqrt(p*p+m):0,g=d*d+m>0?Math.sqrt(d*d+m):0,_=d+Math.sqrt(d*d+m)===0?0:m*Math.log(Math.abs((p+h)/(d+g)));return Math.sqrt(c)/2*(p*h-d*g+_)};function Vs(e,t,n){let r=Hs(1,n,e),a=Hs(1,n,t),o=r*r+a*a;return Math.sqrt(o)}var Hs=(e,t,n)=>{let r=n.length-1,a,o;if(r===0)return 0;if(e===0){o=0;for(let e=0;e<=r;e++)o+=Rs[r][e]*(1-t)**(r-e)*t**+e*n[e];return o}else{a=Array(r);for(let e=0;e<r;e++)a[e]=r*(n[e+1]-n[e]);return Hs(e-1,t,a)}},Us=(e,t,n)=>{let r=1,a=e/t,o=(e-n(a))/t,s=0;for(;r>.001;){let c=n(a+o),l=Math.abs(e-c)/t;if(l<r)r=l,a+=o;else{let s=n(a-o),c=Math.abs(e-s)/t;c<r?(r=c,a-=o):o/=2}if(s++,s>500)break}return a},Ws=class e extends F{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on(`dataChange.konva`,function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=e.parsePathData(this.data()),this.pathLength=e.getPathLength(this.dataArray)}_sceneFunc(e){let t=this.dataArray;e.beginPath();let n=!1;for(let r=0;r<t.length;r++){let a=t[r].command,o=t[r].points;switch(a){case`L`:e.lineTo(o[0],o[1]);break;case`M`:e.moveTo(o[0],o[1]);break;case`C`:e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case`Q`:e.quadraticCurveTo(o[0],o[1],o[2],o[3]);break;case`A`:let t=o[0],r=o[1],a=o[2],s=o[3],c=o[4],l=o[5],u=o[6],d=o[7],f=a>s?a:s,p=a>s?1:a/s,m=a>s?s/a:1;e.translate(t,r),e.rotate(u),e.scale(p,m),e.arc(0,0,f,c,c+l,1-d),e.scale(1/p,1/m),e.rotate(-u),e.translate(-t,-r);break;case`z`:n=!0,e.closePath();break}}!n&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(n){if(n.command===`A`){let r=n.points[4],a=n.points[5],o=n.points[4]+a,s=Math.PI/180;if(Math.abs(r-o)<s&&(s=Math.abs(r-o)),a<0)for(let a=r-s;a>o;a-=s){let r=e.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],a,0);t.push(r.x,r.y)}else for(let a=r+s;a<o;a+=s){let r=e.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],a,0);t.push(r.x,r.y)}}else if(n.command===`C`)for(let r=0;r<=1;r+=.01){let a=e.getPointOnCubicBezier(r,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3],n.points[4],n.points[5]);t.push(a.x,a.y)}else t=t.concat(n.points)});let n=t[0],r=t[0],a=t[1],o=t[1],s,c;for(let e=0;e<t.length/2;e++)s=t[e*2],c=t[e*2+1],isNaN(s)||(n=Math.min(n,s),r=Math.max(r,s)),isNaN(c)||(a=Math.min(a,c),o=Math.max(o,c));return{x:n,y:a,width:r-n,height:o-a}}getLength(){return this.pathLength}getPointAtLength(t){return e.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}static getPathLength(e){let t=0;for(let n=0;n<e.length;++n)t+=e[n].pathLength;return t}static getPointAtLengthOfDataArray(t,n){let r,a=0,o=n.length;if(!o)return null;for(;a<o&&t>n[a].pathLength;)t-=n[a].pathLength,++a;if(a===o)return r=n[a-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return n[a].command===`M`?(r=n[a].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[a].start.x,y:n[a].start.y};let s=n[a],c=s.points;switch(s.command){case`L`:return e.getPointOnLine(t,s.start.x,s.start.y,c[0],c[1]);case`C`:return e.getPointOnCubicBezier(Us(t,e.getPathLength(n),e=>zs([s.start.x,c[0],c[2],c[4]],[s.start.y,c[1],c[3],c[5]],e)),s.start.x,s.start.y,c[0],c[1],c[2],c[3],c[4],c[5]);case`Q`:return e.getPointOnQuadraticBezier(Us(t,e.getPathLength(n),e=>Bs([s.start.x,c[0],c[2]],[s.start.y,c[1],c[3]],e)),s.start.x,s.start.y,c[0],c[1],c[2],c[3]);case`A`:let r=c[0],a=c[1],o=c[2],l=c[3],u=c[5],d=c[6],f=c[4];return f+=u*t/s.pathLength,e.getPointOnEllipticalArc(r,a,o,l,f,d)}return null}static getPointOnLine(e,t,n,r,a,o,s){o??=t,s??=n;let c=this.getLineLength(t,n,r,a);if(c<1e-10)return{x:t,y:n};if(r===t)return{x:o,y:s+(a>n?e:-e)};let l=(a-n)/(r-t),u=Math.sqrt(e*e/(1+l*l))*(r<t?-1:1),d=l*u;if(Math.abs(s-n-l*(o-t))<1e-10)return{x:o+u,y:s+d};let f=((o-t)*(r-t)+(s-n)*(a-n))/(c*c),p=t+f*(r-t),m=n+f*(a-n),h=this.getLineLength(o,s,p,m),g=Math.sqrt(e*e-h*h),_=Math.sqrt(g*g/(1+l*l))*(r<t?-1:1),v=l*_;return{x:p+_,y:m+v}}static getPointOnCubicBezier(e,t,n,r,a,o,s,c,l){function u(e){return e*e*e}function d(e){return 3*e*e*(1-e)}function f(e){return 3*e*(1-e)*(1-e)}function p(e){return(1-e)*(1-e)*(1-e)}return{x:c*u(e)+o*d(e)+r*f(e)+t*p(e),y:l*u(e)+s*d(e)+a*f(e)+n*p(e)}}static getPointOnQuadraticBezier(e,t,n,r,a,o,s){function c(e){return e*e}function l(e){return 2*e*(1-e)}function u(e){return(1-e)*(1-e)}return{x:o*c(e)+r*l(e)+t*u(e),y:s*c(e)+a*l(e)+n*u(e)}}static getPointOnEllipticalArc(e,t,n,r,a,o){let s=Math.cos(o),c=Math.sin(o),l={x:n*Math.cos(a),y:r*Math.sin(a)};return{x:e+(l.x*s-l.y*c),y:t+(l.x*c+l.y*s)}}static parsePathData(e){if(!e)return[];let t=e,n=[`m`,`M`,`l`,`L`,`v`,`V`,`h`,`H`,`z`,`Z`,`c`,`C`,`q`,`Q`,`t`,`T`,`s`,`S`,`a`,`A`];t=t.replace(RegExp(` `,`g`),`,`);for(let e=0;e<n.length;e++)t=t.replace(new RegExp(n[e],`g`),`|`+n[e]);let r=t.split(`|`),a=[],o=[],s=0,c=0,l=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,u;for(let e=1;e<r.length;e++){let t=r[e],n=t.charAt(0);for(t=t.slice(1),o.length=0;u=l.exec(t);)o.push(u[0]);let d=[],f=n===`A`||n===`a`?0:-1;for(let e=0,t=o.length;e<t;e++){let t=o[e];if(t===`00`){d.push(0,0),f>=0&&(f+=2,f>=7&&(f-=7));continue}if(f>=0){if(f===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(t)){d.push(parseInt(t[0],10)),d.push(parseInt(t[1],10)),d.push(parseFloat(t.slice(2))),f+=3,f>=7&&(f-=7);continue}if(t===`11`||t===`10`||t===`01`){d.push(parseInt(t[0],10)),d.push(parseInt(t[1],10)),f+=2,f>=7&&(f-=7);continue}if(t===`0`||t===`1`){d.push(parseInt(t,10)),f+=1,f>=7&&(f-=7);continue}}else if(f===4){if(/^[01]\d+(?:\.\d+)?$/.test(t)){d.push(parseInt(t[0],10)),d.push(parseFloat(t.slice(1))),f+=2,f>=7&&(f-=7);continue}if(t===`0`||t===`1`){d.push(parseInt(t,10)),f+=1,f>=7&&(f-=7);continue}}let e=parseFloat(t);isNaN(e)?d.push(0):d.push(e),f+=1,f>=7&&(f-=7)}else{let e=parseFloat(t);isNaN(e)?d.push(0):d.push(e)}}for(;d.length>0&&!isNaN(d[0]);){let e=``,t=[],r=s,o=c,l,u,f,p,m,h,g,_,v,y;switch(n){case`l`:s+=d.shift(),c+=d.shift(),e=`L`,t.push(s,c);break;case`L`:s=d.shift(),c=d.shift(),t.push(s,c);break;case`m`:let r=d.shift(),o=d.shift();if(s+=r,c+=o,e=`M`,a.length>2&&a[a.length-1].command===`z`){for(let e=a.length-2;e>=0;e--)if(a[e].command===`M`){s=a[e].points[0]+r,c=a[e].points[1]+o;break}}t.push(s,c),n=`l`;break;case`M`:s=d.shift(),c=d.shift(),e=`M`,t.push(s,c),n=`L`;break;case`h`:s+=d.shift(),e=`L`,t.push(s,c);break;case`H`:s=d.shift(),e=`L`,t.push(s,c);break;case`v`:c+=d.shift(),e=`L`,t.push(s,c);break;case`V`:c=d.shift(),e=`L`,t.push(s,c);break;case`C`:t.push(d.shift(),d.shift(),d.shift(),d.shift()),s=d.shift(),c=d.shift(),t.push(s,c);break;case`c`:t.push(s+d.shift(),c+d.shift(),s+d.shift(),c+d.shift()),s+=d.shift(),c+=d.shift(),e=`C`,t.push(s,c);break;case`S`:u=s,f=c,l=a[a.length-1],l.command===`C`&&(u=s+(s-l.points[2]),f=c+(c-l.points[3])),t.push(u,f,d.shift(),d.shift()),s=d.shift(),c=d.shift(),e=`C`,t.push(s,c);break;case`s`:u=s,f=c,l=a[a.length-1],l.command===`C`&&(u=s+(s-l.points[2]),f=c+(c-l.points[3])),t.push(u,f,s+d.shift(),c+d.shift()),s+=d.shift(),c+=d.shift(),e=`C`,t.push(s,c);break;case`Q`:t.push(d.shift(),d.shift()),s=d.shift(),c=d.shift(),t.push(s,c);break;case`q`:t.push(s+d.shift(),c+d.shift()),s+=d.shift(),c+=d.shift(),e=`Q`,t.push(s,c);break;case`T`:u=s,f=c,l=a[a.length-1],l.command===`Q`&&(u=s+(s-l.points[0]),f=c+(c-l.points[1])),s=d.shift(),c=d.shift(),e=`Q`,t.push(u,f,s,c);break;case`t`:u=s,f=c,l=a[a.length-1],l.command===`Q`&&(u=s+(s-l.points[0]),f=c+(c-l.points[1])),s+=d.shift(),c+=d.shift(),e=`Q`,t.push(u,f,s,c);break;case`A`:p=d.shift(),m=d.shift(),h=d.shift(),g=d.shift(),_=d.shift(),v=s,y=c,s=d.shift(),c=d.shift(),e=`A`,t=this.convertEndpointToCenterParameterization(v,y,s,c,g,_,p,m,h);break;case`a`:p=d.shift(),m=d.shift(),h=d.shift(),g=d.shift(),_=d.shift(),v=s,y=c,s+=d.shift(),c+=d.shift(),e=`A`,t=this.convertEndpointToCenterParameterization(v,y,s,c,g,_,p,m,h);break}a.push({command:e||n,points:t,start:{x:r,y:o},pathLength:this.calcLength(r,o,e||n,t)})}(n===`z`||n===`Z`)&&a.push({command:`z`,points:[],start:void 0,pathLength:0})}return a}static calcLength(t,n,r,a){let o,s,c,l,u=e;switch(r){case`L`:return u.getLineLength(t,n,a[0],a[1]);case`C`:return zs([t,a[0],a[2],a[4]],[n,a[1],a[3],a[5]],1);case`Q`:return Bs([t,a[0],a[2]],[n,a[1],a[3]],1);case`A`:o=0;let e=a[4],r=a[5],d=a[4]+r,f=Math.PI/180;if(Math.abs(e-d)<f&&(f=Math.abs(e-d)),s=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],e,0),r<0)for(l=e-f;l>d;l-=f)c=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],l,0),o+=u.getLineLength(s.x,s.y,c.x,c.y),s=c;else for(l=e+f;l<d;l+=f)c=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],l,0),o+=u.getLineLength(s.x,s.y,c.x,c.y),s=c;return c=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],d,0),o+=u.getLineLength(s.x,s.y,c.x,c.y),o}return 0}static convertEndpointToCenterParameterization(e,t,n,r,a,o,s,c,l){let u=Math.PI/180*l,d=Math.cos(u)*(e-n)/2+Math.sin(u)*(t-r)/2,f=-1*Math.sin(u)*(e-n)/2+Math.cos(u)*(t-r)/2,p=d*d/(s*s)+f*f/(c*c);p>1&&(s*=Math.sqrt(p),c*=Math.sqrt(p));let m=Math.sqrt((s*s*(c*c)-s*s*(f*f)-c*c*(d*d))/(s*s*(f*f)+c*c*(d*d)));a===o&&(m*=-1),isNaN(m)&&(m=0);let h=m*s*f/c,g=m*-c*d/s,_=(e+n)/2+Math.cos(u)*h-Math.sin(u)*g,v=(t+r)/2+Math.sin(u)*h+Math.cos(u)*g,y=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},b=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(y(e)*y(t))},x=function(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(b(e,t))},S=x([1,0],[(d-h)/s,(f-g)/c]),C=[(d-h)/s,(f-g)/c],w=[(-1*d-h)/s,(-1*f-g)/c],T=x(C,w);return b(C,w)<=-1&&(T=Math.PI),b(C,w)>=1&&(T=0),o===0&&T>0&&(T-=2*Math.PI),o===1&&T<0&&(T+=2*Math.PI),[_,v,s,c,S,T,u,o]}};Ws.prototype.className=`Path`,Ws.prototype._attrsAffectingSize=[`data`],Mi(Ws),P.addGetterSetter(Ws,`data`);var Gs=class extends Fs{_sceneFunc(e){super._sceneFunc(e);let t=Math.PI*2,n=this.points(),r=n,a=this.tension()!==0&&n.length>4;a&&(r=this.getTensionPoints());let o=this.pointerLength(),s=n.length,c,l;if(a){let e=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[s-2],n[s-1]],t=Ws.calcLength(r[r.length-4],r[r.length-3],`C`,e),a=Ws.getPointOnQuadraticBezier(Math.min(1,1-o/t),e[0],e[1],e[2],e[3],e[4],e[5]);c=n[s-2]-a.x,l=n[s-1]-a.y}else c=n[s-2]-n[s-4],l=n[s-1]-n[s-3];let u=(Math.atan2(l,c)+t)%t,d=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(u),e.moveTo(0,0),e.lineTo(-o,d/2),e.lineTo(-o,-d/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),a?(c=(r[0]+r[2])/2-n[0],l=(r[1]+r[3])/2-n[1]):(c=n[2]-n[0],l=n[3]-n[1]),e.rotate((Math.atan2(-l,-c)+t)%t),e.moveTo(0,0),e.lineTo(-o,d/2),e.lineTo(-o,-d/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){let t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){let e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x,y:e.y-t,width:e.width,height:e.height+t*2}}};Gs.prototype.className=`Arrow`,Mi(Gs),P.addGetterSetter(Gs,`pointerLength`,10,N()),P.addGetterSetter(Gs,`pointerWidth`,10,N()),P.addGetterSetter(Gs,`pointerAtBeginning`,!1),P.addGetterSetter(Gs,`pointerAtEnding`,!0);var Ks=class extends F{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}};Ks.prototype._centroid=!0,Ks.prototype.className=`Circle`,Ks.prototype._attrsAffectingSize=[`radius`],Mi(Ks),P.addGetterSetter(Ks,`radius`,0,N());var qs=class extends F{_sceneFunc(e){let t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}};qs.prototype.className=`Ellipse`,qs.prototype._centroid=!0,qs.prototype._attrsAffectingSize=[`radiusX`,`radiusY`],Mi(qs),P.addComponentsGetterSetter(qs,`radius`,[`x`,`y`]),P.addGetterSetter(qs,`radiusX`,0,N()),P.addGetterSetter(qs,`radiusY`,0,N());var Js=class e extends F{constructor(e){super(e),this._loadListener=()=>{this._requestDraw()},this.on(`imageChange.konva`,e=>{this._removeImageLoad(e.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){let e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener(`load`,this._loadListener)}_removeImageLoad(e){e&&e.removeEventListener&&e.removeEventListener(`load`,this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){let e=!!this.cornerRadius(),t=this.hasShadow();return e&&t?!0:super._useBufferCanvas(!0)}_sceneFunc(e){let t=this.getWidth(),n=this.getHeight(),r=this.cornerRadius(),a=this.attrs.image,o;if(a){let e=this.attrs.cropWidth,r=this.attrs.cropHeight;o=e&&r?[a,this.cropX(),this.cropY(),e,r,0,0,t,n]:[a,0,0,t,n]}(this.hasFill()||this.hasStroke()||r)&&(e.beginPath(),r?M.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),a&&(r&&e.clip(),e.drawImage.apply(e,o))}_hitFunc(e){let t=this.width(),n=this.height(),r=this.cornerRadius();e.beginPath(),r?M.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.attrs.width??this.image()?.width??0}getHeight(){return this.attrs.height??this.image()?.height??0}static fromURL(t,n,r=null){let a=M.createImageElement();a.onload=function(){n(new e({image:a}))},a.onerror=r,a.crossOrigin=`Anonymous`,a.src=t}};Js.prototype.className=`Image`,Js.prototype._attrsAffectingSize=[`image`],Mi(Js),P.addGetterSetter(Js,`cornerRadius`,0,wa(4)),P.addGetterSetter(Js,`image`),P.addComponentsGetterSetter(Js,`crop`,[`x`,`y`,`width`,`height`]),P.addGetterSetter(Js,`cropX`,0,N()),P.addGetterSetter(Js,`cropY`,0,N()),P.addGetterSetter(Js,`cropWidth`,0,N()),P.addGetterSetter(Js,`cropHeight`,0,N());var Ys=[`fontFamily`,`fontSize`,`fontStyle`,`padding`,`lineHeight`,`text`,`width`,`height`,`pointerDirection`,`pointerWidth`,`pointerHeight`],Xs=`Change.konva`,Zs=`none`,Qs=`up`,$s=`right`,ec=`down`,tc=`left`,nc=Ys.length,rc=class extends vs{constructor(e){super(e),this.on(`add.konva`,function(e){this._addListeners(e.child),this._sync()})}getText(){return this.find(`Text`)[0]}getTag(){return this.find(`Tag`)[0]}_addListeners(e){let t=this,n,r=function(){t._sync()};for(n=0;n<nc;n++)e.on(Ys[n]+Xs,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),t=this.getTag(),n,r,a,o,s,c,l;if(e&&t){switch(n=e.width(),r=e.height(),a=t.pointerDirection(),o=t.pointerWidth(),l=t.pointerHeight(),s=0,c=0,a){case Qs:s=n/2,c=-1*l;break;case $s:s=n+o,c=r/2;break;case ec:s=n/2,c=r+l;break;case tc:s=-1*o,c=r/2;break}t.setAttrs({x:-1*s,y:-1*c,width:n,height:r}),e.setAttrs({x:-1*s,y:-1*c})}}};rc.prototype.className=`Label`,Mi(rc);var ic=class extends F{_sceneFunc(e){let t=this.width(),n=this.height(),r=this.pointerDirection(),a=this.pointerWidth(),o=this.pointerHeight(),s=this.cornerRadius(),c=0,l=0,u=0,d=0;typeof s==`number`?c=l=u=d=Math.min(s,t/2,n/2):(c=Math.min(s[0]||0,t/2,n/2),l=Math.min(s[1]||0,t/2,n/2),d=Math.min(s[2]||0,t/2,n/2),u=Math.min(s[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(c,0),r===Qs&&(e.lineTo((t-a)/2,0),e.lineTo(t/2,-1*o),e.lineTo((t+a)/2,0)),e.lineTo(t-l,0),e.arc(t-l,l,l,Math.PI*3/2,0,!1),r===$s&&(e.lineTo(t,(n-o)/2),e.lineTo(t+a,n/2),e.lineTo(t,(n+o)/2)),e.lineTo(t,n-d),e.arc(t-d,n-d,d,0,Math.PI/2,!1),r===ec&&(e.lineTo((t+a)/2,n),e.lineTo(t/2,n+o),e.lineTo((t-a)/2,n)),e.lineTo(u,n),e.arc(u,n-u,u,Math.PI/2,Math.PI,!1),r===tc&&(e.lineTo(0,(n+o)/2),e.lineTo(-1*a,n/2),e.lineTo(0,(n-o)/2)),e.lineTo(0,c),e.arc(c,c,c,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),a=this.pointerDirection(),o=this.width(),s=this.height();return a===Qs?(t-=r,s+=r):a===ec?s+=r:a===tc?(e-=n*1.5,o+=n):a===$s&&(o+=n*1.5),{x:e,y:t,width:o,height:s}}};ic.prototype.className=`Tag`,Mi(ic),P.addGetterSetter(ic,`pointerDirection`,Zs),P.addGetterSetter(ic,`pointerWidth`,0,N()),P.addGetterSetter(ic,`pointerHeight`,0,N()),P.addGetterSetter(ic,`cornerRadius`,0,wa(4));var ac=class extends F{_sceneFunc(e){let t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?M.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};ac.prototype.className=`Rect`,Mi(ac),P.addGetterSetter(ac,`cornerRadius`,0,wa(4));var oc=class extends F{_sceneFunc(e){let t=this._getPoints(),n=this.radius(),r=this.sides(),a=this.cornerRadius();if(e.beginPath(),a)M.drawRoundedPolygonPath(e,t,r,n,a);else{e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y)}e.closePath(),e.fillStrokeShape(this)}_getPoints(){let e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(let r=0;r<e;r++)n.push({x:t*Math.sin(r*2*Math.PI/e),y:-1*t*Math.cos(r*2*Math.PI/e)});return n}getSelfRect(){let e=this._getPoints(),t=e[0].x,n=e[0].x,r=e[0].y,a=e[0].y;return e.forEach(e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),a=Math.max(a,e.y)}),{x:t,y:r,width:n-t,height:a-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};oc.prototype.className=`RegularPolygon`,oc.prototype._centroid=!0,oc.prototype._attrsAffectingSize=[`radius`],Mi(oc),P.addGetterSetter(oc,`radius`,0,N()),P.addGetterSetter(oc,`sides`,0,N()),P.addGetterSetter(oc,`cornerRadius`,0,wa(4));var sc=Math.PI*2,cc=class extends F{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,sc,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),sc,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};cc.prototype.className=`Ring`,cc.prototype._centroid=!0,cc.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`],Mi(cc),P.addGetterSetter(cc,`innerRadius`,0,N()),P.addGetterSetter(cc,`outerRadius`,0,N());var lc=class extends F{constructor(e){super(e),this._updated=!0,this.anim=new bs(()=>{let e=this._updated;return this._updated=!1,e}),this.on(`animationChange.konva`,function(){this.frameIndex(0)}),this.on(`frameIndexChange.konva`,function(){this._updated=!0}),this.on(`frameRateChange.konva`,function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){let t=this.animation(),n=this.frameIndex(),r=n*4,a=this.animations()[t],o=this.frameOffsets(),s=a[r+0],c=a[r+1],l=a[r+2],u=a[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,u),e.closePath(),e.fillStrokeShape(this)),d)if(o){let r=o[t],a=n*2;e.drawImage(d,s,c,l,u,r[a+0],r[a+1],l,u)}else e.drawImage(d,s,c,l,u,0,0,l,u)}_hitFunc(e){let t=this.animation(),n=this.frameIndex(),r=n*4,a=this.animations()[t],o=this.frameOffsets(),s=a[r+2],c=a[r+3];if(e.beginPath(),o){let r=o[t],a=n*2;e.rect(r[a+0],r[a+1],s,c)}else e.rect(0,0,s,c);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){let e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;let e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){let e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}};lc.prototype.className=`Sprite`,Mi(lc),P.addGetterSetter(lc,`animation`),P.addGetterSetter(lc,`animations`),P.addGetterSetter(lc,`frameOffsets`),P.addGetterSetter(lc,`image`),P.addGetterSetter(lc,`frameIndex`,0,N()),P.addGetterSetter(lc,`frameRate`,17,N()),P.backCompat(lc,{index:`frameIndex`,getIndex:`getFrameIndex`,setIndex:`setFrameIndex`});var uc=class extends F{_sceneFunc(e){let t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(let a=1;a<r*2;a++){let o=a%2==0?n:t,s=o*Math.sin(a*Math.PI/r),c=-1*o*Math.cos(a*Math.PI/r);e.lineTo(s,c)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};uc.prototype.className=`Star`,uc.prototype._centroid=!0,uc.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`],Mi(uc),P.addGetterSetter(uc,`numPoints`,5,N()),P.addGetterSetter(uc,`innerRadius`,0,N()),P.addGetterSetter(uc,`outerRadius`,0,N());function dc(e){return[...e].reduce((e,t,n,r)=>{if(/\p{Emoji}/u.test(t)){let a=r[n+1];a&&/\p{Emoji_Modifier}|\u200D/u.test(a)?(e.push(t+a),r[n+1]=``):e.push(t)}else /\p{Regional_Indicator}{2}/u.test(t+(r[n+1]||``))?e.push(t+r[n+1]):n>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(t)?e[e.length-1]+=t:t&&e.push(t);return e},[])}var fc=`auto`,pc=`center`,mc=`inherit`,hc=`justify`,gc=`Change.konva`,_c=`2d`,vc=`-`,yc=`left`,bc=`text`,xc=`Text`,Sc=`top`,Cc=`bottom`,wc=`middle`,Tc=`normal`,Ec=`px `,Dc=` `,Oc=`right`,kc=`rtl`,Ac=`word`,jc=`char`,Mc=`none`,Nc=`…`,Pc=[`direction`,`fontFamily`,`fontSize`,`fontStyle`,`fontVariant`,`padding`,`align`,`verticalAlign`,`lineHeight`,`text`,`width`,`height`,`wrap`,`ellipsis`,`letterSpacing`],Fc=Pc.length,Ic=null;function Lc(){if(Ic!==null)return Ic;Ic=!1;try{let e=document.createElement(`canvas`);e.width=10,e.height=10;let t=e.getContext(_c);if(t){t.globalAlpha=0,t.shadowColor=`black`,t.shadowBlur=5,t.shadowOffsetX=5,t.shadowOffsetY=5,t.fillStyle=`black`,t.font=`10px Arial`,t.fillText(`X`,0,10);let e=t.getImageData(0,0,10,10).data;for(let t=3;t<e.length;t+=4)if(e[t]>0){Ic=!0;break}}}catch{}return Ic}function Rc(e){return e.split(`,`).map(e=>{e=e.trim();let t=e.indexOf(` `)>=0,n=e.indexOf(`"`)>=0||e.indexOf(`'`)>=0;return t&&!n&&(e=`"${e}"`),e}).join(`, `)}var zc;function Bc(){return zc||(zc=M.createCanvasElement().getContext(_c),zc)}function Vc(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Hc(e){e.setAttr(`miterLimit`,2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function Uc(e){return e||={},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||`black`),e}var Wc=class extends F{constructor(e){super(Uc(e)),this._partialTextX=0,this._partialTextY=0;for(let e=0;e<Fc;e++)this.on(Pc[e]+gc,this._setTextData);this._setTextData()}_sceneFunc(e){let t=this.textArr,n=t.length;if(!this.text())return;let r=this.padding(),a=this.fontSize(),o=this.lineHeight()*a,s=this.verticalAlign(),c=this.direction(),l=0,u=this.align(),d=this.getWidth(),f=this.letterSpacing(),p=this.charRenderFunc(),m=this.fill(),h=this.textDecoration(),g=this.underlineOffset(),_=h.indexOf(`underline`)!==-1,v=h.indexOf(`line-through`)!==-1,y;c=c===mc?e.direction:c;let b=o/2,x=wc;if(!j.legacyTextRendering){let e=this.measureSize(`M`);x=`alphabetic`,b=((e.fontBoundingBoxAscent??e.actualBoundingBoxAscent)-(e.fontBoundingBoxDescent??e.actualBoundingBoxDescent))/2+o/2}for(c===kc&&e.setAttr(`direction`,c),e.setAttr(`font`,this._getContextFont()),e.setAttr(`textBaseline`,x),e.setAttr(`textAlign`,yc),s===wc?l=(this.getHeight()-n*o-r*2)/2:s===Cc&&(l=this.getHeight()-n*o-r*2),e.translate(r,l+r),y=0;y<n;y++){let s=0,l=t[y],h=l.text,x=l.width,S=l.lastInParagraph;if(e.save(),u===Oc?s+=d-x-r*2:u===pc&&(s+=(d-x-r*2)/2),_){e.save(),e.beginPath();let t=g??(j.legacyTextRendering?Math.round(a/2):Math.round(a/4)),n=s,o=b+0+t;e.moveTo(n,o);let c=u===hc&&!S?d-r*2:x;e.lineTo(n+Math.round(c),o),e.lineWidth=a/15,e.strokeStyle=this._getLinearGradient()||m,e.stroke(),e.restore()}let C=s;if(c!==kc&&(f!==0||u===hc||p)){let n=h.split(` `).length-1,a=dc(h);for(let o=0;o<a.length;o++){let c=a[o];if(c===` `&&!S&&u===hc&&(s+=(d-r*2-x)/n),this._partialTextX=s,this._partialTextY=b+0,this._partialText=c,p){e.save();let n=t.slice(0,y).reduce((e,t)=>e+dc(t.text).length,0);p({char:c,index:o+n,x:s,y:b+0,lineIndex:y,column:o,isLastInLine:S,width:this.measureSize(c).width,context:e})}e.fillStrokeShape(this),p&&e.restore(),s+=this.measureSize(c).width+f}}else f!==0&&e.setAttr(`letterSpacing`,`${f}px`),this._partialTextX=s,this._partialTextY=b+0,this._partialText=h,e.fillStrokeShape(this);if(v){e.save(),e.beginPath();let t=j.legacyTextRendering?0:-Math.round(a/4),n=C;e.moveTo(n,b+0+t);let o=u===hc&&!S?d-r*2:x;e.lineTo(n+Math.round(o),b+0+t),e.lineWidth=a/15,e.strokeStyle=this._getLinearGradient()||m,e.stroke(),e.restore()}e.restore(),n>1&&(b+=o)}}_hitFunc(e){let t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){let t=M._isString(e)?e:e==null?``:e+``;return this._setAttr(bc,t),this}getWidth(){return this.attrs.width===fc||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===fc||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return M.warn(`text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.`),this.textHeight}measureSize(e){let t=Bc(),n=this.fontSize(),r;t.save(),t.font=this._getContextFont(),r=t.measureText(e),t.restore();let a=n/100;return{actualBoundingBoxAscent:r.actualBoundingBoxAscent??71.58203125*a,actualBoundingBoxDescent:r.actualBoundingBoxDescent??0,actualBoundingBoxLeft:r.actualBoundingBoxLeft??-7.421875*a,actualBoundingBoxRight:r.actualBoundingBoxRight??75.732421875*a,alphabeticBaseline:r.alphabeticBaseline??0,emHeightAscent:r.emHeightAscent??100*a,emHeightDescent:r.emHeightDescent??-20*a,fontBoundingBoxAscent:r.fontBoundingBoxAscent??91*a,fontBoundingBoxDescent:r.fontBoundingBoxDescent??21*a,hangingBaseline:r.hangingBaseline??72.80000305175781*a,ideographicBaseline:r.ideographicBaseline??-21*a,width:r.width,height:n}}_getContextFont(){return this.fontStyle()+Dc+this.fontVariant()+Dc+(this.fontSize()+Ec)+Rc(this.fontFamily())}_addTextLine(e){this.align()===hc&&(e=e.trim());let t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){let t=this.letterSpacing(),n=e.length;return Bc().measureText(e).width+t*n}_setTextData(){let e=this.text().split(`
23
- `),t=+this.fontSize(),n=0,r=this.lineHeight()*t,a=this.attrs.width,o=this.attrs.height,s=a!==fc&&a!==void 0,c=o!==fc&&o!==void 0,l=this.padding(),u=a-l*2,d=o-l*2,f=0,p=this.wrap(),m=p!==jc&&p!==Mc,h=this.ellipsis();this.textArr=[],Bc().font=this._getContextFont();let g=h?this._getTextWidth(Nc):0;for(let t=0,a=e.length;t<a;++t){let o=e[t],l=this._getTextWidth(o);if(s&&l>u)for(;o.length>0;){let e=0,t=dc(o).length,a=``,s=0;for(;e<t;){let n=e+t>>>1,l=dc(o).slice(0,n+1).join(``),p=this._getTextWidth(l);(h&&c&&f+r>d?p+g:p)<=u?(e=n+1,a=l,s=p):t=n}if(a){if(m){let t=dc(o),n=dc(a),r=t[n.length],c=r===Dc||r===vc,l;if(c&&s<=u)l=n.length;else{let e=n.lastIndexOf(Dc),t=n.lastIndexOf(vc);l=Math.max(e,t)+1}l>0&&(e=l,a=t.slice(0,e).join(``),s=this._getTextWidth(a))}if(a=a.trimRight(),this._addTextLine(a),n=Math.max(n,s),f+=r,this._shouldHandleEllipsis(f)){this._tryToAddEllipsisToLastLine();break}if(o=dc(o).slice(e).join(``).trimLeft(),o.length>0&&(l=this._getTextWidth(o),l<=u)){this._addTextLine(o),f+=r,n=Math.max(n,l);break}}else break}else this._addTextLine(o),f+=r,n=Math.max(n,l),this._shouldHandleEllipsis(f)&&t<a-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),c&&f+r>d)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){let t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,a=r!==fc&&r!==void 0,o=r-this.padding()*2;return this.wrap()===Mc||a&&e+n>o}_tryToAddEllipsisToLastLine(){let e=this.attrs.width,t=e!==fc&&e!==void 0,n=e-this.padding()*2,r=this.ellipsis(),a=this.textArr[this.textArr.length-1];!a||!r||(t&&(this._getTextWidth(a.text+Nc)<n||(a.text=a.text.slice(0,a.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(a.text+Nc))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){let e=this.textDecoration().indexOf(`underline`)!==-1||this.textDecoration().indexOf(`line-through`)!==-1,t=this.hasShadow();return e&&t||t&&this.getAbsoluteOpacity()!==1&&Lc()?!0:super._useBufferCanvas()}};Wc.prototype._fillFunc=Vc,Wc.prototype._strokeFunc=Hc,Wc.prototype.className=xc,Wc.prototype._attrsAffectingSize=[`text`,`fontSize`,`padding`,`wrap`,`lineHeight`,`letterSpacing`],Mi(Wc),P.overWriteSetter(Wc,`width`,Ta()),P.overWriteSetter(Wc,`height`,Ta()),P.addGetterSetter(Wc,`direction`,mc),P.addGetterSetter(Wc,`fontFamily`,`Arial`),P.addGetterSetter(Wc,`fontSize`,12,N()),P.addGetterSetter(Wc,`fontStyle`,Tc),P.addGetterSetter(Wc,`fontVariant`,Tc),P.addGetterSetter(Wc,`padding`,0,N()),P.addGetterSetter(Wc,`align`,yc),P.addGetterSetter(Wc,`verticalAlign`,Sc),P.addGetterSetter(Wc,`lineHeight`,1,N()),P.addGetterSetter(Wc,`wrap`,Ac),P.addGetterSetter(Wc,`ellipsis`,!1,ka()),P.addGetterSetter(Wc,`letterSpacing`,0,N()),P.addGetterSetter(Wc,`text`,``,Ea()),P.addGetterSetter(Wc,`textDecoration`,``),P.addGetterSetter(Wc,`underlineOffset`,void 0,N()),P.addGetterSetter(Wc,`charRenderFunc`,void 0);var Gc=``,Kc=`normal`;function qc(e){e.fillText(this.partialText,0,0)}function Jc(e){e.strokeText(this.partialText,0,0)}var Yc=class extends F{constructor(e){super(e),this.dummyCanvas=M.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on(`dataChange.konva`,function(){this._readDataAttribute(),this._setTextData()}),this.on(`textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva directionChange.konva`,this._setTextData),this._setTextData()}_getTextPathLength(){return Ws.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:Ws.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Ws.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr(`font`,this._getContextFont()),e.setAttr(`textBaseline`,this.textBaseline()),e.setAttr(`textAlign`,`left`),e.save();let t=this.textDecoration(),n=this.fill(),r=this.fontSize(),a=this.glyphInfo,o=t.indexOf(`underline`)!==-1,s=t.indexOf(`line-through`)!==-1;o&&e.beginPath();for(let t=0;t<a.length;t++){e.save();let n=a[t].p0;e.translate(n.x,n.y),e.rotate(a[t].rotation),this.partialText=a[t].text,e.fillStrokeShape(this),o&&(t===0&&e.moveTo(0,r/2+1),e.lineTo(a[t].width,r/2+1)),e.restore()}if(o&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),s){e.beginPath();for(let t=0;t<a.length;t++){e.save();let n=a[t].p0;e.translate(n.x,n.y),e.rotate(a[t].rotation),t===0&&e.moveTo(0,0),e.lineTo(a[t].width,0),e.restore()}e.strokeStyle=n,e.lineWidth=r/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();let t=this.glyphInfo;if(t.length>=1){let n=t[0].p0;e.moveTo(n.x,n.y)}for(let n=0;n<t.length;n++){let r=t[n].p1;e.lineTo(r.x,r.y)}e.setAttr(`lineWidth`,this.fontSize()),e.setAttr(`strokeStyle`,this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return M.warn(`text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.`),this.textHeight}setText(e){return Wc.prototype.setText.call(this,e)}_getContextFont(){return Wc.prototype._getContextFont.call(this)}_getTextSize(e){let t=this.dummyCanvas.getContext(`2d`);t.save(),t.font=this._getContextFont();let n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){let e=dc(this.text());this.direction()===`rtl`&&e.reverse();let t=[],n=0;for(let r=0;r<e.length;r++)t.push({char:e[r],width:this._getTextSize(e[r]).width}),n+=t[r].width;let{width:r,height:a}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=a,this.glyphInfo=[],!this.attrs.data)return null;let o=this.letterSpacing(),s=this.align(),c=this.kerningFunc(),l=Math.max(0,n-r),u=Math.max(this.textWidth+((this.attrs.text||``).length-1)*o,0),d=0;s===`center`&&(d=Math.max(0,this.pathLength/2-u/2)),s===`right`&&(d=Math.max(0,this.pathLength-u));let f=d;for(let n=0;n<t.length;n++){let r=this._getPointAtLength(f);if(!r)return;let a=t[n].char,d=t[n].width+o;if(a===` `&&s===`justify`){let e=this.text().split(` `).length-1;d+=(this.pathLength-u)/e}let p=f+d,m=this._getPointAtLength(p>this.pathLength&&p-this.pathLength<=l?this.pathLength:p);if(!m)return;let h=Ws.getLineLength(r.x,r.y,m.x,m.y),g=0;if(c)try{g=c(t[n-1].char,a)*this.fontSize()}catch{g=0}r.x+=g,m.x+=g,this.textWidth+=g;let _=Ws.getPointOnLine(g+h/2,r.x,r.y,m.x,m.y),v=Math.atan2(m.y-r.y,m.x-r.x);this.glyphInfo.push({transposeX:_.x,transposeY:_.y,text:e[n],rotation:v,p0:r,p1:m,width:h}),f+=d}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};let e=[];this.glyphInfo.forEach(function(t){e.push(t.p0.x),e.push(t.p0.y),e.push(t.p1.x),e.push(t.p1.y)});let t=e[0]||0,n=e[0]||0,r=e[1]||0,a=e[1]||0,o,s;for(let c=0;c<e.length/2;c++)o=e[c*2],s=e[c*2+1],t=Math.min(t,o),n=Math.max(n,o),r=Math.min(r,s),a=Math.max(a,s);let c=this.fontSize();return{x:t-c/2,y:r-c/2,width:n-t+c,height:a-r+c}}destroy(){return M.releaseCanvas(this.dummyCanvas),super.destroy()}};Yc.prototype._fillFunc=qc,Yc.prototype._strokeFunc=Jc,Yc.prototype._fillFuncHit=qc,Yc.prototype._strokeFuncHit=Jc,Yc.prototype.className=`TextPath`,Yc.prototype._attrsAffectingSize=[`text`,`fontSize`,`data`],Mi(Yc),P.addGetterSetter(Yc,`data`),P.addGetterSetter(Yc,`fontFamily`,`Arial`),P.addGetterSetter(Yc,`fontSize`,12,N()),P.addGetterSetter(Yc,`fontStyle`,Kc),P.addGetterSetter(Yc,`align`,`left`),P.addGetterSetter(Yc,`letterSpacing`,0,N()),P.addGetterSetter(Yc,`textBaseline`,`middle`),P.addGetterSetter(Yc,`fontVariant`,Kc),P.addGetterSetter(Yc,`text`,Gc),P.addGetterSetter(Yc,`textDecoration`,``),P.addGetterSetter(Yc,`kerningFunc`,void 0),P.addGetterSetter(Yc,`direction`,`inherit`);var Xc=`tr-konva`,Zc=[`resizeEnabledChange`,`rotateAnchorOffsetChange`,`rotateAnchorAngleChange`,`rotateEnabledChange`,`enabledAnchorsChange`,`anchorSizeChange`,`borderEnabledChange`,`borderStrokeChange`,`borderStrokeWidthChange`,`borderDashChange`,`anchorStrokeChange`,`anchorStrokeWidthChange`,`anchorFillChange`,`anchorCornerRadiusChange`,`ignoreStrokeChange`,`anchorStyleFuncChange`].map(e=>e+`.${Xc}`).join(` `),Qc=`nodesRect`,$c=[`widthChange`,`heightChange`,`scaleXChange`,`scaleYChange`,`skewXChange`,`skewYChange`,`rotationChange`,`offsetXChange`,`offsetYChange`,`transformsEnabledChange`,`strokeWidthChange`,`draggableChange`],el={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},tl=`ontouchstart`in j._global;function nl(e,t,n){if(e===`rotater`)return n;t+=M.degToRad(el[e]||0);let r=(M.radToDeg(t)%360+360)%360;return M._inRange(r,337.5,360)||M._inRange(r,0,22.5)?`ns-resize`:M._inRange(r,22.5,67.5)?`nesw-resize`:M._inRange(r,67.5,112.5)?`ew-resize`:M._inRange(r,112.5,157.5)?`nwse-resize`:M._inRange(r,157.5,202.5)?`ns-resize`:M._inRange(r,202.5,247.5)?`nesw-resize`:M._inRange(r,247.5,292.5)?`ew-resize`:M._inRange(r,292.5,337.5)?`nwse-resize`:(M.error(`Transformer has unknown angle for cursor detection: `+r),`pointer`)}var rl=[`top-left`,`top-center`,`top-right`,`middle-right`,`middle-left`,`bottom-left`,`bottom-center`,`bottom-right`];function il(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function al(e,t,n){let r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),a=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return{...e,rotation:e.rotation+t,x:r,y:a}}function ol(e,t){return al(e,t,il(e))}function sl(e,t,n){let r=t;for(let a=0;a<e.length;a++){let o=j.getAngle(e[a]),s=Math.abs(o-t)%(Math.PI*2);Math.min(s,Math.PI*2-s)<n&&(r=o)}return r}var cl=0,ll=class extends vs{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._elementsCreated=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Zc,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return M.warn(`tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead.`),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return Xc+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();let t=e.filter(e=>e.isAncestorOf(this)?(M.error(`Konva.Transformer cannot be an a child of the node you are trying to attach`),!1):!0);return this._nodes=e=t,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(e=>{let t=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(e._attrsAffectingSize.length){let n=e._attrsAffectingSize.map(e=>e+`Change.`+this._getEventNamespace()).join(` `);e.on(n,t)}e.on($c.map(e=>e+`.${this._getEventNamespace()}`).join(` `),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),this._proxyDrag(e)}),this._resetTransformCache(),this.findOne(`.top-left`)&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,n=>{t=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(`.back`)&&this.startDrag(n,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!t)return;let r=e.getAbsolutePosition(),a=r.x-t.x,o=r.y-t.y;this.nodes().forEach(t=>{if(t===e||t.isDragging())return;let r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+a,y:r.y+o}),t.startDrag(n)}),t=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off(`.`+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Qc),this._clearCache(`transform`),this._clearSelfAndDescendantCache(`absoluteTransform`)}_getNodeRect(){return this._getCache(Qc,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){let r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(n),o=e.getAbsolutePosition(n),s=r.x*a.x-e.offsetX()*a.x,c=r.y*a.y-e.offsetY()*a.y,l=(j.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return al({x:o.x+s*Math.cos(l)+c*Math.sin(-l),y:o.y+c*Math.cos(l)+s*Math.sin(l),width:r.width*a.x,height:r.height*a.y,rotation:l},-j.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};let e=[];this.nodes().map(t=>{let n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),r=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}],a=t.getAbsoluteTransform();r.forEach(function(t){let n=a.point(t);e.push(n)})});let t=new Fi;t.rotate(-j.getAngle(this.rotation()));let n=1/0,r=1/0,a=-1/0,o=-1/0;e.forEach(function(e){let s=t.point(e);n===void 0&&(n=a=s.x,r=o=s.y),n=Math.min(n,s.x),r=Math.min(r,s.y),a=Math.max(a,s.x),o=Math.max(o,s.y)}),t.invert();let s=t.point({x:n,y:r});return{x:s.x,y:s.y,width:a-n,height:o-r,rotation:j.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),rl.forEach(e=>{this._createAnchor(e)}),this._createAnchor(`rotater`),this._elementsCreated=!0}_createAnchor(e){let t=new ac({stroke:`rgb(0, 161, 255)`,fill:`white`,strokeWidth:1,name:e+` _anchor`,dragDistance:0,draggable:!0,hitStrokeWidth:tl?10:`auto`}),n=this;t.on(`mousedown touchstart`,function(e){n._handleMouseDown(e)}),t.on(`dragstart`,e=>{t.stopDrag(),e.cancelBubble=!0}),t.on(`dragend`,e=>{e.cancelBubble=!0}),t.on(`mouseenter`,()=>{let n=nl(e,j.getAngle(this.rotation()),this.rotateAnchorCursor());t.getStage().content&&(t.getStage().content.style.cursor=n),this._cursorChange=!0}),t.on(`mouseout`,()=>{t.getStage().content&&(t.getStage().content.style.cursor=``),this._cursorChange=!1}),this.add(t)}_createBack(){let e=new F({name:`back`,width:0,height:0,sceneFunc(e,t){let n=t.getParent(),r=n.padding(),a=t.width(),o=t.height();if(e.beginPath(),e.rect(-r,-r,a+r*2,o+r*2),n.rotateEnabled()&&n.rotateLineVisible()){let t=n.rotateAnchorAngle(),r=n.rotateAnchorOffset(),s=M.degToRad(t),c=Math.sin(s),l=-Math.cos(s),u=a/2,d=o/2,f=1/0;l<0?f=Math.min(f,-d/l):l>0&&(f=Math.min(f,(o-d)/l)),c<0?f=Math.min(f,-u/c):c>0&&(f=Math.min(f,(a-u)/c));let p=u+c*f,m=d+l*f,h=M._sign(o),g=p+c*r*h,_=m+l*r*h;e.moveTo(p,m),e.lineTo(g,_)}e.fillStrokeShape(t)},hitFunc:(e,t)=>{if(!this.shouldOverdrawWholeArea())return;let n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+n*2,t.height()+n*2),e.fillStrokeShape(t)}});this.add(e),this._proxyDrag(e),e.on(`dragstart`,e=>{e.cancelBubble=!0}),e.on(`dragmove`,e=>{e.cancelBubble=!0}),e.on(`dragend`,e=>{e.cancelBubble=!0}),this.on(`dragmove`,e=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(` `)[0];let t=this._getNodeRect(),n=t.width,r=t.height,a=Math.sqrt(n**2+r**2);this.sin=Math.abs(r/a),this.cos=Math.abs(n/a),typeof window<`u`&&(window.addEventListener(`mousemove`,this._handleMouseMove),window.addEventListener(`touchmove`,this._handleMouseMove),window.addEventListener(`mouseup`,this._handleMouseUp,!0),window.addEventListener(`touchend`,this._handleMouseUp,!0)),this._transforming=!0;let o=e.target.getAbsolutePosition(),s=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-o.x,y:s.y-o.y},cl++,this._fire(`transformstart`,{evt:e.evt,target:this.getNode()}),this._nodes.forEach(t=>{t._fire(`transformstart`,{evt:e.evt,target:t})})}_handleMouseMove(e){let t,n,r,a=this.findOne(`.`+this._movingAnchorName),o=a.getStage();o.setPointersPositions(e);let s=o.getPointerPosition(),c={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y},l=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(c=this.anchorDragBoundFunc()(l,c,e)),a.setAbsolutePosition(c);let u=a.getAbsolutePosition();if(l.x===u.x&&l.y===u.y)return;if(this._movingAnchorName===`rotater`){let r=this._getNodeRect();t=a.x()-r.width/2,n=-a.y()+r.height/2;let o=j.getAngle(this.rotateAnchorAngle()),s=Math.atan2(-n,t)+Math.PI/2-o;r.height<0&&(s-=Math.PI);let c=j.getAngle(this.rotation())+s,l=j.getAngle(this.rotationSnapTolerance()),u=ol(r,sl(this.rotationSnaps(),c,l)-r.rotation);this._fitNodesInto(u,e);return}let d=this.shiftBehavior(),f;f=d===`inverted`?this.keepRatio()&&!e.shiftKey:d===`none`?this.keepRatio():this.keepRatio()||e.shiftKey;let p=this.centeredScaling()||e.altKey;if(this._movingAnchorName===`top-left`){if(f){let e=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.bottom-right`).x(),y:this.findOne(`.bottom-right`).y()};r=Math.sqrt((e.x-a.x())**2+(e.y-a.y())**2);let o=this.findOne(`.top-left`).x()>e.x?-1:1,s=this.findOne(`.top-left`).y()>e.y?-1:1;t=r*this.cos*o,n=r*this.sin*s,this.findOne(`.top-left`).x(e.x-t),this.findOne(`.top-left`).y(e.y-n)}}else if(this._movingAnchorName===`top-center`)this.findOne(`.top-left`).y(a.y());else if(this._movingAnchorName===`top-right`){if(f){let e=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.bottom-left`).x(),y:this.findOne(`.bottom-left`).y()};r=Math.sqrt((a.x()-e.x)**2+(e.y-a.y())**2);let o=this.findOne(`.top-right`).x()<e.x?-1:1,s=this.findOne(`.top-right`).y()>e.y?-1:1;t=r*this.cos*o,n=r*this.sin*s,this.findOne(`.top-right`).x(e.x+t),this.findOne(`.top-right`).y(e.y-n)}var m=a.position();this.findOne(`.top-left`).y(m.y),this.findOne(`.bottom-right`).x(m.x)}else if(this._movingAnchorName===`middle-left`)this.findOne(`.top-left`).x(a.x());else if(this._movingAnchorName===`middle-right`)this.findOne(`.bottom-right`).x(a.x());else if(this._movingAnchorName===`bottom-left`){if(f){let e=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.top-right`).x(),y:this.findOne(`.top-right`).y()};r=Math.sqrt((e.x-a.x())**2+(a.y()-e.y)**2);let o=e.x<a.x()?-1:1,s=a.y()<e.y?-1:1;t=r*this.cos*o,n=r*this.sin*s,a.x(e.x-t),a.y(e.y+n)}m=a.position(),this.findOne(`.top-left`).x(m.x),this.findOne(`.bottom-right`).y(m.y)}else if(this._movingAnchorName===`bottom-center`)this.findOne(`.bottom-right`).y(a.y());else if(this._movingAnchorName===`bottom-right`){if(f){let e=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.top-left`).x(),y:this.findOne(`.top-left`).y()};r=Math.sqrt((a.x()-e.x)**2+(a.y()-e.y)**2);let o=this.findOne(`.bottom-right`).x()<e.x?-1:1,s=this.findOne(`.bottom-right`).y()<e.y?-1:1;t=r*this.cos*o,n=r*this.sin*s,this.findOne(`.bottom-right`).x(e.x+t),this.findOne(`.bottom-right`).y(e.y+n)}}else console.error(Error(`Wrong position argument of selection resizer: `+this._movingAnchorName));if(p=this.centeredScaling()||e.altKey,p){let e=this.findOne(`.top-left`),t=this.findOne(`.bottom-right`),n=e.x(),r=e.y(),a=this.getWidth()-t.x(),o=this.getHeight()-t.y();t.move({x:-n,y:-r}),e.move({x:a,y:o})}let h=this.findOne(`.top-left`).getAbsolutePosition();t=h.x,n=h.y;let g=this.findOne(`.bottom-right`).x()-this.findOne(`.top-left`).x(),_=this.findOne(`.bottom-right`).y()-this.findOne(`.top-left`).y();this._fitNodesInto({x:t,y:n,width:g,height:_,rotation:j.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var t;if(this._transforming){this._transforming=!1,typeof window<`u`&&(window.removeEventListener(`mousemove`,this._handleMouseMove),window.removeEventListener(`touchmove`,this._handleMouseMove),window.removeEventListener(`mouseup`,this._handleMouseUp,!0),window.removeEventListener(`touchend`,this._handleMouseUp,!0));let n=this.getNode();cl--,this._fire(`transformend`,{evt:e,target:n}),(t=this.getLayer())==null||t.batchDraw(),n&&this._nodes.forEach(t=>{var n;t._fire(`transformend`,{evt:e,target:t}),(n=t.getLayer())==null||n.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,t){let n=this._getNodeRect();if(M._inRange(e.width,-this.padding()*2-1,1)){this.update();return}if(M._inRange(e.height,-this.padding()*2-1,1)){this.update();return}let r=new Fi;if(r.rotate(j.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf(`left`)>=0){let t=r.point({x:-this.padding()*2,y:0});e.x+=t.x,e.y+=t.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace(`left`,`right`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf(`right`)>=0){let t=r.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace(`right`,`left`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf(`top`)>=0){let t=r.point({x:0,y:-this.padding()*2});e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace(`top`,`bottom`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf(`bottom`)>=0){let t=r.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace(`bottom`,`top`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){let t=this.boundBoxFunc()(n,e);t?e=t:M.warn(`boundBoxFunc returned falsy. You should return new bound rect from it!`)}let a=1e7,o=new Fi;o.translate(n.x,n.y),o.rotate(n.rotation),o.scale(n.width/a,n.height/a);let s=new Fi,c=e.width/a,l=e.height/a;this.flipEnabled()===!1?(s.translate(e.x,e.y),s.rotate(e.rotation),s.translate(e.width<0?e.width:0,e.height<0?e.height:0),s.scale(Math.abs(c),Math.abs(l))):(s.translate(e.x,e.y),s.rotate(e.rotation),s.scale(c,l));let u=s.multiply(o.invert());this._nodes.forEach(e=>{var t;if(!e.getStage())return;let n=e.getParent().getAbsoluteTransform(),r=e.getTransform().copy();r.translate(e.offsetX(),e.offsetY());let a=new Fi;a.multiply(n.copy().invert()).multiply(u).multiply(n).multiply(r);let o=a.decompose();e.setAttrs(o),(t=e.getLayer())==null||t.batchDraw()}),this.rotation(M._getRotation(e.rotation)),this._nodes.forEach(e=>{this._fire(`transform`,{evt:t,target:e}),e._fire(`transform`,{evt:t,target:e})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e;let t=this._getNodeRect();this.rotation(M._getRotation(t.rotation));let n=t.width,r=t.height,a=this.enabledAnchors(),o=this.resizeEnabled(),s=this.padding(),c=this.anchorSize(),l=this.find(`._anchor`);l.forEach(e=>{e.setAttrs({width:c,height:c,offsetX:c/2,offsetY:c/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(`.top-left`,{x:0,y:0,offsetX:c/2+s,offsetY:c/2+s,visible:o&&a.indexOf(`top-left`)>=0}),this._batchChangeChild(`.top-center`,{x:n/2,y:0,offsetY:c/2+s,visible:o&&a.indexOf(`top-center`)>=0}),this._batchChangeChild(`.top-right`,{x:n,y:0,offsetX:c/2-s,offsetY:c/2+s,visible:o&&a.indexOf(`top-right`)>=0}),this._batchChangeChild(`.middle-left`,{x:0,y:r/2,offsetX:c/2+s,visible:o&&a.indexOf(`middle-left`)>=0}),this._batchChangeChild(`.middle-right`,{x:n,y:r/2,offsetX:c/2-s,visible:o&&a.indexOf(`middle-right`)>=0}),this._batchChangeChild(`.bottom-left`,{x:0,y:r,offsetX:c/2+s,offsetY:c/2-s,visible:o&&a.indexOf(`bottom-left`)>=0}),this._batchChangeChild(`.bottom-center`,{x:n/2,y:r,offsetY:c/2-s,visible:o&&a.indexOf(`bottom-center`)>=0}),this._batchChangeChild(`.bottom-right`,{x:n,y:r,offsetX:c/2-s,offsetY:c/2-s,visible:o&&a.indexOf(`bottom-right`)>=0});let u=this.rotateAnchorAngle(),d=this.rotateAnchorOffset(),f=M.degToRad(u),p=Math.sin(f),m=-Math.cos(f),h=n/2,g=r/2,_=1/0;m<0?_=Math.min(_,-g/m):m>0&&(_=Math.min(_,(r-g)/m)),p<0?_=Math.min(_,-h/p):p>0&&(_=Math.min(_,(n-h)/p));let v=h+p*_,y=g+m*_,b=M._sign(r);this._batchChangeChild(`.rotater`,{x:v+p*d*b,y:y+m*d*b-s*m,visible:this.rotateEnabled()}),this._batchChangeChild(`.back`,{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(e=>e.draggable()),x:0,y:0});let x=this.anchorStyleFunc();x&&l.forEach(e=>{x(e)}),(e=this.getLayer())==null||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();let e=this.findOne(`.`+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=``),vs.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(M.error(`You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead.`),this):super.add(...e)}toObject(){return io.prototype.toObject.call(this)}clone(e){return io.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};ll.isTransforming=()=>cl>0;function ul(e){return e instanceof Array||M.warn(`enabledAnchors value should be an array`),e instanceof Array&&e.forEach(function(e){rl.indexOf(e)===-1&&M.warn(`Unknown anchor name: `+e+`. Available names are: `+rl.join(`, `))}),e||[]}ll.prototype.className=`Transformer`,Mi(ll),P.addGetterSetter(ll,`enabledAnchors`,rl,ul),P.addGetterSetter(ll,`flipEnabled`,!0,ka()),P.addGetterSetter(ll,`resizeEnabled`,!0),P.addGetterSetter(ll,`anchorSize`,10,N()),P.addGetterSetter(ll,`rotateEnabled`,!0),P.addGetterSetter(ll,`rotateLineVisible`,!0),P.addGetterSetter(ll,`rotationSnaps`,[]),P.addGetterSetter(ll,`rotateAnchorOffset`,50,N()),P.addGetterSetter(ll,`rotateAnchorAngle`,0,N()),P.addGetterSetter(ll,`rotateAnchorCursor`,`crosshair`),P.addGetterSetter(ll,`rotationSnapTolerance`,5,N()),P.addGetterSetter(ll,`borderEnabled`,!0),P.addGetterSetter(ll,`anchorStroke`,`rgb(0, 161, 255)`),P.addGetterSetter(ll,`anchorStrokeWidth`,1,N()),P.addGetterSetter(ll,`anchorFill`,`white`),P.addGetterSetter(ll,`anchorCornerRadius`,0,N()),P.addGetterSetter(ll,`borderStroke`,`rgb(0, 161, 255)`),P.addGetterSetter(ll,`borderStrokeWidth`,1,N()),P.addGetterSetter(ll,`borderDash`),P.addGetterSetter(ll,`keepRatio`,!0),P.addGetterSetter(ll,`shiftBehavior`,`default`),P.addGetterSetter(ll,`centeredScaling`,!1),P.addGetterSetter(ll,`ignoreStroke`,!1),P.addGetterSetter(ll,`padding`,0,N()),P.addGetterSetter(ll,`nodes`),P.addGetterSetter(ll,`node`),P.addGetterSetter(ll,`boundBoxFunc`),P.addGetterSetter(ll,`anchorDragBoundFunc`),P.addGetterSetter(ll,`anchorStyleFunc`),P.addGetterSetter(ll,`shouldOverdrawWholeArea`,!1),P.addGetterSetter(ll,`useSingleNodeRotation`,!0),P.backCompat(ll,{lineEnabled:`borderEnabled`,rotateHandlerOffset:`rotateAnchorOffset`,enabledHandlers:`enabledAnchors`});var dl=class extends F{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,j.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};dl.prototype.className=`Wedge`,dl.prototype._centroid=!0,dl.prototype._attrsAffectingSize=[`radius`],Mi(dl),P.addGetterSetter(dl,`radius`,0,N()),P.addGetterSetter(dl,`angle`,0,N()),P.addGetterSetter(dl,`clockwise`,!1),P.backCompat(dl,{angleDeg:`angle`,getAngleDeg:`getAngle`,setAngleDeg:`setAngle`});function fl(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var pl=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],ml=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function hl(e,t){let n=e.data,r=e.width,a=e.height,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=t+t+1,D=r-1,O=a-1,ee=t+1,te=ee*(ee+1)/2,ne=new fl,re=pl[t],ie=ml[t],ae=null,k=ne,oe=null,A=null;for(let e=1;e<E;e++)k=k.next=new fl,e===ee&&(ae=k);k.next=ne,c=s=0;for(let e=0;e<a;e++){_=v=y=b=l=u=d=f=0,p=ee*(x=n[s]),m=ee*(S=n[s+1]),h=ee*(C=n[s+2]),g=ee*(w=n[s+3]),l+=te*x,u+=te*S,d+=te*C,f+=te*w,k=ne;for(let e=0;e<ee;e++)k.r=x,k.g=S,k.b=C,k.a=w,k=k.next;for(let e=1;e<ee;e++)o=s+((D<e?D:e)<<2),l+=(k.r=x=n[o])*(T=ee-e),u+=(k.g=S=n[o+1])*T,d+=(k.b=C=n[o+2])*T,f+=(k.a=w=n[o+3])*T,_+=x,v+=S,y+=C,b+=w,k=k.next;oe=ne,A=ae;for(let e=0;e<r;e++)n[s+3]=w=f*re>>ie,w===0?n[s]=n[s+1]=n[s+2]=0:(w=255/w,n[s]=(l*re>>ie)*w,n[s+1]=(u*re>>ie)*w,n[s+2]=(d*re>>ie)*w),l-=p,u-=m,d-=h,f-=g,p-=oe.r,m-=oe.g,h-=oe.b,g-=oe.a,o=c+((o=e+t+1)<D?o:D)<<2,_+=oe.r=n[o],v+=oe.g=n[o+1],y+=oe.b=n[o+2],b+=oe.a=n[o+3],l+=_,u+=v,d+=y,f+=b,oe=oe.next,p+=x=A.r,m+=S=A.g,h+=C=A.b,g+=w=A.a,_-=x,v-=S,y-=C,b-=w,A=A.next,s+=4;c+=r}for(let e=0;e<r;e++){v=y=b=_=u=d=f=l=0,s=e<<2,p=ee*(x=n[s]),m=ee*(S=n[s+1]),h=ee*(C=n[s+2]),g=ee*(w=n[s+3]),l+=te*x,u+=te*S,d+=te*C,f+=te*w,k=ne;for(let e=0;e<ee;e++)k.r=x,k.g=S,k.b=C,k.a=w,k=k.next;let c=r;for(let a=1;a<=t;a++)s=c+e<<2,l+=(k.r=x=n[s])*(T=ee-a),u+=(k.g=S=n[s+1])*T,d+=(k.b=C=n[s+2])*T,f+=(k.a=w=n[s+3])*T,_+=x,v+=S,y+=C,b+=w,k=k.next,a<O&&(c+=r);s=e,oe=ne,A=ae;for(let t=0;t<a;t++)o=s<<2,n[o+3]=w=f*re>>ie,w>0?(w=255/w,n[o]=(l*re>>ie)*w,n[o+1]=(u*re>>ie)*w,n[o+2]=(d*re>>ie)*w):n[o]=n[o+1]=n[o+2]=0,l-=p,u-=m,d-=h,f-=g,p-=oe.r,m-=oe.g,h-=oe.b,g-=oe.a,o=e+((o=t+ee)<O?o:O)*r<<2,l+=_+=oe.r=n[o],u+=v+=oe.g=n[o+1],d+=y+=oe.b=n[o+2],f+=b+=oe.a=n[o+3],oe=oe.next,p+=x=A.r,m+=S=A.g,h+=C=A.b,g+=w=A.a,_-=x,v-=S,y-=C,b-=w,A=A.next,s+=r}}var gl=function(e){let t=Math.round(this.blurRadius());t>0&&hl(e,t)};P.addGetterSetter(io,`blurRadius`,0,N(),P.afterSetFilter);var _l=function(e){let t=this.brightness()*255,n=e.data,r=n.length;for(let e=0;e<r;e+=4)n[e]+=t,n[e+1]+=t,n[e+2]+=t};P.addGetterSetter(io,`brightness`,0,N(),P.afterSetFilter);var vl=function(e){let t=this.brightness(),n=e.data,r=n.length;for(let e=0;e<r;e+=4)n[e]=Math.min(255,n[e]*t),n[e+1]=Math.min(255,n[e+1]*t),n[e+2]=Math.min(255,n[e+2]*t)},yl=function(e){let t=((this.contrast()+100)/100)**2,n=e.data,r=n.length,a=150,o=150,s=150;for(let e=0;e<r;e+=4)a=n[e],o=n[e+1],s=n[e+2],a/=255,a-=.5,a*=t,a+=.5,a*=255,o/=255,o-=.5,o*=t,o+=.5,o*=255,s/=255,s-=.5,s*=t,s+=.5,s*=255,a=a<0?0:a>255?255:a,o=o<0?0:o>255?255:o,s=s<0?0:s>255?255:s,n[e]=a,n[e+1]=o,n[e+2]=s};P.addGetterSetter(io,`contrast`,0,N(),P.afterSetFilter);var bl=function(e){let t=e.data,n=e.width,r=e.height,a=Math.min(1,Math.max(0,this.embossStrength?.call(this)??.5)),o=Math.min(1,Math.max(0,this.embossWhiteLevel?.call(this)??.5)),s={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[this.embossDirection?.call(this)??`top-left`]??315,c=!!(this.embossBlend?.call(this)??!1),l=a*10,u=o*255,d=s*Math.PI/180,f=Math.cos(d),p=Math.sin(d),m=128/1020*l,h=new Uint8ClampedArray(t),g=new Float32Array(n*r);for(let e=0,n=0;n<t.length;n+=4,e++)g[e]=.2126*h[n]+.7152*h[n+1]+.0722*h[n+2];let _=[-1,0,1,-2,0,2,-1,0,1],v=[-1,-2,-1,0,0,0,1,2,1],y=[-n-1,-n,-n+1,-1,0,1,n-1,n,n+1],b=e=>e<0?0:e>255?255:e;for(let e=1;e<r-1;e++)for(let r=1;r<n-1;r++){let a=e*n+r,o=0,s=0;o+=g[a+y[0]]*_[0],s+=g[a+y[0]]*v[0],o+=g[a+y[1]]*_[1],s+=g[a+y[1]]*v[1],o+=g[a+y[2]]*_[2],s+=g[a+y[2]]*v[2],o+=g[a+y[3]]*_[3],s+=g[a+y[3]]*v[3],o+=g[a+y[5]]*_[5],s+=g[a+y[5]]*v[5],o+=g[a+y[6]]*_[6],s+=g[a+y[6]]*v[6],o+=g[a+y[7]]*_[7],s+=g[a+y[7]]*v[7],o+=g[a+y[8]]*_[8],s+=g[a+y[8]]*v[8];let l=b(u+(f*o+p*s)*m),d=a*4;if(c){let e=l-u;t[d]=b(h[d]+e),t[d+1]=b(h[d+1]+e),t[d+2]=b(h[d+2]+e),t[d+3]=h[d+3]}else t[d]=t[d+1]=t[d+2]=l,t[d+3]=h[d+3]}for(let e=0;e<n;e++){let a=e*4,o=((r-1)*n+e)*4;t[a]=h[a],t[a+1]=h[a+1],t[a+2]=h[a+2],t[a+3]=h[a+3],t[o]=h[o],t[o+1]=h[o+1],t[o+2]=h[o+2],t[o+3]=h[o+3]}for(let e=1;e<r-1;e++){let r=e*n*4,a=(e*n+(n-1))*4;t[r]=h[r],t[r+1]=h[r+1],t[r+2]=h[r+2],t[r+3]=h[r+3],t[a]=h[a],t[a+1]=h[a+1],t[a+2]=h[a+2],t[a+3]=h[a+3]}return e};P.addGetterSetter(io,`embossStrength`,.5,N(),P.afterSetFilter),P.addGetterSetter(io,`embossWhiteLevel`,.5,N(),P.afterSetFilter),P.addGetterSetter(io,`embossDirection`,`top-left`,void 0,P.afterSetFilter),P.addGetterSetter(io,`embossBlend`,!1,void 0,P.afterSetFilter);function xl(e,t,n,r,a){let o=n-t,s=a-r;if(o===0)return r+s/2;if(s===0)return r;let c=(e-t)/o;return c=s*c+r,c}var Sl=function(e){let t=e.data,n=t.length,r=t[0],a=r,o,s=t[1],c=s,l,u=t[2],d=u,f,p=this.enhance();if(p===0)return;for(let e=0;e<n;e+=4)o=t[e+0],o<r?r=o:o>a&&(a=o),l=t[e+1],l<s?s=l:l>c&&(c=l),f=t[e+2],f<u?u=f:f>d&&(d=f);a===r&&(a=255,r=0),c===s&&(c=255,s=0),d===u&&(d=255,u=0);let m,h,g,_,v,y;if(p>0)m=a+p*(255-a),h=r-p*(r-0),g=c+p*(255-c),_=s-p*(s-0),v=d+p*(255-d),y=u-p*(u-0);else{let e=(a+r)*.5;m=a+p*(a-e),h=r+p*(r-e);let t=(c+s)*.5;g=c+p*(c-t),_=s+p*(s-t);let n=(d+u)*.5;v=d+p*(d-n),y=u+p*(u-n)}for(let e=0;e<n;e+=4)t[e+0]=xl(t[e+0],r,a,h,m),t[e+1]=xl(t[e+1],s,c,_,g),t[e+2]=xl(t[e+2],u,d,y,v)};P.addGetterSetter(io,`enhance`,0,N(),P.afterSetFilter);var Cl=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=.34*t[e]+.5*t[e+1]+.16*t[e+2];t[e]=n,t[e+1]=n,t[e+2]=n}};P.addGetterSetter(io,`hue`,0,N(),P.afterSetFilter),P.addGetterSetter(io,`saturation`,0,N(),P.afterSetFilter),P.addGetterSetter(io,`luminance`,0,N(),P.afterSetFilter);var wl=function(e){let t=e.data,n=t.length,r=2**this.saturation(),a=Math.abs(this.hue()+360)%360,o=this.luminance()*127,s=1*r*Math.cos(a*Math.PI/180),c=1*r*Math.sin(a*Math.PI/180),l=.299*1+.701*s+.167*c,u=.587*1-.587*s+.33*c,d=.114*1-.114*s-.497*c,f=.299*1-.299*s-.328*c,p=.587*1+.413*s+.035*c,m=.114*1-.114*s+.293*c,h=.299*1-.3*s+1.25*c,g=.587*1-.586*s-1.05*c,_=.114*1+.886*s-.2*c,v,y,b,x;for(let e=0;e<n;e+=4)v=t[e+0],y=t[e+1],b=t[e+2],x=t[e+3],t[e+0]=l*v+u*y+d*b+o,t[e+1]=f*v+p*y+m*b+o,t[e+2]=h*v+g*y+_*b+o,t[e+3]=x},Tl=function(e){let t=e.data,n=t.length,r=2**this.value(),a=2**this.saturation(),o=Math.abs(this.hue()+360)%360,s=r*a*Math.cos(o*Math.PI/180),c=r*a*Math.sin(o*Math.PI/180),l=.299*r+.701*s+.167*c,u=.587*r-.587*s+.33*c,d=.114*r-.114*s-.497*c,f=.299*r-.299*s-.328*c,p=.587*r+.413*s+.035*c,m=.114*r-.114*s+.293*c,h=.299*r-.3*s+1.25*c,g=.587*r-.586*s-1.05*c,_=.114*r+.886*s-.2*c;for(let e=0;e<n;e+=4){let n=t[e+0],r=t[e+1],a=t[e+2],o=t[e+3];t[e+0]=l*n+u*r+d*a,t[e+1]=f*n+p*r+m*a,t[e+2]=h*n+g*r+_*a,t[e+3]=o}};P.addGetterSetter(io,`hue`,0,N(),P.afterSetFilter),P.addGetterSetter(io,`saturation`,0,N(),P.afterSetFilter),P.addGetterSetter(io,`value`,0,N(),P.afterSetFilter);var El=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4)t[e]=255-t[e],t[e+1]=255-t[e+1],t[e+2]=255-t[e+2]},Dl=function(e,t,n){let r=e.data,a=t.data,o=e.width,s=e.height,c=n.polarCenterX||o/2,l=n.polarCenterY||s/2,u=Math.sqrt(c*c+l*l),d=o-c,f=s-l,p=Math.sqrt(d*d+f*f);u=p>u?p:u;let m=s,h=o,g=360/h*Math.PI/180;for(let e=0;e<h;e+=1){let t=Math.sin(e*g),n=Math.cos(e*g);for(let s=0;s<m;s+=1){d=Math.floor(c+u*s/m*n),f=Math.floor(l+u*s/m*t);let p=(f*o+d)*4,h=r[p+0],g=r[p+1],_=r[p+2],v=r[p+3];p=(e+s*o)*4,a[p+0]=h,a[p+1]=g,a[p+2]=_,a[p+3]=v}}},Ol=function(e,t,n){let r=e.data,a=t.data,o=e.width,s=e.height,c=n.polarCenterX||o/2,l=n.polarCenterY||s/2,u=Math.sqrt(c*c+l*l),d=o-c,f=s-l,p=Math.sqrt(d*d+f*f);u=p>u?p:u;let m=s,h=o,g=n.polarRotation||0,_,v;for(d=0;d<o;d+=1)for(f=0;f<s;f+=1){let e=d-c,t=f-l,n=Math.sqrt(e*e+t*t)*m/u,s=(Math.atan2(t,e)*180/Math.PI+360+g)%360;s=s*h/360,_=Math.floor(s),v=Math.floor(n);let p=(v*o+_)*4,y=r[p+0],b=r[p+1],x=r[p+2],S=r[p+3];p=(f*o+d)*4,a[p+0]=y,a[p+1]=b,a[p+2]=x,a[p+3]=S}},kl=function(e){let t=e.width,n=e.height,r,a,o,s,c,l,u,d,f,p,m=Math.round(this.kaleidoscopePower()),h=Math.round(this.kaleidoscopeAngle()),g=Math.floor(h%360*t/360);if(m<1)return;let _=M.createCanvasElement();_.width=t,_.height=n;let v=_.getContext(`2d`).getImageData(0,0,t,n);M.releaseCanvas(_),Dl(e,v,{polarCenterX:t/2,polarCenterY:n/2});let y=t/2**m;for(;y<=8;)y*=2,--m;y=Math.ceil(y);let b=y,x=0,S=b,C=1;for(g+y>t&&(x=b,S=0,C=-1),a=0;a<n;a+=1)for(r=x;r!==S;r+=C)o=Math.round(r+g)%t,f=(t*a+o)*4,c=v.data[f+0],l=v.data[f+1],u=v.data[f+2],d=v.data[f+3],p=(t*a+r)*4,v.data[p+0]=c,v.data[p+1]=l,v.data[p+2]=u,v.data[p+3]=d;for(a=0;a<n;a+=1)for(b=Math.floor(y),s=0;s<m;s+=1){for(r=0;r<b+1;r+=1)f=(t*a+r)*4,c=v.data[f+0],l=v.data[f+1],u=v.data[f+2],d=v.data[f+3],p=(t*a+b*2-r-1)*4,v.data[p+0]=c,v.data[p+1]=l,v.data[p+2]=u,v.data[p+3]=d;b*=2}Ol(v,e,{polarRotation:0})};P.addGetterSetter(io,`kaleidoscopePower`,2,N(),P.afterSetFilter),P.addGetterSetter(io,`kaleidoscopeAngle`,0,N(),P.afterSetFilter);function Al(e,t,n){let r=(n*e.width+t)*4,a=[];return a.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),a}function jl(e,t){return Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2)}function Ml(e){let t=[0,0,0];for(let n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}function Nl(e,t){let n=Al(e,0,0),r=Al(e,e.width-1,0),a=Al(e,0,e.height-1),o=Al(e,e.width-1,e.height-1),s=t||10;if(jl(n,r)<s&&jl(r,o)<s&&jl(o,a)<s&&jl(a,n)<s){let t=Ml([r,n,o,a]),c=[];for(let n=0;n<e.width*e.height;n++)c[n]=jl(t,[e.data[n*4],e.data[n*4+1],e.data[n*4+2]])<s?0:255;return c}}function Pl(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function Fl(e,t,n){let r=[1,1,1,1,0,1,1,1,1],a=Math.round(Math.sqrt(r.length)),o=Math.floor(a/2),s=[];for(let c=0;c<n;c++)for(let l=0;l<t;l++){let u=c*t+l,d=0;for(let s=0;s<a;s++)for(let u=0;u<a;u++){let f=c+s-o,p=l+u-o;if(f>=0&&f<n&&p>=0&&p<t){let n=f*t+p,o=r[s*a+u];d+=e[n]*o}}s[u]=d===2040?255:0}return s}function Il(e,t,n){let r=[1,1,1,1,1,1,1,1,1],a=Math.round(Math.sqrt(r.length)),o=Math.floor(a/2),s=[];for(let c=0;c<n;c++)for(let l=0;l<t;l++){let u=c*t+l,d=0;for(let s=0;s<a;s++)for(let u=0;u<a;u++){let f=c+s-o,p=l+u-o;if(f>=0&&f<n&&p>=0&&p<t){let n=f*t+p,o=r[s*a+u];d+=e[n]*o}}s[u]=d>=1020?255:0}return s}function Ll(e,t,n){let r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],a=Math.round(Math.sqrt(r.length)),o=Math.floor(a/2),s=[];for(let c=0;c<n;c++)for(let l=0;l<t;l++){let u=c*t+l,d=0;for(let s=0;s<a;s++)for(let u=0;u<a;u++){let f=c+s-o,p=l+u-o;if(f>=0&&f<n&&p>=0&&p<t){let n=f*t+p,o=r[s*a+u];d+=e[n]*o}}s[u]=d}return s}P.addGetterSetter(io,`threshold`,0,N(),P.afterSetFilter),P.addGetterSetter(io,`noise`,.2,N(),P.afterSetFilter),P.addGetterSetter(io,`pixelSize`,8,N(),P.afterSetFilter),P.addGetterSetter(io,`levels`,.5,N(),P.afterSetFilter),P.addGetterSetter(io,`red`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),P.addGetterSetter(io,`green`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),P.addGetterSetter(io,`blue`,0,Ca,P.afterSetFilter),P.addGetterSetter(io,`red`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),P.addGetterSetter(io,`green`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),P.addGetterSetter(io,`blue`,0,Ca,P.afterSetFilter),P.addGetterSetter(io,`alpha`,1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e}),P.addGetterSetter(io,`threshold`,.5,N(),P.afterSetFilter),As.Util._assign(As,{Arc:js,Arrow:Gs,Circle:Ks,Ellipse:qs,Image:Js,Label:rc,Tag:ic,Line:Fs,Path:Ws,Rect:ac,RegularPolygon:oc,Ring:cc,Sprite:lc,Star:uc,Text:Wc,TextPath:Yc,Transformer:ll,Wedge:dl,Filters:{Blur:gl,Brightness:vl,Brighten:_l,Contrast:yl,Emboss:bl,Enhance:Sl,Grayscale:Cl,HSL:wl,HSV:Tl,Invert:El,Kaleidoscope:kl,Mask:function(e){let t=Nl(e,this.threshold());return t&&(t=Fl(t,e.width,e.height),t=Il(t,e.width,e.height),t=Ll(t,e.width,e.height),Pl(e,t)),e},Noise:function(e){let t=this.noise()*255,n=e.data,r=n.length,a=t/2;for(let e=0;e<r;e+=4)n[e+0]+=a-2*a*Math.random(),n[e+1]+=a-2*a*Math.random(),n[e+2]+=a-2*a*Math.random()},Pixelate:function(e){let t=Math.ceil(this.pixelSize()),n=e.width,r=e.height,a=Math.ceil(n/t),o=Math.ceil(r/t),s=e.data;if(t<=0){M.error(`pixelSize value can not be <= 0`);return}for(let e=0;e<a;e+=1)for(let a=0;a<o;a+=1){let o=0,c=0,l=0,u=0,d=e*t,f=d+t,p=a*t,m=p+t,h=0;for(let e=d;e<f;e+=1)if(!(e>=n))for(let t=p;t<m;t+=1){if(t>=r)continue;let a=(n*t+e)*4;o+=s[a+0],c+=s[a+1],l+=s[a+2],u+=s[a+3],h+=1}o/=h,c/=h,l/=h,u/=h;for(let e=d;e<f;e+=1)if(!(e>=n))for(let t=p;t<m;t+=1){if(t>=r)continue;let a=(n*t+e)*4;s[a+0]=o,s[a+1]=c,s[a+2]=l,s[a+3]=u}}},Posterize:function(e){let t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,a=255/t;for(let e=0;e<r;e+=1)n[e]=Math.floor(n[e]/a)*a},RGB:function(e){let t=e.data,n=t.length,r=this.red(),a=this.green(),o=this.blue();for(let e=0;e<n;e+=4){let n=(.34*t[e]+.5*t[e+1]+.16*t[e+2])/255;t[e]=n*r,t[e+1]=n*a,t[e+2]=n*o,t[e+3]=t[e+3]}},RGBA:function(e){let t=e.data,n=t.length,r=this.red(),a=this.green(),o=this.blue(),s=this.alpha();for(let e=0;e<n;e+=4){let n=1-s;t[e]=r*s+t[e]*n,t[e+1]=a*s+t[e+1]*n,t[e+2]=o*s+t[e+2]*n}},Sepia:function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=t[e+0],r=t[e+1],a=t[e+2];t[e+0]=Math.min(255,n*.393+r*.769+a*.189),t[e+1]=Math.min(255,n*.349+r*.686+a*.168),t[e+2]=Math.min(255,n*.272+r*.534+a*.131)}},Solarize:function(e){let t=e.data;for(let e=0;e<t.length;e+=4){let n=t[e],r=t[e+1],a=t[e+2];.2126*n+.7152*r+.0722*a>=128&&(t[e]=255-n,t[e+1]=255-r,t[e+2]=255-a)}return e},Threshold:function(e){let t=this.threshold()*255,n=e.data,r=n.length;for(let e=0;e<r;e+=1)n[e]=n[e]<t?0:255}}});var Rl=As,zl=s(((e,t)=>{t.exports=function(e){function t(e,t,n,r){return new N(e,t,n,r)}function n(){}function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function o(e){if(a(e)!==e)throw Error(r(188))}function s(e){var t=e.alternate;if(!t){if(t=a(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,s=t;;){var c=n.return;if(c===null)break;var l=c.alternate;if(l===null){if(s=c.return,s!==null){n=s;continue}break}if(c.child===l.child){for(l=c.child;l;){if(l===n)return o(c),e;if(l===s)return o(c),t;l=l.sibling}throw Error(r(188))}if(n.return!==s.return)n=c,s=l;else{for(var u=!1,d=c.child;d;){if(d===n){u=!0,n=c,s=l;break}if(d===s){u=!0,s=c,n=l;break}d=d.sibling}if(!u){for(d=l.child;d;){if(d===n){u=!0,n=l,s=c;break}if(d===s){u=!0,s=l,n=c;break}d=d.sibling}if(!u)throw Error(r(189))}}if(n.alternate!==s)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function c(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=c(e),t!==null)return t;e=e.sibling}return null}function l(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(e.tag!==4&&(t=l(e),t!==null))return t;e=e.sibling}return null}function u(e){return typeof e!=`object`||!e?null:(e=ro&&e[ro]||e[`@@iterator`],typeof e==`function`?e:null)}function d(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===io?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case Ga:return`Fragment`;case qa:return`Profiler`;case Ka:return`StrictMode`;case Za:return`Suspense`;case Qa:return`SuspenseList`;case to:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case Wa:return`Portal`;case Ya:return e.displayName||`Context`;case Ja:return(e._context.displayName||`Context`)+`.Consumer`;case Xa:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case $a:return t=e.displayName||null,t===null?d(e.type)||`Memo`:t;case eo:t=e._payload,e=e._init;try{return d(e(t))}catch{}}return null}function p(e){return{current:e}}function h(e){0>Tc||(e.current=wc[Tc],wc[Tc]=null,Tc--)}function g(e,t){Tc++,wc[Tc]=e.current,e.current=t}function _(e){return e>>>=0,e===0?32:31-(Oc(e)/kc|0)|0}function v(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function y(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var a=0,o=e.suspendedLanes,s=e.pingedLanes;e=e.warmLanes;var c=r&134217727;return c===0?(c=r&~o,c===0?s===0?n||(n=r&~e,n!==0&&(a=v(n))):a=v(s):a=v(c)):(r=c&~o,r===0?(s&=c,s===0?n||(n=c&~e,n!==0&&(a=v(n))):a=v(s)):a=v(r)),a===0?0:t!==0&&t!==a&&(t&o)===0&&(o=a&-a,n=t&-t,o>=n||o===32&&n&4194048)?t:a}function b(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function x(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function S(){var e=Mc;return Mc<<=1,!(Mc&62914560)&&(Mc=4194304),e}function C(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function w(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function T(e,t,n,r,a,o){var s=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var c=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(n=s&~n;0<n;){var d=31-Dc(n),f=1<<d;c[d]=0,l[d]=-1;var p=u[d];if(p!==null)for(u[d]=null,d=0;d<p.length;d++){var m=p[d];m!==null&&(m.lane&=-536870913)}n&=~f}r!==0&&E(e,r,0),o!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=o&~(s&~t))}function E(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Dc(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function D(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Dc(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}function O(e,t){var n=t&-t;return n=n&42?1:ee(n),(n&(e.suspendedLanes|t))===0?n:0}function ee(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function te(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ne(e){if(typeof Hc==`function`&&Uc(e),Gc&&typeof Gc.setStrictMode==`function`)try{Gc.setStrictMode(Wc,e)}catch{}}function re(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}function ie(e){if(Yc===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Yc=t&&t[1]||``,Xc=-1<e.stack.indexOf(`
24
- at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
25
- `+Yc+e+Xc}function ae(e,t){if(!e||Zc)return``;Zc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var a=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);a&&a.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var o=r.DetermineComponentFrameRoot(),s=o[0],c=o[1];if(s&&c){var l=s.split(`
26
- `),u=c.split(`
27
- `);for(a=r=0;r<l.length&&!l[r].includes(`DetermineComponentFrameRoot`);)r++;for(;a<u.length&&!u[a].includes(`DetermineComponentFrameRoot`);)a++;if(r===l.length||a===u.length)for(r=l.length-1,a=u.length-1;1<=r&&0<=a&&l[r]!==u[a];)a--;for(;1<=r&&0<=a;r--,a--)if(l[r]!==u[a]){if(r!==1||a!==1)do if(r--,a--,0>a||l[r]!==u[a]){var d=`
28
- `+l[r].replace(` at new `,` at `);return e.displayName&&d.includes(`<anonymous>`)&&(d=d.replace(`<anonymous>`,e.displayName)),d}while(1<=r&&0<=a);break}}}finally{Zc=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ie(n):``}function k(e,t){switch(e.tag){case 26:case 27:case 5:return ie(e.type);case 16:return ie(`Lazy`);case 13:return e.child!==t&&t!==null?ie(`Suspense Fallback`):ie(`Suspense`);case 19:return ie(`SuspenseList`);case 0:case 15:return ae(e.type,!1);case 11:return ae(e.type.render,!1);case 1:return ae(e.type,!0);case 31:return ie(`Activity`);default:return``}}function oe(e){try{var t=``,n=null;do t+=k(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
29
- Error generating stack: `+e.message+`
30
- `+e.stack}}function A(e,t){if(typeof e==`object`&&e){var n=Qc.get(e);return n===void 0?(t={value:e,source:t,stack:oe(t)},Qc.set(e,t),t):n}return{value:e,source:t,stack:oe(t)}}function se(e,t){$c[el++]=nl,$c[el++]=tl,tl=e,nl=t}function ce(e,t,n){rl[il++]=ol,rl[il++]=sl,rl[il++]=al,al=e;var r=ol;e=sl;var a=32-Dc(r)-1;r&=~(1<<a),n+=1;var o=32-Dc(t)+a;if(30<o){var s=a-a%5;o=(r&(1<<s)-1).toString(32),r>>=s,a-=s,ol=1<<32-Dc(t)+a|n<<a|r,sl=o+e}else ol=1<<o|n<<a|r,sl=e}function le(e){e.return!==null&&(se(e,1),ce(e,1,0))}function ue(e){for(;e===tl;)tl=$c[--el],$c[el]=null,nl=$c[--el],$c[el]=null;for(;e===al;)al=rl[--il],rl[il]=null,sl=rl[--il],rl[il]=null,ol=rl[--il],rl[il]=null}function de(e,t){rl[il++]=ol,rl[il++]=sl,rl[il++]=al,ol=t.id,sl=t.overflow,al=e}function fe(e,t){g(ul,t),g(ll,e),g(cl,null),e=fo(t),h(cl),g(cl,e)}function pe(){h(cl),h(ll),h(ul)}function me(e){e.memoizedState!==null&&g(dl,e);var t=cl.current,n=po(t,e.type);t!==n&&(g(ll,e),g(cl,n))}function he(e){ll.current===e&&(h(cl),h(ll)),dl.current===e&&(h(dl),wo?Uo._currentValue=Ho:Uo._currentValue2=Ho)}function ge(e){throw Se(A(Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),_l}function _e(e,t){if(!Do)throw Error(r(175));zs(e.stateNode,e.type,e.memoizedProps,t,e)||ge(e,!0)}function ve(e){for(fl=e.return;fl;)switch(fl.tag){case 5:case 31:case 13:gl=!1;return;case 27:case 3:gl=!0;return;default:fl=fl.return}}function ye(e){if(!Do||e!==fl)return!1;if(!ml)return ve(e),ml=!0,!1;var t=e.tag;if(vc?t!==3&&t!==27&&(t!==5||tc(e.type)&&!yo(e.type,e.memoizedProps))&&pl&&ge(e):t!==3&&(t!==5||tc(e.type)&&!yo(e.type,e.memoizedProps))&&pl&&ge(e),ve(e),t===13){if(!Do)throw Error(r(316));if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));pl=Ws(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));pl=Us(e)}else pl=vc&&t===27?ks(e.type,pl):fl?Os(e.stateNode):null;return!0}function be(){Do&&(pl=fl=null,ml=!1)}function xe(){var e=hl;return e!==null&&(td===null?td=e:td.push.apply(td,e),hl=null),e}function Se(e){hl===null?hl=[e]:hl.push(e)}function Ce(e,t,n){wo?(g(vl,t._currentValue),t._currentValue=n):(g(vl,t._currentValue2),t._currentValue2=n)}function we(e){var t=vl.current;wo?e._currentValue=t:e._currentValue2=t,h(vl)}function Te(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ee(e,t,n,a){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var s=o.dependencies;if(s!==null){var c=o.child;s=s.firstContext;a:for(;s!==null;){var l=s;s=o;for(var u=0;u<t.length;u++)if(l.context===t[u]){s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Te(s.return,n,e),a||(c=null);break a}s=l.next}}else if(o.tag===18){if(c=o.return,c===null)throw Error(r(341));c.lanes|=n,s=c.alternate,s!==null&&(s.lanes|=n),Te(c,n,e),c=null}else c=o.child;if(c!==null)c.return=o;else for(c=o;c!==null;){if(c===e){c=null;break}if(o=c.sibling,o!==null){o.return=c.return,c=o;break}c=c.return}o=c}}function De(e,t,n,a){e=null;for(var o=t,s=!1;o!==null;){if(!s){if(o.flags&524288)s=!0;else if(o.flags&262144)break}if(o.tag===10){var c=o.alternate;if(c===null)throw Error(r(387));if(c=c.memoizedProps,c!==null){var l=o.type;Kc(o.pendingProps.value,c.value)||(e===null?e=[l]:e.push(l))}}else if(o===dl.current){if(c=o.alternate,c===null)throw Error(r(387));c.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e===null?e=[Uo]:e.push(Uo))}o=o.return}e!==null&&Ee(t,e,n,a),t.flags|=262144}function Oe(e){for(e=e.firstContext;e!==null;){var t=e.context;if(!Kc(wo?t._currentValue:t._currentValue2,e.memoizedValue))return!0;e=e.next}return!1}function ke(e){yl=e,bl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ae(e){return Me(yl,e)}function je(e,t){return yl===null&&ke(e),Me(e,t)}function Me(e,t){var n=wo?t._currentValue:t._currentValue2;if(t={context:t,memoizedValue:n,next:null},bl===null){if(e===null)throw Error(r(308));bl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else bl=bl.next=t;return n}function Ne(){return{controller:new xl,data:new Map,refCount:0}}function Pe(e){e.refCount--,e.refCount===0&&Sl(Cl,function(){e.controller.abort()})}function Fe(){}function Ie(e){e!==El&&e.next===null&&(El===null?Tl=El=e:El=El.next=e),Ol=!0,Dl||(Dl=!0,Ue())}function Le(e,t){if(!kl&&Ol){kl=!0;do for(var n=!1,r=Tl;r!==null;){if(!t)if(e!==0){var a=r.pendingLanes;if(a===0)var o=0;else{var s=r.suspendedLanes,c=r.pingedLanes;o=(1<<31-Dc(42|e)+1)-1,o&=a&~(s&~c),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,He(r,o))}else o=Vu,o=y(r,r===zu?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==Co),!(o&3)||b(r,o)||(n=!0,He(r,o));r=r.next}while(n);kl=!1}}function Re(){ze()}function ze(){Ol=Dl=!1;var e=0;Al!==0&&No()&&(e=Al);for(var t=Lc(),n=null,r=Tl;r!==null;){var a=r.next,o=Be(r,t);o===0?(r.next=null,n===null?Tl=a:n.next=a,a===null&&(El=n)):(n=r,(e!==0||o&3)&&(Ol=!0)),r=a}cd!==0&&cd!==5||Le(e,!1),Al!==0&&(Al=0)}function Be(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var s=31-Dc(o),c=1<<s,l=a[s];l===-1?((c&n)===0||(c&r)!==0)&&(a[s]=x(c,t)):l<=t&&(e.expiredLanes|=c),o&=~c}if(t=zu,n=Vu,n=y(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==Co),r=e.callbackNode,n===0||e===t&&(Hu===2||Hu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Pc(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||b(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Pc(r),te(n)){case 2:case 8:n=zc;break;case 32:n=Bc;break;case 268435456:n=Vc;break;default:n=Bc}return r=Ve.bind(null,e),n=Nc(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Pc(r),e.callbackPriority=2,e.callbackNode=null,2}function Ve(e,t){if(cd!==0&&cd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ma()&&e.callbackNode!==n)return null;var r=Vu;return r=y(e,e===zu?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==Co),r===0?null:(Ui(e,r,t),Be(e,Lc()),e.callbackNode!=null&&e.callbackNode===n?Ve.bind(null,e):null)}function He(e,t){if(ma())return null;Ui(e,t,!0)}function Ue(){Go?Ko(function(){Ru&6?Nc(Rc,Re):ze()}):Nc(Rc,Re)}function We(){if(Al===0){var e=Nl;e===0&&(e=Ac,Ac<<=1,!(Ac&261888)&&(Ac=256)),Al=e}return Al}function Ge(e,t){if(jl===null){var n=jl=[];Ml=0,Nl=We(),Pl={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ml++,t.then(Ke,Ke),t}function Ke(){if(--Ml===0&&jl!==null){Pl!==null&&(Pl.status=`fulfilled`);var e=jl;jl=null,Nl=0,Pl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function qe(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}function Je(){var e=Il.current;return e===null?zu.pooledCache:e}function Ye(e,t){t===null?g(Il,Il.current):g(Il,t.pool)}function Xe(){var e=Je();return e===null?null:{parent:wo?wl._currentValue:wl._currentValue2,pool:e}}function Ze(e,t){if(Kc(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!Jc.call(t,a)||!Kc(e[a],t[a]))return!1}return!0}function Qe(e){return e=e.status,e===`fulfilled`||e===`rejected`}function $e(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Fe,Fe),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,nt(e),e;default:if(typeof t.status==`string`)t.then(Fe,Fe);else{if(e=zu,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,nt(e),e}throw Vl=t,Ll}}function et(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Vl=e,Ll):e}}function tt(){if(Vl===null)throw Error(r(459));var e=Vl;return Vl=null,e}function nt(e){if(e===Ll||e===zl)throw Error(r(483))}function rt(e){var t=Ul;return Ul+=1,Hl===null&&(Hl=[]),$e(Hl,e,t)}function it(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function at(e,t){throw t.$$typeof===Ha?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function ot(e){function n(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function a(t,r){if(!e)return null;for(;r!==null;)n(t,r),r=r.sibling;return null}function o(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function s(e,t){return e=Ta(e,t),e.index=0,e.sibling=null,e}function c(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function l(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function d(e,t,n,r){return t===null||t.tag!==6?(t=ka(n,e.mode,r),t.return=e,t):(t=s(t,n),t.return=e,t)}function f(e,t,n,r){var a=n.type;return a===Ga?m(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===eo&&et(a)===t.type)?(t=s(t,n.props),it(t,n),t.return=e,t):(t=Da(n.type,n.key,n.props,null,e.mode,r),it(t,n),t.return=e,t)}function p(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ja(n,e.mode,r),t.return=e,t):(t=s(t,n.children||[]),t.return=e,t)}function m(e,t,n,r,a){return t===null||t.tag!==7?(t=Oa(n,e.mode,r,a),t.return=e,t):(t=s(t,n),t.return=e,t)}function h(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ka(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case Ua:return n=Da(t.type,t.key,t.props,null,e.mode,n),it(n,t),n.return=e,n;case Wa:return t=ja(t,e.mode,n),t.return=e,t;case eo:return t=et(t),h(e,t,n)}if(ao(t)||u(t))return t=Oa(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return h(e,rt(t),n);if(t.$$typeof===Ya)return h(e,je(e,t),n);at(e,t)}return null}function g(e,t,n,r){var a=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return a===null?d(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case Ua:return n.key===a?f(e,t,n,r):null;case Wa:return n.key===a?p(e,t,n,r):null;case eo:return n=et(n),g(e,t,n,r)}if(ao(n)||u(n))return a===null?m(e,t,n,r,null):null;if(typeof n.then==`function`)return g(e,t,rt(n),r);if(n.$$typeof===Ya)return g(e,t,je(e,n),r);at(e,n)}return null}function _(e,t,n,r,a){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,d(t,e,``+r,a);if(typeof r==`object`&&r){switch(r.$$typeof){case Ua:return e=e.get(r.key===null?n:r.key)||null,f(t,e,r,a);case Wa:return e=e.get(r.key===null?n:r.key)||null,p(t,e,r,a);case eo:return r=et(r),_(e,t,n,r,a)}if(ao(r)||u(r))return e=e.get(n)||null,m(t,e,r,a,null);if(typeof r.then==`function`)return _(e,t,n,rt(r),a);if(r.$$typeof===Ya)return _(e,t,n,je(t,r),a);at(t,r)}return null}function v(t,r,s,l){for(var u=null,d=null,f=r,p=r=0,m=null;f!==null&&p<s.length;p++){f.index>p?(m=f,f=null):m=f.sibling;var v=g(t,f,s[p],l);if(v===null){f===null&&(f=m);break}e&&f&&v.alternate===null&&n(t,f),r=c(v,r,p),d===null?u=v:d.sibling=v,d=v,f=m}if(p===s.length)return a(t,f),ml&&se(t,p),u;if(f===null){for(;p<s.length;p++)f=h(t,s[p],l),f!==null&&(r=c(f,r,p),d===null?u=f:d.sibling=f,d=f);return ml&&se(t,p),u}for(f=o(f);p<s.length;p++)m=_(f,t,p,s[p],l),m!==null&&(e&&m.alternate!==null&&f.delete(m.key===null?p:m.key),r=c(m,r,p),d===null?u=m:d.sibling=m,d=m);return e&&f.forEach(function(e){return n(t,e)}),ml&&se(t,p),u}function y(t,s,l,u){if(l==null)throw Error(r(151));for(var d=null,f=null,p=s,m=s=0,v=null,y=l.next();p!==null&&!y.done;m++,y=l.next()){p.index>m?(v=p,p=null):v=p.sibling;var b=g(t,p,y.value,u);if(b===null){p===null&&(p=v);break}e&&p&&b.alternate===null&&n(t,p),s=c(b,s,m),f===null?d=b:f.sibling=b,f=b,p=v}if(y.done)return a(t,p),ml&&se(t,m),d;if(p===null){for(;!y.done;m++,y=l.next())y=h(t,y.value,u),y!==null&&(s=c(y,s,m),f===null?d=y:f.sibling=y,f=y);return ml&&se(t,m),d}for(p=o(p);!y.done;m++,y=l.next())y=_(p,t,m,y.value,u),y!==null&&(e&&y.alternate!==null&&p.delete(y.key===null?m:y.key),s=c(y,s,m),f===null?d=y:f.sibling=y,f=y);return e&&p.forEach(function(e){return n(t,e)}),ml&&se(t,m),d}function b(e,t,o,c){if(typeof o==`object`&&o&&o.type===Ga&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case Ua:a:{for(var d=o.key;t!==null;){if(t.key===d){if(d=o.type,d===Ga){if(t.tag===7){a(e,t.sibling),c=s(t,o.props.children),c.return=e,e=c;break a}}else if(t.elementType===d||typeof d==`object`&&d&&d.$$typeof===eo&&et(d)===t.type){a(e,t.sibling),c=s(t,o.props),it(c,o),c.return=e,e=c;break a}a(e,t);break}else n(e,t);t=t.sibling}o.type===Ga?(c=Oa(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=Da(o.type,o.key,o.props,null,e.mode,c),it(c,o),c.return=e,e=c)}return l(e);case Wa:a:{for(d=o.key;t!==null;){if(t.key===d)if(t.tag===4&&t.stateNode.containerInfo===o.containerInfo&&t.stateNode.implementation===o.implementation){a(e,t.sibling),c=s(t,o.children||[]),c.return=e,e=c;break a}else{a(e,t);break}else n(e,t);t=t.sibling}c=ja(o,e.mode,c),c.return=e,e=c}return l(e);case eo:return o=et(o),b(e,t,o,c)}if(ao(o))return v(e,t,o,c);if(u(o)){if(d=u(o),typeof d!=`function`)throw Error(r(150));return o=d.call(o),y(e,t,o,c)}if(typeof o.then==`function`)return b(e,t,rt(o),c);if(o.$$typeof===Ya)return b(e,t,je(e,o),c);at(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,t!==null&&t.tag===6?(a(e,t.sibling),c=s(t,o),c.return=e,e=c):(a(e,t),c=ka(o,e.mode,c),c.return=e,e=c),l(e)):a(e,t)}return function(e,n,r,a){try{Ul=0;var o=b(e,n,r,a);return Hl=null,o}catch(n){if(n===Ll||n===zl)throw n;var s=t(29,n,null,e.mode);return s.lanes=a,s.return=e,s}}}function st(){for(var e=ql,t=Jl=ql=0;t<e;){var n=Kl[t];Kl[t++]=null;var r=Kl[t];Kl[t++]=null;var a=Kl[t];Kl[t++]=null;var o=Kl[t];if(Kl[t++]=null,r!==null&&a!==null){var s=r.pending;s===null?a.next=a:(a.next=s.next,s.next=a),r.pending=a}o!==0&&dt(n,a,o)}}function ct(e,t,n,r){Kl[ql++]=e,Kl[ql++]=t,Kl[ql++]=n,Kl[ql++]=r,Jl|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function lt(e,t,n,r){return ct(e,t,n,r),ft(e)}function ut(e,t){return ct(e,null,null,t),ft(e)}function dt(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var a=!1,o=e.return;o!==null;)o.childLanes|=n,r=o.alternate,r!==null&&(r.childLanes|=n),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(a=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,a&&t!==null&&(a=31-Dc(n),e=o.hiddenUpdates,r=e[a],r===null?e[a]=[t]:r.push(t),t.lane=n|536870912),o):null}function ft(e){if(50<hd)throw hd=0,gd=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}function pt(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function mt(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ht(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function gt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ru&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,t=ft(e),dt(e,null,n),t}return ct(e,r,t,n),ft(e)}function _t(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,D(e,n)}}function vt(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};o===null?a=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?a=o=t:o=o.next=t}else a=o=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function yt(){if(Xl){var e=Pl;if(e!==null)throw e}}function bt(e,t,n,r){Xl=!1;var a=e.updateQueue;Yl=!1;var o=a.firstBaseUpdate,s=a.lastBaseUpdate,c=a.shared.pending;if(c!==null){a.shared.pending=null;var l=c,u=l.next;l.next=null,s===null?o=u:s.next=u,s=l;var d=e.alternate;d!==null&&(d=d.updateQueue,c=d.lastBaseUpdate,c!==s&&(c===null?d.firstBaseUpdate=u:c.next=u,d.lastBaseUpdate=l))}if(o!==null){var f=a.baseState;s=0,d=u=l=null,c=o;do{var p=c.lane&-536870913,m=p!==c.lane;if(m?(Vu&p)===p:(r&p)===p){p!==0&&p===Nl&&(Xl=!0),d!==null&&(d=d.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});a:{var h=e,g=c;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){f=h.call(_,f,p);break a}f=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,f,p):h,p==null)break a;f=Va({},f,p);break a;case 2:Yl=!0}}p=c.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=a.callbacks,m===null?a.callbacks=[p]:m.push(p))}else m={lane:p,tag:c.tag,payload:c.payload,callback:c.callback,next:null},d===null?(u=d=m,l=f):d=d.next=m,s|=p;if(c=c.next,c===null){if(c=a.shared.pending,c===null)break;m=c,c=m.next,m.next=null,a.lastBaseUpdate=m,a.shared.pending=null}}while(1);d===null&&(l=f),a.baseState=l,a.firstBaseUpdate=u,a.lastBaseUpdate=d,o===null&&(a.shared.lanes=0),Yu|=s,e.lanes=s,e.memoizedState=f}}function xt(e,t){if(typeof e!=`function`)throw Error(r(191,e));e.call(t)}function St(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)xt(n[e],t)}function Ct(e,t){e=qu,g(Ql,e),g(Zl,t),qu=e|t.baseLanes}function wt(){g(Ql,qu),g(Zl,Zl.current)}function Tt(){qu=Ql.current,h(Zl),h(Ql)}function Et(e){var t=e.alternate;g(tu,tu.current&1),g($l,e),eu===null&&(t===null||Zl.current!==null||t.memoizedState!==null)&&(eu=e)}function Dt(e){g(tu,tu.current),g($l,e),eu===null&&(eu=e)}function Ot(e){e.tag===22?(g(tu,tu.current),g($l,e),eu===null&&(eu=e)):kt(e)}function kt(){g(tu,tu.current),g($l,$l.current)}function At(e){h($l),eu===e&&(eu=null),h(tu)}function jt(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Ss(n)||Cs(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function Mt(){throw Error(r(321))}function Nt(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Kc(e[n],t[n]))return!1;return!0}function Pt(e,t,n,r,a,o){return nu=o,ru=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,oo.H=e===null||e.memoizedState===null?mu:hu,cu=!1,o=n(r,a),cu=!1,su&&(o=It(t,n,r,a)),Ft(e),o}function Ft(e){oo.H=pu;var t=iu!==null&&iu.next!==null;if(nu=0,au=iu=ru=null,ou=!1,uu=0,du=null,t)throw Error(r(300));e===null||yu||(e=e.dependencies,e!==null&&Oe(e)&&(yu=!0))}function It(e,t,n,a){ru=e;var o=0;do{if(su&&(du=null),uu=0,su=!1,25<=o)throw Error(r(301));if(o+=1,au=iu=null,e.updateQueue!=null){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}oo.H=gu,s=t(n,a)}while(su);return s}function Lt(){var e=oo.H,t=e.useState()[0];return t=typeof t.then==`function`?Wt(t):t,e=e.useState()[0],(iu===null?null:iu.memoizedState)!==e&&(ru.flags|=1024),t}function Rt(){var e=lu!==0;return lu=0,e}function zt(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Bt(e){if(ou){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ou=!1}nu=0,au=iu=ru=null,su=!1,uu=lu=0,du=null}function Vt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return au===null?ru.memoizedState=au=e:au=au.next=e,au}function Ht(){if(iu===null){var e=ru.alternate;e=e===null?null:e.memoizedState}else e=iu.next;var t=au===null?ru.memoizedState:au.next;if(t!==null)au=t,iu=e;else{if(e===null)throw ru.alternate===null?Error(r(467)):Error(r(310));iu=e,e={memoizedState:iu.memoizedState,baseState:iu.baseState,baseQueue:iu.baseQueue,queue:iu.queue,next:null},au===null?ru.memoizedState=au=e:au=au.next=e}return au}function Ut(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wt(e){var t=uu;return uu+=1,du===null&&(du=[]),e=$e(du,e,t),t=ru,(au===null?t.memoizedState:au.next)===null&&(t=t.alternate,oo.H=t===null||t.memoizedState===null?mu:hu),e}function Gt(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Wt(e);if(e.$$typeof===Ya)return Ae(e)}throw Error(r(438,String(e)))}function Kt(e){var t=null,n=ru.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=ru.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Ut(),ru.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=no;return t.index++,n}function qt(e,t){return typeof t==`function`?t(e):t}function Jt(e){return Yt(Ht(),iu,e)}function Yt(e,t,n){var a=e.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=n;var o=e.baseQueue,s=a.pending;if(s!==null){if(o!==null){var c=o.next;o.next=s.next,s.next=c}t.baseQueue=o=s,a.pending=null}if(s=e.baseState,o===null)e.memoizedState=s;else{t=o.next;var l=c=null,u=null,d=t,f=!1;do{var p=d.lane&-536870913;if(p===d.lane?(nu&p)===p:(Vu&p)===p){var m=d.revertLane;if(m===0)u!==null&&(u=u.next={lane:0,revertLane:0,gesture:null,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),p===Nl&&(f=!0);else if((nu&m)===m){d=d.next,m===Nl&&(f=!0);continue}else p={lane:0,revertLane:d.revertLane,gesture:null,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},u===null?(l=u=p,c=s):u=u.next=p,ru.lanes|=m,Yu|=m;p=d.action,cu&&n(s,p),s=d.hasEagerState?d.eagerState:n(s,p)}else m={lane:p,revertLane:d.revertLane,gesture:d.gesture,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},u===null?(l=u=m,c=s):u=u.next=m,ru.lanes|=p,Yu|=p;d=d.next}while(d!==null&&d!==t);if(u===null?c=s:u.next=l,!Kc(s,e.memoizedState)&&(yu=!0,f&&(n=Pl,n!==null)))throw n;e.memoizedState=s,e.baseState=c,e.baseQueue=u,a.lastRenderedState=s}return o===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function Xt(e){var t=Ht(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var a=n.dispatch,o=n.pending,s=t.memoizedState;if(o!==null){n.pending=null;var c=o=o.next;do s=e(s,c.action),c=c.next;while(c!==o);Kc(s,t.memoizedState)||(yu=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,a]}function Zt(e,t,n){var a=ru,o=Ht(),s=ml;if(s){if(n===void 0)throw Error(r(407));n=n()}else n=t();var c=!Kc((iu||o).memoizedState,n);if(c&&(o.memoizedState=n,yu=!0),o=o.queue,Cn(en.bind(null,a,o,e),[e]),o.getSnapshot!==t||c||au!==null&&au.memoizedState.tag&1){if(a.flags|=2048,vn(9,{destroy:void 0},$t.bind(null,a,o,n,t),null),zu===null)throw Error(r(349));s||nu&127||Qt(a,t,n)}return n}function Qt(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ru.updateQueue,t===null?(t=Ut(),ru.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function $t(e,t,n,r){t.value=n,t.getSnapshot=r,tn(t)&&nn(e)}function en(e,t,n){return n(function(){tn(t)&&nn(e)})}function tn(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Kc(e,n)}catch{return!0}}function nn(e){var t=ut(e,2);t!==null&&Hi(t,e,2)}function rn(e){var t=Vt();if(typeof e==`function`){var n=e;if(e=n(),cu){ne(!0);try{n()}finally{ne(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qt,lastRenderedState:e},t}function an(e,t,n,r){return e.baseState=n,Yt(e,iu,typeof r==`function`?r:qt)}function on(e,t,n,a,o){if(Gn(e))throw Error(r(485));if(e=t.action,e!==null){var s={payload:o,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){s.listeners.push(e)}};oo.T===null?s.isTransition=!1:n(!0),a(s),n=t.pending,n===null?(s.next=t.pending=s,sn(t,s)):(s.next=n.next,t.pending=n.next=s)}}function sn(e,t){var n=t.action,r=t.payload,a=e.state;if(t.isTransition){var o=oo.T,s={};oo.T=s;try{var c=n(a,r),l=oo.S;l!==null&&l(s,c),cn(e,t,c)}catch(n){un(e,t,n)}finally{o!==null&&s.types!==null&&(o.types=s.types),oo.T=o}}else try{o=n(a,r),cn(e,t,o)}catch(n){un(e,t,n)}}function cn(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ln(e,t,n)},function(n){return un(e,t,n)}):ln(e,t,n)}function ln(e,t,n){t.status=`fulfilled`,t.value=n,dn(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,sn(e,n)))}function un(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,dn(t),t=t.next;while(t!==r)}e.action=null}function dn(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function fn(e,t){return t}function pn(e,t){if(ml){var n=zu.formState;if(n!==null){a:{var r=ru;if(ml){if(pl){var a=Es(pl,gl);if(a){pl=Os(a),r=Ds(a);break a}}ge(r)}r=!1}r&&(t=n[0])}}n=Vt(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fn,lastRenderedState:t},n.queue=r,n=Hn.bind(null,ru,r),r.dispatch=n,r=rn(!1);var o=Wn.bind(null,ru,!1,r.queue);return r=Vt(),a={state:t,dispatch:null,action:e,pending:null},r.queue=a,n=on.bind(null,ru,a,o,n),a.dispatch=n,r.memoizedState=e,[t,n,!1]}function mn(e){return hn(Ht(),iu,e)}function hn(e,t,n){if(t=Yt(e,t,fn)[0],e=Jt(qt)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Wt(t)}catch(e){throw e===Ll?zl:e}else r=t;t=Ht();var a=t.queue,o=a.dispatch;return n!==t.memoizedState&&(ru.flags|=2048,vn(9,{destroy:void 0},gn.bind(null,a,n),null)),[r,o,e]}function gn(e,t){e.action=t}function _n(e){var t=Ht(),n=iu;if(n!==null)return hn(t,n,e);Ht(),t=t.memoizedState,n=Ht();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function vn(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=ru.updateQueue,t===null&&(t=Ut(),ru.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function yn(){return Ht().memoizedState}function bn(e,t,n,r){var a=Vt();ru.flags|=e,a.memoizedState=vn(1|t,{destroy:void 0},n,r===void 0?null:r)}function xn(e,t,n,r){var a=Ht();r=r===void 0?null:r;var o=a.memoizedState.inst;iu!==null&&r!==null&&Nt(r,iu.memoizedState.deps)?a.memoizedState=vn(t,o,n,r):(ru.flags|=e,a.memoizedState=vn(1|t,o,n,r))}function Sn(e,t){bn(8390656,8,e,t)}function Cn(e,t){xn(2048,8,e,t)}function wn(e){ru.flags|=4;var t=ru.updateQueue;if(t===null)t=Ut(),ru.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Tn(e){var t=Ht().memoizedState;return wn({ref:t,nextImpl:e}),function(){if(Ru&2)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function En(e,t){return xn(4,2,e,t)}function Dn(e,t){return xn(4,4,e,t)}function On(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function kn(e,t,n){n=n==null?null:n.concat([e]),xn(4,4,On.bind(null,t,e),n)}function An(){}function jn(e,t){var n=Ht();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Nt(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Mn(e,t){var n=Ht();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Nt(t,r[1]))return r[0];if(r=e(),cu){ne(!0);try{e()}finally{ne(!1)}}return n.memoizedState=[r,t],r}function Nn(e,t,n){return n===void 0||nu&1073741824&&!(Vu&261930)?e.memoizedState=t:(e.memoizedState=n,e=Vi(),ru.lanes|=e,Yu|=e,n)}function Pn(e,t,n,r){return Kc(n,t)?n:Zl.current===null?!(nu&42)||nu&1073741824&&!(Vu&261930)?(yu=!0,e.memoizedState=n):(e=Vi(),ru.lanes|=e,Yu|=e,t):(e=Nn(e,n,r),Kc(e,t)||(yu=!0),e)}function Fn(e,t,n,r,a){var o=jo();Ao(o!==0&&8>o?o:8);var s=oo.T,c={};oo.T=c,Wn(e,!1,t,n);try{var l=a(),u=oo.S;u!==null&&u(c,l),typeof l==`object`&&l&&typeof l.then==`function`?Un(e,t,qe(l,r),Bi(e)):Un(e,t,r,Bi(e))}catch(n){Un(e,t,{then:function(){},status:`rejected`,reason:n},Bi())}finally{Ao(o),s!==null&&c.types!==null&&(s.types=c.types),oo.T=s}}function In(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Ho,baseState:Ho,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qt,lastRenderedState:Ho},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qt,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ln(){return Ae(Uo)}function Rn(){return Ht().memoizedState}function zn(){return Ht().memoizedState}function Bn(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Bi();e=ht(n);var r=gt(t,e,n);r!==null&&(Hi(r,t,n),_t(r,t,n)),t={cache:Ne()},e.payload=t;return}t=t.return}}function Vn(e,t,n){var r=Bi();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Gn(e)?Kn(t,n):(n=lt(e,t,n,r),n!==null&&(Hi(n,e,r),qn(n,t,r)))}function Hn(e,t,n){Un(e,t,n,Bi())}function Un(e,t,n,r){var a={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Gn(e))Kn(t,a);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,c=o(s,n);if(a.hasEagerState=!0,a.eagerState=c,Kc(c,s))return ct(e,t,a,0),zu===null&&st(),!1}catch{}if(n=lt(e,t,a,r),n!==null)return Hi(n,e,r),qn(n,t,r),!0}return!1}function Wn(e,t,n,a){if(a={lane:2,revertLane:We(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Gn(e)){if(t)throw Error(r(479))}else t=lt(e,n,a,2),t!==null&&Hi(t,e,2)}function Gn(e){var t=e.alternate;return e===ru||t!==null&&t===ru}function Kn(e,t){su=ou=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function qn(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,D(e,n)}}function Jn(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Va({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}function Yn(e,t,n,r,a,o,s){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,o,s):t.prototype&&t.prototype.isPureReactComponent?!Ze(n,r)||!Ze(a,o):!0}function Xn(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&_u.enqueueReplaceState(t,t.state,null)}function Zn(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var a in n===t&&(n=Va({},n)),e)n[a]===void 0&&(n[a]=e[a]);return n}function Qn(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function $n(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function er(e,t,n){return n=ht(n),n.tag=3,n.payload={element:null},n.callback=function(){Qn(e,t)},n}function tr(e){return e=ht(e),e.tag=3,e}function nr(e,t,n,r){var a=n.type.getDerivedStateFromError;if(typeof a==`function`){var o=r.value;e.payload=function(){return a(o)},e.callback=function(){$n(t,n,r)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch==`function`&&(e.callback=function(){$n(t,n,r),typeof a!=`function`&&(sd===null?sd=new Set([this]):sd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function rr(e,t,n,a,o){if(n.flags|=32768,typeof a==`object`&&a&&typeof a.then==`function`){if(t=n.alternate,t!==null&&De(t,n,o,!0),n=$l.current,n!==null){switch(n.tag){case 31:case 13:return eu===null?$i():n.alternate===null&&Ju===0&&(Ju=3),n.flags&=-257,n.flags|=65536,n.lanes=o,a===Bl?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),va(e,a,o)),!1;case 22:return n.flags|=65536,a===Bl?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([a]):n.add(a)),va(e,a,o)),!1}throw Error(r(435,n.tag))}return va(e,a,o),$i(),!1}if(ml)return t=$l.current,t===null?(a!==_l&&(t=Error(r(423),{cause:a}),Se(A(t,n))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,a=A(a,n),o=er(e.stateNode,a,o),vt(e,o),Ju!==4&&(Ju=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=o,a!==_l&&(e=Error(r(422),{cause:a}),Se(A(e,n)))),!1;var s=Error(r(520),{cause:a});if(s=A(s,n),ed===null?ed=[s]:ed.push(s),Ju!==4&&(Ju=2),t===null)return!0;a=A(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,e=er(n.stateNode,a,e),vt(n,e),!1;case 1:if(t=n.type,s=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||s!==null&&typeof s.componentDidCatch==`function`&&(sd===null||!sd.has(s))))return n.flags|=65536,o&=-o,n.lanes|=o,o=tr(o),nr(o,e,n,a),vt(n,o),!1}n=n.return}while(n!==null);return!1}function ir(e,t,n,r){t.child=e===null?Gl(t,null,n,r):Wl(t,e.child,n,r)}function ar(e,t,n,r,a){n=n.render;var o=t.ref;if(`ref`in r){var s={};for(var c in r)c!==`ref`&&(s[c]=r[c])}else s=r;return ke(t),r=Pt(e,t,n,s,o,a),c=Rt(),e!==null&&!yu?(zt(e,t,a),Or(e,t,a)):(ml&&c&&le(t),t.flags|=1,ir(e,t,r,a),t.child)}function or(e,t,n,r,a){if(e===null){var o=n.type;return typeof o==`function`&&!wa(o)&&o.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=o,sr(e,t,o,r,a)):(e=Da(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!kr(e,a)){var s=o.memoizedProps;if(n=n.compare,n=n===null?Ze:n,n(s,r)&&e.ref===t.ref)return Or(e,t,a)}return t.flags|=1,e=Ta(o,r),e.ref=t.ref,e.return=t,t.child=e}function sr(e,t,n,r,a){if(e!==null){var o=e.memoizedProps;if(Ze(o,r)&&e.ref===t.ref)if(yu=!1,t.pendingProps=r=o,kr(e,a))e.flags&131072&&(yu=!0);else return t.lanes=e.lanes,Or(e,t,a)}return hr(e,t,n,r,a)}function cr(e,t,n,r){var a=r.children,o=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(o=o===null?n:o.baseLanes|n,e!==null){for(r=t.child=e.child,a=0;r!==null;)a=a|r.lanes|r.childLanes,r=r.sibling;r=a&~o}else r=0,t.child=null;return ur(e,t,o,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ye(t,o===null?null:o.cachePool),o===null?wt():Ct(t,o),Ot(t);else return r=t.lanes=536870912,ur(e,t,o===null?n:o.baseLanes|n,n,r)}else o===null?(e!==null&&Ye(t,null),wt(),kt(t)):(Ye(t,o.cachePool),Ct(t,o),kt(t),t.memoizedState=null);return ir(e,t,a,n),t.child}function lr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ur(e,t,n,r,a){var o=Je();return o=o===null?null:{parent:wo?wl._currentValue:wl._currentValue2,pool:o},t.memoizedState={baseLanes:n,cachePool:o},e!==null&&Ye(t,null),wt(),Ot(t),e!==null&&De(e,t,r,!0),t.childLanes=a,null}function dr(e,t){return t=Cr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function fr(e,t,n){return Wl(t,e.child,null,n),e=dr(t,t.pendingProps),e.flags|=2,At(t),t.memoizedState=null,e}function pr(e,t,n){var a=t.pendingProps,o=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(ml){if(a.mode===`hidden`)return e=dr(t,a),t.lanes=536870912,lr(null,e);if(Dt(t),(e=pl)?(e=Ls(e,gl),e!==null&&(t.memoizedState={dehydrated:e,treeContext:al===null?null:{id:ol,overflow:sl},retryLane:536870912,hydrationErrors:null},n=Aa(e),n.return=t,t.child=n,fl=t,pl=null)):e=null,e===null)throw ge(t);return t.lanes=536870912,null}return dr(t,a)}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(Dt(t),o)if(t.flags&256)t.flags&=-257,t=fr(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(yu||De(e,t,n,!1),o=(n&e.childLanes)!==0,yu||o){if(a=zu,a!==null&&(c=O(a,n),c!==0&&c!==s.retryLane))throw s.retryLane=c,ut(e,c),Hi(a,e,c),vu;$i(),t=fr(e,t,n)}else e=s.treeContext,Do&&(pl=Ms(c),fl=t,ml=!0,hl=null,gl=!1,e!==null&&de(t,e)),t=dr(t,a),t.flags|=4096;return t}return e=Ta(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function mr(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(r(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function hr(e,t,n,r,a){return ke(t),n=Pt(e,t,n,r,void 0,a),r=Rt(),e!==null&&!yu?(zt(e,t,a),Or(e,t,a)):(ml&&r&&le(t),t.flags|=1,ir(e,t,n,a),t.child)}function gr(e,t,n,r,a,o){return ke(t),t.updateQueue=null,n=It(t,r,n,a),Ft(e),r=Rt(),e!==null&&!yu?(zt(e,t,o),Or(e,t,o)):(ml&&r&&le(t),t.flags|=1,ir(e,t,n,o),t.child)}function _r(e,t,n,r,a){if(ke(t),t.stateNode===null){var o=Ec,s=n.contextType;typeof s==`object`&&s&&(o=Ae(s)),o=new n(r,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=_u,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=r,o.state=t.memoizedState,o.refs={},pt(t),s=n.contextType,o.context=typeof s==`object`&&s?Ae(s):Ec,o.state=t.memoizedState,s=n.getDerivedStateFromProps,typeof s==`function`&&(Jn(t,n,s,r),o.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof o.getSnapshotBeforeUpdate==`function`||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(s=o.state,typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount(),s!==o.state&&_u.enqueueReplaceState(o,o.state,null),bt(t,r,o,a),yt(),o.state=t.memoizedState),typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){o=t.stateNode;var c=t.memoizedProps,l=Zn(n,c);o.props=l;var u=o.context,d=n.contextType;s=Ec,typeof d==`object`&&d&&(s=Ae(d));var f=n.getDerivedStateFromProps;d=typeof f==`function`||typeof o.getSnapshotBeforeUpdate==`function`,c=t.pendingProps!==c,d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(c||u!==s)&&Xn(t,o,r,s),Yl=!1;var p=t.memoizedState;o.state=p,bt(t,r,o,a),yt(),u=t.memoizedState,c||p!==u||Yl?(typeof f==`function`&&(Jn(t,n,f,r),u=t.memoizedState),(l=Yl||Yn(t,n,l,r,p,u,s))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),o.props=r,o.state=u,o.context=s,r=l):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,mt(e,t),s=t.memoizedProps,d=Zn(n,s),o.props=d,f=t.pendingProps,p=o.context,u=n.contextType,l=Ec,typeof u==`object`&&u&&(l=Ae(u)),c=n.getDerivedStateFromProps,(u=typeof c==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==f||p!==l)&&Xn(t,o,r,l),Yl=!1,p=t.memoizedState,o.state=p,bt(t,r,o,a),yt();var m=t.memoizedState;s!==f||p!==m||Yl||e!==null&&e.dependencies!==null&&Oe(e.dependencies)?(typeof c==`function`&&(Jn(t,n,c,r),m=t.memoizedState),(d=Yl||Yn(t,n,d,r,p,m,l)||e!==null&&e.dependencies!==null&&Oe(e.dependencies))?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,l),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,l)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=l,r=d):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return o=r,mr(e,t),r=(t.flags&128)!=0,o||r?(o=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:o.render(),t.flags|=1,e!==null&&r?(t.child=Wl(t,e.child,null,a),t.child=Wl(t,null,n,a)):ir(e,t,n,a),t.memoizedState=o.state,e=t.child):e=Or(e,t,a),e}function vr(e,t,n,r){return be(),t.flags|=256,ir(e,t,n,r),t.child}function yr(e){return{baseLanes:e,cachePool:Xe()}}function br(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Qu),e}function xr(e,t,n){var a=t.pendingProps,o=!1,s=(t.flags&128)!=0,c;if((c=s)||(c=e!==null&&e.memoizedState===null?!1:(tu.current&2)!=0),c&&(o=!0,t.flags&=-129),c=(t.flags&32)!=0,t.flags&=-33,e===null){if(ml){if(o?Et(t):kt(t),(e=pl)?(e=Rs(e,gl),e!==null&&(t.memoizedState={dehydrated:e,treeContext:al===null?null:{id:ol,overflow:sl},retryLane:536870912,hydrationErrors:null},n=Aa(e),n.return=t,t.child=n,fl=t,pl=null)):e=null,e===null)throw ge(t);return Cs(e)?t.lanes=32:t.lanes=536870912,null}var l=a.children;return a=a.fallback,o?(kt(t),o=t.mode,l=Cr({mode:`hidden`,children:l},o),a=Oa(a,o,n,null),l.return=t,a.return=t,l.sibling=a,t.child=l,a=t.child,a.memoizedState=yr(n),a.childLanes=br(e,c,n),t.memoizedState=bu,lr(null,a)):(Et(t),Sr(t,l))}var u=e.memoizedState;if(u!==null&&(l=u.dehydrated,l!==null)){if(s)t.flags&256?(Et(t),t.flags&=-257,t=wr(e,t,n)):t.memoizedState===null?(kt(t),l=a.fallback,o=t.mode,a=Cr({mode:`visible`,children:a.children},o),l=Oa(l,o,n,null),l.flags|=2,a.return=t,l.return=t,a.sibling=l,t.child=a,Wl(t,e.child,null,n),a=t.child,a.memoizedState=yr(n),a.childLanes=br(e,c,n),t.memoizedState=bu,t=lr(null,a)):(kt(t),t.child=e.child,t.flags|=128,t=null);else if(Et(t),Cs(l))c=ws(l).digest,a=Error(r(419)),a.stack=``,a.digest=c,Se({value:a,source:null,stack:null}),t=wr(e,t,n);else if(yu||De(e,t,n,!1),c=(n&e.childLanes)!==0,yu||c){if(c=zu,c!==null&&(a=O(c,n),a!==0&&a!==u.retryLane))throw u.retryLane=a,ut(e,a),Hi(c,e,a),vu;Ss(l)||$i(),t=wr(e,t,n)}else Ss(l)?(t.flags|=192,t.child=e.child,t=null):(e=u.treeContext,Do&&(pl=Ns(l),fl=t,ml=!0,hl=null,gl=!1,e!==null&&de(t,e)),t=Sr(t,a.children),t.flags|=4096);return t}return o?(kt(t),l=a.fallback,o=t.mode,u=e.child,s=u.sibling,a=Ta(u,{mode:`hidden`,children:a.children}),a.subtreeFlags=u.subtreeFlags&65011712,s===null?(l=Oa(l,o,n,null),l.flags|=2):l=Ta(s,l),l.return=t,a.return=t,a.sibling=l,t.child=a,lr(null,a),a=t.child,l=e.child.memoizedState,l===null?l=yr(n):(o=l.cachePool,o===null?o=Xe():(u=wo?wl._currentValue:wl._currentValue2,o=o.parent===u?o:{parent:u,pool:u}),l={baseLanes:l.baseLanes|n,cachePool:o}),a.memoizedState=l,a.childLanes=br(e,c,n),t.memoizedState=bu,lr(e.child,a)):(Et(t),n=e.child,e=n.sibling,n=Ta(n,{mode:`visible`,children:a.children}),n.return=t,n.sibling=null,e!==null&&(c=t.deletions,c===null?(t.deletions=[e],t.flags|=16):c.push(e)),t.child=n,t.memoizedState=null,n)}function Sr(e,t){return t=Cr({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Cr(e,n){return e=t(22,e,null,n),e.lanes=0,e}function wr(e,t,n){return Wl(t,e.child,null,n),e=Sr(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Tr(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Te(e.return,t,n)}function Er(e,t,n,r,a,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a,treeForkCount:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=a,s.treeForkCount=o)}function Dr(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;r=r.children;var s=tu.current,c=(s&2)!=0;if(c?(s=s&1|2,t.flags|=128):s&=1,g(tu,s),ir(e,t,r,n),r=ml?nl:0,!c&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Tr(e,n,t);else if(e.tag===19)Tr(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case`forwards`:for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&jt(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Er(t,!1,a,n,o,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&jt(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Er(t,!0,n,null,o,r);break;case`together`:Er(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Or(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Yu|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(De(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Ta(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ta(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function kr(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Oe(e))):!0}function Ar(e,t,n){switch(t.tag){case 3:fe(t,t.stateNode.containerInfo),Ce(t,wl,e.memoizedState.cache),be();break;case 27:case 5:me(t);break;case 4:fe(t,t.stateNode.containerInfo);break;case 10:Ce(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Dt(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Et(t),e=Or(e,t,n),e===null?null:e.sibling):xr(e,t,n):(Et(t),t.flags|=128,null);Et(t);break;case 19:var a=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(De(e,t,n,!1),(n&t.childLanes)!==0),a){if(r)return Dr(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),g(tu,tu.current),r)break;return null;case 22:return t.lanes=0,cr(e,t,n,t.pendingProps);case 24:Ce(t,wl,e.memoizedState.cache)}return Or(e,t,n)}function jr(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)yu=!0;else{if(!kr(e,n)&&!(t.flags&128))return yu=!1,Ar(e,t,n);yu=!!(e.flags&131072)}else yu=!1,ml&&t.flags&1048576&&ce(t,nl,t.index);switch(t.lanes=0,t.tag){case 16:a:{var a=t.pendingProps;if(e=et(t.elementType),t.type=e,typeof e==`function`)wa(e)?(a=Zn(e,a),t.tag=1,t=_r(null,t,e,a,n)):(t.tag=0,t=hr(null,t,e,a,n));else{if(e!=null){var o=e.$$typeof;if(o===Xa){t.tag=11,t=ar(null,t,e,a,n);break a}else if(o===$a){t.tag=14,t=or(null,t,e,a,n);break a}}throw t=d(e)||e,Error(r(306,t,``))}}return t;case 0:return hr(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,o=Zn(a,t.pendingProps),_r(e,t,a,o,n);case 3:a:{if(fe(t,t.stateNode.containerInfo),e===null)throw Error(r(387));var s=t.pendingProps;o=t.memoizedState,a=o.element,mt(e,t),bt(t,s,null,n);var c=t.memoizedState;if(s=c.cache,Ce(t,wl,s),s!==o.cache&&Ee(t,[wl],n,!0),yt(),s=c.element,Do&&o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:c.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=vr(e,t,s,n);break a}else if(s!==a){a=A(Error(r(424)),t),Se(a),t=vr(e,t,s,n);break a}else for(Do&&(pl=js(t.stateNode.containerInfo),fl=t,ml=!0,hl=null,gl=!0),n=Gl(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(be(),s===a){t=Or(e,t,n);break a}ir(e,t,s,n)}t=t.child}return t;case 26:if(ic)return mr(e,t),e===null?(n=sc(t.type,null,t.pendingProps,null))?t.memoizedState=n:ml||(t.stateNode=pc(t.type,t.pendingProps,ul.current,t)):t.memoizedState=sc(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:if(vc)return me(t),e===null&&vc&&ml&&(a=t.stateNode=yc(t.type,t.pendingProps,ul.current,cl.current,!1),fl=t,gl=!0,pl=Ps(t.type,a,pl)),ir(e,t,t.pendingProps.children,n),mr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ml&&(nc(t.type,t.pendingProps,cl.current),(o=a=pl)&&(a=Fs(a,t.type,t.pendingProps,gl),a===null?o=!1:(t.stateNode=a,fl=t,pl=As(a),gl=!1,o=!0)),o||ge(t)),me(t),o=t.type,s=t.pendingProps,c=e===null?null:e.memoizedProps,a=s.children,yo(o,s)?a=null:c!==null&&yo(o,c)&&(t.flags|=32),t.memoizedState!==null&&(o=Pt(e,t,Lt,null,null,n),wo?Uo._currentValue=o:Uo._currentValue2=o),mr(e,t),ir(e,t,a,n),t.child;case 6:return e===null&&ml&&(rc(t.pendingProps,cl.current),(e=n=pl)&&(n=Is(n,t.pendingProps,gl),n===null?e=!1:(t.stateNode=n,fl=t,pl=null,e=!0)),e||ge(t)),null;case 13:return xr(e,t,n);case 4:return fe(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Wl(t,null,a,n):ir(e,t,a,n),t.child;case 11:return ar(e,t,t.type,t.pendingProps,n);case 7:return ir(e,t,t.pendingProps,n),t.child;case 8:return ir(e,t,t.pendingProps.children,n),t.child;case 12:return ir(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,Ce(t,t.type,a.value),ir(e,t,a.children,n),t.child;case 9:return o=t.type._context,a=t.pendingProps.children,ke(t),o=Ae(o),a=a(o),t.flags|=1,ir(e,t,a,n),t.child;case 14:return or(e,t,t.type,t.pendingProps,n);case 15:return sr(e,t,t.type,t.pendingProps,n);case 19:return Dr(e,t,n);case 31:return pr(e,t,n);case 22:return cr(e,t,n,t.pendingProps);case 24:return ke(t),a=Ae(wl),e===null?(o=Je(),o===null&&(o=zu,s=Ne(),o.pooledCache=s,s.refCount++,s!==null&&(o.pooledCacheLanes|=n),o=s),t.memoizedState={parent:a,cache:o},pt(t),Ce(t,wl,o)):((e.lanes&n)!==0&&(mt(e,t),bt(t,null,null,n),yt()),o=e.memoizedState,s=t.memoizedState,o.parent===a?(a=s.cache,Ce(t,wl,a),a!==o.cache&&Ee(t,[wl],n,!0)):(o={parent:a,cache:a},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),Ce(t,wl,a))),ir(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Mr(e){e.flags|=4}function Nr(e){Eo&&(e.flags|=8)}function Pr(e,t){if(e!==null&&e.child===t.child)return!1;if(t.flags&16)return!0;for(e=t.child;e!==null;){if(e.flags&8218||e.subtreeFlags&8218)return!0;e=e.sibling}return!1}function Fr(e,t,n,r){if(To)for(n=t.child;n!==null;){if(n.tag===5||n.tag===6)_o(e,n.stateNode);else if(!(n.tag===4||vc&&n.tag===27)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}else if(Eo)for(var a=t.child;a!==null;){if(a.tag===5){var o=a.stateNode;n&&r&&(o=bs(o,a.type,a.memoizedProps)),_o(e,o)}else if(a.tag===6)o=a.stateNode,n&&r&&(o=xs(o,a.memoizedProps)),_o(e,o);else if(a.tag!==4){if(a.tag===22&&a.memoizedState!==null)o=a.child,o!==null&&(o.return=a),Fr(e,a,!0,!0);else if(a.child!==null){a.child.return=a,a=a.child;continue}}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return;a=a.return}a.sibling.return=a.return,a=a.sibling}}function Ir(e,t,n,r){var a=!1;if(Eo)for(var o=t.child;o!==null;){if(o.tag===5){var s=o.stateNode;n&&r&&(s=bs(s,o.type,o.memoizedProps)),_s(e,s)}else if(o.tag===6)s=o.stateNode,n&&r&&(s=xs(s,o.memoizedProps)),_s(e,s);else if(o.tag!==4){if(o.tag===22&&o.memoizedState!==null)a=o.child,a!==null&&(a.return=o),Ir(e,o,!0,!0),a=!0;else if(o.child!==null){o.child.return=o,o=o.child;continue}}if(o===t)break;for(;o.sibling===null;){if(o.return===null||o.return===t)return a;o=o.return}o.sibling.return=o.return,o=o.sibling}return a}function Lr(e,t){if(Eo&&Pr(e,t)){e=t.stateNode;var n=e.containerInfo,r=gs();Ir(r,t,!1,!1),e.pendingChildren=r,Mr(t),vs(n,r)}}function Rr(e,t,n,r){if(To)e.memoizedProps!==r&&Mr(t);else if(Eo){var a=e.stateNode,o=e.memoizedProps;if((e=Pr(e,t))||o!==r){var s=cl.current;o=hs(a,n,o,r,!e,null),o===a?t.stateNode=a:(Nr(t),vo(o,n,r,s)&&Mr(t),t.stateNode=o,e&&Fr(o,t,!1,!1))}else t.stateNode=a}}function zr(e,t,n,r,a){if(e.mode&32&&(n===null?Fo(t,r):Io(t,n,r))){if(e.flags|=16777216,(a&335544128)===a||Lo(t,r))if(Ro(e.stateNode,t,r))e.flags|=8192;else if(Zi())e.flags|=8192;else throw Vl=Bl,Rl}else e.flags&=-16777217}function Br(e,t){if(hc(t)){if(e.flags|=16777216,!gc(t))if(Zi())e.flags|=8192;else throw Vl=Bl,Rl}else e.flags&=-16777217}function Vr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:S(),e.lanes|=t,$u|=t)}function Hr(e,t){if(!ml)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ur(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&65011712,r|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Wr(e,t,n){var a=t.pendingProps;switch(ue(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ur(t),null;case 1:return Ur(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),we(wl),pe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ye(t)?Mr(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,xe())),Lr(e,t),Ur(t),null;case 26:if(ic){var o=t.type,s=t.memoizedState;return e===null?(Mr(t),s===null?(Ur(t),zr(t,o,null,a,n)):(Ur(t),Br(t,s))):s?s===e.memoizedState?(Ur(t),t.flags&=-16777217):(Mr(t),Ur(t),Br(t,s)):(s=e.memoizedProps,To?s!==a&&Mr(t):Rr(e,t,o,a),Ur(t),zr(t,o,s,a,n)),null}case 27:if(vc){if(he(t),n=ul.current,o=t.type,e!==null&&t.stateNode!=null)To?e.memoizedProps!==a&&Mr(t):Rr(e,t,o,a);else{if(!a){if(t.stateNode===null)throw Error(r(166));return Ur(t),null}e=cl.current,ye(t)?_e(t,e):(e=yc(o,a,n,e,!0),t.stateNode=e,Mr(t))}return Ur(t),null}case 5:if(he(t),o=t.type,e!==null&&t.stateNode!=null)Rr(e,t,o,a);else{if(!a){if(t.stateNode===null)throw Error(r(166));return Ur(t),null}if(s=cl.current,ye(t))_e(t,s),Ys(t.stateNode,o,a,s)&&(t.flags|=64);else{var c=go(o,a,ul.current,s,t);Nr(t),Fr(c,t,!1,!1),t.stateNode=c,vo(c,o,a,s)&&Mr(t)}}return Ur(t),zr(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)n=e.memoizedProps,To?n!==a&&Mr(t):Eo&&(n===a?t.stateNode=e.stateNode:(e=ul.current,n=cl.current,Nr(t),t.stateNode=bo(a,e,n,t)));else{if(typeof a!=`string`&&t.stateNode===null)throw Error(r(166));if(e=ul.current,n=cl.current,ye(t)){if(!Do)throw Error(r(176));if(e=t.stateNode,n=t.memoizedProps,a=null,o=fl,o!==null)switch(o.tag){case 27:case 5:a=o.memoizedProps}Bs(e,n,t,a)||ge(t,!0)}else Nr(t),t.stateNode=bo(a,e,n,t)}return Ur(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(a=ye(t),n!==null){if(e===null){if(!a)throw Error(r(318));if(!Do)throw Error(r(556));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(557));Vs(e,t)}else be(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ur(t),e=!1}else n=xe(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(At(t),t):(At(t),null);if(t.flags&128)throw Error(r(558))}return Ur(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=ye(t),a!==null&&a.dehydrated!==null){if(e===null){if(!o)throw Error(r(318));if(!Do)throw Error(r(344));if(o=t.memoizedState,o=o===null?null:o.dehydrated,!o)throw Error(r(317));Hs(o,t)}else be(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ur(t),o=!1}else o=xe(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(At(t),t):(At(t),null)}return At(t),t.flags&128?(t.lanes=n,t):(n=a!==null,e=e!==null&&e.memoizedState!==null,n&&(a=t.child,o=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(o=a.alternate.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==o&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Vr(t,t.updateQueue),Ur(t),null);case 4:return pe(),Lr(e,t),e===null&&ko(t.stateNode.containerInfo),Ur(t),null;case 10:return we(t.type),Ur(t),null;case 19:if(h(tu),a=t.memoizedState,a===null)return Ur(t),null;if(o=(t.flags&128)!=0,s=a.rendering,s===null)if(o)Hr(a,!1);else{if(Ju!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=jt(e),s!==null){for(t.flags|=128,Hr(a,!1),e=s.updateQueue,t.updateQueue=e,Vr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Ea(n,e),n=n.sibling;return g(tu,tu.current&1|2),ml&&se(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&Lc()>ad&&(t.flags|=128,o=!0,Hr(a,!1),t.lanes=4194304)}else{if(!o)if(e=jt(s),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Vr(t,e),Hr(a,!0),a.tail===null&&a.tailMode===`hidden`&&!s.alternate&&!ml)return Ur(t),null}else 2*Lc()-a.renderingStartTime>ad&&n!==536870912&&(t.flags|=128,o=!0,Hr(a,!1),t.lanes=4194304);a.isBackwards?(s.sibling=t.child,t.child=s):(e=a.last,e===null?t.child=s:e.sibling=s,a.last=s)}return a.tail===null?(Ur(t),null):(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=Lc(),e.sibling=null,n=tu.current,g(tu,o?n&1|2:n&1),ml&&se(t,a.treeForkCount),e);case 22:case 23:return At(t),Tt(),a=t.memoizedState!==null,e===null?a&&(t.flags|=8192):e.memoizedState!==null!==a&&(t.flags|=8192),a?n&536870912&&!(t.flags&128)&&(Ur(t),t.subtreeFlags&6&&(t.flags|=8192)):Ur(t),n=t.updateQueue,n!==null&&Vr(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&h(Il),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),we(wl),Ur(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Gr(e,t){switch(ue(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return we(wl),pe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return he(t),null;case 31:if(t.memoizedState!==null){if(At(t),t.alternate===null)throw Error(r(340));be()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(At(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));be()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return h(tu),null;case 4:return pe(),null;case 10:return we(t.type),null;case 22:case 23:return At(t),Tt(),e!==null&&h(Il),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return we(wl),null;case 25:return null;default:return null}}function Kr(e,t){switch(ue(t),t.tag){case 3:we(wl),pe();break;case 26:case 27:case 5:he(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&At(t);break;case 13:At(t);break;case 19:h(tu);break;case 10:we(t.type);break;case 22:case 23:At(t),Tt(),e!==null&&h(Il);break;case 24:we(wl)}}function qr(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var a=r.next;n=a;do{if((n.tag&e)===e){r=void 0;var o=n.create,s=n.inst;r=o(),s.destroy=r}n=n.next}while(n!==a)}}catch(e){_a(t,t.return,e)}}function Jr(e,t,n){try{var r=t.updateQueue,a=r===null?null:r.lastEffect;if(a!==null){var o=a.next;r=o;do{if((r.tag&e)===e){var s=r.inst,c=s.destroy;if(c!==void 0){s.destroy=void 0,a=t;var l=n,u=c;try{u()}catch(e){_a(a,l,e)}}}r=r.next}while(r!==o)}}catch(e){_a(t,t.return,e)}}function Yr(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{St(t,n)}catch(t){_a(e,e.return,t)}}}function Xr(e,t,n){n.props=Zn(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){_a(e,t,n)}}function Zr(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=uo(e.stateNode);break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){_a(e,t,n)}}function Qr(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){_a(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){_a(e,t,n)}else n.current=null}function $r(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{is(r,t,n,e)}catch(t){_a(e,e.return,t)}}function ei(e,t,n){try{as(e.stateNode,e.type,n,t,e)}catch(t){_a(e,e.return,t)}}function ti(e){return e.tag===5||e.tag===3||(ic?e.tag===26:!1)||(vc?e.tag===27&&Cc(e.type):!1)||e.tag===4}function ni(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||ti(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(vc&&e.tag===27&&Cc(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ri(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?ss(n,e,t):ns(n,e);else if(r!==4&&(vc&&r===27&&Cc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(ri(e,t,n),e=e.sibling;e!==null;)ri(e,t,n),e=e.sibling}function ii(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?os(n,e,t):ts(n,e);else if(r!==4&&(vc&&r===27&&Cc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(ii(e,t,n),e=e.sibling;e!==null;)ii(e,t,n),e=e.sibling}function ai(e,t,n){e=e.containerInfo;try{ys(e,n)}catch(e){_a(t,t.return,e)}}function oi(e){var t=e.stateNode,n=e.memoizedProps;try{bc(e.type,n,t,e)}catch(t){_a(e,e.return,t)}}function si(e,t){for(mo(e.containerInfo),Tu=t;Tu!==null;)if(e=Tu,t=e.child,e.subtreeFlags&1028&&t!==null)t.return=e,Tu=t;else for(;Tu!==null;){e=Tu;var n=e.alternate;switch(t=e.flags,e.tag){case 0:if(t&4&&(t=e.updateQueue,t=t===null?null:t.events,t!==null))for(var a=0;a<t.length;a++){var o=t[a];o.ref.impl=o.nextImpl}break;case 11:case 15:break;case 1:if(t&1024&&n!==null){t=void 0,a=e,o=n.memoizedProps,n=n.memoizedState;var s=a.stateNode;try{var c=Zn(a.type,o);t=s.getSnapshotBeforeUpdate(c,n),s.__reactInternalSnapshotBeforeUpdate=t}catch(e){_a(a,a.return,e)}}break;case 3:t&1024&&To&&ms(e.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(t&1024)throw Error(r(163))}if(t=e.sibling,t!==null){t.return=e.return,Tu=t;break}Tu=e.return}}function ci(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:bi(e,n),r&4&&qr(5,n);break;case 1:if(bi(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){_a(n,n.return,e)}else{var a=Zn(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){_a(n,n.return,e)}}r&64&&Yr(n),r&512&&Zr(n,n.return);break;case 3:if(bi(e,n),r&64&&(r=n.updateQueue,r!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=uo(n.child.stateNode);break;case 1:e=n.child.stateNode}try{St(r,e)}catch(e){_a(n,n.return,e)}}break;case 27:vc&&t===null&&r&4&&oi(n);case 26:case 5:if(bi(e,n),t===null){if(r&4)$r(n);else if(r&64){e=n.type,t=n.memoizedProps,a=n.stateNode;try{Gs(a,e,t,n)}catch(e){_a(n,n.return,e)}}}r&512&&Zr(n,n.return);break;case 12:bi(e,n);break;case 31:bi(e,n),r&4&&fi(e,n);break;case 13:bi(e,n),r&4&&pi(e,n),r&64&&(r=n.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(n=xa.bind(null,n),Ts(r,n))));break;case 22:if(r=n.memoizedState!==null||xu,!r){t=t!==null&&t.memoizedState!==null||Su,a=xu;var o=Su;xu=r,(Su=t)&&!o?Si(e,n,(n.subtreeFlags&8772)!=0):bi(e,n),xu=a,Su=o}break;case 30:break;default:bi(e,n)}}function li(e){var t=e.alternate;t!==null&&(e.alternate=null,li(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Po(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ui(e,t,n){for(n=n.child;n!==null;)di(e,t,n),n=n.sibling}function di(e,t,n){if(Gc&&typeof Gc.onCommitFiberUnmount==`function`)try{Gc.onCommitFiberUnmount(Wc,n)}catch{}switch(n.tag){case 26:if(ic){Su||Qr(n,t),ui(e,t,n),n.memoizedState?lc(n.memoizedState):n.stateNode&&fc(n.stateNode);break}case 27:if(vc){Su||Qr(n,t);var r=Eu,a=Du;Cc(n.type)&&(Eu=n.stateNode,Du=!1),ui(e,t,n),xc(n.stateNode),Eu=r,Du=a;break}case 5:Su||Qr(n,t);case 6:if(To){if(r=Eu,a=Du,Eu=null,ui(e,t,n),Eu=r,Du=a,Eu!==null)if(Du)try{ls(Eu,n.stateNode)}catch(e){_a(n,t,e)}else try{cs(Eu,n.stateNode)}catch(e){_a(n,t,e)}}else ui(e,t,n);break;case 18:To&&Eu!==null&&(Du?Qs(Eu,n.stateNode):Zs(Eu,n.stateNode));break;case 4:To?(r=Eu,a=Du,Eu=n.stateNode.containerInfo,Du=!0,ui(e,t,n),Eu=r,Du=a):(Eo&&ai(n.stateNode,n,gs()),ui(e,t,n));break;case 0:case 11:case 14:case 15:Jr(2,n,t),Su||Jr(4,n,t),ui(e,t,n);break;case 1:Su||(Qr(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Xr(n,t,r)),ui(e,t,n);break;case 21:ui(e,t,n);break;case 22:Su=(r=Su)||n.memoizedState!==null,ui(e,t,n),Su=r;break;default:ui(e,t,n)}}function fi(e,t){if(Do&&t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{qs(e)}catch(e){_a(t,t.return,e)}}}function pi(e,t){if(Do&&t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Js(e)}catch(e){_a(t,t.return,e)}}function mi(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new wu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new wu),t;default:throw Error(r(435,e.tag))}}function hi(e,t){var n=mi(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Sa.bind(null,e,t);t.then(r,r)}})}function gi(e,t){var n=t.deletions;if(n!==null)for(var a=0;a<n.length;a++){var o=n[a],s=e,c=t;if(To){var l=c;a:for(;l!==null;){switch(l.tag){case 27:if(vc){if(Cc(l.type)){Eu=l.stateNode,Du=!1;break a}break}case 5:Eu=l.stateNode,Du=!1;break a;case 3:case 4:Eu=l.stateNode.containerInfo,Du=!0;break a}l=l.return}if(Eu===null)throw Error(r(160));di(s,c,o),Eu=null,Du=!1}else di(s,c,o);s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)_i(t,e),t=t.sibling}function _i(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:gi(t,e),vi(e),a&4&&(Jr(3,e,e.return),qr(3,e),Jr(5,e,e.return));break;case 1:gi(t,e),vi(e),a&512&&(Su||n===null||Qr(n,n.return)),a&64&&xu&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?a:n.concat(a))));break;case 26:if(ic){var o=Ou;if(gi(t,e),vi(e),a&512&&(Su||n===null||Qr(n,n.return)),a&4){a=n===null?null:n.memoizedState;var s=e.memoizedState;n===null?s===null?e.stateNode===null?e.stateNode=uc(o,e.type,e.memoizedProps,e):dc(o,e.type,e.stateNode):e.stateNode=cc(o,s,e.memoizedProps):a===s?s===null&&e.stateNode!==null&&ei(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&fc(n.stateNode):lc(a),s===null?dc(o,e.type,e.stateNode):cc(o,s,e.memoizedProps))}break}case 27:if(vc){gi(t,e),vi(e),a&512&&(Su||n===null||Qr(n,n.return)),n!==null&&a&4&&ei(e,e.memoizedProps,n.memoizedProps);break}case 5:if(gi(t,e),vi(e),a&512&&(Su||n===null||Qr(n,n.return)),To){if(e.flags&32){o=e.stateNode;try{us(o)}catch(t){_a(e,e.return,t)}}a&4&&e.stateNode!=null&&(o=e.memoizedProps,ei(e,o,n===null?o:n.memoizedProps)),a&1024&&(Cu=!0)}else Eo&&e.alternate!==null&&(e.alternate.stateNode=e.stateNode);break;case 6:if(gi(t,e),vi(e),a&4&&To){if(e.stateNode===null)throw Error(r(162));a=e.memoizedProps,n=n===null?a:n.memoizedProps,o=e.stateNode;try{rs(o,n,a)}catch(t){_a(e,e.return,t)}}break;case 3:if(ic?(mc(),o=Ou,Ou=oc(t.containerInfo),gi(t,e),Ou=o):gi(t,e),vi(e),a&4){if(To&&Do&&n!==null&&n.memoizedState.isDehydrated)try{Ks(t.containerInfo)}catch(t){_a(e,e.return,t)}if(Eo){a=t.containerInfo,n=t.pendingChildren;try{ys(a,n)}catch(t){_a(e,e.return,t)}}}Cu&&(Cu=!1,yi(e));break;case 4:ic?(n=Ou,Ou=oc(e.stateNode.containerInfo),gi(t,e),vi(e),Ou=n):(gi(t,e),vi(e)),a&4&&Eo&&ai(e.stateNode,e,e.stateNode.pendingChildren);break;case 12:gi(t,e),vi(e);break;case 31:gi(t,e),vi(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,hi(e,a)));break;case 13:gi(t,e),vi(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(rd=Lc()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,hi(e,a)));break;case 22:o=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,l=xu,u=Su;if(xu=l||o,Su=u||c,gi(t,e),Su=u,xu=l,vi(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(n===null||c||xu||Su||xi(e)),To)){a:if(n=null,To)for(t=e;;){if(t.tag===5||ic&&t.tag===26){if(n===null){c=n=t;try{s=c.stateNode,o?ds(s):fs(c.stateNode,c.memoizedProps)}catch(e){_a(c,c.return,e)}}}else if(t.tag===6){if(n===null){c=t;try{var d=c.stateNode;o?F(d):ps(d,c.memoizedProps)}catch(e){_a(c,c.return,e)}}}else if(t.tag===18){if(n===null){c=t;try{var f=c.stateNode;o?$s(f):ec(c.stateNode)}catch(e){_a(c,c.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}}a&4&&(a=e.updateQueue,a!==null&&(n=a.retryQueue,n!==null&&(a.retryQueue=null,hi(e,n))));break;case 19:gi(t,e),vi(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,hi(e,a)));break;case 30:break;case 21:break;default:gi(t,e),vi(e)}}function vi(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(ti(a)){n=a;break}a=a.return}if(To){if(n==null)throw Error(r(160));switch(n.tag){case 27:if(vc){var o=n.stateNode;ii(e,ni(e),o);break}case 5:var s=n.stateNode;n.flags&32&&(us(s),n.flags&=-33),ii(e,ni(e),s);break;case 3:case 4:var c=n.stateNode.containerInfo;ri(e,ni(e),c);break;default:throw Error(r(161))}}}catch(t){_a(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yi(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;yi(t),t.tag===5&&t.flags&1024&&Wo(t.stateNode),e=e.sibling}}function bi(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ci(e,t.alternate,t),t=t.sibling}function xi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Jr(4,t,t.return),xi(t);break;case 1:Qr(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Xr(t,t.return,n),xi(t);break;case 27:vc&&xc(t.stateNode);case 26:case 5:Qr(t,t.return),xi(t);break;case 22:t.memoizedState===null&&xi(t);break;case 30:xi(t);break;default:xi(t)}e=e.sibling}}function Si(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,a=e,o=t,s=o.flags;switch(o.tag){case 0:case 11:case 15:Si(a,o,n),qr(4,o);break;case 1:if(Si(a,o,n),r=o,a=r.stateNode,typeof a.componentDidMount==`function`)try{a.componentDidMount()}catch(e){_a(r,r.return,e)}if(r=o,a=r.updateQueue,a!==null){var c=r.stateNode;try{var l=a.shared.hiddenCallbacks;if(l!==null)for(a.shared.hiddenCallbacks=null,a=0;a<l.length;a++)xt(l[a],c)}catch(e){_a(r,r.return,e)}}n&&s&64&&Yr(o),Zr(o,o.return);break;case 27:vc&&oi(o);case 26:case 5:Si(a,o,n),n&&r===null&&s&4&&$r(o),Zr(o,o.return);break;case 12:Si(a,o,n);break;case 31:Si(a,o,n),n&&s&4&&fi(a,o);break;case 13:Si(a,o,n),n&&s&4&&pi(a,o);break;case 22:o.memoizedState===null&&Si(a,o,n),Zr(o,o.return);break;case 30:break;default:Si(a,o,n)}t=t.sibling}}function Ci(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Pe(n))}function wi(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Pe(e))}function Ti(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ei(e,t,n,r),t=t.sibling}function Ei(e,t,n,r){var a=t.flags;switch(t.tag){case 0:case 11:case 15:Ti(e,t,n,r),a&2048&&qr(9,t);break;case 1:Ti(e,t,n,r);break;case 3:Ti(e,t,n,r),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Pe(e)));break;case 12:if(a&2048){Ti(e,t,n,r),e=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){_a(t,t.return,e)}}else Ti(e,t,n,r);break;case 31:Ti(e,t,n,r);break;case 13:Ti(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?o._visibility&2?Ti(e,t,n,r):(o._visibility|=2,Di(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):o._visibility&2?Ti(e,t,n,r):Oi(e,t),a&2048&&Ci(s,t);break;case 24:Ti(e,t,n,r),a&2048&&wi(t.alternate,t);break;default:Ti(e,t,n,r)}}function Di(e,t,n,r,a){for(a&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var o=e,s=t,c=n,l=r,u=s.flags;switch(s.tag){case 0:case 11:case 15:Di(o,s,c,l,a),qr(8,s);break;case 23:break;case 22:var d=s.stateNode;s.memoizedState===null?(d._visibility|=2,Di(o,s,c,l,a)):d._visibility&2?Di(o,s,c,l,a):Oi(o,s),a&&u&2048&&Ci(s.alternate,s);break;case 24:Di(o,s,c,l,a),a&&u&2048&&wi(s.alternate,s);break;default:Di(o,s,c,l,a)}t=t.sibling}}function Oi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,a=r.flags;switch(r.tag){case 22:Oi(n,r),a&2048&&Ci(r.alternate,r);break;case 24:Oi(n,r),a&2048&&wi(r.alternate,r);break;default:Oi(n,r)}t=t.sibling}}function ki(e,t,n){if(e.subtreeFlags&ku)for(e=e.child;e!==null;)Ai(e,t,n),e=e.sibling}function Ai(e,t,n){switch(e.tag){case 26:if(ki(e,t,n),e.flags&ku)if(e.memoizedState!==null)_c(n,Ou,e.memoizedState,e.memoizedProps);else{var r=e.stateNode,a=e.type;e=e.memoizedProps,((t&335544128)===t||Lo(a,e))&&Bo(n,r,a,e)}break;case 5:ki(e,t,n),e.flags&ku&&(r=e.stateNode,a=e.type,e=e.memoizedProps,((t&335544128)===t||Lo(a,e))&&Bo(n,r,a,e));break;case 3:case 4:ic?(r=Ou,Ou=oc(e.stateNode.containerInfo),ki(e,t,n),Ou=r):ki(e,t,n);break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=ku,ku=16777216,ki(e,t,n),ku=r):ki(e,t,n));break;default:ki(e,t,n)}}function ji(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function j(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Tu=r,Pi(r,e)}ji(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Mi(e),e=e.sibling}function Mi(e){switch(e.tag){case 0:case 11:case 15:j(e),e.flags&2048&&Jr(9,e,e.return);break;case 3:j(e);break;case 12:j(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ni(e)):j(e);break;default:j(e)}}function Ni(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Tu=r,Pi(r,e)}ji(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Jr(8,t,t.return),Ni(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ni(t));break;default:Ni(t)}e=e.sibling}}function Pi(e,t){for(;Tu!==null;){var n=Tu;switch(n.tag){case 0:case 11:case 15:Jr(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Pe(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Tu=r;else a:for(n=e;Tu!==null;){r=Tu;var a=r.sibling,o=r.return;if(li(r),r===n){Tu=null;break a}if(a!==null){a.return=o,Tu=a;break a}Tu=o}}}function Fi(e){var t=Oo(e);if(t!=null){if(typeof t.memoizedProps[`data-testname`]!=`string`)throw Error(r(364));return t}if(e=Jo(e),e===null)throw Error(r(362));return e.stateNode.current}function Ii(e,t){var n=e.tag;switch(t.$$typeof){case ju:if(e.type===t.value)return!0;break;case Mu:a:{for(t=t.value,e=[e,0],n=0;n<e.length;){var a=e[n++],o=a.tag,s=e[n++],c=t[s];if(o!==5&&o!==26&&o!==27||!Zo(a)){for(;c!=null&&Ii(a,c);)s++,c=t[s];if(s===t.length){t=!0;break a}else for(a=a.child;a!==null;)e.push(a,s),a=a.sibling}}t=!1}return t;case Nu:if((n===5||n===26||n===27)&&Qo(e.stateNode,t.value))return!0;break;case Fu:if((n===5||n===6||n===26||n===27)&&(e=Xo(e),e!==null&&0<=e.indexOf(t.value)))return!0;break;case Pu:if((n===5||n===26||n===27)&&(e=e.memoizedProps[`data-testname`],typeof e==`string`&&e.toLowerCase()===t.value.toLowerCase()))return!0;break;default:throw Error(r(365))}return!1}function Li(e){switch(e.$$typeof){case ju:return`<`+(d(e.value)||`Unknown`)+`>`;case Mu:return`:has(`+(Li(e)||``)+`)`;case Nu:return`[role="`+e.value+`"]`;case Fu:return`"`+e.value+`"`;case Pu:return`[data-testname="`+e.value+`"]`;default:throw Error(r(365))}}function Ri(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var a=e[r++],o=a.tag,s=e[r++],c=t[s];if(o!==5&&o!==26&&o!==27||!Zo(a)){for(;c!=null&&Ii(a,c);)s++,c=t[s];if(s===t.length)n.push(a);else for(a=a.child;a!==null;)e.push(a,s),a=a.sibling}}return n}function zi(e,t){if(!qo)throw Error(r(363));e=Fi(e),e=Ri(e,t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var a=e[n++],o=a.tag;if(o===5||o===26||o===27)Zo(a)||t.push(a.stateNode);else for(a=a.child;a!==null;)e.push(a),a=a.sibling}return t}function Bi(){return Ru&2&&Vu!==0?Vu&-Vu:oo.T===null?Mo():We()}function Vi(){if(Qu===0)if(!(Vu&536870912)||ml){var e=jc;jc<<=1,!(jc&3932160)&&(jc=262144),Qu=e}else Qu=536870912;return e=$l.current,e!==null&&(e.flags|=32),Qu}function Hi(e,t,n){(e===zu&&(Hu===2||Hu===9)||e.cancelPendingCommit!==null)&&(Yi(e,0),Ki(e,Vu,Qu,!1)),w(e,n),(!(Ru&2)||e!==zu)&&(e===zu&&(!(Ru&2)&&(Xu|=n),Ju===4&&Ki(e,Vu,Qu,!1)),Ie(e))}function Ui(e,t,n){if(Ru&6)throw Error(r(327));var a=!n&&(t&127)==0&&(t&e.expiredLanes)===0||b(e,t),o=a?na(e,t):ea(e,t,!0),s=a;do{if(o===0){Gu&&!a&&Ki(e,t,0,!1);break}else{if(n=e.current.alternate,s&&!Gi(n)){o=ea(e,t,!1),s=!1;continue}if(o===2){if(s=t,e.errorRecoveryDisabledLanes&s)var c=0;else c=e.pendingLanes&-536870913,c=c===0?c&536870912?536870912:0:c;if(c!==0){t=c;a:{var l=e;o=ed;var u=Do&&l.current.memoizedState.isDehydrated;if(u&&(Yi(l,c).flags|=256),c=ea(l,c,!1),c!==2){if(Ku&&!u){l.errorRecoveryDisabledLanes|=s,Xu|=s,o=4;break a}s=td,td=o,s!==null&&(td===null?td=s:td.push.apply(td,s))}o=c}if(s=!1,o!==2)continue}}if(o===1){Yi(e,0),Ki(e,t,0,!0);break}a:{switch(a=e,s=o,s){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Ki(a,t,Qu,!Wu);break a;case 2:td=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(o=rd+300-Lc(),10<o)){if(Ki(a,t,Qu,!Wu),y(a,0,!0)!==0)break a;dd=t,a.timeoutHandle=xo(Wi.bind(null,a,n,td,od,nd,t,Qu,Xu,$u,Wu,s,`Throttled`,-0,0),o);break a}Wi(a,n,td,od,nd,t,Qu,Xu,$u,Wu,s,null,-0,0)}}break}while(1);Ie(e)}function Wi(e,t,n,r,a,o,s,c,l,u,d,f,p,m){if(e.timeoutHandle=Co,f=t.subtreeFlags,f&8192||(f&16785408)==16785408){f=zo(),Ai(t,o,f);var h=(o&62914560)===o?rd-Lc():(o&4194048)===o?id-Lc():0;if(h=Vo(f,h),h!==null){dd=o,e.cancelPendingCommit=h(la.bind(null,e,t,o,n,r,a,s,c,l,d,f,null,p,m)),Ki(e,o,s,!u);return}}la(e,t,o,n,r,a,s,c,l)}function Gi(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var a=n[r],o=a.getSnapshot;a=a.value;try{if(!Kc(o(),a))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ki(e,t,n,r){t&=~Zu,t&=~Xu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var a=t;0<a;){var o=31-Dc(a),s=1<<o;r[o]=-1,a&=~s}n!==0&&E(e,n,t)}function qi(){return Ru&6?!0:(Le(0,!1),!1)}function Ji(){if(Bu!==null){if(Hu===0)var e=Bu.return;else e=Bu,bl=yl=null,Bt(e),Hl=null,Ul=0,e=Bu;for(;e!==null;)Kr(e.alternate,e),e=e.return;Bu=null}}function Yi(e,t){var n=e.timeoutHandle;n!==Co&&(e.timeoutHandle=Co,So(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),dd=0,Ji(),zu=e,Bu=n=Ta(e.current,null),Vu=t,Hu=0,Uu=null,Wu=!1,Gu=b(e,t),Ku=!1,$u=Qu=Zu=Xu=Yu=Ju=0,td=ed=null,nd=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var a=31-Dc(r),o=1<<a;t|=e[a],r&=~o}return qu=t,st(),n}function Xi(e,t){ru=null,oo.H=pu,t===Ll||t===zl?(t=tt(),Hu=3):t===Rl?(t=tt(),Hu=4):Hu=t===vu?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Uu=t,Bu===null&&(Ju=1,Qn(e,A(t,e.current)))}function Zi(){var e=$l.current;return e===null?!0:(Vu&4194048)===Vu?eu===null:(Vu&62914560)===Vu||Vu&536870912?e===eu:!1}function Qi(){var e=oo.H;return oo.H=pu,e===null?pu:e}function M(){var e=oo.A;return oo.A=Au,e}function $i(){Ju=4,Wu||(Vu&4194048)!==Vu&&$l.current!==null||(Gu=!0),!(Yu&134217727)&&!(Xu&134217727)||zu===null||Ki(zu,Vu,Qu,!1)}function ea(e,t,n){var r=Ru;Ru|=2;var a=Qi(),o=M();(zu!==e||Vu!==t)&&(od=null,Yi(e,t)),t=!1;var s=Ju;a:do try{if(Hu!==0&&Bu!==null){var c=Bu,l=Uu;switch(Hu){case 8:Ji(),s=6;break a;case 3:case 2:case 9:case 6:$l.current===null&&(t=!0);var u=Hu;if(Hu=0,Uu=null,oa(e,c,l,u),n&&Gu){s=0;break a}break;default:u=Hu,Hu=0,Uu=null,oa(e,c,l,u)}}ta(),s=Ju;break}catch(t){Xi(e,t)}while(1);return t&&e.shellSuspendCounter++,bl=yl=null,Ru=r,oo.H=a,oo.A=o,Bu===null&&(zu=null,Vu=0,st()),s}function ta(){for(;Bu!==null;)ia(Bu)}function na(e,t){var n=Ru;Ru|=2;var a=Qi(),o=M();zu!==e||Vu!==t?(od=null,ad=Lc()+500,Yi(e,t)):Gu=b(e,t);a:do try{if(Hu!==0&&Bu!==null){t=Bu;var s=Uu;b:switch(Hu){case 1:Hu=0,Uu=null,oa(e,t,s,1);break;case 2:case 9:if(Qe(s)){Hu=0,Uu=null,aa(t);break}t=function(){Hu!==2&&Hu!==9||zu!==e||(Hu=7),Ie(e)},s.then(t,t);break a;case 3:Hu=7;break a;case 4:Hu=5;break a;case 7:Qe(s)?(Hu=0,Uu=null,aa(t)):(Hu=0,Uu=null,oa(e,t,s,7));break;case 5:var c=null;switch(Bu.tag){case 26:c=Bu.memoizedState;case 5:case 27:var l=Bu,u=l.type,d=l.pendingProps;if(c?gc(c):Ro(l.stateNode,u,d)){Hu=0,Uu=null;var f=l.sibling;if(f!==null)Bu=f;else{var p=l.return;p===null?Bu=null:(Bu=p,sa(p))}break b}}Hu=0,Uu=null,oa(e,t,s,5);break;case 6:Hu=0,Uu=null,oa(e,t,s,6);break;case 8:Ji(),Ju=6;break a;default:throw Error(r(462))}}ra();break}catch(t){Xi(e,t)}while(1);return bl=yl=null,oo.H=a,oo.A=o,Ru=n,Bu===null?(zu=null,Vu=0,st(),Ju):0}function ra(){for(;Bu!==null&&!Fc();)ia(Bu)}function ia(e){var t=jr(e.alternate,e,qu);e.memoizedProps=e.pendingProps,t===null?sa(e):Bu=t}function aa(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=gr(n,t,t.pendingProps,t.type,void 0,Vu);break;case 11:t=gr(n,t,t.pendingProps,t.type.render,t.ref,Vu);break;case 5:Bt(t);default:Kr(n,t),t=Bu=Ea(t,qu),t=jr(n,t,qu)}e.memoizedProps=e.pendingProps,t===null?sa(e):Bu=t}function oa(e,t,n,r){bl=yl=null,Bt(t),Hl=null,Ul=0;var a=t.return;try{if(rr(e,a,t,n,Vu)){Ju=1,Qn(e,A(n,e.current)),Bu=null;return}}catch(t){if(a!==null)throw Bu=a,t;Ju=1,Qn(e,A(n,e.current)),Bu=null;return}t.flags&32768?(ml||r===1?e=!0:Gu||Vu&536870912?e=!1:(Wu=e=!0,(r===2||r===9||r===3||r===6)&&(r=$l.current,r!==null&&r.tag===13&&(r.flags|=16384))),ca(t,e)):sa(t)}function sa(e){var t=e;do{if(t.flags&32768){ca(t,Wu);return}e=t.return;var n=Wr(t.alternate,t,qu);if(n!==null){Bu=n;return}if(t=t.sibling,t!==null){Bu=t;return}Bu=t=e}while(t!==null);Ju===0&&(Ju=5)}function ca(e,t){do{var n=Gr(e.alternate,e);if(n!==null){n.flags&=32767,Bu=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Bu=e;return}Bu=e=n}while(e!==null);Ju=6,Bu=null}function la(e,t,n,a,o,s,c,l,u){e.cancelPendingCommit=null;do ma();while(cd!==0);if(Ru&6)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(s=t.lanes|t.childLanes,s|=Jl,T(e,n,s,c,l,u),e===zu&&(Bu=zu=null,Vu=0),ud=t,ld=e,dd=n,fd=s,pd=o,md=a,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Ca(Bc,function(){return ha(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!=0,t.subtreeFlags&13878||a){a=oo.T,oo.T=null,o=jo(),Ao(2),c=Ru,Ru|=4;try{si(e,t,n)}finally{Ru=c,Ao(o),oo.T=a}}cd=1,ua(),da(),fa()}}function ua(){if(cd===1){cd=0;var e=ld,t=ud,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=oo.T,oo.T=null;var r=jo();Ao(2);var a=Ru;Ru|=4;try{_i(t,e),ho(e.containerInfo)}finally{Ru=a,Ao(r),oo.T=n}}e.current=t,cd=2}}function da(){if(cd===2){cd=0;var e=ld,t=ud,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=oo.T,oo.T=null;var r=jo();Ao(2);var a=Ru;Ru|=4;try{ci(e,t.alternate,t)}finally{Ru=a,Ao(r),oo.T=n}}cd=3}}function fa(){if(cd===4||cd===3){cd=0,Ic();var e=ld,t=ud,n=dd,r=md;t.subtreeFlags&10256||t.flags&10256?cd=5:(cd=0,ud=ld=null,pa(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(sd=null),te(n),t=t.stateNode,Gc&&typeof Gc.onCommitFiberRoot==`function`)try{Gc.onCommitFiberRoot(Wc,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=oo.T,a=jo(),Ao(2),oo.T=null;try{for(var o=e.onRecoverableError,s=0;s<r.length;s++){var c=r[s];o(c.value,{componentStack:c.stack})}}finally{oo.T=t,Ao(a)}}dd&3&&ma(),Ie(e),a=e.pendingLanes,n&261930&&a&42?e===gd?hd++:(hd=0,gd=e):hd=0,Do&&Xs(),Le(0,!1)}}function pa(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Pe(t)))}function ma(){return ua(),da(),fa(),ha()}function ha(){if(cd!==5)return!1;var e=ld,t=fd;fd=0;var n=te(dd),a=32>n?32:n;n=oo.T;var o=jo();try{Ao(a),oo.T=null,a=pd,pd=null;var s=ld,c=dd;if(cd=0,ud=ld=null,dd=0,Ru&6)throw Error(r(331));var l=Ru;if(Ru|=4,Mi(s.current),Ei(s,s.current,c,a),Ru=l,Le(0,!1),Gc&&typeof Gc.onPostCommitFiberRoot==`function`)try{Gc.onPostCommitFiberRoot(Wc,s)}catch{}return!0}finally{Ao(o),oo.T=n,pa(e,t)}}function ga(e,t,n){t=A(n,t),t=er(e.stateNode,t,2),e=gt(e,t,2),e!==null&&(w(e,2),Ie(e))}function _a(e,t,n){if(e.tag===3)ga(e,e,n);else for(;t!==null;){if(t.tag===3){ga(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(sd===null||!sd.has(r))){e=A(n,e),n=tr(2),r=gt(t,n,2),r!==null&&(nr(n,r,t,e),w(r,2),Ie(r));break}}t=t.return}}function va(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Lu;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(Ku=!0,a.add(n),e=ya.bind(null,e,t,n),t.then(e,e))}function ya(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,zu===e&&(Vu&n)===n&&(Ju===4||Ju===3&&(Vu&62914560)===Vu&&300>Lc()-rd?!(Ru&2)&&Yi(e,0):Zu|=n,$u===Vu&&($u=0)),Ie(e)}function ba(e,t){t===0&&(t=S()),e=ut(e,t),e!==null&&(w(e,t),Ie(e))}function xa(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ba(e,n)}function Sa(e,t){var n=0;switch(e.tag){case 31:case 13:var a=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(r(314))}a!==null&&a.delete(t),ba(e,n)}function Ca(e,t){return Nc(e,t)}function N(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ta(e,n){var r=e.alternate;return r===null?(r=t(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function Ea(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Da(e,n,a,o,s,c){var l=0;if(o=e,typeof e==`function`)wa(e)&&(l=1);else if(typeof e==`string`)l=ic&&vc?ac(e,a,cl.current)?26:Sc(e)?27:5:ic?ac(e,a,cl.current)?26:5:vc&&Sc(e)?27:5;else a:switch(e){case to:return e=t(31,a,n,s),e.elementType=to,e.lanes=c,e;case Ga:return Oa(a.children,s,c,n);case Ka:l=8,s|=24;break;case qa:return e=t(12,a,n,s|2),e.elementType=qa,e.lanes=c,e;case Za:return e=t(13,a,n,s),e.elementType=Za,e.lanes=c,e;case Qa:return e=t(19,a,n,s),e.elementType=Qa,e.lanes=c,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case Ya:l=10;break a;case Ja:l=9;break a;case Xa:l=11;break a;case $a:l=14;break a;case eo:l=16,o=null;break a}l=29,a=Error(r(130,e===null?`null`:typeof e,``)),o=null}return n=t(l,a,n,s),n.elementType=e,n.type=o,n.lanes=c,n}function Oa(e,n,r,a){return e=t(7,e,a,n),e.lanes=r,e}function ka(e,n,r){return e=t(6,e,null,n),e.lanes=r,e}function Aa(e){var n=t(18,null,null,0);return n.stateNode=e,n}function ja(e,n,r){return n=t(4,e.children===null?[]:e.children,e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Ma(e,t,n,r,a,o,s,c,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Co,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=C(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=C(0),this.hiddenUpdates=C(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=o,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function P(e,n,r,a,o,s,c,l,u,d,f,p){return e=new Ma(e,n,r,c,u,d,f,p,l),n=1,!0===s&&(n|=24),s=t(3,null,null,n),e.current=s,s.stateNode=e,n=Ne(),n.refCount++,e.pooledCache=n,n.refCount++,s.memoizedState={element:a,isDehydrated:r,cache:n},pt(s),e}function Na(e){return e?(e=Ec,e):Ec}function Pa(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=s(t),e=e===null?null:c(e),e===null?null:uo(e.stateNode)}function Fa(e,t,n,r,a,o){a=Na(a),r.context===null?r.context=a:r.pendingContext=a,r=ht(t),r.payload={element:n},o=o===void 0?null:o,o!==null&&(r.callback=o),n=gt(e,r,t),n!==null&&(Hi(n,e,t),_t(n,e,t))}function Ia(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function La(e,t){Ia(e,t),(e=e.alternate)&&Ia(e,t)}var Ra={},za=m(),Ba=f(),Va=Object.assign,Ha=Symbol.for(`react.element`),Ua=Symbol.for(`react.transitional.element`),Wa=Symbol.for(`react.portal`),Ga=Symbol.for(`react.fragment`),Ka=Symbol.for(`react.strict_mode`),qa=Symbol.for(`react.profiler`),Ja=Symbol.for(`react.consumer`),Ya=Symbol.for(`react.context`),Xa=Symbol.for(`react.forward_ref`),Za=Symbol.for(`react.suspense`),Qa=Symbol.for(`react.suspense_list`),$a=Symbol.for(`react.memo`),eo=Symbol.for(`react.lazy`),to=Symbol.for(`react.activity`),no=Symbol.for(`react.memo_cache_sentinel`),ro=Symbol.iterator,io=Symbol.for(`react.client.reference`),ao=Array.isArray,oo=za.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,so=e.rendererVersion,co=e.rendererPackageName,lo=e.extraDevToolsConfig,uo=e.getPublicInstance,fo=e.getRootHostContext,po=e.getChildHostContext,mo=e.prepareForCommit,ho=e.resetAfterCommit,go=e.createInstance;e.cloneMutableInstance;var _o=e.appendInitialChild,vo=e.finalizeInitialChildren,yo=e.shouldSetTextContent,bo=e.createTextInstance;e.cloneMutableTextInstance;var xo=e.scheduleTimeout,So=e.cancelTimeout,Co=e.noTimeout,wo=e.isPrimaryRenderer;e.warnsIfNotActing;var To=e.supportsMutation,Eo=e.supportsPersistence,Do=e.supportsHydration,Oo=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var ko=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var Ao=e.setCurrentUpdatePriority,jo=e.getCurrentUpdatePriority,Mo=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var No=e.shouldAttemptEagerTransition,Po=e.detachDeletedInstance;e.requestPostPaintCallback;var Fo=e.maySuspendCommit,Io=e.maySuspendCommitOnUpdate,Lo=e.maySuspendCommitInSyncRender,Ro=e.preloadInstance,zo=e.startSuspendingCommit,Bo=e.suspendInstance;e.suspendOnActiveViewTransition;var Vo=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var Ho=e.NotPendingTransition,Uo=e.HostTransitionContext,Wo=e.resetFormInstance;e.bindToConsole;var Go=e.supportsMicrotasks,Ko=e.scheduleMicrotask,qo=e.supportsTestSelectors,Jo=e.findFiberRoot,Yo=e.getBoundingRect,Xo=e.getTextContent,Zo=e.isHiddenSubtree,Qo=e.matchAccessibilityRole,$o=e.setFocusIfFocusable,es=e.setupIntersectionObserver,ts=e.appendChild,ns=e.appendChildToContainer,rs=e.commitTextUpdate,is=e.commitMount,as=e.commitUpdate,os=e.insertBefore,ss=e.insertInContainerBefore,cs=e.removeChild,ls=e.removeChildFromContainer,us=e.resetTextContent,ds=e.hideInstance,F=e.hideTextInstance,fs=e.unhideInstance,ps=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var ms=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var hs=e.cloneInstance,gs=e.createContainerChildSet,_s=e.appendChildToContainerChildSet,vs=e.finalizeContainerChildren,ys=e.replaceContainerChildren,bs=e.cloneHiddenInstance,xs=e.cloneHiddenTextInstance,Ss=e.isSuspenseInstancePending,Cs=e.isSuspenseInstanceFallback,ws=e.getSuspenseInstanceFallbackErrorDetails,Ts=e.registerSuspenseInstanceRetry,Es=e.canHydrateFormStateMarker,Ds=e.isFormStateMarkerMatching,Os=e.getNextHydratableSibling,ks=e.getNextHydratableSiblingAfterSingleton,As=e.getFirstHydratableChild,js=e.getFirstHydratableChildWithinContainer,Ms=e.getFirstHydratableChildWithinActivityInstance,Ns=e.getFirstHydratableChildWithinSuspenseInstance,Ps=e.getFirstHydratableChildWithinSingleton,Fs=e.canHydrateInstance,Is=e.canHydrateTextInstance,Ls=e.canHydrateActivityInstance,Rs=e.canHydrateSuspenseInstance,zs=e.hydrateInstance,Bs=e.hydrateTextInstance,Vs=e.hydrateActivityInstance,Hs=e.hydrateSuspenseInstance,Us=e.getNextHydratableInstanceAfterActivityInstance,Ws=e.getNextHydratableInstanceAfterSuspenseInstance,Gs=e.commitHydratedInstance,Ks=e.commitHydratedContainer,qs=e.commitHydratedActivityInstance,Js=e.commitHydratedSuspenseInstance,Ys=e.finalizeHydratedChildren,Xs=e.flushHydrationEvents;e.clearActivityBoundary;var Zs=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var Qs=e.clearSuspenseBoundaryFromContainer,$s=e.hideDehydratedBoundary,ec=e.unhideDehydratedBoundary,tc=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var nc=e.validateHydratableInstance,rc=e.validateHydratableTextInstance,ic=e.supportsResources,ac=e.isHostHoistableType,oc=e.getHoistableRoot,sc=e.getResource,cc=e.acquireResource,lc=e.releaseResource,uc=e.hydrateHoistable,dc=e.mountHoistable,fc=e.unmountHoistable,pc=e.createHoistableInstance,mc=e.prepareToCommitHoistables,hc=e.mayResourceSuspendCommit,gc=e.preloadResource,_c=e.suspendResource,vc=e.supportsSingletons,yc=e.resolveSingletonInstance,bc=e.acquireSingletonInstance,xc=e.releaseSingletonInstance,Sc=e.isHostSingletonType,Cc=e.isSingletonScope,wc=[],Tc=-1,Ec={},Dc=Math.clz32?Math.clz32:_,Oc=Math.log,kc=Math.LN2,Ac=256,jc=262144,Mc=4194304,Nc=Ba.unstable_scheduleCallback,Pc=Ba.unstable_cancelCallback,Fc=Ba.unstable_shouldYield,Ic=Ba.unstable_requestPaint,Lc=Ba.unstable_now,Rc=Ba.unstable_ImmediatePriority,zc=Ba.unstable_UserBlockingPriority,Bc=Ba.unstable_NormalPriority,Vc=Ba.unstable_IdlePriority,Hc=Ba.log,Uc=Ba.unstable_setDisableYieldValue,Wc=null,Gc=null,Kc=typeof Object.is==`function`?Object.is:re,qc=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)},Jc=Object.prototype.hasOwnProperty,Yc,Xc,Zc=!1,Qc=new WeakMap,$c=[],el=0,tl=null,nl=0,rl=[],il=0,al=null,ol=1,sl=``,cl=p(null),ll=p(null),ul=p(null),dl=p(null),fl=null,pl=null,ml=!1,hl=null,gl=!1,_l=Error(r(519)),vl=p(null),yl=null,bl=null,xl=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Sl=Ba.unstable_scheduleCallback,Cl=Ba.unstable_NormalPriority,wl={$$typeof:Ya,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Tl=null,El=null,Dl=!1,Ol=!1,kl=!1,Al=0,jl=null,Ml=0,Nl=0,Pl=null,Fl=oo.S;oo.S=function(e,t){id=Lc(),typeof t==`object`&&t&&typeof t.then==`function`&&Ge(e,t),Fl!==null&&Fl(e,t)};var Il=p(null),Ll=Error(r(460)),Rl=Error(r(474)),zl=Error(r(542)),Bl={then:function(){}},Vl=null,Hl=null,Ul=0,Wl=ot(!0),Gl=ot(!1),Kl=[],ql=0,Jl=0,Yl=!1,Xl=!1,Zl=p(null),Ql=p(0),$l=p(null),eu=null,tu=p(0),nu=0,ru=null,iu=null,au=null,ou=!1,su=!1,cu=!1,lu=0,uu=0,du=null,fu=0,pu={readContext:Ae,use:Gt,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useLayoutEffect:Mt,useInsertionEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useSyncExternalStore:Mt,useId:Mt,useHostTransitionStatus:Mt,useFormState:Mt,useActionState:Mt,useOptimistic:Mt,useMemoCache:Mt,useCacheRefresh:Mt};pu.useEffectEvent=Mt;var mu={readContext:Ae,use:Gt,useCallback:function(e,t){return Vt().memoizedState=[e,t===void 0?null:t],e},useContext:Ae,useEffect:Sn,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),bn(4194308,4,On.bind(null,t,e),n)},useLayoutEffect:function(e,t){return bn(4194308,4,e,t)},useInsertionEffect:function(e,t){bn(4,2,e,t)},useMemo:function(e,t){var n=Vt();t=t===void 0?null:t;var r=e();if(cu){ne(!0);try{e()}finally{ne(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Vt();if(n!==void 0){var a=n(t);if(cu){ne(!0);try{n(t)}finally{ne(!1)}}}else a=t;return r.memoizedState=r.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},r.queue=e,e=e.dispatch=Vn.bind(null,ru,e),[r.memoizedState,e]},useRef:function(e){var t=Vt();return e={current:e},t.memoizedState=e},useState:function(e){e=rn(e);var t=e.queue,n=Hn.bind(null,ru,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:An,useDeferredValue:function(e,t){return Nn(Vt(),e,t)},useTransition:function(){var e=rn(!1);return e=Fn.bind(null,ru,e.queue,!0,!1),Vt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=ru,o=Vt();if(ml){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),zu===null)throw Error(r(349));Vu&127||Qt(a,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,Sn(en.bind(null,a,s,e),[e]),a.flags|=2048,vn(9,{destroy:void 0},$t.bind(null,a,s,n,t),null),n},useId:function(){var e=Vt(),t=zu.identifierPrefix;if(ml){var n=sl,r=ol;n=(r&~(1<<32-Dc(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=lu++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=fu++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ln,useFormState:pn,useActionState:pn,useOptimistic:function(e){var t=Vt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Wn.bind(null,ru,!0,n),n.dispatch=t,[e,t]},useMemoCache:Kt,useCacheRefresh:function(){return Vt().memoizedState=Bn.bind(null,ru)},useEffectEvent:function(e){var t=Vt(),n={impl:e};return t.memoizedState=n,function(){if(Ru&2)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},hu={readContext:Ae,use:Gt,useCallback:jn,useContext:Ae,useEffect:Cn,useImperativeHandle:kn,useInsertionEffect:En,useLayoutEffect:Dn,useMemo:Mn,useReducer:Jt,useRef:yn,useState:function(){return Jt(qt)},useDebugValue:An,useDeferredValue:function(e,t){return Pn(Ht(),iu.memoizedState,e,t)},useTransition:function(){var e=Jt(qt)[0],t=Ht().memoizedState;return[typeof e==`boolean`?e:Wt(e),t]},useSyncExternalStore:Zt,useId:Rn,useHostTransitionStatus:Ln,useFormState:mn,useActionState:mn,useOptimistic:function(e,t){return an(Ht(),iu,e,t)},useMemoCache:Kt,useCacheRefresh:zn};hu.useEffectEvent=Tn;var gu={readContext:Ae,use:Gt,useCallback:jn,useContext:Ae,useEffect:Cn,useImperativeHandle:kn,useInsertionEffect:En,useLayoutEffect:Dn,useMemo:Mn,useReducer:Xt,useRef:yn,useState:function(){return Xt(qt)},useDebugValue:An,useDeferredValue:function(e,t){var n=Ht();return iu===null?Nn(n,e,t):Pn(n,iu.memoizedState,e,t)},useTransition:function(){var e=Xt(qt)[0],t=Ht().memoizedState;return[typeof e==`boolean`?e:Wt(e),t]},useSyncExternalStore:Zt,useId:Rn,useHostTransitionStatus:Ln,useFormState:_n,useActionState:_n,useOptimistic:function(e,t){var n=Ht();return iu===null?(n.baseState=e,[e,n.queue.dispatch]):an(n,iu,e,t)},useMemoCache:Kt,useCacheRefresh:zn};gu.useEffectEvent=Tn;var _u={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Bi(),a=ht(r);a.payload=t,n!=null&&(a.callback=n),t=gt(e,a,r),t!==null&&(Hi(t,e,r),_t(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Bi(),a=ht(r);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=gt(e,a,r),t!==null&&(Hi(t,e,r),_t(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Bi(),r=ht(n);r.tag=2,t!=null&&(r.callback=t),t=gt(e,r,n),t!==null&&(Hi(t,e,n),_t(t,e,n))}},vu=Error(r(461)),yu=!1,bu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},xu=!1,Su=!1,Cu=!1,wu=typeof WeakSet==`function`?WeakSet:Set,Tu=null,Eu=null,Du=!1,Ou=null,ku=8192,Au={getCacheForType:function(e){var t=Ae(wl),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ae(wl).controller.signal}},ju=0,Mu=1,Nu=2,Pu=3,Fu=4;if(typeof Symbol==`function`&&Symbol.for){var Iu=Symbol.for;ju=Iu(`selector.component`),Mu=Iu(`selector.has_pseudo_class`),Nu=Iu(`selector.role`),Pu=Iu(`selector.test_id`),Fu=Iu(`selector.text`)}var Lu=typeof WeakMap==`function`?WeakMap:Map,Ru=0,zu=null,Bu=null,Vu=0,Hu=0,Uu=null,Wu=!1,Gu=!1,Ku=!1,qu=0,Ju=0,Yu=0,Xu=0,Zu=0,Qu=0,$u=0,ed=null,td=null,nd=!1,rd=0,id=0,ad=1/0,od=null,sd=null,cd=0,ld=null,ud=null,dd=0,fd=0,pd=null,md=null,hd=0,gd=null;return Ra.attemptContinuousHydration=function(e){if(e.tag===13||e.tag===31){var t=ut(e,67108864);t!==null&&Hi(t,e,67108864),La(e,67108864)}},Ra.attemptHydrationAtCurrentPriority=function(e){if(e.tag===13||e.tag===31){var t=Bi();t=ee(t);var n=ut(e,t);n!==null&&Hi(n,e,t),La(e,t)}},Ra.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if(e=e.stateNode,e.current.memoizedState.isDehydrated){var t=v(e.pendingLanes);if(t!==0){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var n=1<<31-Dc(t);e.entanglements[1]|=n,t&=~n}Ie(e),!(Ru&6)&&(ad=Lc()+500,Le(0,!1))}}break;case 31:case 13:t=ut(e,2),t!==null&&Hi(t,e,2),qi(),La(e,2)}},Ra.batchedUpdates=function(e,t){return e(t)},Ra.createComponentSelector=function(e){return{$$typeof:ju,value:e}},Ra.createContainer=function(e,t,n,r,a,o,s,c,l,u){return P(e,t,!1,null,n,r,o,null,s,c,l,u)},Ra.createHasPseudoClassSelector=function(e){return{$$typeof:Mu,value:e}},Ra.createHydrationContainer=function(e,t,n,r,a,o,s,c,l,u,d,f,p,m){return e=P(n,r,!0,e,a,o,c,m,l,u,d,f),e.context=Na(null),n=e.current,r=Bi(),r=ee(r),a=ht(r),a.callback=t??null,gt(n,a,r),t=r,e.current.lanes=t,w(e,t),Ie(e),e},Ra.createPortal=function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Wa,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}},Ra.createRoleSelector=function(e){return{$$typeof:Nu,value:e}},Ra.createTestNameSelector=function(e){return{$$typeof:Pu,value:e}},Ra.createTextSelector=function(e){return{$$typeof:Fu,value:e}},Ra.defaultOnCaughtError=function(e){console.error(e)},Ra.defaultOnRecoverableError=function(e){qc(e)},Ra.defaultOnUncaughtError=function(e){qc(e)},Ra.deferredUpdates=function(e){var t=oo.T,n=jo();try{return Ao(32),oo.T=null,e()}finally{Ao(n),oo.T=t}},Ra.discreteUpdates=function(e,t,n,r,a){var o=oo.T,s=jo();try{return Ao(2),oo.T=null,e(t,n,r,a)}finally{Ao(s),oo.T=o,Ru===0&&(ad=Lc()+500)}},Ra.findAllNodes=zi,Ra.findBoundingRects=function(e,t){if(!qo)throw Error(r(363));t=zi(e,t),e=[];for(var n=0;n<t.length;n++)e.push(Yo(t[n]));for(t=e.length-1;0<t;t--){n=e[t];for(var a=n.x,o=a+n.width,s=n.y,c=s+n.height,l=t-1;0<=l;l--)if(t!==l){var u=e[l],d=u.x,f=d+u.width,p=u.y,m=p+u.height;if(a>=d&&s>=p&&o<=f&&c<=m){e.splice(t,1);break}else if(!(a!==d||n.width!==u.width||m<s||p>c)){p>s&&(u.height+=p-s,u.y=s),m<c&&(u.height=c-p),e.splice(t,1);break}else if(!(s!==p||n.height!==u.height||f<a||d>o)){d>a&&(u.width+=d-a,u.x=a),f<o&&(u.width=o-d),e.splice(t,1);break}}}return e},Ra.findHostInstance=Pa,Ra.findHostInstanceWithNoPortals=function(e){return e=s(e),e=e===null?null:l(e),e===null?null:uo(e.stateNode)},Ra.findHostInstanceWithWarning=function(e){return Pa(e)},Ra.flushPassiveEffects=ma,Ra.flushSyncFromReconciler=function(e){var t=Ru;Ru|=1;var n=oo.T,r=jo();try{if(Ao(2),oo.T=null,e)return e()}finally{Ao(r),oo.T=n,Ru=t,!(Ru&6)&&Le(0,!1)}},Ra.flushSyncWork=qi,Ra.focusWithin=function(e,t){if(!qo)throw Error(r(363));for(e=Fi(e),t=Ri(e,t),t=Array.from(t),e=0;e<t.length;){var n=t[e++],a=n.tag;if(!Zo(n)){if((a===5||a===26||a===27)&&$o(n.stateNode))return!0;for(n=n.child;n!==null;)t.push(n),n=n.sibling}}return!1},Ra.getFindAllNodesFailureDescription=function(e,t){if(!qo)throw Error(r(363));var n=0,a=[];e=[Fi(e),0];for(var o=0;o<e.length;){var s=e[o++],c=s.tag,l=e[o++],u=t[l];if((c!==5&&c!==26&&c!==27||!Zo(s))&&(Ii(s,u)&&(a.push(Li(u)),l++,l>n&&(n=l)),l<t.length))for(s=s.child;s!==null;)e.push(s,l),s=s.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(Li(t[n]));return`findAllNodes was able to match part of the selector:
31
- `+(a.join(` > `)+`
32
-
33
- No matching component was found for:
34
- `)+e.join(` > `)}return null},Ra.getPublicRootInstance=function(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 27:case 5:return uo(e.child.stateNode);default:return e.child.stateNode}},Ra.injectIntoDevTools=function(){var e={bundleType:0,version:so,rendererPackageName:co,currentDispatcherRef:oo,reconcilerVersion:`19.2.0`};if(lo!==null&&(e.rendererConfig=lo),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{Wc=t.inject(e),Gc=t}catch{}e=!!t.checkDCE}}return e},Ra.isAlreadyRendering=function(){return(Ru&6)!=0},Ra.observeVisibleRects=function(e,t,n,a){if(!qo)throw Error(r(363));e=zi(e,t);var o=es(e,n,a).disconnect;return{disconnect:function(){o()}}},Ra.shouldError=function(){return null},Ra.shouldSuspend=function(){return!1},Ra.startHostTransition=function(e,t,a,o){if(e.tag!==5)throw Error(r(476));var s=In(e).queue;Fn(e,s,t,Ho,a===null?n:function(){var t=In(e);return t.next===null&&(t=e.alternate.memoizedState),Un(e,t.next.queue,{},Bi()),a(o)})},Ra.updateContainer=function(e,t,n,r){var a=t.current,o=Bi();return Fa(a,o,e,t,n,r),o},Ra.updateContainerSync=function(e,t,n,r){return Fa(t.current,2,e,t,n,r),2},Ra},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})})),Bl=s(((e,t)=>{t.exports=zl()})),Vl=s((e=>{e.ConcurrentRoot=1,e.DefaultEventPriority=32,e.DiscreteEventPriority=2})),Hl=s(((e,t)=>{t.exports=Vl()})),Ul=u(Bl()),Wl=Hl(),Gl={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0},Kl=!1,ql=!1,Jl=`.react-konva-event`,Yl=!1,Xl=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
35
- Position of a node will be changed during drag&drop, so you should update state of the react app as well.
36
- Consider to add onDragMove or onDragEnd events.
37
- For more info see: https://github.com/konvajs/react-konva/issues/256
38
- `,Zl=`ReactKonva: You are using "zIndex" attribute for a Konva node.
39
- react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
40
- For more info see: https://github.com/konvajs/react-konva/issues/194
41
- `,Ql={},$l=()=>{};function eu(e){$l=e}var tu=!1;function nu(e){return function(...t){let n=e.apply(this,t);if(!tu){tu=!0;try{$l()}finally{tu=!1}}return n}}function ru(e,t,n=Ql){if(!Kl&&`zIndex`in t&&(console.warn(Zl),Kl=!0),!ql&&t.draggable){var r=t.x!==void 0||t.y!==void 0,a=t.onDragEnd||t.onDragMove;r&&!a&&(console.warn(Xl),ql=!0)}for(var o in n)if(!Gl[o]){var s=o.slice(0,2)===`on`,c=n[o]!==t[o];if(s&&c){var l=o.substr(2).toLowerCase();l.substr(0,7)===`content`&&(l=`content`+l.substr(7,1).toUpperCase()+l.substr(8)),e.off(l+Jl)}t.hasOwnProperty(o)||e.setAttr(o,void 0)}var u=Yl||t._useStrictMode,d={},f=!1;let p={};for(var o in t)if(!Gl[o]){var s=o.slice(0,2)===`on`,m=n[o]!==t[o];if(s&&m){var l=o.substr(2).toLowerCase();l.substr(0,7)===`content`&&(l=`content`+l.substr(7,1).toUpperCase()+l.substr(8)),t[o]&&(p[l]=t[o])}!s&&(t[o]!==n[o]||u&&t[o]!==e.getAttr(o))&&(f=!0,d[o]=t[o])}for(var l in f&&(e.setAttrs(d),iu(e)),p)e.off(l+Jl),e.on(l+Jl,nu(p[l]))}function iu(e){if(!j.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}var au=c({HostTransitionContext:()=>sd,NotPendingTransition:()=>null,afterActiveInstanceBlur:()=>Wu,appendChild:()=>Du,appendChildToContainer:()=>Ou,appendInitialChild:()=>uu,beforeActiveInstanceBlur:()=>Uu,cancelTimeout:()=>wu,clearContainer:()=>Bu,commitMount:()=>Pu,commitTextUpdate:()=>Nu,commitUpdate:()=>Fu,createInstance:()=>du,createTextInstance:()=>fu,detachDeletedInstance:()=>Vu,finalizeInitialChildren:()=>pu,getChildHostContext:()=>Su,getCurrentEventPriority:()=>Gu,getCurrentUpdatePriority:()=>Yu,getInstanceFromNode:()=>Hu,getInstanceFromScope:()=>qu,getPublicInstance:()=>mu,getRootHostContext:()=>xu,hideInstance:()=>Iu,hideTextInstance:()=>Lu,idlePriority:()=>ou.unstable_IdlePriority,insertBefore:()=>ku,insertInContainerBefore:()=>Au,isPrimaryRenderer:()=>!1,maySuspendCommit:()=>nd,noTimeout:()=>-1,now:()=>ou.unstable_now,preloadInstance:()=>rd,prepareForCommit:()=>hu,preparePortalMount:()=>gu,prepareScopeUpdate:()=>Ku,prepareUpdate:()=>_u,removeChild:()=>ju,removeChildFromContainer:()=>Mu,requestPostPaintCallback:()=>td,resetAfterCommit:()=>vu,resetFormInstance:()=>cd,resetTextContent:()=>yu,resolveEventTimeStamp:()=>ed,resolveEventType:()=>$u,resolveUpdatePriority:()=>Xu,run:()=>ou.unstable_runWithPriority,scheduleMicrotask:()=>Tu,scheduleTimeout:()=>Cu,setCurrentUpdatePriority:()=>Ju,shouldAttemptEagerTransition:()=>Zu,shouldDeprioritizeSubtree:()=>bu,shouldSetTextContent:()=>Eu,startSuspendingCommit:()=>id,supportsHydration:()=>!1,supportsMicrotasks:()=>!0,supportsMutation:()=>!0,supportsPersistence:()=>!1,suspendInstance:()=>ad,trackSchedulerEvent:()=>Qu,unhideInstance:()=>Ru,unhideTextInstance:()=>zu,waitForCommitToBeReady:()=>od,warnsIfNotActing:()=>!1}),ou=f(),su={},cu={};Rl.Node.prototype._applyProps=ru;var lu=Wl.DefaultEventPriority;function uu(e,t){if(typeof t==`string`){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),iu(e)}function du(e,t,n){let r=Rl[e];r||=(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),Rl.Group);let a={},o={};for(var s in t)s!==`ref`&&(s.slice(0,2)===`on`?o[s]=t[s]:a[s]=t[s]);let c=new r(a);return ru(c,o),c}function fu(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function pu(e,t,n){return!1}function mu(e){return e}function hu(){return null}function gu(){return null}function _u(e,t,n,r){return cu}function vu(){}function yu(e){}function bu(e,t){return!1}function xu(){return su}function Su(){return su}var Cu=setTimeout,wu=clearTimeout,Tu=typeof queueMicrotask==`function`?queueMicrotask:e=>Promise.resolve(null).then(e);function Eu(e,t){return!1}function Du(e,t){t.parent===e?t.moveToTop():e.add(t),iu(e)}function Ou(e,t){t.parent===e?t.moveToTop():e.add(t),iu(e)}function ku(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),iu(e)}function Au(e,t,n){ku(e,t,n)}function ju(e,t){t.destroy(),t.off(Jl),iu(e)}function Mu(e,t){t.destroy(),t.off(Jl),iu(e)}function Nu(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function Pu(e,t,n){}function Fu(e,t,n,r){ru(e,r,n)}function Iu(e){e.hide(),iu(e)}function Lu(e){}function Ru(e,t){(t.visible==null||t.visible)&&e.show()}function zu(e,t){}function Bu(e){}function Vu(){}function Hu(){return null}function Uu(){}function Wu(){}function Gu(){return Wl.DefaultEventPriority}function Ku(){}function qu(){return null}function Ju(e){lu=e}function Yu(){return lu}function Xu(){return Wl.DiscreteEventPriority}function Zu(){return!1}function Qu(){}function $u(){return null}function ed(){return-1.1}function td(){}function nd(){return!1}function rd(){return!0}function id(){}function ad(){}function od(){return null}var sd=S.createContext(null);function cd(){}typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)?S.useLayoutEffect:S.useEffect;function ld(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){let e=ld(r,t,n);if(e)return e;r=t?null:r.sibling}}function ud(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}var dd=ud(S.createContext(null)),fd=class extends S.Component{render(){return S.createElement(dd.Provider,{value:this._reactInternals},this.props.children)}};function pd(){let e=S.useContext(dd);if(e===null)throw Error(`its-fine: useFiber must be called within a <FiberProvider />!`);let t=S.useId();return S.useMemo(()=>{for(let n of[e,e?.alternate]){if(!n)continue;let e=ld(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}var md=Symbol.for(`react.context`),hd=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===md;function gd(){let e=pd(),[t]=S.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;hd(e)&&e!==dd&&!t.has(e)&&t.set(e,S.use(ud(e))),n=n.return}return t}function _d(){let e=gd();return S.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>S.createElement(t,null,S.createElement(n.Provider,{...r,value:e.get(n)})),e=>S.createElement(fd,{...e})),[e])}function vd(e){let t=S.useRef({});return S.useLayoutEffect(()=>{t.current=e}),S.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}var yd=()=>{let e=S.useRef(0);return S.useMemo(()=>{e.current++},[]),e.current>1},bd=e=>{let t=S.useRef(null),n=S.useRef(null),r=S.useRef(null),a=vd(e),o=_d(),s=S.useRef(null),c=t=>{let{forwardedRef:n}=e;n&&(typeof n==`function`?n(t):n.current=t)},l=yd(),u=()=>{c(null),Od.flushSyncFromReconciler(()=>{Od.updateContainer(null,r.current,null)}),n.current?.destroy(),n.current=null};return S.useLayoutEffect(()=>(s.current&&=(clearTimeout(s.current),null),n.current?c(n.current):(n.current=new Rl.Stage({width:e.width,height:e.height,container:t.current}),c(n.current),r.current=Od.createContainer(n.current,Wl.ConcurrentRoot,null,!1,null,``,console.error,console.error,console.error,null),Od.updateContainer(S.createElement(o,{},e.children),r.current,null,()=>{})),()=>{l?s.current=setTimeout(u,0):u()}),[]),S.useLayoutEffect(()=>{c(n.current),ru(n.current,e,a),Od.updateContainer(S.createElement(o,{},e.children),r.current,null),Od.flushSyncWork()}),S.createElement(`div`,{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},xd=`Layer`,Sd=`Group`,Cd=`Rect`,wd=`Circle`,Td=`Line`,Ed=`Text`,Dd=`Arrow`,Od=(0,Ul.default)(au);eu(()=>Od.flushSyncWork());var kd=S.forwardRef((e,t)=>S.createElement(fd,{},S.createElement(bd,{...e,forwardedRef:t}))),Ad;function I(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let a=s.prototype,o=Object.keys(a);for(let e=0;e<o.length;e++){let t=o[e];t in n||(n[t]=a[t].bind(n))}}let a=n?.Parent??Object;class o extends a{}Object.defineProperty(o,"name",{value:e});function s(e){var t;let a=n?.Parent?new o:this;r(a,e),(t=a._zod).deferred??(t.deferred=[]);for(let e of a._zod.deferred)e();return a}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var jd=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Md=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ad=globalThis).__zod_globalConfig??(Ad.__zod_globalConfig={});var Nd=globalThis.__zod_globalConfig;function Pd(e){return e&&Object.assign(Nd,e),Nd}function Fd(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Id(e,t){return typeof t==`bigint`?t.toString():t}function Ld(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Rd(e){return e==null}function zd(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Bd(e,t){let n=e/t,r=Math.round(n),a=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<a?0:n-r}var Vd=Symbol(`evaluating`);function Hd(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Vd)return r===void 0&&(r=Vd,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ud(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Wd(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Gd(e){return JSON.stringify(e)}function Kd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var qd=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Jd(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Yd=Ld(()=>{if(Nd.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Xd(e){if(Jd(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Jd(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Zd(e){return Xd(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Qd=new Set([`string`,`number`,`symbol`]);function $d(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ef(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function tf(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function nf(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var rf={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function af(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return ef(e,Wd(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ud(this,`shape`,e),e},checks:[]}))}function of(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return ef(e,Wd(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ud(this,`shape`,r),r},checks:[]}))}function sf(e,t){if(!Xd(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ef(e,Wd(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ud(this,`shape`,n),n}}))}function cf(e,t){if(!Xd(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ef(e,Wd(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ud(this,`shape`,n),n}}))}function lf(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return ef(e,Wd(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ud(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function uf(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return ef(t,Wd(t._zod.def,{get shape(){let r=t._zod.def.shape,a={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(a[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)a[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ud(this,`shape`,a),a},checks:[]}))}function df(e,t,n){return ef(t,Wd(t._zod.def,{get shape(){let r=t._zod.def.shape,a={...r};if(n)for(let t in n){if(!(t in a))throw Error(`Unrecognized key: "${t}"`);n[t]&&(a[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)a[t]=new e({type:`nonoptional`,innerType:r[t]});return Ud(this,`shape`,a),a}}))}function ff(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function pf(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function mf(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function hf(e){return typeof e==`string`?e:e?.message}function gf(e,t,n){let r=e.message?e.message:hf(e.inst?._zod.def?.error?.(e))??hf(t?.error?.(e))??hf(n.customError?.(e))??hf(n.localeError?.(e))??`Invalid input`,{inst:a,continue:o,input:s,...c}=e;return c.path??=[],c.message=r,t?.reportInput&&(c.input=s),c}function _f(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function vf(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var yf=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Id,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bf=I(`$ZodError`,yf),xf=I(`$ZodError`,yf,{Parent:Error});function Sf(e,t=e=>e.message){let n={},r=[];for(let a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}function Cf(e,t=e=>e.message){let n={_errors:[]},r=(e,a=[])=>{for(let o of e.issues)if(o.code===`invalid_union`&&o.errors.length)o.errors.map(e=>r({issues:e},[...a,...o.path]));else if(o.code===`invalid_key`)r({issues:o.issues},[...a,...o.path]);else if(o.code===`invalid_element`)r({issues:o.issues},[...a,...o.path]);else{let e=[...a,...o.path];if(e.length===0)n._errors.push(t(o));else{let r=n,a=0;for(;a<e.length;){let n=e[a];a===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(o))):r[n]=r[n]||{_errors:[]},r=r[n],a++}}}};return r(e),n}var wf=e=>(t,n,r,a)=>{let o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new jd;if(s.issues.length){let t=new(a?.Err??e)(s.issues.map(e=>gf(e,o,Pd())));throw qd(t,a?.callee),t}return s.value},Tf=e=>async(t,n,r,a)=>{let o=r?{...r,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let t=new(a?.Err??e)(s.issues.map(e=>gf(e,o,Pd())));throw qd(t,a?.callee),t}return s.value},Ef=e=>(t,n,r)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new jd;return o.issues.length?{success:!1,error:new(e??bf)(o.issues.map(e=>gf(e,a,Pd())))}:{success:!0,data:o.value}},Df=Ef(xf),Of=e=>async(t,n,r)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>gf(e,a,Pd())))}:{success:!0,data:o.value}},kf=Of(xf),Af=e=>(t,n,r)=>{let a=r?{...r,direction:`backward`}:{direction:`backward`};return wf(e)(t,n,a)},jf=e=>(t,n,r)=>wf(e)(t,n,r),Mf=e=>async(t,n,r)=>{let a=r?{...r,direction:`backward`}:{direction:`backward`};return Tf(e)(t,n,a)},Nf=e=>async(t,n,r)=>Tf(e)(t,n,r),Pf=e=>(t,n,r)=>{let a=r?{...r,direction:`backward`}:{direction:`backward`};return Ef(e)(t,n,a)},Ff=e=>(t,n,r)=>Ef(e)(t,n,r),If=e=>async(t,n,r)=>{let a=r?{...r,direction:`backward`}:{direction:`backward`};return Of(e)(t,n,a)},Lf=e=>async(t,n,r)=>Of(e)(t,n,r),Rf=/^[cC][0-9a-z]{6,}$/,zf=/^[0-9a-z]+$/,Bf=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Vf=/^[0-9a-vA-V]{20}$/,Hf=/^[A-Za-z0-9]{27}$/,Uf=/^[a-zA-Z0-9_-]{21}$/,Wf=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Gf=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Kf=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,qf=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Jf=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Yf(){return new RegExp(Jf,`u`)}var Xf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Qf=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,$f=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ep=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tp=/^[A-Za-z0-9_-]*$/,np=/^https?$/,rp=/^\+[1-9]\d{6,14}$/,ip=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,ap=RegExp(`^${ip}$`);function op(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function sp(e){return RegExp(`^${op(e)}$`)}function cp(e){let t=op({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${ip}T(?:${r})$`)}var lp=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},up=/^-?\d+$/,dp=/^-?\d+(?:\.\d+)?$/,fp=/^(?:true|false)$/i,pp=/^null$/i,mp=/^[^A-Z]*$/,hp=/^[^a-z]*$/,gp=I(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),_p={number:`number`,bigint:`bigint`,object:`date`},vp=I(`$ZodCheckLessThan`,(e,t)=>{gp.init(e,t);let n=_p[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yp=I(`$ZodCheckGreaterThan`,(e,t)=>{gp.init(e,t);let n=_p[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bp=I(`$ZodCheckMultipleOf`,(e,t)=>{gp.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Bd(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),xp=I(`$ZodCheckNumberFormat`,(e,t)=>{gp.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[a,o]=rf[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=a,r.maximum=o,n&&(r.pattern=up)}),e._zod.check=s=>{let c=s.value;if(n){if(!Number.isInteger(c)){s.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:c,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}c<a&&s.issues.push({origin:`number`,input:c,code:`too_small`,minimum:a,inclusive:!0,inst:e,continue:!t.abort}),c>o&&s.issues.push({origin:`number`,input:c,code:`too_big`,maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Sp=I(`$ZodCheckMaxLength`,(e,t)=>{var n;gp.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Rd(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let a=_f(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cp=I(`$ZodCheckMinLength`,(e,t)=>{var n;gp.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Rd(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let a=_f(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wp=I(`$ZodCheckLengthEquals`,(e,t)=>{var n;gp.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Rd(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,a=r.length;if(a===t.length)return;let o=_f(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Tp=I(`$ZodCheckStringFormat`,(e,t)=>{var n,r;gp.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ep=I(`$ZodCheckRegex`,(e,t)=>{Tp.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Dp=I(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=mp,Tp.init(e,t)}),Op=I(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=hp,Tp.init(e,t)}),kp=I(`$ZodCheckIncludes`,(e,t)=>{gp.init(e,t);let n=$d(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ap=I(`$ZodCheckStartsWith`,(e,t)=>{gp.init(e,t);let n=RegExp(`^${$d(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),jp=I(`$ZodCheckEndsWith`,(e,t)=>{gp.init(e,t);let n=RegExp(`.*${$d(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Mp=I(`$ZodCheckOverwrite`,(e,t)=>{gp.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Np=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
42
- `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
43
- `))}},Pp={major:4,minor:4,patch:3},Fp=I(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pp;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ff(e),a;for(let o of t){if(o._zod.def.when){if(pf(e)||!o._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&n?.async===!1)throw new jd;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(r||=ff(e,t))});else{if(e.issues.length===t)continue;r||=ff(e,t)}}return a?a.then(()=>e):e},n=(n,a,o)=>{if(ff(n))return n.aborted=!0,n;let s=t(a,r,o);if(s instanceof Promise){if(o.async===!1)throw new jd;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction===`backward`){let t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,a,o)):n(t,a,o)}let s=e._zod.parse(a,o);if(s instanceof Promise){if(o.async===!1)throw new jd;return s.then(e=>t(e,r,o))}return t(s,r,o)}}Hd(e,`~standard`,()=>({validate:t=>{try{let n=Df(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return kf(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ip=I(`$ZodString`,(e,t)=>{Fp.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??lp(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Lp=I(`$ZodStringFormat`,(e,t)=>{Tp.init(e,t),Ip.init(e,t)}),Rp=I(`$ZodGUID`,(e,t)=>{t.pattern??=Gf,Lp.init(e,t)}),zp=I(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Kf(e)}else t.pattern??=Kf();Lp.init(e,t)}),Bp=I(`$ZodEmail`,(e,t)=>{t.pattern??=qf,Lp.init(e,t)}),Vp=I(`$ZodURL`,(e,t)=>{Lp.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===np.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let a=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(`:`)?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=a.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Hp=I(`$ZodEmoji`,(e,t)=>{t.pattern??=Yf(),Lp.init(e,t)}),Up=I(`$ZodNanoID`,(e,t)=>{t.pattern??=Uf,Lp.init(e,t)}),Wp=I(`$ZodCUID`,(e,t)=>{t.pattern??=Rf,Lp.init(e,t)}),Gp=I(`$ZodCUID2`,(e,t)=>{t.pattern??=zf,Lp.init(e,t)}),Kp=I(`$ZodULID`,(e,t)=>{t.pattern??=Bf,Lp.init(e,t)}),qp=I(`$ZodXID`,(e,t)=>{t.pattern??=Vf,Lp.init(e,t)}),Jp=I(`$ZodKSUID`,(e,t)=>{t.pattern??=Hf,Lp.init(e,t)}),Yp=I(`$ZodISODateTime`,(e,t)=>{t.pattern??=cp(t),Lp.init(e,t)}),Xp=I(`$ZodISODate`,(e,t)=>{t.pattern??=ap,Lp.init(e,t)}),Zp=I(`$ZodISOTime`,(e,t)=>{t.pattern??=sp(t),Lp.init(e,t)}),Qp=I(`$ZodISODuration`,(e,t)=>{t.pattern??=Wf,Lp.init(e,t)}),$p=I(`$ZodIPv4`,(e,t)=>{t.pattern??=Xf,Lp.init(e,t),e._zod.bag.format=`ipv4`}),em=I(`$ZodIPv6`,(e,t)=>{t.pattern??=Zf,Lp.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),tm=I(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Qf,Lp.init(e,t)}),nm=I(`$ZodCIDRv6`,(e,t)=>{t.pattern??=$f,Lp.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function rm(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var im=I(`$ZodBase64`,(e,t)=>{t.pattern??=ep,Lp.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{rm(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function am(e){if(!tp.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return rm(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var om=I(`$ZodBase64URL`,(e,t)=>{t.pattern??=tp,Lp.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{am(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),sm=I(`$ZodE164`,(e,t)=>{t.pattern??=rp,Lp.init(e,t)});function cm(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let a=JSON.parse(atob(r));return!(`typ`in a&&a?.typ!==`JWT`||!a.alg||t&&(!(`alg`in a)||a.alg!==t))}catch{return!1}}var lm=I(`$ZodJWT`,(e,t)=>{Lp.init(e,t),e._zod.check=n=>{cm(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),um=I(`$ZodNumber`,(e,t)=>{Fp.init(e,t),e._zod.pattern=e._zod.bag.pattern??dp,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let a=n.value;if(typeof a==`number`&&!Number.isNaN(a)&&Number.isFinite(a))return n;let o=typeof a==`number`?Number.isNaN(a)?`NaN`:Number.isFinite(a)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:a,inst:e,...o?{received:o}:{}}),n}}),dm=I(`$ZodNumberFormat`,(e,t)=>{xp.init(e,t),um.init(e,t)}),fm=I(`$ZodBoolean`,(e,t)=>{Fp.init(e,t),e._zod.pattern=fp,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let a=n.value;return typeof a==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:a,inst:e}),n}}),pm=I(`$ZodNull`,(e,t)=>{Fp.init(e,t),e._zod.pattern=pp,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),mm=I(`$ZodAny`,(e,t)=>{Fp.init(e,t),e._zod.parse=e=>e}),hm=I(`$ZodUnknown`,(e,t)=>{Fp.init(e,t),e._zod.parse=e=>e}),gm=I(`$ZodNever`,(e,t)=>{Fp.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),_m=I(`$ZodVoid`,(e,t)=>{Fp.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),vm=I(`$ZodDate`,(e,t)=>{Fp.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let a=n.value,o=a instanceof Date;return o&&!Number.isNaN(a.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:a,...o?{received:`Invalid Date`}:{},inst:e}),n}});function ym(e,t,n){e.issues.length&&t.issues.push(...mf(n,e.issues)),t.value[n]=e.value}var bm=I(`$ZodArray`,(e,t)=>{Fp.init(e,t),e._zod.parse=(n,r)=>{let a=n.value;if(!Array.isArray(a))return n.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),n;n.value=Array(a.length);let o=[];for(let e=0;e<a.length;e++){let s=a[e],c=t.element._zod.run({value:s,issues:[]},r);c instanceof Promise?o.push(c.then(t=>ym(t,n,e))):ym(c,n,e)}return o.length?Promise.all(o).then(()=>n):n}});function xm(e,t,n,r,a,o){let s=n in r;if(e.issues.length){if(a&&o&&!s)return;t.issues.push(...mf(n,e.issues))}if(!s&&!a){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?s&&(t.value[n]=void 0):t.value[n]=e.value}function Sm(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=nf(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Cm(e,t,n,r,a,o){let s=[],c=a.keySet,l=a.catchall._zod,u=l.def.type,d=l.optin===`optional`,f=l.optout===`optional`;for(let a in t){if(a===`__proto__`||c.has(a))continue;if(u===`never`){s.push(a);continue}let o=l.run({value:t[a],issues:[]},r);o instanceof Promise?e.push(o.then(e=>xm(e,n,a,t,d,f))):xm(o,n,a,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}var wm=I(`$ZodObject`,(e,t)=>{if(Fp.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Ld(()=>Sm(t));Hd(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Jd,a=t.catchall,o;e._zod.parse=(t,s)=>{o??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value={};let l=[],u=o.shape;for(let e of o.keys){let n=u[e],r=n._zod.optin===`optional`,a=n._zod.optout===`optional`,o=n._zod.run({value:c[e],issues:[]},s);o instanceof Promise?l.push(o.then(n=>xm(n,t,e,c,r,a))):xm(o,t,e,c,r,a)}return a?Cm(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),Tm=I(`$ZodObjectJIT`,(e,t)=>{wm.init(e,t);let n=e._zod.parse,r=Ld(()=>Sm(t)),a=e=>{let t=new Np([`shape`,`payload`,`ctx`]),n=r.value,a=e=>{let t=Gd(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let o=Object.create(null),s=0;for(let e of n.keys)o[e]=`key_${s++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=o[r],s=Gd(r),c=e[r],l=c?._zod?.optin===`optional`,u=c?._zod?.optout===`optional`;t.write(`const ${n} = ${a(r)};`),l&&u?t.write(`
44
- if (${n}.issues.length) {
45
- if (${s} in input) {
46
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
47
- ...iss,
48
- path: iss.path ? [${s}, ...iss.path] : [${s}]
49
- })));
50
- }
51
- }
52
-
53
- if (${n}.value === undefined) {
54
- if (${s} in input) {
55
- newResult[${s}] = undefined;
56
- }
57
- } else {
58
- newResult[${s}] = ${n}.value;
59
- }
60
-
61
- `):l?t.write(`
62
- if (${n}.issues.length) {
63
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
64
- ...iss,
65
- path: iss.path ? [${s}, ...iss.path] : [${s}]
66
- })));
67
- }
68
-
69
- if (${n}.value === undefined) {
70
- if (${s} in input) {
71
- newResult[${s}] = undefined;
72
- }
73
- } else {
74
- newResult[${s}] = ${n}.value;
75
- }
76
-
77
- `):t.write(`
78
- const ${n}_present = ${s} in input;
79
- if (${n}.issues.length) {
80
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
81
- ...iss,
82
- path: iss.path ? [${s}, ...iss.path] : [${s}]
83
- })));
84
- }
85
- if (!${n}_present && !${n}.issues.length) {
86
- payload.issues.push({
87
- code: "invalid_type",
88
- expected: "nonoptional",
89
- input: undefined,
90
- path: [${s}]
91
- });
92
- }
93
-
94
- if (${n}_present) {
95
- if (${n}.value === undefined) {
96
- newResult[${s}] = undefined;
97
- } else {
98
- newResult[${s}] = ${n}.value;
99
- }
100
- }
101
-
102
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let c=t.compile();return(t,n)=>c(e,t,n)},o,s=Jd,c=!Nd.jitless,l=c&&Yd.value,u=t.catchall,d;e._zod.parse=(f,p)=>{d??=r.value;let m=f.value;return s(m)?c&&l&&p?.async===!1&&p.jitless!==!0?(o||=a(t.shape),f=o(f,p),u?Cm([],m,f,p,d,e):f):n(f,p):(f.issues.push({expected:`object`,code:`invalid_type`,input:m,inst:e}),f)}});function Em(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let a=e.filter(e=>!ff(e));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>gf(e,r,Pd())))}),t)}var Dm=I(`$ZodUnion`,(e,t)=>{Fp.init(e,t),Hd(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Hd(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Hd(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Hd(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>zd(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,a)=>{if(n)return n(r,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>Em(t,r,e,a)):Em(s,r,e,a)}}),Om=I(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Dm.init(e,t);let n=e._zod.parse;Hd(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Ld(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(a,o)=>{let s=a.value;if(!Jd(s))return a.issues.push({code:`invalid_type`,expected:`object`,input:s,inst:e}),a;let c=r.value.get(s?.[t.discriminator]);return c?c._zod.run(a,o):t.unionFallback||o.direction===`backward`?n(a,o):(a.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:s,path:[t.discriminator],inst:e}),a)}}),km=I(`$ZodIntersection`,(e,t)=>{Fp.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,a=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([t,n])=>jm(e,t,n)):jm(e,a,o)}});function Am(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Xd(e)&&Xd(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),a={...e,...t};for(let n of r){let r=Am(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};a[n]=r.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let a=e[r],o=t[r],s=Am(a,o);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function jm(e,t,n){let r=new Map,a;for(let n of t.issues)if(n.code===`unrecognized_keys`){a??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let o=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&a&&e.issues.push({...a,keys:o}),ff(e))return e;let s=Am(t.value,n.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var Mm=I(`$ZodTuple`,(e,t)=>{Fp.init(e,t);let n=t.items;e._zod.parse=(r,a)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let s=[],c=Nm(n,`optin`),l=Nm(n,`optout`);if(!t.rest){if(o.length<c)return r.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),r;o.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):u[e]=t}if(t.rest){let e=n.length-1,c=o.slice(n.length);for(let n of c){e++;let o=t.rest._zod.run({value:n,issues:[]},a);o instanceof Promise?s.push(o.then(t=>Pm(t,r,e))):Pm(o,r,e)}}return s.length?Promise.all(s).then(()=>Fm(u,r,n,o,l)):Fm(u,r,n,o,l)}});function Nm(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Pm(e,t,n){e.issues.length&&t.issues.push(...mf(n,e.issues)),t.value[n]=e.value}function Fm(e,t,n,r,a){for(let o=0;o<n.length;o++){let n=e[o],s=o<r.length;if(n.issues.length){if(!s&&o>=a){t.value.length=o;break}t.issues.push(...mf(o,n.issues))}t.value[o]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var Im=I(`$ZodRecord`,(e,t)=>{Fp.init(e,t),e._zod.parse=(n,r)=>{let a=n.value;if(!Xd(a))return n.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),n;let o=[],s=t.keyType._zod.values;if(s){n.value={};let c=new Set;for(let l of s)if(typeof l==`string`||typeof l==`number`||typeof l==`symbol`){c.add(typeof l==`number`?l.toString():l);let s=t.keyType._zod.run({value:l,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>gf(e,r,Pd())),input:l,path:[l],inst:e});continue}let u=s.value,d=t.valueType._zod.run({value:a[l],issues:[]},r);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&n.issues.push(...mf(l,e.issues)),n.value[u]=e.value})):(d.issues.length&&n.issues.push(...mf(l,d.issues)),n.value[u]=d.value)}let l;for(let e in a)c.has(e)||(l??=[],l.push(e));l&&l.length>0&&n.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l})}else{n.value={};for(let s of Reflect.ownKeys(a)){if(s===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,s))continue;let c=t.keyType._zod.run({value:s,issues:[]},r);if(c instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof s==`string`&&dp.test(s)&&c.issues.length){let e=t.keyType._zod.run({value:Number(s),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(c=e)}if(c.issues.length){t.mode===`loose`?n.value[s]=a[s]:n.issues.push({code:`invalid_key`,origin:`record`,issues:c.issues.map(e=>gf(e,r,Pd())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:a[s],issues:[]},r);l instanceof Promise?o.push(l.then(e=>{e.issues.length&&n.issues.push(...mf(s,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(...mf(s,l.issues)),n.value[c.value]=l.value)}}return o.length?Promise.all(o).then(()=>n):n}}),Lm=I(`$ZodEnum`,(e,t)=>{Fp.init(e,t);let n=Fd(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Qd.has(typeof e)).map(e=>typeof e==`string`?$d(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,a)=>{let o=t.value;return r.has(o)||t.issues.push({code:`invalid_value`,values:n,input:o,inst:e}),t}}),Rm=I(`$ZodLiteral`,(e,t)=>{if(Fp.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?$d(e):e?$d(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,a)=>{let o=r.value;return n.has(o)||r.issues.push({code:`invalid_value`,values:t.values,input:o,inst:e}),r}}),zm=I(`$ZodTransform`,(e,t)=>{Fp.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Md(e.constructor.name);let a=t.transform(n.value,n);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then(e=>(n.value=e,n.fallback=!0,n));if(a instanceof Promise)throw new jd;return n.value=a,n.fallback=!0,n}});function Bm(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Vm=I(`$ZodOptional`,(e,t)=>{Fp.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Hd(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Hd(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${zd(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,a=t.innerType._zod.run(e,n);return a instanceof Promise?a.then(e=>Bm(e,r)):Bm(a,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Hm=I(`$ZodExactOptional`,(e,t)=>{Vm.init(e,t),Hd(e._zod,`values`,()=>t.innerType._zod.values),Hd(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Um=I(`$ZodNullable`,(e,t)=>{Fp.init(e,t),Hd(e._zod,`optin`,()=>t.innerType._zod.optin),Hd(e._zod,`optout`,()=>t.innerType._zod.optout),Hd(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${zd(e.source)}|null)$`):void 0}),Hd(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Wm=I(`$ZodDefault`,(e,t)=>{Fp.init(e,t),e._zod.optin=`optional`,Hd(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Gm(e,t)):Gm(r,t)}});function Gm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Km=I(`$ZodPrefault`,(e,t)=>{Fp.init(e,t),e._zod.optin=`optional`,Hd(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),qm=I(`$ZodNonOptional`,(e,t)=>{Fp.init(e,t),Hd(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(t=>Jm(t,e)):Jm(a,e)}});function Jm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Ym=I(`$ZodCatch`,(e,t)=>{Fp.init(e,t),e._zod.optin=`optional`,Hd(e._zod,`optout`,()=>t.innerType._zod.optout),Hd(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>gf(e,n,Pd()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>gf(e,n,Pd()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Xm=I(`$ZodPipe`,(e,t)=>{Fp.init(e,t),Hd(e._zod,`values`,()=>t.in._zod.values),Hd(e._zod,`optin`,()=>t.in._zod.optin),Hd(e._zod,`optout`,()=>t.out._zod.optout),Hd(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Zm(e,t.in,n)):Zm(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Zm(e,t.out,n)):Zm(r,t.out,n)}});function Zm(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Qm=I(`$ZodReadonly`,(e,t)=>{Fp.init(e,t),Hd(e._zod,`propValues`,()=>t.innerType._zod.propValues),Hd(e._zod,`values`,()=>t.innerType._zod.values),Hd(e._zod,`optin`,()=>t.innerType?._zod?.optin),Hd(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then($m):$m(r)}});function $m(e){return e.value=Object.freeze(e.value),e}var eh=I(`$ZodLazy`,(e,t)=>{Fp.init(e,t),Hd(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Hd(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Hd(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Hd(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Hd(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),th=I(`$ZodCustom`,(e,t)=>{gp.init(e,t),Fp.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,a=t.fn(r);if(a instanceof Promise)return a.then(t=>nh(t,n,r,e));nh(a,n,r,e)}});function nh(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(vf(e))}}var rh,ih=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ah(){return new ih}(rh=globalThis).__zod_globalRegistry??(rh.__zod_globalRegistry=ah());var oh=globalThis.__zod_globalRegistry;function sh(e,t){return new e({type:`string`,...tf(t)})}function ch(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...tf(t)})}function lh(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...tf(t)})}function uh(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...tf(t)})}function dh(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...tf(t)})}function fh(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...tf(t)})}function ph(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...tf(t)})}function mh(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...tf(t)})}function hh(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...tf(t)})}function gh(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...tf(t)})}function _h(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...tf(t)})}function vh(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...tf(t)})}function yh(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...tf(t)})}function bh(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...tf(t)})}function xh(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...tf(t)})}function Sh(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...tf(t)})}function Ch(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...tf(t)})}function wh(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...tf(t)})}function Th(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...tf(t)})}function Eh(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...tf(t)})}function Dh(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...tf(t)})}function Oh(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...tf(t)})}function kh(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...tf(t)})}function Ah(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...tf(t)})}function jh(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...tf(t)})}function Mh(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...tf(t)})}function Nh(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...tf(t)})}function Ph(e,t){return new e({type:`number`,checks:[],...tf(t)})}function Fh(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...tf(t)})}function Ih(e,t){return new e({type:`boolean`,...tf(t)})}function Lh(e,t){return new e({type:`null`,...tf(t)})}function Rh(e){return new e({type:`any`})}function zh(e){return new e({type:`unknown`})}function Bh(e,t){return new e({type:`never`,...tf(t)})}function Vh(e,t){return new e({type:`void`,...tf(t)})}function Hh(e,t){return new e({type:`date`,...tf(t)})}function Uh(e,t){return new vp({check:`less_than`,...tf(t),value:e,inclusive:!1})}function Wh(e,t){return new vp({check:`less_than`,...tf(t),value:e,inclusive:!0})}function Gh(e,t){return new yp({check:`greater_than`,...tf(t),value:e,inclusive:!1})}function Kh(e,t){return new yp({check:`greater_than`,...tf(t),value:e,inclusive:!0})}function qh(e,t){return new bp({check:`multiple_of`,...tf(t),value:e})}function Jh(e,t){return new Sp({check:`max_length`,...tf(t),maximum:e})}function Yh(e,t){return new Cp({check:`min_length`,...tf(t),minimum:e})}function Xh(e,t){return new wp({check:`length_equals`,...tf(t),length:e})}function Zh(e,t){return new Ep({check:`string_format`,format:`regex`,...tf(t),pattern:e})}function Qh(e){return new Dp({check:`string_format`,format:`lowercase`,...tf(e)})}function $h(e){return new Op({check:`string_format`,format:`uppercase`,...tf(e)})}function eg(e,t){return new kp({check:`string_format`,format:`includes`,...tf(t),includes:e})}function tg(e,t){return new Ap({check:`string_format`,format:`starts_with`,...tf(t),prefix:e})}function ng(e,t){return new jp({check:`string_format`,format:`ends_with`,...tf(t),suffix:e})}function rg(e){return new Mp({check:`overwrite`,tx:e})}function ig(e){return rg(t=>t.normalize(e))}function ag(){return rg(e=>e.trim())}function og(){return rg(e=>e.toLowerCase())}function sg(){return rg(e=>e.toUpperCase())}function cg(){return rg(e=>Kd(e))}function lg(e,t,n){return new e({type:`array`,element:t,...tf(n)})}function ug(e,t,n){let r=tf(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function dg(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...tf(n)})}function fg(e,t){let n=pg(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(vf(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(vf(r))}},e(t.value,t)),t);return n}function pg(e,t){let n=new gp({check:`custom`,...tf(t)});return n._zod.check=e,n}function mg(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??oh,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function hg(e,t,n={path:[],schemaPath:[]}){var r;let a=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,r);else{let n=s.schema,o=t.processors[a.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);o(e,t,n,r)}let o=e._zod.parent;o&&(s.ref||=o,hg(o,t,r),t.seen.get(o).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),t.io===`input`&&vg(e)&&(delete s.schema.examples,delete s.schema.default),t.io===`input`&&`_prefault`in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function gg(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let a=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(n)return{ref:a(n)};let o=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=o,{defId:o,ref:`${a(`__shared`)}#/${r}/${o}`}}if(t[1]===n)return{ref:`#`};let a=`#/${r}/`,o=t[1].schema.id??`__schema${e.counter++}`;return{defId:o,ref:a+o}},o=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=a(e);t.def={...t.schema},r&&(t.defId=r);let o=t.schema;for(let e in o)delete o[e];o.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
103
-
104
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){o(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){o(n);continue}}if(e.metadataRegistry.get(n[0])?.id){o(n);continue}if(r.cycle){o(n);continue}if(r.count>1&&e.reused===`ref`){o(n);continue}}}function _g(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let a=n.def??n.schema,o={...a},s=n.ref;if(n.ref=null,s){r(s);let n=e.seen.get(s),c=n.schema;if(c.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(a.allOf=a.allOf??[],a.allOf.push(c)):Object.assign(a,c),Object.assign(a,o),t._zod.parent===s)for(let e in a)e===`$ref`||e===`allOf`||e in o||delete a[e];if(c.$ref&&n.def)for(let e in a)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(a[e])===JSON.stringify(n.def[e])&&delete a[e]}let c=t._zod.parent;if(c&&c!==s){r(c);let t=e.seen.get(c);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(let e in a)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let a={};if(e.target===`draft-2020-12`?a.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?a.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?a.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");a.$id=e.external.uri(n)}Object.assign(a,n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&a.id===o&&delete a.id;let s=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&(e.target===`draft-2020-12`?a.$defs=s:a.definitions=s);try{let n=JSON.parse(JSON.stringify(a));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:bg(t,`input`,e.processors),output:bg(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function vg(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return vg(r.element,n);if(r.type===`set`)return vg(r.valueType,n);if(r.type===`lazy`)return vg(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return vg(r.innerType,n);if(r.type===`intersection`)return vg(r.left,n)||vg(r.right,n);if(r.type===`record`||r.type===`map`)return vg(r.keyType,n)||vg(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:vg(r.in,n)||vg(r.out,n);if(r.type===`object`){for(let e in r.shape)if(vg(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(vg(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(vg(e,n))return!0;return!!(r.rest&&vg(r.rest,n))}return!1}var yg=(e,t={})=>n=>{let r=mg({...n,processors:t});return hg(e,r),gg(r,e),_g(r,e)},bg=(e,t,n={})=>r=>{let{libraryOptions:a,target:o}=r??{},s=mg({...a??{},target:o,io:t,processors:n});return hg(e,s),gg(s,e),_g(s,e)},xg={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Sg=(e,t,n,r)=>{let a=n;a.type=`string`;let{minimum:o,maximum:s,format:c,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof o==`number`&&(a.minLength=o),typeof s==`number`&&(a.maxLength=s),c&&(a.format=xg[c]??c,a.format===``&&delete a.format,c===`time`&&delete a.format),u&&(a.contentEncoding=u),l&&l.size>0){let e=[...l];e.length===1?a.pattern=e[0].source:e.length>1&&(a.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Cg=(e,t,n,r)=>{let a=n,{minimum:o,maximum:s,format:c,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof c==`string`&&c.includes(`int`)?a.type=`integer`:a.type=`number`;let f=typeof d==`number`&&d>=(o??-1/0),p=typeof u==`number`&&u<=(s??1/0),m=t.target===`draft-04`||t.target===`openapi-3.0`;f?m?(a.minimum=d,a.exclusiveMinimum=!0):a.exclusiveMinimum=d:typeof o==`number`&&(a.minimum=o),p?m?(a.maximum=u,a.exclusiveMaximum=!0):a.exclusiveMaximum=u:typeof s==`number`&&(a.maximum=s),typeof l==`number`&&(a.multipleOf=l)},wg=(e,t,n,r)=>{n.type=`boolean`},Tg=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Eg=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},Dg=(e,t,n,r)=>{n.not={}},Og=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},kg=(e,t,n,r)=>{let a=e._zod.def,o=Fd(a.entries);o.every(e=>typeof e==`number`)&&(n.type=`number`),o.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=o},Ag=(e,t,n,r)=>{let a=e._zod.def,o=[];for(let e of a.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);o.push(Number(e))}else o.push(e);if(o.length!==0)if(o.length===1){let e=o[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else o.every(e=>typeof e==`number`)&&(n.type=`number`),o.every(e=>typeof e==`string`)&&(n.type=`string`),o.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),o.every(e=>e===null)&&(n.type=`null`),n.enum=o},jg=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Mg=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ng=(e,t,n,r)=>{let a=n,o=e._zod.def,{minimum:s,maximum:c}=e._zod.bag;typeof s==`number`&&(a.minItems=s),typeof c==`number`&&(a.maxItems=c),a.type=`array`,a.items=hg(o.element,t,{...r,path:[...r.path,`items`]})},Pg=(e,t,n,r)=>{let a=n,o=e._zod.def;a.type=`object`,a.properties={};let s=o.shape;for(let e in s)a.properties[e]=hg(s[e],t,{...r,path:[...r.path,`properties`,e]});let c=new Set(Object.keys(s)),l=new Set([...c].filter(e=>{let n=o.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));l.size>0&&(a.required=Array.from(l)),o.catchall?._zod.def.type===`never`?a.additionalProperties=!1:o.catchall?o.catchall&&(a.additionalProperties=hg(o.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(a.additionalProperties=!1)},Fg=(e,t,n,r)=>{let a=e._zod.def,o=a.inclusive===!1,s=a.options.map((e,n)=>hg(e,t,{...r,path:[...r.path,o?`oneOf`:`anyOf`,n]}));o?n.oneOf=s:n.anyOf=s},Ig=(e,t,n,r)=>{let a=e._zod.def,o=hg(a.left,t,{...r,path:[...r.path,`allOf`,0]}),s=hg(a.right,t,{...r,path:[...r.path,`allOf`,1]}),c=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...c(o)?o.allOf:[o],...c(s)?s.allOf:[s]]},Lg=(e,t,n,r)=>{let a=n,o=e._zod.def;a.type=`array`;let s=t.target===`draft-2020-12`?`prefixItems`:`items`,c=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,l=o.items.map((e,n)=>hg(e,t,{...r,path:[...r.path,s,n]})),u=o.rest?hg(o.rest,t,{...r,path:[...r.path,c,...t.target===`openapi-3.0`?[o.items.length]:[]]}):null;t.target===`draft-2020-12`?(a.prefixItems=l,u&&(a.items=u)):t.target===`openapi-3.0`?(a.items={anyOf:l},u&&a.items.anyOf.push(u),a.minItems=l.length,u||(a.maxItems=l.length)):(a.items=l,u&&(a.additionalItems=u));let{minimum:d,maximum:f}=e._zod.bag;typeof d==`number`&&(a.minItems=d),typeof f==`number`&&(a.maxItems=f)},Rg=(e,t,n,r)=>{let a=n,o=e._zod.def;a.type=`object`;let s=o.keyType,c=s._zod.bag?.patterns;if(o.mode===`loose`&&c&&c.size>0){let e=hg(o.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});a.patternProperties={};for(let t of c)a.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(a.propertyNames=hg(o.keyType,t,{...r,path:[...r.path,`propertyNames`]})),a.additionalProperties=hg(o.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let l=s._zod.values;if(l){let e=[...l].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(a.required=e)}},zg=(e,t,n,r)=>{let a=e._zod.def,o=hg(a.innerType,t,r),s=t.seen.get(e);t.target===`openapi-3.0`?(s.ref=a.innerType,n.nullable=!0):n.anyOf=[o,{type:`null`}]},Bg=(e,t,n,r)=>{let a=e._zod.def;hg(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType},Vg=(e,t,n,r)=>{let a=e._zod.def;hg(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType,n.default=JSON.parse(JSON.stringify(a.defaultValue))},Hg=(e,t,n,r)=>{let a=e._zod.def;hg(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},Ug=(e,t,n,r)=>{let a=e._zod.def;hg(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType;let s;try{s=a.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=s},Wg=(e,t,n,r)=>{let a=e._zod.def,o=a.in._zod.traits.has(`$ZodTransform`),s=t.io===`input`?o?a.out:a.in:a.out;hg(s,t,r);let c=t.seen.get(e);c.ref=s},Gg=(e,t,n,r)=>{let a=e._zod.def;hg(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType,n.readOnly=!0},Kg=(e,t,n,r)=>{let a=e._zod.def;hg(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType},qg=(e,t,n,r)=>{let a=e._zod.innerType;hg(a,t,r);let o=t.seen.get(e);o.ref=a},Jg=I(`ZodISODateTime`,(e,t)=>{Yp.init(e,t),b_.init(e,t)});function Yg(e){return Ah(Jg,e)}var Xg=I(`ZodISODate`,(e,t)=>{Xp.init(e,t),b_.init(e,t)});function Zg(e){return jh(Xg,e)}var Qg=I(`ZodISOTime`,(e,t)=>{Zp.init(e,t),b_.init(e,t)});function $g(e){return Mh(Qg,e)}var e_=I(`ZodISODuration`,(e,t)=>{Qp.init(e,t),b_.init(e,t)});function t_(e){return Nh(e_,e)}var n_=I(`ZodError`,(e,t)=>{bf.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Cf(e,t)},flatten:{value:t=>Sf(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Id,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Id,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),r_=wf(n_),i_=Tf(n_),a_=Ef(n_),o_=Of(n_),s_=Af(n_),c_=jf(n_),l_=Mf(n_),u_=Nf(n_),d_=Pf(n_),f_=Ff(n_),p_=If(n_),m_=Lf(n_),h_=new WeakMap;function g_(e,t,n){let r=Object.getPrototypeOf(e),a=h_.get(r);if(a||(a=new Set,h_.set(r,a)),!a.has(t)){a.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var __=I(`ZodType`,(e,t)=>(Fp.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:bg(e,`input`),output:bg(e,`output`)}}),e.toJSONSchema=yg(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>r_(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>a_(e,t,n),e.parseAsync=async(t,n)=>i_(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>o_(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>s_(e,t,n),e.decode=(t,n)=>c_(e,t,n),e.encodeAsync=async(t,n)=>l_(e,t,n),e.decodeAsync=async(t,n)=>u_(e,t,n),e.safeEncode=(t,n)=>d_(e,t,n),e.safeDecode=(t,n)=>f_(e,t,n),e.safeEncodeAsync=async(t,n)=>p_(e,t,n),e.safeDecodeAsync=async(t,n)=>m_(e,t,n),g_(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Wd(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ef(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Bv(e,t))},superRefine(e,t){return this.check(Vv(e,t))},overwrite(e){return this.check(rg(e))},optional(){return yv(this)},exactOptional(){return xv(this)},nullable(){return Cv(this)},nullish(){return yv(Cv(this))},nonoptional(e){return kv(this,e)},array(){return H(this)},or(e){return av([this,e])},and(e){return lv(this,e)},transform(e){return Nv(this,_v(e))},default(e){return Tv(this,e)},prefault(e){return Dv(this,e)},catch(e){return jv(this,e)},pipe(e){return Nv(this,e)},readonly(){return Fv(this)},describe(e){let t=this.clone();return oh.add(t,{description:e}),t},meta(...e){if(e.length===0)return oh.get(this);let t=this.clone();return oh.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return oh.get(e)?.description},configurable:!0}),e)),v_=I(`_ZodString`,(e,t)=>{Ip.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sg(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,g_(e,`_ZodString`,{regex(...e){return this.check(Zh(...e))},includes(...e){return this.check(eg(...e))},startsWith(...e){return this.check(tg(...e))},endsWith(...e){return this.check(ng(...e))},min(...e){return this.check(Yh(...e))},max(...e){return this.check(Jh(...e))},length(...e){return this.check(Xh(...e))},nonempty(...e){return this.check(Yh(1,...e))},lowercase(e){return this.check(Qh(e))},uppercase(e){return this.check($h(e))},trim(){return this.check(ag())},normalize(...e){return this.check(ig(...e))},toLowerCase(){return this.check(og())},toUpperCase(){return this.check(sg())},slugify(){return this.check(cg())}})}),y_=I(`ZodString`,(e,t)=>{Ip.init(e,t),v_.init(e,t),e.email=t=>e.check(ch(x_,t)),e.url=t=>e.check(mh(T_,t)),e.jwt=t=>e.check(kh(V_,t)),e.emoji=t=>e.check(hh(D_,t)),e.guid=t=>e.check(lh(C_,t)),e.uuid=t=>e.check(uh(w_,t)),e.uuidv4=t=>e.check(dh(w_,t)),e.uuidv6=t=>e.check(fh(w_,t)),e.uuidv7=t=>e.check(ph(w_,t)),e.nanoid=t=>e.check(gh(O_,t)),e.guid=t=>e.check(lh(C_,t)),e.cuid=t=>e.check(_h(k_,t)),e.cuid2=t=>e.check(vh(A_,t)),e.ulid=t=>e.check(yh(j_,t)),e.base64=t=>e.check(Eh(R_,t)),e.base64url=t=>e.check(Dh(z_,t)),e.xid=t=>e.check(bh(M_,t)),e.ksuid=t=>e.check(xh(N_,t)),e.ipv4=t=>e.check(Sh(P_,t)),e.ipv6=t=>e.check(Ch(F_,t)),e.cidrv4=t=>e.check(wh(I_,t)),e.cidrv6=t=>e.check(Th(L_,t)),e.e164=t=>e.check(Oh(B_,t)),e.datetime=t=>e.check(Yg(t)),e.date=t=>e.check(Zg(t)),e.time=t=>e.check($g(t)),e.duration=t=>e.check(t_(t))});function L(e){return sh(y_,e)}var b_=I(`ZodStringFormat`,(e,t)=>{Lp.init(e,t),v_.init(e,t)}),x_=I(`ZodEmail`,(e,t)=>{Bp.init(e,t),b_.init(e,t)});function S_(e){return ch(x_,e)}var C_=I(`ZodGUID`,(e,t)=>{Rp.init(e,t),b_.init(e,t)}),w_=I(`ZodUUID`,(e,t)=>{zp.init(e,t),b_.init(e,t)}),T_=I(`ZodURL`,(e,t)=>{Vp.init(e,t),b_.init(e,t)});function E_(e){return mh(T_,e)}var D_=I(`ZodEmoji`,(e,t)=>{Hp.init(e,t),b_.init(e,t)}),O_=I(`ZodNanoID`,(e,t)=>{Up.init(e,t),b_.init(e,t)}),k_=I(`ZodCUID`,(e,t)=>{Wp.init(e,t),b_.init(e,t)}),A_=I(`ZodCUID2`,(e,t)=>{Gp.init(e,t),b_.init(e,t)}),j_=I(`ZodULID`,(e,t)=>{Kp.init(e,t),b_.init(e,t)}),M_=I(`ZodXID`,(e,t)=>{qp.init(e,t),b_.init(e,t)}),N_=I(`ZodKSUID`,(e,t)=>{Jp.init(e,t),b_.init(e,t)}),P_=I(`ZodIPv4`,(e,t)=>{$p.init(e,t),b_.init(e,t)}),F_=I(`ZodIPv6`,(e,t)=>{em.init(e,t),b_.init(e,t)}),I_=I(`ZodCIDRv4`,(e,t)=>{tm.init(e,t),b_.init(e,t)}),L_=I(`ZodCIDRv6`,(e,t)=>{nm.init(e,t),b_.init(e,t)}),R_=I(`ZodBase64`,(e,t)=>{im.init(e,t),b_.init(e,t)}),z_=I(`ZodBase64URL`,(e,t)=>{om.init(e,t),b_.init(e,t)}),B_=I(`ZodE164`,(e,t)=>{sm.init(e,t),b_.init(e,t)}),V_=I(`ZodJWT`,(e,t)=>{lm.init(e,t),b_.init(e,t)}),H_=I(`ZodNumber`,(e,t)=>{um.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cg(e,t,n,r),g_(e,`ZodNumber`,{gt(e,t){return this.check(Gh(e,t))},gte(e,t){return this.check(Kh(e,t))},min(e,t){return this.check(Kh(e,t))},lt(e,t){return this.check(Uh(e,t))},lte(e,t){return this.check(Wh(e,t))},max(e,t){return this.check(Wh(e,t))},int(e){return this.check(W_(e))},safe(e){return this.check(W_(e))},positive(e){return this.check(Gh(0,e))},nonnegative(e){return this.check(Kh(0,e))},negative(e){return this.check(Uh(0,e))},nonpositive(e){return this.check(Wh(0,e))},multipleOf(e,t){return this.check(qh(e,t))},step(e,t){return this.check(qh(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function R(e){return Ph(H_,e)}var U_=I(`ZodNumberFormat`,(e,t)=>{dm.init(e,t),H_.init(e,t)});function W_(e){return Fh(U_,e)}var G_=I(`ZodBoolean`,(e,t)=>{fm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wg(e,t,n,r)});function z(e){return Ih(G_,e)}var K_=I(`ZodNull`,(e,t)=>{pm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tg(e,t,n,r)});function q_(e){return Lh(K_,e)}var J_=I(`ZodAny`,(e,t)=>{mm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Y_(){return Rh(J_)}var X_=I(`ZodUnknown`,(e,t)=>{hm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function B(){return zh(X_)}var Z_=I(`ZodNever`,(e,t)=>{gm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dg(e,t,n,r)});function Q_(e){return Bh(Z_,e)}var $_=I(`ZodVoid`,(e,t)=>{_m.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eg(e,t,n,r)});function V(e){return Vh($_,e)}var ev=I(`ZodDate`,(e,t)=>{vm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Og(e,t,n,r),e.min=(t,n)=>e.check(Kh(t,n)),e.max=(t,n)=>e.check(Wh(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function tv(e){return Hh(ev,e)}var nv=I(`ZodArray`,(e,t)=>{bm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ng(e,t,n,r),e.element=t.element,g_(e,`ZodArray`,{min(e,t){return this.check(Yh(e,t))},nonempty(e){return this.check(Yh(1,e))},max(e,t){return this.check(Jh(e,t))},length(e,t){return this.check(Xh(e,t))},unwrap(){return this.element}})});function H(e,t){return lg(nv,e,t)}var rv=I(`ZodObject`,(e,t)=>{Tm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pg(e,t,n,r),Hd(e,`shape`,()=>t.shape),g_(e,`ZodObject`,{keyof(){return G(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:B()})},loose(){return this.clone({...this._zod.def,catchall:B()})},strict(){return this.clone({...this._zod.def,catchall:Q_()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return sf(this,e)},safeExtend(e){return cf(this,e)},merge(e){return lf(this,e)},pick(e){return af(this,e)},omit(e){return of(this,e)},partial(...e){return uf(vv,this,e[0])},required(...e){return df(Ov,this,e[0])}})});function U(e,t){return new rv({type:`object`,shape:e??{},...tf(t)})}var iv=I(`ZodUnion`,(e,t)=>{Dm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fg(e,t,n,r),e.options=t.options});function av(e,t){return new iv({type:`union`,options:e,...tf(t)})}var ov=I(`ZodDiscriminatedUnion`,(e,t)=>{iv.init(e,t),Om.init(e,t)});function sv(e,t,n){return new ov({type:`union`,options:t,discriminator:e,...tf(n)})}var cv=I(`ZodIntersection`,(e,t)=>{km.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ig(e,t,n,r)});function lv(e,t){return new cv({type:`intersection`,left:e,right:t})}var uv=I(`ZodTuple`,(e,t)=>{Mm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lg(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function dv(e,t,n){let r=t instanceof Fp;return new uv({type:`tuple`,items:e,rest:r?t:null,...tf(r?n:t)})}var fv=I(`ZodRecord`,(e,t)=>{Im.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rg(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function W(e,t,n){return!t||!t._zod?new fv({type:`record`,keyType:L(),valueType:e,...tf(t)}):new fv({type:`record`,keyType:e,valueType:t,...tf(n)})}function pv(e,t,n){let r=ef(e);return r._zod.values=void 0,new fv({type:`record`,keyType:r,valueType:t,...tf(n)})}var mv=I(`ZodEnum`,(e,t)=>{Lm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kg(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let a={};for(let r of e)if(n.has(r))a[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new mv({...t,checks:[],...tf(r),entries:a})},e.exclude=(e,r)=>{let a={...t.entries};for(let t of e)if(n.has(t))delete a[t];else throw Error(`Key ${t} not found in enum`);return new mv({...t,checks:[],...tf(r),entries:a})}});function G(e,t){return new mv({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...tf(t)})}var hv=I(`ZodLiteral`,(e,t)=>{Rm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ag(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function K(e,t){return new hv({type:`literal`,values:Array.isArray(e)?e:[e],...tf(t)})}var gv=I(`ZodTransform`,(e,t)=>{zm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mg(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Md(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(vf(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(vf(t))}};let a=t.transform(n.value,n);return a instanceof Promise?a.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}});function _v(e){return new gv({type:`transform`,transform:e})}var vv=I(`ZodOptional`,(e,t)=>{Vm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yv(e){return new vv({type:`optional`,innerType:e})}var bv=I(`ZodExactOptional`,(e,t)=>{Hm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xv(e){return new bv({type:`optional`,innerType:e})}var Sv=I(`ZodNullable`,(e,t)=>{Um.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cv(e){return new Sv({type:`nullable`,innerType:e})}var wv=I(`ZodDefault`,(e,t)=>{Wm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Tv(e,t){return new wv({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Zd(t)}})}var Ev=I(`ZodPrefault`,(e,t)=>{Km.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dv(e,t){return new Ev({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Zd(t)}})}var Ov=I(`ZodNonOptional`,(e,t)=>{qm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kv(e,t){return new Ov({type:`nonoptional`,innerType:e,...tf(t)})}var Av=I(`ZodCatch`,(e,t)=>{Ym.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ug(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jv(e,t){return new Av({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Mv=I(`ZodPipe`,(e,t)=>{Xm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wg(e,t,n,r),e.in=t.in,e.out=t.out});function Nv(e,t){return new Mv({type:`pipe`,in:e,out:t})}var Pv=I(`ZodReadonly`,(e,t)=>{Qm.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fv(e){return new Pv({type:`readonly`,innerType:e})}var Iv=I(`ZodLazy`,(e,t)=>{eh.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qg(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Lv(e){return new Iv({type:`lazy`,getter:e})}var Rv=I(`ZodCustom`,(e,t)=>{th.init(e,t),__.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jg(e,t,n,r)});function zv(e,t){return ug(Rv,e??(()=>!0),t)}function Bv(e,t={}){return dg(Rv,e,t)}function Vv(e,t){return fg(e,t)}function Hv(e,t={}){let n=new Rv({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...tf(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}var Uv=G([`singleton`,`device`,`widget`]),Wv=U({capName:L(),kind:Uv,deviceId:R().optional(),reachable:z(),latencyMs:R(),error:L().optional()}),Gv=U({addonId:L(),caps:H(Wv).readonly(),widgets:H(Wv).readonly()}),Kv=U({nodeId:L(),addons:H(Gv).readonly()});U({ok:z(),degraded:z(),checkedAt:L(),nodes:H(Kv).readonly(),summary:U({total:R(),reachable:R(),unreachable:R()})});var qv=[`onnx`,`coreml`,`openvino`,`tflite`,`pt`],Jv=function(e){return e.SystemBoot=`system.boot`,e.SystemAddonsReady=`system.addons-ready`,e.SystemRestarting=`system.restarting`,e.SystemRestartCompleted=`system.restart-completed`,e.SystemReadyState=`system.ready-state`,e.AddonStarted=`addon.started`,e.AddonStopped=`addon.stopped`,e.AddonRestarted=`addon.restarted`,e.AddonUpdated=`addon.updated`,e.AddonInstalled=`addon.installed`,e.AddonUninstalled=`addon.uninstalled`,e.AddonCrashed=`addon.crashed`,e.AddonError=`addon.error`,e.AddonPageReady=`addon.page-ready`,e.AddonWidgetReady=`addon.widget-ready`,e.AddonLoadFailed=`addon.load-failed`,e.AddonLoadRecovered=`addon.load-recovered`,e.AddonRetryScheduled=`addon.retry-scheduled`,e.AddonRetryAttempting=`addon.retry-attempting`,e.DeviceRegistered=`device.registered`,e.DeviceUnregistered=`device.unregistered`,e.DeviceEnabled=`device.enabled`,e.DeviceDisabled=`device.disabled`,e.DeviceSettingsUpdated=`device.settings-updated`,e.DeviceBindingsChanged=`device.bindings-changed`,e.DeviceMetaChanged=`device.meta-changed`,e.DeviceSourceInfoChanged=`device.source-info-changed`,e.DeviceStreamsRegistered=`device.streams-registered`,e.DeviceProvisioned=`device.provisioned`,e.DeviceReady=`device.ready`,e.IntegrationEnabled=`integration.enabled`,e.IntegrationDisabled=`integration.disabled`,e.IntegrationDeleted=`integration.deleted`,e.BrokerStatusChanged=`broker.status-changed`,e.BrokerMessage=`broker.message`,e.ProviderStarted=`provider.started`,e.ProviderStopped=`provider.stopped`,e.ProcessCrashed=`process.crashed`,e.ProcessRestartScheduled=`process.restart_scheduled`,e.ProcessRestarted=`process.restarted`,e.RecordingStarted=`recording.started`,e.RecordingStopped=`recording.stopped`,e.RecordingError=`recording.error`,e.RecordingHealthDegraded=`recording.health.degraded`,e.RecordingStorageCritical=`recording.storage.critical`,e.RecordingSegmentWritten=`recording.segment.written`,e.RecordingPolicyFallback=`recording.policy.fallback`,e.RecordingRetentionCompleted=`recording.retention.completed`,e.DetectionEvent=`detection.event`,e.SessionTrackNew=`session.track.new`,e.SessionTrackExpired=`session.track.expired`,e.BenchmarkProgress=`benchmark.progress`,e.PlatformProbePhase=`platform-probe.phase`,e.PipelineProgress=`pipeline.progress`,e.PipelineTrace=`pipeline.trace`,e.PipelineInferenceResult=`pipeline.inference-result`,e.PipelineCameraAssigned=`pipeline.camera-assigned`,e.PipelineCameraUnassigned=`pipeline.camera-unassigned`,e.PipelineCameraUpdated=`pipeline.camera-updated`,e.PipelineRunnerLoadSnapshot=`pipeline.runner-load-snapshot`,e.PipelineCameraMetricsSnapshot=`pipeline.camera-metrics-snapshot`,e.StreamBrokerMetricsSnapshot=`stream-broker.metrics-snapshot`,e.StreamBrokerOnCamStreamDemand=`stream-broker.onCamStreamDemand`,e.StreamBrokerOnCamStreamIdle=`stream-broker.onCamStreamIdle`,e.StreamBrokerOnRequestStreamSourceRefresh=`stream-broker.onRequestStreamSourceRefresh`,e.StreamParamsChanged=`stream-params.changed`,e.DeviceStateChanged=`device.state-changed`,e.BatteryOnStatusChanged=`battery.onStatusChanged`,e.BatteryOnWakeStarted=`battery.onWakeStarted`,e.DoorbellOnPressed=`doorbell.onPressed`,e.EventEmitted=`event-emitter.event`,e.PipelineEngineMetricsSnapshot=`pipeline.engine-metrics-snapshot`,e.ClusterTopologySnapshot=`cluster.topology-snapshot`,e.MetricsNodeResourcesSnapshot=`metrics.node-resources-snapshot`,e.MetricsNodeProcessesSnapshot=`metrics.node-processes-snapshot`,e.CapabilityBindingChanged=`capability.binding-changed`,e.ModelDownloadProgress=`model.download.progress`,e.AgentRegistered=`agent.registered`,e.AgentUnregistered=`agent.unregistered`,e.AgentOnline=`agent.online`,e.AgentOffline=`agent.offline`,e.WorkerOnline=`worker.online`,e.WorkerOffline=`worker.offline`,e.AgentTaskDispatched=`agent.task.dispatched`,e.AgentTaskAssigned=`agent.task.assigned`,e.AgentTrpcConnected=`agent.trpc.connected`,e.AgentWsConnected=`agent.ws.connected`,e.AgentWsDisconnected=`agent.ws.disconnected`,e.AgentBackupActivated=`agent.backup.activated`,e.OrchestrationSettingsUpdated=`orchestration.settings-updated`,e.PipelineAgentHwaccelChanged=`pipeline.agent-hwaccel-changed`,e.MotionAnalysis=`detection.motion-analysis`,e.MotionZonesRaw=`detection.motion-zones-raw`,e.MotionOnMotionChanged=`motion.on-motion-changed`,e.DetectionResult=`detection.result`,e.DetectionRaw=`detection.raw`,e.DetectionCameraNative=`detection.camera-native`,e.PipelineAudioInferenceResult=`pipeline.audio-inference-result`,e.DetectionPhaseTransition=`detection.phase-transition`,e.ProviderMotion=`provider.motion`,e.ProviderDetection=`provider.detection`,e.EnrichmentEmbeddingStored=`enrichment.embedding.stored`,e.EnrichmentSceneStateChanged=`enrichment.scene.state-changed`,e.EnrichmentActivitySummary=`enrichment.activity.summary`,e.PipelineAnalyticsTrackStarted=`pipeline-analytics.track-started`,e.PipelineAnalyticsTrackEnded=`pipeline-analytics.track-ended`,e.PipelineAnalyticsDetectionEvent=`pipeline-analytics.detection-event`,e.PipelineAnalyticsFrameTracked=`pipeline-analytics.frame-tracked`,e.FrigateLiveEvent=`frigate.live-event`,e.CameraStreamsProfileSlotsChanged=`camera-streams.onProfileSlotsChanged`,e.StreamOnline=`stream.online`,e.StreamOffline=`stream.offline`,e.NetworkTunnelStarted=`network.tunnel.started`,e.NetworkTunnelStopped=`network.tunnel.stopped`,e.LocalNetworkChanged=`network.local.changed`,e.MeshNetworkChanged=`network.mesh.changed`,e.BackupCompleted=`backup.completed`,e.BackupRestored=`backup.restored`,e.NotificationDispatched=`notification.dispatched`,e.NotificationFailed=`notification.failed`,e.DeviceUpdated=`device.updated`,e.DeviceOnline=`device.online`,e.DeviceOffline=`device.offline`,e.DeviceAwake=`device.awake`,e.DeviceSleeping=`device.sleeping`,e.RetentionCleanup=`retention.cleanup`,e.AddonsBulkUpdateProgress=`addons.bulk-update-progress`,e.AccessoriesChildVisibilityChanged=`accessories.onChildVisibilityChanged`,e.AccessoriesChanged=`accessories.onAccessoriesChanged`,e}({});Object.fromEntries([{id:`overview`,label:`Overview`,icon:`layout-dashboard`,order:-10},{id:`general`,label:`General`,icon:`settings`,order:0},{id:`image`,label:`Image`,icon:`image`,order:5},{id:`light`,label:`Light`,icon:`lightbulb`,order:7},{id:`motion`,label:`Motion`,icon:`activity`,order:10},{id:`audio`,label:`Audio`,icon:`mic`,order:12},{id:`alarms`,label:`Alarms`,icon:`bell-ring`,order:13},{id:`snapshot`,label:`Snapshot`,icon:`camera`,order:15},{id:`osd`,label:`OSD`,icon:`type`,order:18},{id:`stream-broker`,label:`Stream Broker`,icon:`radio`,order:20},{id:`streaming`,label:`Streaming`,icon:`video`,order:35},{id:`ptz`,label:`PTZ`,icon:`move`,order:40},{id:`consumables`,label:`Consumables`,icon:`recycle`,order:44},{id:`pipeline`,label:`Detection Pipeline`,icon:`cpu`,order:39},{id:`detection-pipeline`,label:`Detection pipeline`,icon:`cpu`,order:39},{id:`zones`,label:`Detection`,icon:`shapes`,order:38},{id:`analytics`,label:`Analytics`,icon:`activity`,order:37},{id:`live-stats`,label:`Live Stats`,icon:`activity`,order:39},{id:`recording`,label:`Recording`,icon:`circle-dot`,order:40},{id:`engine`,label:`Inference Engine`,icon:`zap`,order:41},{id:`scheduler`,label:`Scheduler`,icon:`list-checks`,order:42},{id:`decoder`,label:`Decoder`,icon:`film`,order:43},{id:`notifications`,label:`Notifications`,icon:`bell`,order:50},{id:`network`,label:`Network`,icon:`globe`,order:60},{id:`storage`,label:`Storage`,icon:`hard-drive`,order:70},{id:`advanced`,label:`Advanced`,icon:`wrench`,order:100}].map(e=>[e.id,e]));var Yv=G([`high`,`mid`,`low`]),Xv=G([`pull-rtsp`,`pull-rtmp`,`pull-http`,`pull-rfc4571`,`push-annexb`,`derived`]),Zv=U({width:R().int().positive(),height:R().int().positive()}),Qv=U({camStreamId:L().min(1),deviceId:R().int().nonnegative(),kind:Xv,url:L().optional(),codec:L().optional(),resolution:Zv.optional(),fps:R().positive().optional(),label:L().optional(),deviceFeatures:H(L()).optional(),autoEligible:z().optional(),metadata:W(L(),B()).optional()}),$v=G([`unassigned`,`idle`,`connecting`,`streaming`,`error`]),ey=U({deviceId:R().int().nonnegative(),profile:Yv,brokerId:L(),sourceCamStreamId:L().nullable(),status:$v,resolution:Zv.optional(),codec:L().optional(),preBufferSec:R().nonnegative().optional(),errorMessage:L().optional()}),ty=U({id:L(),label:L(),protocol:G([`rtsp`,`rtmp`,`annexb`,`http-mjpeg`,`webrtc`,`custom`]),url:L().optional(),resolution:U({width:R(),height:R()}).readonly().optional(),fps:R().optional(),bitrate:R().optional(),codec:L().optional(),profileHint:Yv.optional()});U({type:L(),url:L(),videoCodec:L().optional(),audioCodec:L().optional(),metadata:W(L(),B()).readonly().optional()});var ny=U({type:G([`video`,`audio`]),data:Hv(Uint8Array),pts:R(),dts:R(),keyframe:z(),codec:L()}),ry=U({data:Hv(Uint8Array),width:R(),height:R(),format:G([`jpeg`,`rgb`,`bgr`,`yuv420`,`gray`]),timestamp:R()}),iy=U({shmId:L(),slot:R().int().nonnegative(),seq:R().int().nonnegative(),width:R().int().positive(),height:R().int().positive(),format:G([`jpeg`,`rgb`,`bgr`,`yuv420`,`gray`]),pts:R(),byteLength:R().int().nonnegative(),nodeId:L(),slotCount:R().int().positive()}),ay=G([`rgb`,`bgr`,`yuv420`,`gray`]),oy=U({brokerId:L(),format:ay,maxFps:R().positive().optional(),tag:L().optional()}),sy=U({subscriptionId:L(),maxFps:R().nonnegative()}),cy=U({data:Hv(Uint8Array),sampleRate:R().int().positive(),channels:R().int().positive(),timestamp:R()}),ly=U({brokerId:L(),tag:L().optional()}),uy=U({subscriptionId:L()}),dy=U({status:G([`idle`,`connecting`,`streaming`,`error`,`stopped`]),inputFps:R(),decodeFps:R(),encodedSubscribers:R(),decodedSubscribers:R(),uptimeMs:R(),bitrateKbps:R(),idrIntervalMs:R(),codec:L().optional(),totalBytes:R(),packetCount:R(),rtspClients:R(),pipeClients:R(),preBufferSec:R(),preBufferMs:R(),preBufferPackets:R(),decoderNodeId:L().nullable(),audio:U({codec:L(),sampleRate:R(),channels:R(),supported:z()}).nullable().optional()}),fy=U({profile:Yv,brokerId:L(),url:L(),mutedUrl:L(),enabled:z(),codec:L().optional(),resolution:Zv.optional()}),py=R().int().min(0).max(6),my=/^([01]\d|2[0-3]):[0-5]\d$/,hy=sv(`kind`,[U({kind:K(`always`)}),U({kind:K(`timeOfDay`),start:L().regex(my),end:L().regex(my),days:H(py).optional()})]),gy=G([`continuous`,`onMotion`,`onAudioThreshold`]),_y=G([`off`,`events`,`continuous`]),vy=U({motion:z().optional(),audioThresholdDbfs:R().optional()}),yy=G([`continuous`,`events`]),by=vy,xy=U({days:H(py),start:L().regex(my),end:L().regex(my),mode:yy,triggers:by.optional(),preBufferSec:R().min(0).optional(),postBufferSec:R().min(0).optional()}),Sy=U({schedule:hy,mode:gy,preBufferSec:R().min(0).default(0),postBufferSec:R().min(0).default(0),resetTimeoutOnNewEvent:z().default(!0),thresholdDbfs:R().optional()}),Cy=U({maxAgeDays:R().min(0).optional(),maxSizeGb:R().min(0).optional()}),wy=U({enabled:z(),mode:_y.optional(),profiles:H(Yv).optional(),segmentSeconds:R().int().positive().optional(),schedules:H(hy).optional(),schedule:hy.optional(),triggers:vy.optional(),preBufferSec:R().min(0).optional(),postBufferSec:R().min(0).optional(),rules:H(Sy).optional(),bands:H(xy).optional(),retention:Cy.optional()}),Ty=L().regex(/^[a-z][a-zA-Z0-9-]*$/),Ey=U({id:L().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/),type:L(),displayName:L().min(1),providerId:L().min(1),config:W(L(),B()),nodeId:L().optional(),isDefault:z().default(!1),isSystem:z().default(!1),createdAt:R(),updatedAt:R()}),Dy=av([Ty,L().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/)]),Oy=U({id:L().regex(/^[a-z][a-zA-Z0-9-]*$/,{message:`id must start with a lowercase letter and contain only letters, digits, or hyphens`}),displayName:L().min(1,{message:`displayName must not be empty`}),description:L().optional(),cardinality:G([`single`,`multi`]),defaultsTo:L().optional()}),ky=U({inputFps:R(),outputFps:R(),avgDecodeTimeMs:R(),droppedFrames:R()}),Ay=U({codec:L(),maxFps:R().default(0),outputFormat:G([`jpeg`,`rgb`,`bgr`,`yuv420`,`gray`]).default(`jpeg`),scale:R().default(1),width:R().optional(),height:R().optional(),deviceId:R().int().nonnegative().optional(),tag:L().optional(),frameSink:G([`callback`,`shm`]).default(`callback`)}),jy=U({video:U({codec:G([`h264`,`h265`,`copy`]),profile:G([`baseline`,`main`,`high`]).optional(),width:R().int().positive().optional(),height:R().int().positive().optional(),fps:R().positive().optional(),bitrateKbps:R().int().positive().optional(),gopFrames:R().int().positive().optional(),bf:R().int().min(0).optional(),preset:G([`ultrafast`,`superfast`,`veryfast`,`faster`,`fast`,`medium`]).optional(),tune:G([`zerolatency`,`film`,`animation`]).optional()}),audio:av([K(`passthrough`),U({codec:G([`opus`,`aac`,`pcmu`,`pcma`,`copy`]),bitrateKbps:R().int().positive().optional(),sampleRateHz:R().int().positive().optional(),channels:av([K(1),K(2)]).optional()})]),inputArgs:H(L()).optional(),outputArgs:H(L()).optional()}),My={mapping:{Speech:`speech`,"Child speech, kid speaking":`speech`,Conversation:`speech`,"Narration, monologue":`speech`,Babbling:`speech`,Whispering:`speech`,"Speech synthesizer":`speech`,Humming:`speech`,Rapping:`speech`,Singing:`speech`,Choir:`speech`,"Child singing":`speech`,Shout:`scream`,Bellow:`scream`,Yell:`scream`,Screaming:`scream`,"Children shouting":`scream`,Whoop:`scream`,"Crying, sobbing":`crying`,"Baby cry, infant cry":`crying`,Whimper:`crying`,"Wail, moan":`crying`,Groan:`crying`,Laughter:`laughter`,"Baby laughter":`laughter`,Giggle:`laughter`,Snicker:`laughter`,"Belly laugh":`laughter`,"Chuckle, chortle":`laughter`,Music:`music`,"Musical instrument":`music`,Guitar:`music`,Piano:`music`,Drum:`music`,"Drum kit":`music`,"Violin, fiddle":`music`,Flute:`music`,Saxophone:`music`,Trumpet:`music`,Synthesizer:`music`,"Pop music":`music`,"Rock music":`music`,"Hip hop music":`music`,"Classical music":`music`,Jazz:`music`,"Electronic music":`music`,"Background music":`music`,Dog:`dog`,Bark:`dog`,Yip:`dog`,Howl:`dog`,"Bow-wow":`dog`,Growling:`dog`,"Whimper (dog)":`dog`,Cat:`cat`,Purr:`cat`,Meow:`cat`,Hiss:`cat`,Caterwaul:`cat`,Bird:`bird`,"Bird vocalization, bird call, bird song":`bird`,"Chirp, tweet":`bird`,Squawk:`bird`,Crow:`bird`,Owl:`bird`,"Pigeon, dove":`bird`,Animal:`animal`,"Domestic animals, pets":`animal`,"Livestock, farm animals, working animals":`animal`,Horse:`animal`,"Cattle, bovinae":`animal`,Pig:`animal`,Sheep:`animal`,Goat:`animal`,Frog:`animal`,Insect:`animal`,Cricket:`animal`,Alarm:`alarm`,"Alarm clock":`alarm`,"Smoke detector, smoke alarm":`alarm`,"Fire alarm":`alarm`,Buzzer:`alarm`,"Civil defense siren":`alarm`,"Car alarm":`alarm`,Siren:`siren`,"Police car (siren)":`siren`,"Ambulance (siren)":`siren`,"Fire engine, fire truck (siren)":`siren`,"Emergency vehicle":`siren`,Foghorn:`siren`,Doorbell:`doorbell`,"Ding-dong":`doorbell`,Knock:`doorbell`,Tap:`doorbell`,Glass:`glass_breaking`,Shatter:`glass_breaking`,"Chink, clink":`glass_breaking`,"Gunshot, gunfire":`gunshot`,"Machine gun":`gunshot`,Explosion:`gunshot`,Fireworks:`gunshot`,Firecracker:`gunshot`,"Artillery fire":`gunshot`,"Cap gun":`gunshot`,Boom:`gunshot`,Vehicle:`vehicle`,Car:`vehicle`,Truck:`vehicle`,Bus:`vehicle`,Motorcycle:`vehicle`,"Car passing by":`vehicle`,"Vehicle horn, car horn, honking":`vehicle`,"Traffic noise, roadway noise":`vehicle`,Train:`vehicle`,Aircraft:`vehicle`,Helicopter:`vehicle`,Bicycle:`vehicle`,Skateboard:`vehicle`,Fire:`fire`,Crackle:`fire`,Water:`water`,Rain:`water`,Raindrop:`water`,"Rain on surface":`water`,Stream:`water`,Waterfall:`water`,Ocean:`water`,"Waves, surf":`water`,"Splash, splatter":`water`,Wind:`wind`,Thunderstorm:`wind`,Thunder:`wind`,"Wind noise (microphone)":`wind`,"Rustling leaves":`wind`,Door:`door`,"Sliding door":`door`,Slam:`door`,"Cupboard open or close":`door`,"Walk, footsteps":`footsteps`,Run:`footsteps`,Shuffle:`footsteps`,Crowd:`crowd`,Chatter:`crowd`,Cheering:`crowd`,Applause:`crowd`,"Children playing":`crowd`,"Hubbub, speech noise, speech babble":`crowd`,Telephone:`telephone`,"Telephone bell ringing":`telephone`,Ringtone:`telephone`,"Telephone dialing, DTMF":`telephone`,"Busy signal":`telephone`,Engine:`engine`,"Engine starting":`engine`,Idling:`engine`,"Accelerating, revving, vroom":`engine`,"Light engine (high frequency)":`engine`,"Medium engine (mid frequency)":`engine`,"Heavy engine (low frequency)":`engine`,"Lawn mower":`engine`,Chainsaw:`engine`,Hammer:`tools`,Jackhammer:`tools`,Sawing:`tools`,"Power tool":`tools`,Drill:`tools`,Sanding:`tools`,Silence:`silence`},preserveOriginal:!1},Ny={mapping:{speech:`speech`,child_speech:`speech`,conversation:`speech`,whispering:`speech`,singing:`speech`,humming:`speech`,shout:`scream`,yell:`scream`,screaming:`scream`,crying:`crying`,baby_crying:`crying`,sobbing:`crying`,laughter:`laughter`,baby_laughter:`laughter`,giggling:`laughter`,music:`music`,guitar:`music`,piano:`music`,drums:`music`,dog_bark:`dog`,dog_bow_wow:`dog`,dog_growling:`dog`,dog_howl:`dog`,cat_meow:`cat`,cat_purr:`cat`,cat_hiss:`cat`,bird:`bird`,bird_chirp:`bird`,bird_squawk:`bird`,animal:`animal`,horse:`animal`,cow_moo:`animal`,insect:`animal`,alarm:`alarm`,smoke_alarm:`alarm`,fire_alarm:`alarm`,car_alarm:`alarm`,siren:`siren`,police_siren:`siren`,ambulance_siren:`siren`,doorbell:`doorbell`,door_knock:`doorbell`,knocking:`doorbell`,glass_breaking:`glass_breaking`,glass_shatter:`glass_breaking`,gunshot:`gunshot`,explosion:`gunshot`,fireworks:`gunshot`,car:`vehicle`,truck:`vehicle`,motorcycle:`vehicle`,car_horn:`vehicle`,vehicle_horn:`vehicle`,traffic:`vehicle`,fire:`fire`,fire_crackle:`fire`,water:`water`,rain:`water`,ocean:`water`,splash:`water`,wind:`wind`,thunder:`wind`,thunderstorm:`wind`,door:`door`,door_slam:`door`,sliding_door:`door`,footsteps:`footsteps`,walking:`footsteps`,running:`footsteps`,crowd:`crowd`,chatter:`crowd`,cheering:`crowd`,applause:`crowd`,telephone_ring:`telephone`,ringtone:`telephone`,engine:`engine`,engine_starting:`engine`,lawn_mower:`engine`,chainsaw:`engine`,hammer:`tools`,jackhammer:`tools`,drill:`tools`,power_tool:`tools`,silence:`silence`},preserveOriginal:!1},Py=new Map;for(let[e,t]of Object.entries(My.mapping))Py.set(e.toLowerCase(),t);for(let[e,t]of Object.entries(Ny.mapping))Py.set(e.toLowerCase(),t);var q=function(e){return e.Camera=`camera`,e.Hub=`hub`,e.Light=`light`,e.Siren=`siren`,e.Switch=`switch`,e.Sensor=`sensor`,e.Thermostat=`thermostat`,e.Button=`button`,e.EventEmitter=`event-emitter`,e.Update=`update`,e.Generic=`generic`,e.Notifier=`notifier`,e.Script=`script`,e.Automation=`automation`,e.Lock=`lock`,e.Cover=`cover`,e.Valve=`valve`,e.Humidifier=`humidifier`,e.WaterHeater=`water-heater`,e.Fan=`fan`,e.MediaPlayer=`media-player`,e.AlarmPanel=`alarm-panel`,e.Control=`control`,e.Presence=`presence`,e.Weather=`weather`,e.Vacuum=`vacuum`,e.LawnMower=`lawn-mower`,e.Container=`container`,e.Image=`image`,e}({}),Fy=function(e){return e.BatteryOperated=`battery-operated`,e.Rebootable=`rebootable`,e.Resyncable=`resyncable`,e.NativeSnapshot=`native-snapshot`,e.DoorbellButton=`doorbell-button`,e.TwoWayAudio=`two-way-audio`,e.PanTiltZoom=`pan-tilt-zoom`,e.PtzAutotrack=`ptz-autotrack`,e.MotionTrigger=`motion-trigger`,e.LightColorRgb=`light-color-rgb`,e.LightColorHsv=`light-color-hsv`,e.LightColorMired=`light-color-mired`,e.ClimateDualSetpoint=`climate-dual-setpoint`,e.ClimateHumidity=`climate-humidity`,e.ClimateFanMode=`climate-fan-mode`,e.ClimatePreset=`climate-preset`,e.CoverPositionable=`cover-positionable`,e.CoverTilt=`cover-tilt`,e.ValvePositionable=`valve-positionable`,e.FanSpeed=`fan-speed`,e.FanPreset=`fan-preset`,e.FanDirection=`fan-direction`,e.FanOscillating=`fan-oscillating`,e.LockPinRequired=`lock-pin-required`,e.LockOpen=`lock-open`,e.MediaPlayerSeek=`media-player-seek`,e.MediaPlayerVolume=`media-player-volume`,e.MediaPlayerMute=`media-player-mute`,e.MediaPlayerShuffle=`media-player-shuffle`,e.MediaPlayerRepeat=`media-player-repeat`,e.MediaPlayerSelectSource=`media-player-select-source`,e.MediaPlayerPlayMedia=`media-player-play-media`,e.MediaPlayerNext=`media-player-next`,e.MediaPlayerPrevious=`media-player-previous`,e.MediaPlayerStop=`media-player-stop`,e.AlarmPinRequired=`alarm-pin-required`,e.PresenceGps=`presence-gps`,e.NotifierImage=`notifier-image`,e.NotifierPriority=`notifier-priority`,e.NotifierData=`notifier-data`,e.NotifierActions=`notifier-actions`,e.NotifierRecipients=`notifier-recipients`,e.ScriptVariables=`script-variables`,e.AutomationSkipCondition=`automation-skip-condition`,e}({}),Iy=function(e){return e.Siren=`siren`,e.Floodlight=`floodlight`,e.Spotlight=`spotlight`,e.PirSensor=`pir-sensor`,e.Chime=`chime`,e.Autotrack=`autotrack`,e.Nightvision=`nightvision`,e.PrivacyMask=`privacy-mask`,e.Doorbell=`doorbell`,e.BinaryHelper=`binary-helper`,e.MotionSensor=`motion-sensor`,e.ContactSensor=`contact-sensor`,e.LeakSensor=`leak-sensor`,e.SmokeSensor=`smoke-sensor`,e.COSensor=`co-sensor`,e.GasSensor=`gas-sensor`,e.TamperSensor=`tamper-sensor`,e.VibrationSensor=`vibration-sensor`,e.ConnectivitySensor=`connectivity-sensor`,e.SoundSensor=`sound-sensor`,e.BinarySensor=`binary-sensor`,e.TemperatureSensor=`temperature-sensor`,e.HumiditySensor=`humidity-sensor`,e.AmbientLightSensor=`ambient-light-sensor`,e.PressureSensor=`pressure-sensor`,e.PowerSensor=`power-sensor`,e.EnergySensor=`energy-sensor`,e.VoltageSensor=`voltage-sensor`,e.CurrentSensor=`current-sensor`,e.AirQualitySensor=`air-quality-sensor`,e.BatterySensor=`battery-sensor`,e.NumericSensor=`numeric-sensor`,e.EnumSensor=`enum-sensor`,e.DateTimeSensor=`datetime-sensor`,e.GenericSensor=`generic-sensor`,e.NumericControl=`numeric-control`,e.SelectControl=`select-control`,e.TextControl=`text-control`,e.DateTimeControl=`datetime-control`,e.MobilePushNotifier=`mobile-push-notifier`,e.MessagingNotifier=`messaging-notifier`,e.EmailNotifier=`email-notifier`,e.GenericNotifier=`generic-notifier`,e}({}),Ly={Siren:Iy.Siren,Floodlight:Iy.Floodlight,Spotlight:Iy.Spotlight,PirSensor:Iy.PirSensor,Chime:Iy.Chime,Autotrack:Iy.Autotrack,Nightvision:Iy.Nightvision,PrivacyMask:Iy.PrivacyMask};Ly.Siren,Ly.Floodlight,Ly.Spotlight,Ly.PirSensor,Ly.Chime,Ly.Autotrack,Ly.Nightvision,Ly.PrivacyMask,Fy.BatteryOperated;var Ry=U({online:z(),lastChangedAt:R()}),zy={name:`device-status`,scope:`device`,deviceNative:!0,mode:`singleton`,methods:{},events:{onStatusChanged:{data:U({deviceId:R(),status:Ry})}},status:{schema:Ry,kind:`push`},runtimeState:Ry},By=U({flags:W(L(),B()),deviceType:L().nullable(),model:L().nullable(),channelCount:R().nullable(),lastProbedAt:R(),lastFetchedAt:R()}),Vy={name:`feature-probe`,scope:`device`,deviceNative:!0,mode:`singleton`,methods:{},events:{onProbeChanged:{data:U({deviceId:R(),status:By})}},status:{schema:By,kind:`push`},runtimeState:By},Hy=U({co2Ppm:R().min(0).optional(),vocPpb:R().min(0).optional(),pm25:R().min(0).optional(),pm10:R().min(0).optional(),aqi:R().optional(),lastFetchedAt:R(),unit:L().optional(),precision:R().int().min(0).max(10).optional()}),Uy={name:`air-quality-sensor`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:Hy,kind:`push`},runtimeState:Hy},Wy=U({id:L(),title:L(),description:L().optional(),style:G([`card`,`accordion`]).optional(),defaultCollapsed:z().optional(),columns:av([K(1),K(2),K(3),K(4)]).optional(),tab:L().optional(),location:G([`settings`,`top-tab`]).optional(),order:R().optional(),fields:H(Y_())});U({tabs:H(U({id:L(),label:L(),icon:L(),order:R().optional()})).optional(),sections:H(Wy)}).nullable(),U({deviceId:R()}),U({deviceId:R()}),U({deviceId:R(),patch:W(L(),B())}),U({success:K(!0)}),U({deviceId:R()}),B().nullable();function J(e,t,n){return{input:e,output:t,kind:n?.kind??`query`,auth:n?.auth??`protected`,...n?.access===void 0?{}:{access:n.access},timeoutMs:n?.timeoutMs}}function Gy(e){return{data:e}}var Ky=G([`disarmed`,`armed_home`,`armed_away`,`armed_night`,`armed_vacation`,`armed_custom_bypass`,`arming`,`disarming`,`pending`,`triggered`]),qy=G([`home`,`away`,`night`,`vacation`,`custom_bypass`]),Jy=U({state:Ky,availableModes:H(qy),requiresCode:z(),lastChangedAt:R()}),Yy={name:`alarm-panel`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.AlarmPanel],methods:{arm:J(U({deviceId:R().int().nonnegative(),mode:qy,code:L().min(1).optional()}),V(),{kind:`mutation`,auth:`admin`}),disarm:J(U({deviceId:R().int().nonnegative(),code:L().min(1).optional()}),V(),{kind:`mutation`,auth:`admin`}),trigger:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:Jy,kind:`push`},runtimeState:Jy},Xy=U({lux:R().min(0),lastFetchedAt:R(),unit:L().optional(),precision:R().int().min(0).max(10).optional()}),Zy={name:`ambient-light-sensor`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:Xy,kind:`push`},runtimeState:Xy},Qy=U({className:L(),hits:R().int().nonnegative(),avgScore:R().min(0).max(1),peakScore:R().min(0).max(1)}),$y=U({ts:R().int(),windowSec:R().int().positive(),level:U({rms:R(),dbfs:R()}),peakDbfs:R(),avgDbfs:R(),current:U({className:L(),score:R().min(0).max(1),timestamp:R().int()}).nullable(),byClass:H(Qy).readonly()}),eb=U({points:H(U({ts:R().int(),dbfs:R().nullable(),peakDbfs:R(),avgDbfs:R(),topClass:L().nullable(),topScore:R().min(0).max(1).nullable()})).readonly(),effectiveSampleEveryMs:R().int().positive(),windowMsActual:R().int().nonnegative()}),tb={name:`audio-metrics`,scope:`device`,mode:`singleton`,deviceTypes:[q.Camera],methods:{getCurrentSnapshot:J(U({deviceId:R()}),$y.nullable()),getHistory:J(U({deviceId:R(),windowSec:R().int().positive().optional(),sampleEveryMs:R().int().positive().optional()}),eb)},runtimeState:$y},nb=U({enabled:z(),isRunning:z(),lastTriggeredAt:R(),lastError:L().nullable(),lastChangedAt:R()}),rb={name:`automation-control`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Automation],methods:{enable:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),disable:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),trigger:J(U({deviceId:R().int().nonnegative(),skipCondition:z().optional()}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:nb,kind:`push`},runtimeState:nb},ib=U({percentage:R().min(0).max(100),charging:G([`dc`,`solar`,`none`]),sleeping:z(),lastUpdated:R(),binary:z().optional()}),ab={name:`battery`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera,q.Sensor,q.Button,q.Switch],methods:{wakeForStream:J(U({deviceId:R(),timeoutMs:R().int().min(500).max(3e4).default(8e3)}),U({awoke:z(),durationMs:R()}),{kind:`mutation`})},events:{onStatusChanged:{data:U({deviceId:R(),status:ib})}},status:{schema:ib,kind:`push`},runtimeState:ib},ob=U({on:z(),lastChangedAt:R()}),sb={name:`binary`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:ob,kind:`push`},runtimeState:ob},cb=U({percentage:R().min(0).max(100),lastChangedAt:R()}),lb={name:`brightness`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Light],methods:{setBrightness:J(U({deviceId:R().int().nonnegative(),percentage:R().min(0).max(100)}),V(),{kind:`mutation`,auth:`admin`})},events:{onBrightnessChanged:{data:U({deviceId:R(),percentage:R().min(0).max(100),lastChangedAt:R()})}},status:{schema:cb,kind:`command-driven`},runtimeState:cb},ub=G([`webrtc`,`hls`,`mjpeg`,`rtsp`]),db=U({streamId:L(),format:ub,url:L().nullable(),active:z()}),fb={name:`streaming-engine`,scope:`system`,mode:`singleton`,internal:!0,methods:{registerStream:J(U({streamId:L(),sourceUrl:L(),codec:L().optional()}),V(),{kind:`mutation`}),unregisterStream:J(U({streamId:L()}),V(),{kind:`mutation`}),getStreamUrl:J(U({streamId:L(),format:ub}),L().nullable()),listStreams:J(V(),H(db))}},pb=U({brokerId:L(),url:L(),mutedUrl:L(),enabled:z(),codec:L().optional(),resolution:U({width:R().int().positive(),height:R().int().positive()}).optional()}),mb=U({sessionId:L(),remoteAddr:L(),playing:z(),muted:z(),connectedAt:R(),lastRtpAt:R(),bytesSent:R()}),hb=U({tag:L(),subscribedAt:R(),maxFps:R(),framesDelivered:R(),framesDropped:R()}),gb=U({tag:L(),subscribedAt:R(),chunksDelivered:R()}),_b=U({kind:G([`alexa`,`homekit`,`webrtc-browser`,`webrtc-mobile`,`webrtc-whep`,`rtsp-listen`,`derived-broker`,`recording`,`pipeline`,`snapshot`,`warmup`,`unknown`]),label:L().optional(),media:G([`audio`,`video`,`both`]).optional(),targetCodec:L().optional(),transport:G([`passthrough`,`repacketize`,`transcode`]).optional(),remoteAddr:L().optional(),userAgent:L().optional(),userId:L().optional(),sessionId:L().optional(),extra:W(L(),L()).optional()}).readonly(),vb=U({id:L(),channel:G([`annexb`,`rtp`]),attribution:_b,subscribedAt:R(),packetsDelivered:R()}),yb=U({rtsp:H(mb).readonly(),decoded:H(hb).readonly(),audio:H(gb).readonly(),encoded:H(vb).readonly(),pipeClients:R(),encodedSubscribers:R()});G([`reconnecting`,`sleeping`,`offline`,`disabled`,`waking`]);var bb=G([`h264`,`h265`,`copy`]),xb=G([`aac`,`opus`,`pcmu`,`copy`,`none`]),Sb=U({deviceId:R().int().nonnegative(),video:bb,audio:xb.optional(),profile:Yv.optional(),targetResolution:U({width:R().int().positive(),height:R().int().positive()}).optional(),outputArgs:H(L()).optional(),audioEgress:z().optional(),hostname:L().optional(),tag:L().optional()}),Cb=U({url:L(),videoCodec:G([`H264`,`H265`]),audioCodec:L(),resolution:U({width:R().int().positive(),height:R().int().positive()}),transcoded:z(),encoder:L(),pipelineKey:L()}),wb={name:`stream-broker`,scope:`system`,mode:`singleton`,exposesDeviceSettings:!0,methods:{publishCameraStream:J(U({deviceId:R().int().nonnegative(),camStreamId:L().min(1),kind:Xv,url:L().optional(),codec:L().optional(),resolution:Zv.optional(),fps:R().positive().optional(),label:L().optional(),deviceFeatures:H(L()).optional(),autoEligible:z().optional(),metadata:W(L(),B()).optional(),sourceCamStreamId:L().min(1).optional(),encodeProfile:jy.optional()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),retractCameraStream:J(U({deviceId:R().int().nonnegative(),camStreamId:L().min(1)}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),assignProfile:J(U({deviceId:R().int().nonnegative(),profile:Yv,camStreamId:L().min(1)}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),unassignProfile:J(U({deviceId:R().int().nonnegative(),profile:Yv}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),listAllCameraStreams:J(V(),H(Qv).readonly()),listAllProfileSlots:J(V(),H(ey).readonly()),getBrokerStats:J(U({brokerId:L()}),dy),probeStream:J(U({brokerId:L()}),U({probed:z(),summary:L()}),{kind:`mutation`,auth:`admin`}),listClients:J(U({brokerId:L()}),yb),killClient:J(U({brokerId:L(),channel:G([`rtsp`,`decoded`,`audio`]),handle:L()}),U({killed:z()}),{kind:`mutation`,auth:`admin`}),restartProfile:J(U({deviceId:R().int().nonnegative(),profile:Yv}),U({success:z()}),{kind:`mutation`,auth:`admin`}),getStreamUrl:J(U({streamId:L(),format:ub}),U({url:L()})),getStreamWithCodec:J(Sb,Cb,{kind:`mutation`,auth:`admin`}),releaseStreamWithCodec:J(U({pipelineKey:L()}),U({released:z(),refcount:R().int().nonnegative()}),{kind:`mutation`,auth:`admin`}),subscribeAudioChunks:J(ly,uy,{kind:`mutation`}),pullAudioChunks:J(U({subscriptionId:L(),maxCount:R().int().positive().default(8)}),H(cy).readonly()),unsubscribeAudioChunks:J(U({subscriptionId:L()}),U({released:z()}),{kind:`mutation`}),subscribeFrames:J(oy,sy,{kind:`mutation`}),pullFrameHandles:J(U({subscriptionId:L(),maxCount:R().int().positive().default(4)}),H(iy).readonly()),unsubscribeFrames:J(U({subscriptionId:L()}),U({released:z()}),{kind:`mutation`}),setPreBufferDuration:J(U({brokerId:L(),seconds:R().min(0).max(30)}),V(),{kind:`mutation`,auth:`admin`}),getPreBufferInfo:J(U({brokerId:L()}),U({configuredSec:R(),bufferedMs:R(),packetCount:R()})),getRtspPort:J(V(),R()),getAllRtspEntries:J(U({hostname:L().optional()}),H(pb).readonly()),getRtspEntry:J(U({brokerId:L(),hostname:L().optional()}),pb.nullable()),regenerateRtspToken:J(U({brokerId:L()}),L().nullable(),{kind:`mutation`,auth:`admin`}),setRtspEnabled:J(U({brokerId:L(),enabled:z()}),V(),{kind:`mutation`,auth:`admin`}),isRtspEnabled:J(U({brokerId:L()}),z())},events:{onCamStreamDemand:Gy(U({deviceId:R().int().nonnegative(),camStreamId:L(),profile:Yv})),onCamStreamIdle:Gy(U({deviceId:R().int().nonnegative(),camStreamId:L()})),onRequestStreamSourceRefresh:Gy(U({deviceId:R().int().nonnegative(),camStreamId:L(),brokerId:L()}))}},Tb=G([`h264`,`h265`,`hevc`,`av1`,`mjpeg`,`vp8`,`vp9`]),Eb=U({acceptCodecs:H(Tb).readonly().optional(),minHeight:R().int().positive().optional(),minWidth:R().int().positive().optional(),excludeDerived:z().optional(),requireSiblingCodec:H(Tb).readonly().optional()}).readonly(),Db=U({preferredProviders:H(L()).readonly().optional(),resolutionPreference:G([`highest`,`lowest`]).optional()}).readonly(),Ob=U({camStreamId:L(),codec:L().optional(),resolution:Zv.optional(),reason:L()}),kb={name:`camera-streams`,scope:`device`,mode:`singleton`,kind:`wrapper`,defaultActive:!0,deviceTypes:[q.Camera],methods:{getCameraStreams:J(U({deviceId:R().int().nonnegative()}),H(Qv).readonly()),getBrokerStreams:J(U({deviceId:R().int().nonnegative()}),H(ey).readonly()),getRtspEntries:J(U({deviceId:R().int().nonnegative(),hostname:L().optional()}),H(pb).readonly()),getProfileRtspEntries:J(U({deviceId:R().int().nonnegative(),hostname:L().optional()}),H(fy).readonly()),pickStream:J(U({deviceId:R().int().nonnegative(),requirements:Eb,preferences:Db.optional()}),Ob.nullable())},events:{onCamStreamsChanged:Gy(U({deviceId:R().int().nonnegative(),camStreams:H(Qv).readonly()})),onProfileSlotsChanged:Gy(U({deviceId:R().int().nonnegative(),profileSlots:H(ey).readonly()}))},runtimeState:U({online:z(),slotStatuses:U({high:$v.optional(),mid:$v.optional(),low:$v.optional()}),slotErrors:U({high:L().optional(),mid:L().optional(),low:L().optional()}),lastChangedAt:R()})},Ab=U({detected:z(),lastChangedAt:R()}),jb={name:`carbon-monoxide`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:Ab,kind:`push`},runtimeState:Ab},Mb=G([`off`,`heat`,`cool`,`auto`,`heat_cool`,`fan_only`,`dry`]),Nb=U({mode:Mb,availableModes:H(Mb),fanMode:L(),availableFanModes:H(L()),preset:L(),availablePresets:H(L()),target:R().nullable(),targetHigh:R().nullable(),targetLow:R().nullable(),targetHumidity:R().min(0).max(100).nullable(),currentTemp:R().nullable(),currentHumidity:R().min(0).max(100).nullable(),lastFetchedAt:R()}),Pb={name:`climate-control`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Thermostat],methods:{setMode:J(U({deviceId:R().int().nonnegative(),mode:Mb}),V(),{kind:`mutation`,auth:`admin`}),setFanMode:J(U({deviceId:R().int().nonnegative(),fanMode:L().min(1)}),V(),{kind:`mutation`,auth:`admin`}),setPreset:J(U({deviceId:R().int().nonnegative(),preset:L().min(1)}),V(),{kind:`mutation`,auth:`admin`}),setTarget:J(U({deviceId:R().int().nonnegative(),target:R()}),V(),{kind:`mutation`,auth:`admin`}),setTargetRange:J(U({deviceId:R().int().nonnegative(),targetLow:R(),targetHigh:R()}),V(),{kind:`mutation`,auth:`admin`}),setTargetHumidity:J(U({deviceId:R().int().nonnegative(),targetHumidity:R().min(0).max(100)}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:Nb,kind:`push`},runtimeState:Nb},Fb=U({r:R().int().min(0).max(255),g:R().int().min(0).max(255),b:R().int().min(0).max(255)}),Ib=U({h:R().min(0).max(360),s:R().min(0).max(100),v:R().min(0).max(100)}),Lb=sv(`mode`,[U({mode:K(`rgb`),rgb:Fb}),U({mode:K(`hsv`),hsv:Ib}),U({mode:K(`mired`),mireds:R().int().min(50).max(1e3)})]),Rb=U({mode:G([`rgb`,`hsv`,`mired`]),rgb:Fb.optional(),hsv:Ib.optional(),mireds:R().int().optional(),lastChangedAt:R()}),zb={name:`color`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Light],methods:{setColor:J(U({deviceId:R().int().nonnegative(),color:Lb}),V(),{kind:`mutation`,auth:`admin`})},events:{onColorChanged:{data:U({deviceId:R(),mode:G([`rgb`,`hsv`,`mired`]),rgb:Fb.optional(),hsv:Ib.optional(),mireds:R().int().optional(),lastChangedAt:R()})}},status:{schema:Rb,kind:`command-driven`},runtimeState:Rb},Bb=U({connected:z(),lastChangedAt:R()}),Vb={name:`connectivity`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:Bb,kind:`push`},runtimeState:Bb},Hb=U({items:H(U({key:L().min(1),label:L().min(1),level:R().min(0).max(100).nullable(),status:G([`ok`,`replace`]).nullable(),lastResetAt:R().nullable(),resettable:z()})),lastChangedAt:R()}),Ub={name:`consumables`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera,q.Hub,q.Light,q.Siren,q.Switch,q.Sensor,q.Thermostat,q.Button,q.EventEmitter,q.Update,q.Generic,q.Notifier,q.Script,q.Automation,q.Lock,q.Cover,q.Valve,q.Humidifier,q.WaterHeater,q.Fan,q.MediaPlayer,q.AlarmPanel,q.Control,q.Presence,q.Weather,q.Vacuum,q.LawnMower,q.Container,q.Image],deviceConfig:{ui:{kind:`widget`,widgetId:`host/consumables-panel`,tab:`consumables`,topTab:!0,label:`Consumables`,order:5}},methods:{reset:J(U({deviceId:R().int().nonnegative(),key:L().min(1)}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:Hb,kind:`push`},runtimeState:Hb.extend({lastFetchedAt:R()})},Wb=U({entryOpen:z(),lastChangedAt:R()}),Gb={name:`contact`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:Wb,kind:`push`},runtimeState:Wb},Kb=U({kind:G([`numeric`,`select`,`text`,`datetime`]),value:av([R(),L()]),options:H(L()),lastChangedAt:R(),unit:L().optional(),min:R().optional(),max:R().optional(),step:R().optional(),precision:R().int().min(0).max(10).optional(),format:G([`date`,`time`,`datetime`]).optional()}),qb=sv(`kind`,[U({kind:K(`numeric`),value:R()}),U({kind:K(`select`),value:L().min(1)}),U({kind:K(`text`),value:L()}),U({kind:K(`datetime`),value:L().min(1)})]),Jb={name:`control`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Control],methods:{setValue:J(U({deviceId:R().int().nonnegative(),control:qb}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:Kb,kind:`push`},runtimeState:Kb},Yb=U({state:G([`open`,`opening`,`closing`,`closed`,`stopped`]),position:R().min(0).max(100).nullable(),tiltPosition:R().min(0).max(100).nullable(),lastChangedAt:R()}),Xb={name:`cover`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Cover],methods:{open:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),close:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),stop:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),setPosition:J(U({deviceId:R().int().nonnegative(),position:R().min(0).max(100)}),V(),{kind:`mutation`,auth:`admin`}),setTiltPosition:J(U({deviceId:R().int().nonnegative(),tiltPosition:R().min(0).max(100)}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:Yb,kind:`push`},runtimeState:Yb},Zb=U({id:L(),system:L(),uniqueId:L().optional(),raw:W(L(),B()).optional()}),Qb=G([`online`,`sleeping`,`offline`,`unknown`]),$b=Lv(()=>U({childNativeId:L(),name:L(),type:G(q),status:Qb,metadata:U({model:L().optional(),serialNumber:L().optional(),uid:L().optional(),rtspChannel:R().int().nonnegative().optional(),isBattery:z().optional(),isDoorbell:z().optional(),isMultifocal:z().optional(),externalLocation:L().optional(),manufacturer:L().optional(),integration:L().optional()}).default({}),alreadyAdopted:z(),adoptedDeviceId:R().int().nonnegative().nullable(),capabilities:H(L()).readonly().optional(),features:H(L()).readonly().optional(),sourceInfo:Zb.optional(),children:H($b).readonly().optional()})),ex=U({discovered:H($b),lastDiscoveryAt:R().int().nonnegative().nullable(),lastError:L().nullable()}),tx={name:`device-discovery`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Hub],status:{schema:ex,kind:`poll`},runtimeState:ex.extend({lastFetchedAt:R().int().nonnegative()}),methods:{listDiscovered:J(U({deviceId:R().int().nonnegative()}),H($b).readonly()),refreshDiscovery:J(U({deviceId:R().int().nonnegative()}),H($b).readonly(),{kind:`mutation`,auth:`admin`}),adoptDevice:J(U({deviceId:R().int().nonnegative(),childNativeId:L(),name:L().optional()}),U({deviceId:R().int().nonnegative(),stableId:L()}),{kind:`mutation`,auth:`admin`}),releaseDevice:J(U({deviceId:R().int().nonnegative(),childDeviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`})}},nx=U({lastPressedAt:R().nullable(),pressCountSinceStart:R()}),rx=U({deviceId:R(),timestamp:R()}),ix={name:`doorbell`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Button],methods:{},events:{onPressed:{data:rx}},status:{schema:nx,kind:`push`},runtimeState:nx},ax=G([`date`,`time`,`datetime`]),ox=U({value:L(),format:ax.optional(),lastFetchedAt:R()}),sx={name:`enum-sensor`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:ox,kind:`push`},runtimeState:ox},cx=U({deviceId:R(),eventType:L(),data:W(L(),B()).nullable(),timestamp:R(),seq:R()}),lx=U({eventTypes:H(L()),lastEvent:cx.nullable(),eventCountSinceStart:R()}),ux={name:`event-emitter`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.EventEmitter],methods:{},events:{onEvent:{data:cx}},status:{schema:lx,kind:`push`},runtimeState:lx},dx=G([`forward`,`reverse`]),fx=U({percentage:R().min(0).max(100).nullable(),percentageStep:R().positive().optional(),preset:L(),availablePresets:H(L()),direction:dx.nullable(),oscillating:z().nullable(),lastChangedAt:R()}),px={name:`fan-control`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Fan],methods:{setPercentage:J(U({deviceId:R().int().nonnegative(),percentage:R().min(0).max(100)}),V(),{kind:`mutation`,auth:`admin`}),setPreset:J(U({deviceId:R().int().nonnegative(),preset:L().min(1)}),V(),{kind:`mutation`,auth:`admin`}),setDirection:J(U({deviceId:R().int().nonnegative(),direction:dx}),V(),{kind:`mutation`,auth:`admin`}),setOscillating:J(U({deviceId:R().int().nonnegative(),oscillating:z()}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:fx,kind:`push`},runtimeState:fx},mx=U({flooded:z(),lastChangedAt:R()}),hx={name:`flood`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:mx,kind:`push`},runtimeState:mx},gx=U({detected:z(),lastChangedAt:R()}),_x={name:`gas`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:gx,kind:`push`},runtimeState:gx},vx=U({on:z(),currentHumidity:R().min(0).max(100).nullable(),targetHumidity:R().min(0).max(100).nullable(),mode:L().nullable(),availableModes:H(L()),action:L().nullable(),minHumidity:R().nullable(),maxHumidity:R().nullable(),lastChangedAt:R()}),yx={name:`humidifier`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Humidifier],methods:{setOn:J(U({deviceId:R().int().nonnegative(),on:z()}),V(),{kind:`mutation`,auth:`admin`}),setTargetHumidity:J(U({deviceId:R().int().nonnegative(),humidity:R().min(0).max(100)}),V(),{kind:`mutation`,auth:`admin`}),setMode:J(U({deviceId:R().int().nonnegative(),mode:L().min(1)}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:vx,kind:`push`},runtimeState:vx},bx=U({percent:R().min(0).max(100),lastFetchedAt:R(),unit:L().optional(),precision:R().int().min(0).max(10).optional()}),xx={name:`humidity-sensor`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor,q.Thermostat],methods:{},status:{schema:bx,kind:`push`},runtimeState:bx},Sx=U({url:L().nullable(),lastUpdated:R().nullable()}),Cx={name:`image`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Image],methods:{},status:{schema:Sx,kind:`push`},runtimeState:Sx},wx=U({activity:G([`idle`,`mowing`,`paused`,`docked`,`error`]),batteryLevel:R().min(0).max(100).nullable(),lastChangedAt:R()}),Tx={name:`lawn-mower-control`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.LawnMower],methods:{startMowing:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),pause:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),dock:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:wx,kind:`push`},runtimeState:wx},Ex=U({state:G([`locked`,`unlocked`,`locking`,`unlocking`,`jammed`]),lastChangedAt:R()}),Dx={name:`lock-control`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Lock],methods:{lock:J(U({deviceId:R().int().nonnegative(),code:L().min(1).optional()}),V(),{kind:`mutation`,auth:`admin`}),unlock:J(U({deviceId:R().int().nonnegative(),code:L().min(1).optional()}),V(),{kind:`mutation`,auth:`admin`}),open:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:Ex,kind:`push`},runtimeState:Ex},Ox=G([`off`,`on`,`idle`,`playing`,`paused`,`buffering`,`standby`]),kx=G([`off`,`all`,`one`]),Ax=U({type:L(),title:L(),artist:L().optional(),album:L().optional(),imageUrl:L().optional()}),jx=U({state:Ox,volumeLevel:R().min(0).max(100).nullable(),isMuted:z().nullable(),source:L(),availableSources:H(L()),currentMedia:Ax.nullable(),positionMs:R().int().nonnegative().nullable(),durationMs:R().int().nonnegative().nullable(),shuffle:z().nullable(),repeat:kx.nullable(),lastChangedAt:R()}),Mx={name:`media-player`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.MediaPlayer],methods:{play:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),pause:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),stop:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),next:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),previous:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),seek:J(U({deviceId:R().int().nonnegative(),positionMs:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),setVolume:J(U({deviceId:R().int().nonnegative(),volumeLevel:R().min(0).max(100)}),V(),{kind:`mutation`,auth:`admin`}),setMute:J(U({deviceId:R().int().nonnegative(),muted:z()}),V(),{kind:`mutation`,auth:`admin`}),setShuffle:J(U({deviceId:R().int().nonnegative(),shuffle:z()}),V(),{kind:`mutation`,auth:`admin`}),setRepeat:J(U({deviceId:R().int().nonnegative(),repeat:kx}),V(),{kind:`mutation`,auth:`admin`}),selectSource:J(U({deviceId:R().int().nonnegative(),source:L().min(1)}),V(),{kind:`mutation`,auth:`admin`}),playMedia:J(U({deviceId:R().int().nonnegative(),mediaId:L().min(1),mediaType:L().min(1)}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:jx,kind:`push`},runtimeState:jx},Nx=G([`jpeg`,`rgb`,`bgr`,`yuv420`,`gray`]),Px=U({data:zv(),format:Nx,width:R(),height:R(),timestamp:R()}),Fx=U({x:R(),y:R(),w:R(),h:R()}),Ix=U({class:L(),originalClass:L(),score:R(),bbox:Fx}),Lx=U({data:Hv(Uint8Array),sampleRate:R(),channels:R(),timestamp:R(),deviceId:R().optional()}),Rx=U({rms:R(),dbfs:R()}),zx=U({className:L(),originalClass:L().optional(),score:R()}),Bx=U({bbox:Fx,pixelCount:R(),intensity:R()}),Vx=U({detected:z(),regionCount:R(),regions:H(Bx).readonly(),rawRegions:H(Bx).readonly(),frameWidth:R(),frameHeight:R(),analysisMs:R()}),Hx={name:`motion-detection`,scope:`device`,mode:`singleton`,kind:`wrapper`,defaultActive:!0,exposesDeviceSettings:!0,methods:{analyze:J(U({deviceId:R(),frame:Px}),Vx,{kind:`mutation`}),removeCamera:J(U({deviceId:R()}),V(),{kind:`mutation`}),reset:J(V(),V(),{kind:`mutation`})},events:{onMotion:{data:U({deviceId:R(),detected:z(),regionCount:R()})}}};U({activeCameras:R(),throttledCameras:R(),avgInferenceTimeMs:R(),queueDepth:R()});var Ux=U({detectionMode:G([`disabled`,`always-on`,`on-motion`]),configuredFps:R(),actualFps:R(),queueDepth:R(),avgInferenceTimeMs:R(),droppedFrames:R(),phase:G([`idle`,`watching`,`active`])}),Wx=Ux.extend({deviceId:R()}),Gx=G([`onnx`,`coreml`,`openvino`,`tflite`,`pt`]),Kx=G([`detector`,`cropper`,`classifier`,`refiner`,`audio-classifier`]),qx=U({runtime:G([`node`,`python`]),backend:L(),format:Gx,device:L().optional()}),Jx=U({engine:qx,devices:H(U({id:L(),label:L(),description:L().optional()})).readonly(),defaultDevice:L()}),Yx=Lv(()=>U({addonId:L(),addonName:L(),slot:Kx,inputClasses:H(L()).readonly(),outputClasses:H(L()).readonly(),enabled:z(),modelId:L(),children:H(Yx).readonly(),engine:qx.optional(),group:L().optional(),settings:W(L(),B()).optional()})),Xx=Lv(()=>U({addonId:L(),enabled:z(),modelId:L(),children:H(Xx).readonly(),settings:W(L(),B()).optional()})),Zx=U({id:L(),name:L(),createdAt:L(),updatedAt:L(),engine:qx,steps:H(Xx).readonly()}),Qx=U({id:L(),name:L(),formats:W(L(),U({downloaded:z(),sizeMB:R()}))}),$x=zv(),eS=U({id:L(),name:L(),slot:Kx,inputClasses:H(L()).readonly(),outputClasses:H(L()).readonly(),childSlots:H(Kx).readonly(),models:H(Qx).readonly(),defaultModelId:L(),defaultModelIdByFormat:W(L(),L()).optional(),enabledByDefault:z().optional(),defaultConfidence:R(),group:L().optional(),configSchema:H($x).readonly().optional()}),tS=U({id:Kx,label:L(),priority:R(),parentSlot:Kx.nullable(),addons:H(eS).readonly()}),nS=U({availableEngines:H(Jx).readonly(),selectedEngine:qx,slots:H(tS).readonly()}),rS=U({detections:H(Ix).readonly(),inferenceMs:R(),modelId:L()}),iS=Lv(()=>U({addonId:L(),modelId:L(),enabled:z().default(!0),children:H(iS).optional(),settings:W(L(),B()).optional()})),aS=U({filename:L(),stepIds:H(L()).readonly().optional()}),oS=U({base64:L(),filename:L()}),sS=U({filename:L(),sizeKb:R()}),cS=U({base64:L()}),lS=U({id:L(),name:L(),description:L(),available:z(),rawLabels:H(L()).readonly().optional()}),uS=U({activeBackend:L(),availableBackends:H(lS).readonly(),sampleRate:R(),chunkDurationMs:R()}),dS=U({filePath:L(),sizeMB:R(),durationMs:R()}),fS=U({success:z(),error:L().optional(),frame:zv().optional()}),pS=zv(),mS=zv(),hS=zv(),gS=zv(),_S=zv(),vS=zv(),yS={name:`pipeline-executor`,scope:`system`,mode:`singleton`,methods:{getAvailableEngines:J(V(),H(qx)),getSelectedEngine:J(V(),qx),getDefaultSteps:J(qx,H(Yx)),reprobeEngine:J(V(),qx,{kind:`mutation`,auth:`admin`}),getVideoPipelineSteps:J(V(),W(L(),U({modelId:L(),settings:W(L(),B()).readonly()}))),setVideoPipelineSteps:J(U({steps:W(L(),U({modelId:L(),settings:W(L(),B()).readonly()}))}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),getSchema:J(V(),nS),getGlobalSteps:J(V(),H(Yx).readonly().nullable()),getGlobalPipelineConfig:J(V(),pS),getOrchestratorConfigSchema:J(V(),mS),listTemplates:J(V(),H(Zx).readonly()),saveTemplate:J(U({name:L(),steps:H(Xx).readonly(),engine:qx}),Zx,{kind:`mutation`}),updateTemplate:J(U({id:L(),name:L().optional(),steps:H(Xx).readonly().optional()}),Zx,{kind:`mutation`}),deleteTemplate:J(U({id:L()}),V(),{kind:`mutation`}),getCapabilities:J(V(),gS),getAddonModels:J(U({addonId:L()}),_S),downloadModel:J(U({addonId:L(),modelId:L(),format:Gx}),dS,{kind:`mutation`}),deleteModel:J(U({addonId:L(),modelId:L(),format:Gx}),U({success:K(!0)}),{kind:`mutation`}),detect:J(U({addonId:L(),frame:Px,config:W(L(),B()).optional()}),rS),runPipeline:J(U({engine:qx.optional(),steps:H(iS).min(1),frame:Px.optional(),imageBase64:L().optional(),image:Hv(Uint8Array).optional(),referenceImage:L().optional(),deviceId:R().optional(),sessionId:L().optional()}),vS,{kind:`mutation`}),runPipelineBatch:J(U({engine:qx.optional(),steps:H(iS).min(1),frames:H(Px).min(1).max(255),deviceId:R().optional(),sessionId:L().optional()}),U({results:H(vS).readonly()}),{kind:`mutation`}),cacheFrameInPool:J(U({data:Hv(Uint8Array),width:R().int().positive(),height:R().int().positive(),format:G([`rgb`,`bgr`,`gray`])}),U({frameId:R(),width:R(),height:R()}),{kind:`mutation`}),inferCached:J(U({stepId:L(),frameId:R().int()}),W(L(),B()),{kind:`mutation`}),uncacheFrame:J(U({frameId:R().int()}),V(),{kind:`mutation`}),getEffectiveTuning:J(V(),U({batchMode:L(),windowMs:R(),maxBatchSize:R(),concurrency:R()})),listLoadedEngines:J(V(),H(U({engineKey:L(),engine:qx,modelsLoaded:H(L()).readonly(),inUseByCameras:H(R()).readonly(),kind:G([`runtime`,`warm-override`]),poolPid:R().nullable(),idleMs:R().nullable(),idleTtlMs:R().nullable()})).readonly()),spinEngine:J(U({engine:qx}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),killEngine:J(U({engine:qx,force:z().optional()}),U({success:z(),reason:L().optional()}),{kind:`mutation`,auth:`admin`}),listReferenceImages:J(V(),H(aS).readonly()),getReferenceImage:J(U({filename:L()}),oS.nullable()),getReferenceAudioFiles:J(V(),H(sS).readonly()),getReferenceAudio:J(U({filename:L()}),cS.nullable()),getAudioCapabilities:J(V(),uS),runAudioTest:J(U({addonId:L(),modelId:L(),filename:L().optional(),settings:W(L(),B()).optional()}),fS,{kind:`mutation`}),getDetectionConfigSchema:J(V(),hS)}},bS=G([`polygon`,`tripwire`]),xS=U({x:R(),y:R()}),SS=U({id:L(),name:L(),kind:bS.default(`polygon`),polygon:H(xS).readonly(),color:L().default(`#3b82f6`)}),CS={name:`zones`,scope:`device`,mode:`singleton`,deviceTypes:[q.Camera],methods:{listZones:J(U({deviceId:R()}),H(SS).readonly()),addZone:J(U({deviceId:R(),zone:SS}),V(),{kind:`mutation`,auth:`admin`}),removeZone:J(U({deviceId:R(),zoneId:L()}),V(),{kind:`mutation`,auth:`admin`}),updateZone:J(U({deviceId:R(),zone:SS}),V(),{kind:`mutation`,auth:`admin`})},runtimeState:U({zones:H(SS).readonly()})},wS={min:0,max:6e4,default:3e4,step:500},TS={min:1,max:30,default:4,step:1},ES={min:1,max:30,default:10,step:1},DS={min:0,max:300,default:30,step:5},OS={min:1,max:10,default:4,step:1},kS=G([`onboard`,`analyzer`]),AS=H(kS),jS=U({deviceId:R(),detected:z(),source:kS.default(`analyzer`),regions:H(Bx).readonly().optional()}),MS=U({deviceId:R(),detectionMode:G([`disabled`,`always-on`,`on-motion`]).default(`on-motion`),audioMode:G([`disabled`,`always-on`,`on-motion`]).default(`always-on`),motionCooldownMs:R().min(wS.min).default(wS.default),motionFps:R().min(TS.min).max(TS.max).default(TS.default),detectionFps:R().min(ES.min).max(ES.max).default(ES.default),motionStreamId:L(),detectionStreamId:L(),motionSources:AS.default([`analyzer`]),pipelineEnabled:z().default(!0),engine:qx.optional(),steps:H(iS).readonly().optional(),audio:U({engine:qx,modelId:L(),enabled:z()}).nullable().optional(),zones:H(SS).readonly().default([]),onboardMotionDrivesAnalyzer:z().default(!0),occupancyRecheckSec:R().min(DS.min).max(DS.max).default(DS.default),occupancyRecheckFrames:R().min(OS.min).max(OS.max).default(OS.default)});TS.min,TS.max,TS.step,TS.default,ES.min,ES.max,ES.step,ES.default,wS.min,wS.max,wS.step,wS.default,DS.min,DS.max,DS.step,DS.default,OS.min,OS.max,OS.step,OS.default;var NS=U({nodeId:L(),attachedCameras:R(),activeCameras:R(),avgInferenceFps:R(),avgInferenceTimeMs:R(),queueDepthTotal:R(),hardware:U({hasGpu:z(),inferenceBackend:L().optional(),cpuCores:R().optional()})}),PS=U({nodeId:L(),activeCameras:R(),throttledCameras:R(),avgInferenceTimeMs:R(),queueDepth:R()}),FS={name:`pipeline-runner`,scope:`system`,mode:`singleton`,methods:{attachCamera:J(MS,U({success:K(!0)}),{kind:`mutation`}),detachCamera:J(U({deviceId:R()}),U({success:K(!0)}),{kind:`mutation`}),reportMotion:J(jS,U({success:K(!0)}),{kind:`mutation`}),getLocalLoad:J(V(),NS),getLocalMetrics:J(V(),PS),getCameraMetrics:J(U({deviceId:R()}),Ux.nullable()),getAllCameraMetrics:J(V(),H(Wx).readonly()),getLocalCameras:J(V(),H(R()).readonly())}},IS=U({detected:z(),lastDetectedAt:R().nullable(),autoClearAfterMs:R().nullable()}),LS=U({deviceId:R(),detected:z(),timestamp:R(),source:kS,regions:H(Bx).readonly().optional()}),RS={name:`motion`,scope:`device`,mode:`singleton`,deviceTypes:[q.Camera,q.Sensor],methods:{isDetected:J(U({deviceId:R()}),z())},events:{onMotionChanged:{data:LS}},status:{schema:IS,kind:`push`},runtimeState:IS},zS=U({enabled:z(),lastChangedAt:R()}),BS=zS.extend({lastFetchedAt:R()}),VS={name:`motion-trigger`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Light,q.Siren,q.Switch],methods:{setMotionTrigger:J(U({deviceId:R().int().nonnegative(),enabled:z()}),V(),{kind:`mutation`,auth:`admin`})},events:{onMotionTriggerChanged:{data:U({deviceId:R(),enabled:z(),lastChangedAt:R()})}},status:{schema:zS,kind:`command-driven`},runtimeState:BS},HS=U({x:R(),y:R()}),US=U({kind:K(`rect`),x:R(),y:R(),width:R(),height:R()}),WS=U({kind:K(`polygon`),points:H(HS)}),GS=U({kind:K(`grid`),gridWidth:R(),gridHeight:R(),cells:H(z())});sv(`kind`,[US,WS,GS,U({kind:K(`line`),points:H(HS)})]);var KS=G([`rect`,`polygon`,`grid`,`line`]),qS=U({min:R(),max:R()}),JS=U({width:R(),height:R()}),YS=U({id:R(),enabled:z(),shape:GS}),XS=U({enabled:z(),sensitivity:R(),regions:H(YS),lastFetchedAt:R()}),ZS=U({maxRegions:R(),supportedShapes:H(KS),grid:JS,sensitivity:U({min:R(),max:R(),step:R()})}),QS=U({enabled:z().optional(),sensitivity:R().optional(),regions:H(YS).optional()}),$S={name:`motion-zones`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera],deviceConfig:{ui:{kind:`widget`,widgetId:`host/motion-zones-grid`,tab:`motion`,label:`Motion Zones`}},methods:{getOptions:J(U({deviceId:R()}),ZS),setZone:J(U({deviceId:R(),patch:QS}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:XS,kind:`poll`},runtimeState:XS},eC=G([`person`,`vehicle`,`animal`,`face`,`package`,`other`]),tC=U({class:eC,timestamp:R(),confidence:R().min(0).max(1).optional()}),nC=U({lastByClass:pv(eC,tC.nullable()),supportedClasses:H(eC).readonly(),enabled:z()}),rC=nC.extend({lastFetchedAt:R()}),iC={name:`native-object-detection`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera],methods:{setEnabled:J(U({deviceId:R(),enabled:z()}),V(),{kind:`mutation`,auth:`admin`})},events:{onDetected:{data:U({deviceId:R(),detection:tC})}},status:{schema:nC,kind:`push`},runtimeState:rC},aC=G([`min`,`low`,`normal`,`high`]),oC=U({id:L().min(1),title:L().min(1),uri:E_().optional(),destructive:z().optional()}),sC=U({image:z(),priority:z(),data:z(),actions:z(),recipients:z()}),cC=U({lastSentAt:R(),lastError:L().nullable(),queueDepth:R().int().nonnegative(),supports:sC}),lC=U({deviceId:R().int().nonnegative(),title:L().optional(),body:L().min(1),image:L().optional(),priority:aC.optional(),channel:L().optional(),recipients:H(L()).optional(),actions:H(oC).optional(),data:W(L(),B()).optional()}),uC=U({notificationId:L(),acceptedAt:R()}),dC={name:`notifier`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Notifier],methods:{send:J(lC,uC,{kind:`mutation`,auth:`admin`}),cancel:J(U({deviceId:R().int().nonnegative(),notificationId:L().min(1)}),V(),{kind:`mutation`,auth:`admin`})},events:{onSent:{data:U({deviceId:R(),notificationId:L(),success:z(),error:L().nullable(),acceptedAt:R()})}},status:{schema:cC,kind:`command-driven`},runtimeState:cC},fC=U({value:R(),unit:L().optional(),precision:R().int().min(0).max(10).optional(),lastFetchedAt:R()}),pC={name:`numeric-sensor`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:fC,kind:`push`},runtimeState:fC},mC=U({watts:R().optional(),kwhTotal:R().optional(),volts:R().optional(),amps:R().optional(),va:R().optional(),powerFactor:R().min(0).max(1).optional(),lastFetchedAt:R(),unit:L().optional(),precision:R().int().min(0).max(10).optional()}),hC={name:`power-meter`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:mC,kind:`push`},runtimeState:mC},gC=U({latitude:R().min(-90).max(90),longitude:R().min(-180).max(180),accuracyMeters:R().nonnegative()}),_C=U({state:L(),location:L().nullable(),gps:gC.nullable(),batteryPercent:R().min(0).max(100).nullable(),lastChangedAt:R()}),vC={name:`presence`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Presence],methods:{},status:{schema:_C,kind:`push`},runtimeState:_C},yC=U({hpa:R(),lastFetchedAt:R(),unit:L().optional(),precision:R().int().min(0).max(10).optional()}),bC={name:`pressure-sensor`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:yC,kind:`push`},runtimeState:yC},xC=sv(`kind`,[US,WS]),SC=U({id:R(),enabled:z(),shape:xC}),CC=U({enabled:z(),regions:H(SC),lastFetchedAt:R()}),wC=U({maxRegions:R(),supportedShapes:H(KS),polygonVertices:qS.optional()}),TC=U({enabled:z().optional(),regions:H(SC).optional()}),EC={name:`privacy-mask`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera],deviceConfig:{ui:{kind:`widget`,widgetId:`host/privacy-mask-grid`,tab:`image`,label:`Privacy Mask`}},methods:{getOptions:J(U({deviceId:R()}),wC),setMask:J(U({deviceId:R(),patch:TC}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:CC,kind:`poll`},runtimeState:CC},DC=U({targetType:L().describe(`Vendor target string (people/vehicle/pet); empty = camera default`),stopDelaySeconds:R().int().min(0).max(300),disappearDelaySeconds:R().int().min(0).max(300)}),OC=U({value:L(),label:L()}),kC=U({enabled:z(),lastChangedAt:R(),currentSettings:DC.nullable(),supportedTargetTypes:H(OC)}),AC=kC.extend({lastFetchedAt:R()}),jC={name:`ptz-autotrack`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera],deviceConfig:{ui:{kind:`widget`,widgetId:`host/ptz-autotrack`,tab:`ptz`,topTab:!0,label:`Auto-Tracking`,order:5}},methods:{getStatus:J(U({deviceId:R()}),kC),setEnabled:J(U({deviceId:R(),enabled:z()}),V(),{kind:`mutation`}),getSettings:J(U({deviceId:R()}),DC.nullable()),setSettings:J(U({deviceId:R(),settings:DC.partial()}),V(),{kind:`mutation`})},events:{onStatusChanged:{data:U({deviceId:R(),status:kC})}},status:{schema:kC,kind:`command-driven`},runtimeState:AC},MC=U({isRunning:z(),lastRunAt:R(),lastRunSuccess:z().nullable(),lastError:L().nullable(),lastChangedAt:R()}),NC={name:`script-runner`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Script],methods:{run:J(U({deviceId:R().int().nonnegative(),variables:W(L(),B()).optional()}),V(),{kind:`mutation`,auth:`admin`}),stop:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:MC,kind:`push`},runtimeState:MC},PC=U({detected:z(),lastChangedAt:R()}),FC={name:`smoke`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:PC,kind:`push`},runtimeState:PC},IC=G([`main`,`sub`,`ext`]),LC=U({width:R(),height:R(),codec:G([`h264`,`h265`]),framerate:R(),bitrate:R(),bitrateMode:G([`vbr`,`cbr`]).optional(),encoderProfile:G([`high`,`main`,`baseline`]).optional(),gop:R().optional(),audio:z().optional()}),RC=U({main:LC.optional(),sub:LC.optional(),ext:LC.optional(),lastFetchedAt:R()}),zC=U({resolutions:H(U({width:R(),height:R()})),codecs:H(G([`h264`,`h265`])),framerates:H(R()),bitrates:H(R()),bitrateRange:dv([R(),R()]).optional(),supportsBitrateMode:z(),supportsEncoderProfile:z(),supportsGop:z(),gop:U({min:R(),max:R(),step:R()}).optional()}),BC=U({main:zC.optional(),sub:zC.optional(),ext:zC.optional()}),VC=U({width:R().optional(),height:R().optional(),codec:G([`h264`,`h265`]).optional(),framerate:R().optional(),bitrate:R().optional(),bitrateMode:G([`vbr`,`cbr`]).optional(),encoderProfile:G([`high`,`main`,`baseline`]).optional(),gop:R().optional(),audio:z().optional()}),HC={name:`stream-params`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera],deviceConfig:{ui:{kind:`derived-form`,builderId:`stream-params`,tab:`streaming`}},methods:{getOptions:J(U({deviceId:R()}),BC),setProfile:J(U({deviceId:R(),profile:IC,patch:VC}),V(),{kind:`mutation`,auth:`admin`}),getConfigSchema:J(U({deviceId:R()}),B().nullable())},status:{schema:RC,kind:`poll`},runtimeState:RC},UC=U({on:z(),lastChangedAt:R()}),WC={name:`switch`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Switch,q.Siren,q.Light],methods:{setState:J(U({deviceId:R(),on:z()}),V(),{kind:`mutation`,auth:`admin`})},events:{onStateChanged:{data:U({deviceId:R(),on:z(),lastChangedAt:R()})}},status:{schema:UC,kind:`command-driven`},runtimeState:UC,settings:{bindings:[{kind:`scalar`,statusPath:`on`,method:`setState`,valueArg:`on`,field:{label:`On`,kind:`boolean`}}]}},GC=U({tampered:z(),lastChangedAt:R()}),KC={name:`tamper`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:GC,kind:`push`},runtimeState:GC},qC=U({celsius:R(),lastFetchedAt:R(),unit:L().optional(),precision:R().int().min(0).max(10).optional()}),JC={name:`temperature-sensor`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor,q.Thermostat],methods:{},status:{schema:qC,kind:`push`},runtimeState:qC},YC=U({currentVersion:L().nullable(),availableVersion:L().nullable(),updatable:z(),state:L().nullable(),inProgress:z()}),XC={name:`update`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Update],methods:{installUpdate:J(V(),V(),{kind:`mutation`,auth:`admin`})},status:{schema:YC,kind:`poll`},runtimeState:YC},ZC=G([`idle`,`cleaning`,`paused`,`returning`,`docked`,`error`]),QC=U({level:R().min(0).max(100).nullable(),status:G([`ok`,`low`,`full`]).nullable()}),$C=U({state:ZC,batteryLevel:R().min(0).max(100).nullable(),fanSpeed:L().nullable(),availableFanSpeeds:H(L()),cleanWater:QC.nullable(),dirtyWater:QC.nullable(),detergent:QC.nullable(),dustBin:QC.nullable(),lastChangedAt:R()}),ew={name:`vacuum-control`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Vacuum],methods:{start:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),pause:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),stop:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),returnToBase:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),locate:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),setFanSpeed:J(U({deviceId:R().int().nonnegative(),speed:L().min(1)}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:$C,kind:`push`},runtimeState:$C},tw=U({state:G([`open`,`opening`,`closing`,`closed`,`stopped`]),position:R().min(0).max(100).nullable(),lastChangedAt:R()}),nw={name:`valve`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Valve],methods:{open:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),close:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),stop:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`}),setPosition:J(U({deviceId:R().int().nonnegative(),position:R().min(0).max(100)}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:tw,kind:`push`},runtimeState:tw},rw=U({detected:z(),lastChangedAt:R()}),iw={name:`vibration`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Sensor],methods:{},status:{schema:rw,kind:`push`},runtimeState:rw},aw=U({currentTemp:R().nullable(),targetTemp:R().nullable(),operationMode:L().nullable(),availableModes:H(L()),away:z().nullable(),minTemp:R().nullable(),maxTemp:R().nullable(),lastChangedAt:R()}),ow={name:`water-heater`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.WaterHeater],methods:{setTargetTemp:J(U({deviceId:R().int().nonnegative(),temp:R().finite()}),V(),{kind:`mutation`,auth:`admin`}),setOperationMode:J(U({deviceId:R().int().nonnegative(),mode:L().min(1)}),V(),{kind:`mutation`,auth:`admin`}),setAway:J(U({deviceId:R().int().nonnegative(),on:z()}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:aw,kind:`push`},runtimeState:aw},sw=U({condition:L().nullable(),temperature:R().nullable(),temperatureUnit:L().nullable(),humidity:R().min(0).max(100).nullable(),pressure:R().nullable(),pressureUnit:L().nullable(),windSpeed:R().nullable(),windSpeedUnit:L().nullable(),windBearing:R().nullable(),lastFetchedAt:R()}),cw={name:`weather`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Weather],methods:{},status:{schema:sw,kind:`push`},runtimeState:sw},lw=U({totalObjects:R().int().nonnegative(),byClass:W(L(),R().int().nonnegative())}),uw=lw.extend({zoneId:L(),zoneName:L(),trackIds:H(L()).readonly()}),dw=U({ts:R().int(),frameWidth:R().int().nonnegative(),frameHeight:R().int().nonnegative(),zones:H(uw).readonly(),frame:lw,unzoned:lw}),fw=G([`minute`,`5min`,`hour`]),pw=U({from:R().int(),to:R().int(),resolution:fw}),mw=U({ts:R().int(),count:R().int().nonnegative()}),hw={name:`zone-analytics`,scope:`device`,mode:`singleton`,deviceTypes:[q.Camera],methods:{getCurrentSnapshot:J(U({deviceId:R()}),dw.nullable()),getZoneHistory:J(U({deviceId:R(),zoneId:L(),className:L().optional()}).extend(pw.shape),H(mw).readonly()),getCameraHistory:J(U({deviceId:R(),className:L().optional()}).extend(pw.shape),H(mw).readonly()),getUnzonedHistory:J(U({deviceId:R(),className:L().optional()}).extend(pw.shape),H(mw).readonly())},runtimeState:dw},gw=G([`include`,`exclude`]),_w=U({id:L(),name:L().optional(),zoneIds:H(L()).min(1).readonly(),mode:gw,classFilter:H(L()).readonly().optional(),overlapThreshold:R().min(0).max(1).optional(),bboxInclusionPct:R().min(0).max(100).optional(),preferMask:z().optional(),enabled:z().default(!0)});H(_w).readonly();var vw=G([`motion`,`detection`]),yw={name:`zone-rules`,scope:`device`,mode:`singleton`,deviceTypes:[q.Camera],methods:{listRules:J(U({deviceId:R(),stage:vw}),H(_w).readonly()),setRules:J(U({deviceId:R(),stage:vw,rules:H(_w).readonly()}),V(),{kind:`mutation`,auth:`admin`})},runtimeState:U({motion:H(_w).readonly(),detection:H(_w).readonly()})},bw=U({connected:z(),deviceCount:R(),error:L().optional()});U({externalId:L(),name:L(),type:L(),metadata:W(L(),B()).optional()});var xw=U({stableId:L(),type:G(q),suggestedName:L(),prefilledConfig:W(L(),B()),sourceInfo:Zb.optional()}),Sw=U({id:R(),stableId:L(),addonId:L(),type:L(),name:L(),parentDeviceId:R().nullable(),online:z(),features:H(L()),config:W(L(),B()),sourceInfo:Zb.optional()}),Cw=U({status:G([`ok`,`error`]),labels:H(L()).optional(),error:L().optional()}),ww=B(),Tw={name:`device-provider`,scope:`system`,mode:`collection`,methods:{start:J(V(),V(),{kind:`mutation`}),stop:J(V(),V(),{kind:`mutation`}),getStatus:J(V(),bw),getDevices:J(V(),H(U({id:L(),name:L(),type:L()}))),supportsDiscovery:J(U({}),z()),discoverDevices:J(U({}),H(xw),{kind:`mutation`,auth:`admin`}),adoptDiscoveredDevice:J(U({candidate:xw}),Sw,{kind:`mutation`,auth:`admin`}),supportsManualCreation:J(U({}),z()),getChildCreationSchema:J(U({type:G(q)}),ww),createDevice:J(U({type:G(q),config:W(L(),B())}),Sw,{kind:`mutation`,auth:`admin`}),testCreationField:J(U({type:G(q),key:L(),value:B(),formValues:W(L(),B()).optional()}),Cw,{kind:`mutation`,auth:`admin`})}},Ew=`device.state-changed`;function Dw(e){let t=new Map,n=new Map,r=null,a=(e,t)=>`${e}:${t}`,o=()=>{r||e.live?.onEvent&&(r=e.live.onEvent.subscribe({category:Ew},{onData:e=>{let r=e.data;if(!r||typeof r.deviceId!=`number`||typeof r.capName!=`string`)return;let o=a(r.deviceId,r.capName);t.set(o,r.slice);let s=n.get(o);if(s)for(let e of s)try{e(r.slice)}catch{}}}))},s=()=>{r&&(n.size>0||(r.unsubscribe(),r=null))};return{read(e,n){return t.get(a(e,n))},async refresh(r,o){let s=await e.deviceState.getCapSlice.query({deviceId:r,capName:o}),c=a(r,o);t.set(c,s??void 0);let l=n.get(c);if(l)for(let e of l)try{e(s??void 0)}catch{}},watch(e,t,r){let c=a(e,t),l=n.get(c);return l||(l=new Set,n.set(c,l)),l.add(r),o(),()=>{l.delete(r),l.size===0&&n.delete(c),s()}},async write(t,n,r){await e.deviceState.setCapSlice.mutate({deviceId:t,capName:n,slice:r})}}}function Ow(e,t,n){let r=(e,t)=>`${e}:${t}`;return{read(t,n){return e.get(t)?.get(n)},async refresh(){},watch(e,n,a){let o=r(e,n),s=t.get(o);return s||(s=new Set,t.set(o,s)),s.add(a),()=>{s.delete(a),s.size===0&&t.delete(o)}},async write(e,t,r){if(!n)throw Error(`createMirrorSource: write requires an api reference — pass it as the third argument when constructing the source`);await n.deviceState.setCapSlice.mutate({deviceId:e,capName:t,slice:r})}}}function kw(e,t,n){let r=Aw(e)?e:Dw(e);return{get value(){return r.read(t,n)},refresh(){return r.refresh(t,n)},subscribe(e){let a=r.watch(t,n,t=>{try{e(t)}catch{}});try{e(r.read(t,n))}catch{}return r.read(t,n)===void 0&&r.refresh(t,n).catch(()=>void 0),a},async set(e){await r.write(t,n,e)},async patch(e){let a={...r.read(t,n),...e};await r.write(t,n,a)}}}function Aw(e){return typeof e.read==`function`&&typeof e.watch==`function`}function jw(e,t,n){let r=e,a=n?.stateSource??Dw(e);function o(e,n){let r=typeof e==`object`&&e?e:{};return n===void 0?{...r,deviceId:t.deviceId}:{...r,deviceId:t.deviceId,nodeId:n}}function s(e,t,n,a,o){let s=r[e]?.[t];if(!s)throw Error(`DeviceProxy: api has no '${e}.${t}'`);let c=s;return n===`mutation`?c.mutate(a):n===`subscription`?c.subscribe(a,o):c.query(a)}function c(e,n,r,a,c,l){return s(n,r,a,o(c,t.entries.find(t=>t.capName===e)?.providerNodeId),l)}function l(e,t,n,r,a){return s(e,t,n,o(r,void 0),a)}return{deviceId:t.deviceId,binding:t,state:{airQualitySensor:kw(a,t.deviceId,`air-quality-sensor`),alarmPanel:kw(a,t.deviceId,`alarm-panel`),ambientLightSensor:kw(a,t.deviceId,`ambient-light-sensor`),audioMetrics:kw(a,t.deviceId,`audio-metrics`),automationControl:kw(a,t.deviceId,`automation-control`),battery:kw(a,t.deviceId,`battery`),binary:kw(a,t.deviceId,`binary`),brightness:kw(a,t.deviceId,`brightness`),cameraStreams:kw(a,t.deviceId,`camera-streams`),carbonMonoxide:kw(a,t.deviceId,`carbon-monoxide`),climateControl:kw(a,t.deviceId,`climate-control`),color:kw(a,t.deviceId,`color`),connectivity:kw(a,t.deviceId,`connectivity`),consumables:kw(a,t.deviceId,`consumables`),contact:kw(a,t.deviceId,`contact`),control:kw(a,t.deviceId,`control`),cover:kw(a,t.deviceId,`cover`),deviceDiscovery:kw(a,t.deviceId,`device-discovery`),deviceStatus:kw(a,t.deviceId,`device-status`),doorbell:kw(a,t.deviceId,`doorbell`),enumSensor:kw(a,t.deviceId,`enum-sensor`),eventEmitter:kw(a,t.deviceId,`event-emitter`),fanControl:kw(a,t.deviceId,`fan-control`),featureProbe:kw(a,t.deviceId,`feature-probe`),flood:kw(a,t.deviceId,`flood`),gas:kw(a,t.deviceId,`gas`),humidifier:kw(a,t.deviceId,`humidifier`),humiditySensor:kw(a,t.deviceId,`humidity-sensor`),image:kw(a,t.deviceId,`image`),lawnMowerControl:kw(a,t.deviceId,`lawn-mower-control`),lockControl:kw(a,t.deviceId,`lock-control`),mediaPlayer:kw(a,t.deviceId,`media-player`),motion:kw(a,t.deviceId,`motion`),motionTrigger:kw(a,t.deviceId,`motion-trigger`),motionZones:kw(a,t.deviceId,`motion-zones`),nativeObjectDetection:kw(a,t.deviceId,`native-object-detection`),notifier:kw(a,t.deviceId,`notifier`),numericSensor:kw(a,t.deviceId,`numeric-sensor`),powerMeter:kw(a,t.deviceId,`power-meter`),presence:kw(a,t.deviceId,`presence`),pressureSensor:kw(a,t.deviceId,`pressure-sensor`),privacyMask:kw(a,t.deviceId,`privacy-mask`),ptzAutotrack:kw(a,t.deviceId,`ptz-autotrack`),scriptRunner:kw(a,t.deviceId,`script-runner`),smoke:kw(a,t.deviceId,`smoke`),streamParams:kw(a,t.deviceId,`stream-params`),switch:kw(a,t.deviceId,`switch`),tamper:kw(a,t.deviceId,`tamper`),temperatureSensor:kw(a,t.deviceId,`temperature-sensor`),update:kw(a,t.deviceId,`update`),vacuumControl:kw(a,t.deviceId,`vacuum-control`),valve:kw(a,t.deviceId,`valve`),vibration:kw(a,t.deviceId,`vibration`),waterHeater:kw(a,t.deviceId,`water-heater`),weather:kw(a,t.deviceId,`weather`),zoneAnalytics:kw(a,t.deviceId,`zone-analytics`),zoneRules:kw(a,t.deviceId,`zone-rules`),zones:kw(a,t.deviceId,`zones`)},accessories:{setChildHidden:e=>c(`accessories`,`accessories`,`setChildHidden`,`mutation`,e),getStatus:e=>c(`accessories`,`accessories`,`getStatus`,`query`,e)},airQualitySensor:{getStatus:e=>c(`air-quality-sensor`,`airQualitySensor`,`getStatus`,`query`,e)},alarmPanel:{arm:e=>c(`alarm-panel`,`alarmPanel`,`arm`,`mutation`,e),disarm:e=>c(`alarm-panel`,`alarmPanel`,`disarm`,`mutation`,e),trigger:e=>c(`alarm-panel`,`alarmPanel`,`trigger`,`mutation`,e),getStatus:e=>c(`alarm-panel`,`alarmPanel`,`getStatus`,`query`,e)},ambientLightSensor:{getStatus:e=>c(`ambient-light-sensor`,`ambientLightSensor`,`getStatus`,`query`,e)},audioAnalysis:{resolveDeviceSettings:e=>c(`audio-analysis`,`audioAnalysis`,`resolveDeviceSettings`,`query`,e),getDeviceSettingsContribution:e=>c(`audio-analysis`,`audioAnalysis`,`getDeviceSettingsContribution`,`query`,e),getDeviceLiveContribution:e=>c(`audio-analysis`,`audioAnalysis`,`getDeviceLiveContribution`,`query`,e),applyDeviceSettingsPatch:e=>c(`audio-analysis`,`audioAnalysis`,`applyDeviceSettingsPatch`,`mutation`,e)},audioMetrics:{getCurrentSnapshot:e=>c(`audio-metrics`,`audioMetrics`,`getCurrentSnapshot`,`query`,e),getHistory:e=>c(`audio-metrics`,`audioMetrics`,`getHistory`,`query`,e)},automationControl:{enable:e=>c(`automation-control`,`automationControl`,`enable`,`mutation`,e),disable:e=>c(`automation-control`,`automationControl`,`disable`,`mutation`,e),trigger:e=>c(`automation-control`,`automationControl`,`trigger`,`mutation`,e),getStatus:e=>c(`automation-control`,`automationControl`,`getStatus`,`query`,e)},battery:{wakeForStream:e=>c(`battery`,`battery`,`wakeForStream`,`mutation`,e),getStatus:e=>c(`battery`,`battery`,`getStatus`,`query`,e)},binary:{getStatus:e=>c(`binary`,`binary`,`getStatus`,`query`,e)},brightness:{setBrightness:e=>c(`brightness`,`brightness`,`setBrightness`,`mutation`,e),getStatus:e=>c(`brightness`,`brightness`,`getStatus`,`query`,e)},button:{press:e=>c(`button`,`button`,`press`,`mutation`,e)},cameraCredentials:{getCredentials:e=>c(`camera-credentials`,`cameraCredentials`,`getCredentials`,`query`,e),getStatus:e=>c(`camera-credentials`,`cameraCredentials`,`getStatus`,`query`,e)},cameraStreams:{getCameraStreams:e=>c(`camera-streams`,`cameraStreams`,`getCameraStreams`,`query`,e),getBrokerStreams:e=>c(`camera-streams`,`cameraStreams`,`getBrokerStreams`,`query`,e),getRtspEntries:e=>c(`camera-streams`,`cameraStreams`,`getRtspEntries`,`query`,e),getProfileRtspEntries:e=>c(`camera-streams`,`cameraStreams`,`getProfileRtspEntries`,`query`,e),pickStream:e=>c(`camera-streams`,`cameraStreams`,`pickStream`,`query`,e)},carbonMonoxide:{getStatus:e=>c(`carbon-monoxide`,`carbonMonoxide`,`getStatus`,`query`,e)},climateControl:{setMode:e=>c(`climate-control`,`climateControl`,`setMode`,`mutation`,e),setFanMode:e=>c(`climate-control`,`climateControl`,`setFanMode`,`mutation`,e),setPreset:e=>c(`climate-control`,`climateControl`,`setPreset`,`mutation`,e),setTarget:e=>c(`climate-control`,`climateControl`,`setTarget`,`mutation`,e),setTargetRange:e=>c(`climate-control`,`climateControl`,`setTargetRange`,`mutation`,e),setTargetHumidity:e=>c(`climate-control`,`climateControl`,`setTargetHumidity`,`mutation`,e),getStatus:e=>c(`climate-control`,`climateControl`,`getStatus`,`query`,e)},color:{setColor:e=>c(`color`,`color`,`setColor`,`mutation`,e),getStatus:e=>c(`color`,`color`,`getStatus`,`query`,e)},connectivity:{getStatus:e=>c(`connectivity`,`connectivity`,`getStatus`,`query`,e)},consumables:{reset:e=>c(`consumables`,`consumables`,`reset`,`mutation`,e),getStatus:e=>c(`consumables`,`consumables`,`getStatus`,`query`,e)},contact:{getStatus:e=>c(`contact`,`contact`,`getStatus`,`query`,e)},control:{setValue:e=>c(`control`,`control`,`setValue`,`mutation`,e),getStatus:e=>c(`control`,`control`,`getStatus`,`query`,e)},cover:{open:e=>c(`cover`,`cover`,`open`,`mutation`,e),close:e=>c(`cover`,`cover`,`close`,`mutation`,e),stop:e=>c(`cover`,`cover`,`stop`,`mutation`,e),setPosition:e=>c(`cover`,`cover`,`setPosition`,`mutation`,e),setTiltPosition:e=>c(`cover`,`cover`,`setTiltPosition`,`mutation`,e),getStatus:e=>c(`cover`,`cover`,`getStatus`,`query`,e)},detectionPipeline:{getDeviceSettingsContribution:e=>c(`detection-pipeline`,`detectionPipeline`,`getDeviceSettingsContribution`,`query`,e),getDeviceLiveContribution:e=>c(`detection-pipeline`,`detectionPipeline`,`getDeviceLiveContribution`,`query`,e),applyDeviceSettingsPatch:e=>c(`detection-pipeline`,`detectionPipeline`,`applyDeviceSettingsPatch`,`mutation`,e)},deviceDiscovery:{listDiscovered:e=>c(`device-discovery`,`deviceDiscovery`,`listDiscovered`,`query`,e),refreshDiscovery:e=>c(`device-discovery`,`deviceDiscovery`,`refreshDiscovery`,`mutation`,e),adoptDevice:e=>c(`device-discovery`,`deviceDiscovery`,`adoptDevice`,`mutation`,e),releaseDevice:e=>c(`device-discovery`,`deviceDiscovery`,`releaseDevice`,`mutation`,e),getStatus:e=>c(`device-discovery`,`deviceDiscovery`,`getStatus`,`query`,e)},deviceOps:{getStreamSources:e=>c(`device-ops`,`deviceOps`,`getStreamSources`,`query`,e),getConfigEntries:e=>c(`device-ops`,`deviceOps`,`getConfigEntries`,`query`,e),setConfig:e=>c(`device-ops`,`deviceOps`,`setConfig`,`mutation`,e),runAction:e=>c(`device-ops`,`deviceOps`,`runAction`,`mutation`,e),removeDevice:e=>c(`device-ops`,`deviceOps`,`removeDevice`,`mutation`,e),getSettingsSchema:e=>c(`device-ops`,`deviceOps`,`getSettingsSchema`,`query`,e),getRawState:e=>c(`device-ops`,`deviceOps`,`getRawState`,`query`,e)},deviceStatus:{getStatus:e=>c(`device-status`,`deviceStatus`,`getStatus`,`query`,e)},doorbell:{getStatus:e=>c(`doorbell`,`doorbell`,`getStatus`,`query`,e)},enumSensor:{getStatus:e=>c(`enum-sensor`,`enumSensor`,`getStatus`,`query`,e)},eventEmitter:{getStatus:e=>c(`event-emitter`,`eventEmitter`,`getStatus`,`query`,e)},events:{getEvents:e=>c(`events`,`events`,`getEvents`,`query`,e),getEventThumbnail:e=>c(`events`,`events`,`getEventThumbnail`,`query`,e),getEventClipUrl:e=>c(`events`,`events`,`getEventClipUrl`,`query`,e)},fanControl:{setPercentage:e=>c(`fan-control`,`fanControl`,`setPercentage`,`mutation`,e),setPreset:e=>c(`fan-control`,`fanControl`,`setPreset`,`mutation`,e),setDirection:e=>c(`fan-control`,`fanControl`,`setDirection`,`mutation`,e),setOscillating:e=>c(`fan-control`,`fanControl`,`setOscillating`,`mutation`,e),getStatus:e=>c(`fan-control`,`fanControl`,`getStatus`,`query`,e)},featureProbe:{getStatus:e=>c(`feature-probe`,`featureProbe`,`getStatus`,`query`,e)},flood:{getStatus:e=>c(`flood`,`flood`,`getStatus`,`query`,e)},gas:{getStatus:e=>c(`gas`,`gas`,`getStatus`,`query`,e)},humidifier:{setOn:e=>c(`humidifier`,`humidifier`,`setOn`,`mutation`,e),setTargetHumidity:e=>c(`humidifier`,`humidifier`,`setTargetHumidity`,`mutation`,e),setMode:e=>c(`humidifier`,`humidifier`,`setMode`,`mutation`,e),getStatus:e=>c(`humidifier`,`humidifier`,`getStatus`,`query`,e)},humiditySensor:{getStatus:e=>c(`humidity-sensor`,`humiditySensor`,`getStatus`,`query`,e)},image:{getStatus:e=>c(`image`,`image`,`getStatus`,`query`,e)},intercom:{startSession:e=>c(`intercom`,`intercom`,`startSession`,`mutation`,e),handleAnswer:e=>c(`intercom`,`intercom`,`handleAnswer`,`mutation`,e),stopSession:e=>c(`intercom`,`intercom`,`stopSession`,`mutation`,e),startTalkSession:e=>c(`intercom`,`intercom`,`startTalkSession`,`mutation`,e),pushTalkAudio:e=>c(`intercom`,`intercom`,`pushTalkAudio`,`mutation`,e),endTalkSession:e=>c(`intercom`,`intercom`,`endTalkSession`,`mutation`,e),getStatus:e=>c(`intercom`,`intercom`,`getStatus`,`query`,e)},lawnMowerControl:{startMowing:e=>c(`lawn-mower-control`,`lawnMowerControl`,`startMowing`,`mutation`,e),pause:e=>c(`lawn-mower-control`,`lawnMowerControl`,`pause`,`mutation`,e),dock:e=>c(`lawn-mower-control`,`lawnMowerControl`,`dock`,`mutation`,e),getStatus:e=>c(`lawn-mower-control`,`lawnMowerControl`,`getStatus`,`query`,e)},lockControl:{lock:e=>c(`lock-control`,`lockControl`,`lock`,`mutation`,e),unlock:e=>c(`lock-control`,`lockControl`,`unlock`,`mutation`,e),open:e=>c(`lock-control`,`lockControl`,`open`,`mutation`,e),getStatus:e=>c(`lock-control`,`lockControl`,`getStatus`,`query`,e)},mediaPlayer:{play:e=>c(`media-player`,`mediaPlayer`,`play`,`mutation`,e),pause:e=>c(`media-player`,`mediaPlayer`,`pause`,`mutation`,e),stop:e=>c(`media-player`,`mediaPlayer`,`stop`,`mutation`,e),next:e=>c(`media-player`,`mediaPlayer`,`next`,`mutation`,e),previous:e=>c(`media-player`,`mediaPlayer`,`previous`,`mutation`,e),seek:e=>c(`media-player`,`mediaPlayer`,`seek`,`mutation`,e),setVolume:e=>c(`media-player`,`mediaPlayer`,`setVolume`,`mutation`,e),setMute:e=>c(`media-player`,`mediaPlayer`,`setMute`,`mutation`,e),setShuffle:e=>c(`media-player`,`mediaPlayer`,`setShuffle`,`mutation`,e),setRepeat:e=>c(`media-player`,`mediaPlayer`,`setRepeat`,`mutation`,e),selectSource:e=>c(`media-player`,`mediaPlayer`,`selectSource`,`mutation`,e),playMedia:e=>c(`media-player`,`mediaPlayer`,`playMedia`,`mutation`,e),getStatus:e=>c(`media-player`,`mediaPlayer`,`getStatus`,`query`,e)},motion:{isDetected:e=>c(`motion`,`motion`,`isDetected`,`query`,e),getStatus:e=>c(`motion`,`motion`,`getStatus`,`query`,e)},motionDetection:{analyze:e=>c(`motion-detection`,`motionDetection`,`analyze`,`mutation`,e),removeCamera:e=>c(`motion-detection`,`motionDetection`,`removeCamera`,`mutation`,e),reset:e=>c(`motion-detection`,`motionDetection`,`reset`,`mutation`,e),getDeviceSettingsContribution:e=>c(`motion-detection`,`motionDetection`,`getDeviceSettingsContribution`,`query`,e),getDeviceLiveContribution:e=>c(`motion-detection`,`motionDetection`,`getDeviceLiveContribution`,`query`,e),applyDeviceSettingsPatch:e=>c(`motion-detection`,`motionDetection`,`applyDeviceSettingsPatch`,`mutation`,e)},motionTrigger:{setMotionTrigger:e=>c(`motion-trigger`,`motionTrigger`,`setMotionTrigger`,`mutation`,e),getStatus:e=>c(`motion-trigger`,`motionTrigger`,`getStatus`,`query`,e)},motionZones:{getOptions:e=>c(`motion-zones`,`motionZones`,`getOptions`,`query`,e),setZone:e=>c(`motion-zones`,`motionZones`,`setZone`,`mutation`,e),getStatus:e=>c(`motion-zones`,`motionZones`,`getStatus`,`query`,e)},nativeObjectDetection:{setEnabled:e=>c(`native-object-detection`,`nativeObjectDetection`,`setEnabled`,`mutation`,e),getStatus:e=>c(`native-object-detection`,`nativeObjectDetection`,`getStatus`,`query`,e)},notifier:{send:e=>c(`notifier`,`notifier`,`send`,`mutation`,e),cancel:e=>c(`notifier`,`notifier`,`cancel`,`mutation`,e),getStatus:e=>c(`notifier`,`notifier`,`getStatus`,`query`,e)},numericSensor:{getStatus:e=>c(`numeric-sensor`,`numericSensor`,`getStatus`,`query`,e)},osd:{setOverlay:e=>c(`osd`,`osd`,`setOverlay`,`mutation`,e),getStatus:e=>c(`osd`,`osd`,`getStatus`,`query`,e)},pipelineAnalytics:{getActiveTracks:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`getActiveTracks`,`query`,e),getTrack:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`getTrack`,`query`,e),listTracks:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`listTracks`,`query`,e),clearTracks:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`clearTracks`,`mutation`,e),getMotionEvents:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`getMotionEvents`,`query`,e),getObjectEvents:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`getObjectEvents`,`query`,e),getAudioEvents:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`getAudioEvents`,`query`,e),getEventDensity:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`getEventDensity`,`query`,e),pruneEventsBefore:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`pruneEventsBefore`,`mutation`,e),getEventMedia:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`getEventMedia`,`query`,e),getTrackMedia:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`getTrackMedia`,`query`,e),getDeviceSettingsContribution:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`getDeviceSettingsContribution`,`query`,e),getDeviceLiveContribution:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`getDeviceLiveContribution`,`query`,e),applyDeviceSettingsPatch:e=>c(`pipeline-analytics`,`pipelineAnalytics`,`applyDeviceSettingsPatch`,`mutation`,e)},powerMeter:{getStatus:e=>c(`power-meter`,`powerMeter`,`getStatus`,`query`,e)},presence:{getStatus:e=>c(`presence`,`presence`,`getStatus`,`query`,e)},pressureSensor:{getStatus:e=>c(`pressure-sensor`,`pressureSensor`,`getStatus`,`query`,e)},privacyMask:{getOptions:e=>c(`privacy-mask`,`privacyMask`,`getOptions`,`query`,e),setMask:e=>c(`privacy-mask`,`privacyMask`,`setMask`,`mutation`,e),getStatus:e=>c(`privacy-mask`,`privacyMask`,`getStatus`,`query`,e)},ptz:{move:e=>c(`ptz`,`ptz`,`move`,`mutation`,e),continuousMove:e=>c(`ptz`,`ptz`,`continuousMove`,`mutation`,e),stop:e=>c(`ptz`,`ptz`,`stop`,`mutation`,e),getPresets:e=>c(`ptz`,`ptz`,`getPresets`,`query`,e),goToPreset:e=>c(`ptz`,`ptz`,`goToPreset`,`mutation`,e),savePreset:e=>c(`ptz`,`ptz`,`savePreset`,`mutation`,e),deletePreset:e=>c(`ptz`,`ptz`,`deletePreset`,`mutation`,e),getOptions:e=>c(`ptz`,`ptz`,`getOptions`,`query`,e),goHome:e=>c(`ptz`,`ptz`,`goHome`,`mutation`,e),getPosition:e=>c(`ptz`,`ptz`,`getPosition`,`query`,e),setAutofocus:e=>c(`ptz`,`ptz`,`setAutofocus`,`mutation`,e),getStatus:e=>c(`ptz`,`ptz`,`getStatus`,`query`,e)},ptzAutotrack:{getStatus:e=>c(`ptz-autotrack`,`ptzAutotrack`,`getStatus`,`query`,e),setEnabled:e=>c(`ptz-autotrack`,`ptzAutotrack`,`setEnabled`,`mutation`,e),getSettings:e=>c(`ptz-autotrack`,`ptzAutotrack`,`getSettings`,`query`,e),setSettings:e=>c(`ptz-autotrack`,`ptzAutotrack`,`setSettings`,`mutation`,e)},reboot:{reboot:e=>c(`reboot`,`reboot`,`reboot`,`mutation`,e)},scriptRunner:{run:e=>c(`script-runner`,`scriptRunner`,`run`,`mutation`,e),stop:e=>c(`script-runner`,`scriptRunner`,`stop`,`mutation`,e),getStatus:e=>c(`script-runner`,`scriptRunner`,`getStatus`,`query`,e)},smoke:{getStatus:e=>c(`smoke`,`smoke`,`getStatus`,`query`,e)},snapshot:{getSnapshot:e=>c(`snapshot`,`snapshot`,`getSnapshot`,`query`,e),invalidateCache:e=>c(`snapshot`,`snapshot`,`invalidateCache`,`mutation`,e),getStatus:e=>c(`snapshot`,`snapshot`,`getStatus`,`query`,e),getDeviceSettingsContribution:e=>c(`snapshot`,`snapshot`,`getDeviceSettingsContribution`,`query`,e),getDeviceLiveContribution:e=>c(`snapshot`,`snapshot`,`getDeviceLiveContribution`,`query`,e),applyDeviceSettingsPatch:e=>c(`snapshot`,`snapshot`,`applyDeviceSettingsPatch`,`mutation`,e)},streamCatalog:{getCatalog:e=>c(`stream-catalog`,`streamCatalog`,`getCatalog`,`query`,e)},streamParams:{getOptions:e=>c(`stream-params`,`streamParams`,`getOptions`,`query`,e),setProfile:e=>c(`stream-params`,`streamParams`,`setProfile`,`mutation`,e),getConfigSchema:e=>c(`stream-params`,`streamParams`,`getConfigSchema`,`query`,e),getStatus:e=>c(`stream-params`,`streamParams`,`getStatus`,`query`,e)},switch:{setState:e=>c(`switch`,`switch`,`setState`,`mutation`,e),getStatus:e=>c(`switch`,`switch`,`getStatus`,`query`,e)},tamper:{getStatus:e=>c(`tamper`,`tamper`,`getStatus`,`query`,e)},temperatureSensor:{getStatus:e=>c(`temperature-sensor`,`temperatureSensor`,`getStatus`,`query`,e)},update:{installUpdate:e=>c(`update`,`update`,`installUpdate`,`mutation`,e),getStatus:e=>c(`update`,`update`,`getStatus`,`query`,e)},vacuumControl:{start:e=>c(`vacuum-control`,`vacuumControl`,`start`,`mutation`,e),pause:e=>c(`vacuum-control`,`vacuumControl`,`pause`,`mutation`,e),stop:e=>c(`vacuum-control`,`vacuumControl`,`stop`,`mutation`,e),returnToBase:e=>c(`vacuum-control`,`vacuumControl`,`returnToBase`,`mutation`,e),locate:e=>c(`vacuum-control`,`vacuumControl`,`locate`,`mutation`,e),setFanSpeed:e=>c(`vacuum-control`,`vacuumControl`,`setFanSpeed`,`mutation`,e),getStatus:e=>c(`vacuum-control`,`vacuumControl`,`getStatus`,`query`,e)},valve:{open:e=>c(`valve`,`valve`,`open`,`mutation`,e),close:e=>c(`valve`,`valve`,`close`,`mutation`,e),stop:e=>c(`valve`,`valve`,`stop`,`mutation`,e),setPosition:e=>c(`valve`,`valve`,`setPosition`,`mutation`,e),getStatus:e=>c(`valve`,`valve`,`getStatus`,`query`,e)},vibration:{getStatus:e=>c(`vibration`,`vibration`,`getStatus`,`query`,e)},videoclips:{listClips:e=>c(`videoclips`,`videoclips`,`listClips`,`query`,e),getClipPlayback:e=>c(`videoclips`,`videoclips`,`getClipPlayback`,`query`,e)},waterHeater:{setTargetTemp:e=>c(`water-heater`,`waterHeater`,`setTargetTemp`,`mutation`,e),setOperationMode:e=>c(`water-heater`,`waterHeater`,`setOperationMode`,`mutation`,e),setAway:e=>c(`water-heater`,`waterHeater`,`setAway`,`mutation`,e),getStatus:e=>c(`water-heater`,`waterHeater`,`getStatus`,`query`,e)},weather:{getStatus:e=>c(`weather`,`weather`,`getStatus`,`query`,e)},webrtcSession:{listStreams:e=>c(`webrtc-session`,`webrtcSession`,`listStreams`,`query`,e),createSession:e=>c(`webrtc-session`,`webrtcSession`,`createSession`,`mutation`,e),handleOffer:e=>c(`webrtc-session`,`webrtcSession`,`handleOffer`,`mutation`,e),handleAnswer:e=>c(`webrtc-session`,`webrtcSession`,`handleAnswer`,`mutation`,e),addIceCandidate:e=>c(`webrtc-session`,`webrtcSession`,`addIceCandidate`,`mutation`,e),getIceCandidates:e=>c(`webrtc-session`,`webrtcSession`,`getIceCandidates`,`query`,e),closeSession:e=>c(`webrtc-session`,`webrtcSession`,`closeSession`,`mutation`,e),hasAdaptiveBitrate:e=>c(`webrtc-session`,`webrtcSession`,`hasAdaptiveBitrate`,`query`,e),getSessionState:e=>c(`webrtc-session`,`webrtcSession`,`getSessionState`,`query`,e)},zoneAnalytics:{getCurrentSnapshot:e=>c(`zone-analytics`,`zoneAnalytics`,`getCurrentSnapshot`,`query`,e),getZoneHistory:e=>c(`zone-analytics`,`zoneAnalytics`,`getZoneHistory`,`query`,e),getCameraHistory:e=>c(`zone-analytics`,`zoneAnalytics`,`getCameraHistory`,`query`,e),getUnzonedHistory:e=>c(`zone-analytics`,`zoneAnalytics`,`getUnzonedHistory`,`query`,e)},zoneRules:{listRules:e=>c(`zone-rules`,`zoneRules`,`listRules`,`query`,e),setRules:e=>c(`zone-rules`,`zoneRules`,`setRules`,`mutation`,e)},zones:{listZones:e=>c(`zones`,`zones`,`listZones`,`query`,e),addZone:e=>c(`zones`,`zones`,`addZone`,`mutation`,e),removeZone:e=>c(`zones`,`zones`,`removeZone`,`mutation`,e),updateZone:e=>c(`zones`,`zones`,`updateZone`,`mutation`,e)},addonSettings:{getDeviceSettings:e=>l(`addonSettings`,`getDeviceSettings`,`query`,e),updateDeviceSettings:e=>l(`addonSettings`,`updateDeviceSettings`,`mutation`,e)},cameraPipelineConfig:{getDeviceSettingsContribution:e=>l(`cameraPipelineConfig`,`getDeviceSettingsContribution`,`query`,e),getDeviceLiveContribution:e=>l(`cameraPipelineConfig`,`getDeviceLiveContribution`,`query`,e),applyDeviceSettingsPatch:e=>l(`cameraPipelineConfig`,`applyDeviceSettingsPatch`,`mutation`,e)},deviceAdoption:{getStatus:e=>l(`deviceAdoption`,`getStatus`,`query`,e)},deviceExport:{getDeviceSettingsContribution:e=>l(`deviceExport`,`getDeviceSettingsContribution`,`query`,e),getDeviceLiveContribution:e=>l(`deviceExport`,`getDeviceLiveContribution`,`query`,e),applyDeviceSettingsPatch:e=>l(`deviceExport`,`applyDeviceSettingsPatch`,`mutation`,e)},deviceManager:{loadConfig:e=>l(`deviceManager`,`loadConfig`,`query`,e),loadRuntimeState:e=>l(`deviceManager`,`loadRuntimeState`,`query`,e),loadMeta:e=>l(`deviceManager`,`loadMeta`,`query`,e),setName:e=>l(`deviceManager`,`setName`,`mutation`,e),setLocation:e=>l(`deviceManager`,`setLocation`,`mutation`,e),setType:e=>l(`deviceManager`,`setType`,`mutation`,e),setIntegrationId:e=>l(`deviceManager`,`setIntegrationId`,`mutation`,e),setLinkDeviceId:e=>l(`deviceManager`,`setLinkDeviceId`,`mutation`,e),setPrimaryChildEntityId:e=>l(`deviceManager`,`setPrimaryChildEntityId`,`mutation`,e),setChildLayout:e=>l(`deviceManager`,`setChildLayout`,`mutation`,e),setDeviceLinks:e=>l(`deviceManager`,`setDeviceLinks`,`mutation`,e),getWireableFields:e=>l(`deviceManager`,`getWireableFields`,`query`,e),setRole:e=>l(`deviceManager`,`setRole`,`mutation`,e),applyInitialMeta:e=>l(`deviceManager`,`applyInitialMeta`,`mutation`,e),setMetadata:e=>l(`deviceManager`,`setMetadata`,`mutation`,e),setDisabled:e=>l(`deviceManager`,`setDisabled`,`mutation`,e),getDevice:e=>l(`deviceManager`,`getDevice`,`query`,e),getStreamSources:e=>l(`deviceManager`,`getStreamSources`,`query`,e),getConfigSchema:e=>l(`deviceManager`,`getConfigSchema`,`query`,e),getSettingsSchema:e=>l(`deviceManager`,`getSettingsSchema`,`query`,e),updateConfig:e=>l(`deviceManager`,`updateConfig`,`mutation`,e),enable:e=>l(`deviceManager`,`enable`,`mutation`,e),disable:e=>l(`deviceManager`,`disable`,`mutation`,e),remove:e=>l(`deviceManager`,`remove`,`mutation`,e),getStreamProfileMap:e=>l(`deviceManager`,`getStreamProfileMap`,`query`,e),setStreamProfileMap:e=>l(`deviceManager`,`setStreamProfileMap`,`mutation`,e),probeStreams:e=>l(`deviceManager`,`probeStreams`,`mutation`,e),getBindings:e=>l(`deviceManager`,`getBindings`,`query`,e),getAllBindings:e=>l(`deviceManager`,`getAllBindings`,`query`,e),setWrapperActive:e=>l(`deviceManager`,`setWrapperActive`,`mutation`,e),getDeviceSettingsAggregate:e=>l(`deviceManager`,`getDeviceSettingsAggregate`,`query`,e),getDeviceLiveInfoAggregate:e=>l(`deviceManager`,`getDeviceLiveInfoAggregate`,`query`,e),getDeviceAggregate:e=>l(`deviceManager`,`getDeviceAggregate`,`query`,e),runDeviceAction:e=>l(`deviceManager`,`runDeviceAction`,`mutation`,e),updateDeviceField:e=>l(`deviceManager`,`updateDeviceField`,`mutation`,e),updateDeviceFieldsBatch:e=>l(`deviceManager`,`updateDeviceFieldsBatch`,`mutation`,e),testField:e=>l(`deviceManager`,`testField`,`mutation`,e),getDeviceStatusAggregate:e=>l(`deviceManager`,`getDeviceStatusAggregate`,`query`,e)},deviceState:{getSnapshot:e=>l(`deviceState`,`getSnapshot`,`query`,e),getCapSlice:e=>l(`deviceState`,`getCapSlice`,`query`,e),setCapSlice:e=>l(`deviceState`,`setCapSlice`,`mutation`,e)},faceGallery:{getFaceByTrack:e=>l(`faceGallery`,`getFaceByTrack`,`query`,e)},networkQuality:{getDeviceStats:e=>l(`networkQuality`,`getDeviceStats`,`query`,e),reportClientStats:e=>l(`networkQuality`,`reportClientStats`,`mutation`,e)},pipelineExecutor:{runPipeline:e=>l(`pipelineExecutor`,`runPipeline`,`mutation`,e),runPipelineBatch:e=>l(`pipelineExecutor`,`runPipelineBatch`,`mutation`,e)},pipelineOrchestrator:{assignPipeline:e=>l(`pipelineOrchestrator`,`assignPipeline`,`mutation`,e),unassignPipeline:e=>l(`pipelineOrchestrator`,`unassignPipeline`,`mutation`,e),getPipelineAssignment:e=>l(`pipelineOrchestrator`,`getPipelineAssignment`,`query`,e),getCameraMetrics:e=>l(`pipelineOrchestrator`,`getCameraMetrics`,`query`,e),assignDecoder:e=>l(`pipelineOrchestrator`,`assignDecoder`,`mutation`,e),unassignDecoder:e=>l(`pipelineOrchestrator`,`unassignDecoder`,`mutation`,e),assignAudio:e=>l(`pipelineOrchestrator`,`assignAudio`,`mutation`,e),unassignAudio:e=>l(`pipelineOrchestrator`,`unassignAudio`,`mutation`,e),getAudioAssignment:e=>l(`pipelineOrchestrator`,`getAudioAssignment`,`query`,e),getAudioAssignments:e=>l(`pipelineOrchestrator`,`getAudioAssignments`,`query`,e),getDecoderAssignment:e=>l(`pipelineOrchestrator`,`getDecoderAssignment`,`query`,e),getCameraSettings:e=>l(`pipelineOrchestrator`,`getCameraSettings`,`query`,e),setCameraStepToggle:e=>l(`pipelineOrchestrator`,`setCameraStepToggle`,`mutation`,e),getCameraStepOverrides:e=>l(`pipelineOrchestrator`,`getCameraStepOverrides`,`query`,e),setCameraStepOverride:e=>l(`pipelineOrchestrator`,`setCameraStepOverride`,`mutation`,e),setCameraPipelineForAgent:e=>l(`pipelineOrchestrator`,`setCameraPipelineForAgent`,`mutation`,e),resolvePipeline:e=>l(`pipelineOrchestrator`,`resolvePipeline`,`query`,e),getDeviceSettingsContribution:e=>l(`pipelineOrchestrator`,`getDeviceSettingsContribution`,`query`,e),getDeviceLiveContribution:e=>l(`pipelineOrchestrator`,`getDeviceLiveContribution`,`query`,e),applyDeviceSettingsPatch:e=>l(`pipelineOrchestrator`,`applyDeviceSettingsPatch`,`mutation`,e)},pipelineRunner:{detachCamera:e=>l(`pipelineRunner`,`detachCamera`,`mutation`,e),getCameraMetrics:e=>l(`pipelineRunner`,`getCameraMetrics`,`query`,e)},plateGallery:{listPlates:e=>l(`plateGallery`,`listPlates`,`query`,e),getPlateByTrack:e=>l(`plateGallery`,`getPlateByTrack`,`query`,e)},recording:{getAvailability:e=>l(`recording`,`getAvailability`,`query`,e),getDaysWithRecordings:e=>l(`recording`,`getDaysWithRecordings`,`query`,e),getPlaybackManifest:e=>l(`recording`,`getPlaybackManifest`,`query`,e),getDeviceConfig:e=>l(`recording`,`getDeviceConfig`,`query`,e),locateSegment:e=>l(`recording`,`locateSegment`,`query`,e),readSegmentBytes:e=>l(`recording`,`readSegmentBytes`,`query`,e),setDeviceConfig:e=>l(`recording`,`setDeviceConfig`,`mutation`,e),rescanStorage:e=>l(`recording`,`rescanStorage`,`mutation`,e),pruneFootage:e=>l(`recording`,`pruneFootage`,`mutation`,e),getStatus:e=>l(`recording`,`getStatus`,`query`,e),getDeviceSettingsContribution:e=>l(`recording`,`getDeviceSettingsContribution`,`query`,e),getDeviceLiveContribution:e=>l(`recording`,`getDeviceLiveContribution`,`query`,e),applyDeviceSettingsPatch:e=>l(`recording`,`applyDeviceSettingsPatch`,`mutation`,e)},snapshotProvider:{supportsDevice:e=>l(`snapshotProvider`,`supportsDevice`,`query`,e),getSnapshot:e=>l(`snapshotProvider`,`getSnapshot`,`query`,e)},streamBroker:{publishCameraStream:e=>l(`streamBroker`,`publishCameraStream`,`mutation`,e),retractCameraStream:e=>l(`streamBroker`,`retractCameraStream`,`mutation`,e),assignProfile:e=>l(`streamBroker`,`assignProfile`,`mutation`,e),unassignProfile:e=>l(`streamBroker`,`unassignProfile`,`mutation`,e),restartProfile:e=>l(`streamBroker`,`restartProfile`,`mutation`,e),getDeviceSettingsContribution:e=>l(`streamBroker`,`getDeviceSettingsContribution`,`query`,e),getDeviceLiveContribution:e=>l(`streamBroker`,`getDeviceLiveContribution`,`query`,e),applyDeviceSettingsPatch:e=>l(`streamBroker`,`applyDeviceSettingsPatch`,`mutation`,e)}}}function Mw(e){let t=e;function n(e,n,r,a,o){let s=t[e]?.[n];if(!s)throw Error(`SystemProxy: api has no '${e}.${n}'`);let c=s;return r===`mutation`?c.mutate(a):r===`subscription`?c.subscribe(a,o):c.query(a)}return{addonPages:{listPages:e=>n(`addonPages`,`listPages`,`query`,e)},addons:{list:e=>n(`addons`,`list`,`query`,e),getLogs:e=>n(`addons`,`getLogs`,`query`,e),listPackages:e=>n(`addons`,`listPackages`,`query`,e),installPackage:e=>n(`addons`,`installPackage`,`mutation`,e),installFromWorkspace:e=>n(`addons`,`installFromWorkspace`,`mutation`,e),isWorkspaceAvailable:e=>n(`addons`,`isWorkspaceAvailable`,`query`,e),listWorkspacePackages:e=>n(`addons`,`listWorkspacePackages`,`query`,e),uninstallPackage:e=>n(`addons`,`uninstallPackage`,`mutation`,e),reloadPackages:e=>n(`addons`,`reloadPackages`,`mutation`,e),searchAvailable:e=>n(`addons`,`searchAvailable`,`query`,e),listUpdates:e=>n(`addons`,`listUpdates`,`query`,e),updatePackage:e=>n(`addons`,`updatePackage`,`mutation`,e),rollbackPackage:e=>n(`addons`,`rollbackPackage`,`mutation`,e),forceRefresh:e=>n(`addons`,`forceRefresh`,`mutation`,e),restartServer:e=>n(`addons`,`restartServer`,`mutation`,e),getLastRestart:e=>n(`addons`,`getLastRestart`,`query`,e),listFrameworkPackages:e=>n(`addons`,`listFrameworkPackages`,`query`,e),listCapabilityProviders:e=>n(`addons`,`listCapabilityProviders`,`query`,e),setCapabilityProviderEnabled:e=>n(`addons`,`setCapabilityProviderEnabled`,`mutation`,e),updateFrameworkPackage:e=>n(`addons`,`updateFrameworkPackage`,`mutation`,e),startBulkUpdate:e=>n(`addons`,`startBulkUpdate`,`mutation`,e),getBulkUpdateState:e=>n(`addons`,`getBulkUpdateState`,`query`,e),cancelBulkUpdate:e=>n(`addons`,`cancelBulkUpdate`,`mutation`,e),listActiveBulkUpdates:e=>n(`addons`,`listActiveBulkUpdates`,`query`,e),getVersions:e=>n(`addons`,`getVersions`,`query`,e),restartAddon:e=>n(`addons`,`restartAddon`,`mutation`,e),retryLoad:e=>n(`addons`,`retryLoad`,`mutation`,e),getAutoUpdateSettings:e=>n(`addons`,`getAutoUpdateSettings`,`query`,e),setAutoUpdateSettings:e=>n(`addons`,`setAutoUpdateSettings`,`mutation`,e),getAddonAutoUpdate:e=>n(`addons`,`getAddonAutoUpdate`,`query`,e),setAddonAutoUpdate:e=>n(`addons`,`setAddonAutoUpdate`,`mutation`,e),applyAutoUpdateToAll:e=>n(`addons`,`applyAutoUpdateToAll`,`mutation`,e),custom:e=>n(`addons`,`custom`,`mutation`,e),onAddonLogs:(e,t)=>n(`addons`,`onAddonLogs`,`subscription`,e,t)},addonSettings:{getGlobalSettings:e=>n(`addonSettings`,`getGlobalSettings`,`query`,e),updateGlobalSettings:e=>n(`addonSettings`,`updateGlobalSettings`,`mutation`,e)},addonWidgets:{listWidgets:e=>n(`addonWidgets`,`listWidgets`,`query`,e)},alerts:{emit:e=>n(`alerts`,`emit`,`mutation`,e),update:e=>n(`alerts`,`update`,`mutation`,e),list:e=>n(`alerts`,`list`,`query`,e),getUnreadCount:e=>n(`alerts`,`getUnreadCount`,`query`,e),markRead:e=>n(`alerts`,`markRead`,`mutation`,e),markAllRead:e=>n(`alerts`,`markAllRead`,`mutation`,e),dismiss:e=>n(`alerts`,`dismiss`,`mutation`,e)},audioAnalyzer:{analyseChunk:e=>n(`audioAnalyzer`,`analyseChunk`,`mutation`,e),classify:e=>n(`audioAnalyzer`,`classify`,`query`,e),isReady:e=>n(`audioAnalyzer`,`isReady`,`query`,e),dispose:e=>n(`audioAnalyzer`,`dispose`,`mutation`,e),reprobeAudioEngine:e=>n(`audioAnalyzer`,`reprobeAudioEngine`,`mutation`,e)},audioCodec:{listSupportedCodecs:e=>n(`audioCodec`,`listSupportedCodecs`,`query`,e),canHandle:e=>n(`audioCodec`,`canHandle`,`query`,e),createDecodeSession:e=>n(`audioCodec`,`createDecodeSession`,`mutation`,e),createEncodeSession:e=>n(`audioCodec`,`createEncodeSession`,`mutation`,e),closeSession:e=>n(`audioCodec`,`closeSession`,`mutation`,e),pushEncodedFrame:e=>n(`audioCodec`,`pushEncodedFrame`,`mutation`,e),pullPcm:e=>n(`audioCodec`,`pullPcm`,`query`,e),pushPcm:e=>n(`audioCodec`,`pushPcm`,`mutation`,e),pullEncoded:e=>n(`audioCodec`,`pullEncoded`,`query`,e),flushEncode:e=>n(`audioCodec`,`flushEncode`,`mutation`,e),listActiveSessions:e=>n(`audioCodec`,`listActiveSessions`,`query`,e)},backup:{listDestinations:e=>n(`backup`,`listDestinations`,`query`,e),trigger:e=>n(`backup`,`trigger`,`mutation`,e),list:e=>n(`backup`,`list`,`query`,e),listLocations:e=>n(`backup`,`listLocations`,`query`,e),getEntries:e=>n(`backup`,`getEntries`,`query`,e),restore:e=>n(`backup`,`restore`,`mutation`,e),delete:e=>n(`backup`,`delete`,`mutation`,e),listArchives:e=>n(`backup`,`listArchives`,`query`,e),upsertDestinationPolicy:e=>n(`backup`,`upsertDestinationPolicy`,`mutation`,e),previewSchedule:e=>n(`backup`,`previewSchedule`,`query`,e)},broker:{list:e=>n(`broker`,`list`,`query`,e),get:e=>n(`broker`,`get`,`query`,e),listProviders:e=>n(`broker`,`listProviders`,`query`,e),add:e=>n(`broker`,`add`,`mutation`,e),remove:e=>n(`broker`,`remove`,`mutation`,e),testConnection:e=>n(`broker`,`testConnection`,`mutation`,e),getSettings:e=>n(`broker`,`getSettings`,`query`,e),setSettings:e=>n(`broker`,`setSettings`,`mutation`,e),getBrokerConfig:e=>n(`broker`,`getBrokerConfig`,`query`,e),getSettingsSchema:e=>n(`broker`,`getSettingsSchema`,`query`,e),testSettings:e=>n(`broker`,`testSettings`,`mutation`,e),publish:e=>n(`broker`,`publish`,`mutation`,e),subscribe:e=>n(`broker`,`subscribe`,`mutation`,e),unsubscribe:e=>n(`broker`,`unsubscribe`,`mutation`,e),getState:e=>n(`broker`,`getState`,`query`,e),getStatus:e=>n(`broker`,`getStatus`,`query`,e)},decoder:{supportsCodec:e=>n(`decoder`,`supportsCodec`,`query`,e),getInfo:e=>n(`decoder`,`getInfo`,`query`,e),createSession:e=>n(`decoder`,`createSession`,`query`,e),destroySession:e=>n(`decoder`,`destroySession`,`query`,e),pushPacket:e=>n(`decoder`,`pushPacket`,`query`,e),openStream:e=>n(`decoder`,`openStream`,`query`,e),pullFrames:e=>n(`decoder`,`pullFrames`,`query`,e),pullHandles:e=>n(`decoder`,`pullHandles`,`query`,e),getFrame:e=>n(`decoder`,`getFrame`,`query`,e),getShmStats:e=>n(`decoder`,`getShmStats`,`query`,e),updateConfig:e=>n(`decoder`,`updateConfig`,`query`,e),getStats:e=>n(`decoder`,`getStats`,`query`,e),listActiveSessions:e=>n(`decoder`,`listActiveSessions`,`query`,e),reprobeHwaccel:e=>n(`decoder`,`reprobeHwaccel`,`mutation`,e)},deviceAdoption:{listCandidateFilters:e=>n(`deviceAdoption`,`listCandidateFilters`,`query`,e),listCandidates:e=>n(`deviceAdoption`,`listCandidates`,`query`,e),getCandidate:e=>n(`deviceAdoption`,`getCandidate`,`query`,e),refresh:e=>n(`deviceAdoption`,`refresh`,`mutation`,e),adopt:e=>n(`deviceAdoption`,`adopt`,`mutation`,e),release:e=>n(`deviceAdoption`,`release`,`mutation`,e),resync:e=>n(`deviceAdoption`,`resync`,`mutation`,e)},deviceExport:{getStatus:e=>n(`deviceExport`,`getStatus`,`query`,e),listSupportedDeviceKinds:e=>n(`deviceExport`,`listSupportedDeviceKinds`,`query`,e),listExposedDevices:e=>n(`deviceExport`,`listExposedDevices`,`query`,e),exposeDevice:e=>n(`deviceExport`,`exposeDevice`,`mutation`,e),unexposeDevice:e=>n(`deviceExport`,`unexposeDevice`,`mutation`,e)},deviceManager:{allocateDeviceId:e=>n(`deviceManager`,`allocateDeviceId`,`mutation`,e),registerDevice:e=>n(`deviceManager`,`registerDevice`,`mutation`,e),removeDevice:e=>n(`deviceManager`,`removeDevice`,`mutation`,e),persistConfig:e=>n(`deviceManager`,`persistConfig`,`mutation`,e),listLocations:e=>n(`deviceManager`,`listLocations`,`query`,e),addLocation:e=>n(`deviceManager`,`addLocation`,`mutation`,e),removeLocation:e=>n(`deviceManager`,`removeLocation`,`mutation`,e),listPersistedByAddon:e=>n(`deviceManager`,`listPersistedByAddon`,`query`,e),listAll:e=>n(`deviceManager`,`listAll`,`query`,e),getChildren:e=>n(`deviceManager`,`getChildren`,`query`,e),removeByIntegration:e=>n(`deviceManager`,`removeByIntegration`,`mutation`,e),listWrappersForCap:e=>n(`deviceManager`,`listWrappersForCap`,`query`,e),listBindableCapsForDeviceType:e=>n(`deviceManager`,`listBindableCapsForDeviceType`,`query`,e),discoverDevices:e=>n(`deviceManager`,`discoverDevices`,`mutation`,e),adoptDevice:e=>n(`deviceManager`,`adoptDevice`,`mutation`,e),getCreationSchema:e=>n(`deviceManager`,`getCreationSchema`,`query`,e),createDevice:e=>n(`deviceManager`,`createDevice`,`mutation`,e),testCreationField:e=>n(`deviceManager`,`testCreationField`,`mutation`,e),adoptionListCandidates:e=>n(`deviceManager`,`adoptionListCandidates`,`query`,e),adoptionRefresh:e=>n(`deviceManager`,`adoptionRefresh`,`mutation`,e),adoptionAdopt:e=>n(`deviceManager`,`adoptionAdopt`,`mutation`,e),adoptionRelease:e=>n(`deviceManager`,`adoptionRelease`,`mutation`,e)},deviceProvider:{start:e=>n(`deviceProvider`,`start`,`mutation`,e),stop:e=>n(`deviceProvider`,`stop`,`mutation`,e),getStatus:e=>n(`deviceProvider`,`getStatus`,`query`,e),getDevices:e=>n(`deviceProvider`,`getDevices`,`query`,e),supportsDiscovery:e=>n(`deviceProvider`,`supportsDiscovery`,`query`,e),discoverDevices:e=>n(`deviceProvider`,`discoverDevices`,`mutation`,e),adoptDiscoveredDevice:e=>n(`deviceProvider`,`adoptDiscoveredDevice`,`mutation`,e),supportsManualCreation:e=>n(`deviceProvider`,`supportsManualCreation`,`query`,e),getChildCreationSchema:e=>n(`deviceProvider`,`getChildCreationSchema`,`query`,e),createDevice:e=>n(`deviceProvider`,`createDevice`,`mutation`,e),testCreationField:e=>n(`deviceProvider`,`testCreationField`,`mutation`,e)},deviceState:{getAllSnapshots:e=>n(`deviceState`,`getAllSnapshots`,`query`,e)},faceGallery:{listIdentities:e=>n(`faceGallery`,`listIdentities`,`query`,e),createIdentity:e=>n(`faceGallery`,`createIdentity`,`mutation`,e),renameIdentity:e=>n(`faceGallery`,`renameIdentity`,`mutation`,e),deleteIdentity:e=>n(`faceGallery`,`deleteIdentity`,`mutation`,e),listIdentitySamples:e=>n(`faceGallery`,`listIdentitySamples`,`query`,e),removeSample:e=>n(`faceGallery`,`removeSample`,`mutation`,e),listRecentFaces:e=>n(`faceGallery`,`listRecentFaces`,`query`,e),getFaceMedia:e=>n(`faceGallery`,`getFaceMedia`,`query`,e),assignFace:e=>n(`faceGallery`,`assignFace`,`mutation`,e),unassignFace:e=>n(`faceGallery`,`unassignFace`,`mutation`,e),deleteFace:e=>n(`faceGallery`,`deleteFace`,`mutation`,e),assignFaces:e=>n(`faceGallery`,`assignFaces`,`mutation`,e),unassignFaces:e=>n(`faceGallery`,`unassignFaces`,`mutation`,e),suggestFaceClusters:e=>n(`faceGallery`,`suggestFaceClusters`,`query`,e)},integrations:{list:e=>n(`integrations`,`list`,`query`,e),get:e=>n(`integrations`,`get`,`query`,e),getByAddonId:e=>n(`integrations`,`getByAddonId`,`query`,e),create:e=>n(`integrations`,`create`,`mutation`,e),update:e=>n(`integrations`,`update`,`mutation`,e),delete:e=>n(`integrations`,`delete`,`mutation`,e),getSettings:e=>n(`integrations`,`getSettings`,`query`,e),setSettings:e=>n(`integrations`,`setSettings`,`mutation`,e),getAvailableTypes:e=>n(`integrations`,`getAvailableTypes`,`query`,e),testConnection:e=>n(`integrations`,`testConnection`,`mutation`,e)},localNetwork:{list:e=>n(`localNetwork`,`list`,`query`,e),getPreferred:e=>n(`localNetwork`,`getPreferred`,`query`,e),getConnectionEndpoints:e=>n(`localNetwork`,`getConnectionEndpoints`,`query`,e),getAllowedAddresses:e=>n(`localNetwork`,`getAllowedAddresses`,`query`,e),setAllowedAddresses:e=>n(`localNetwork`,`setAllowedAddresses`,`mutation`,e),resetAllowlistToBestMatch:e=>n(`localNetwork`,`resetAllowlistToBestMatch`,`mutation`,e)},meshNetwork:{getStatus:e=>n(`meshNetwork`,`getStatus`,`query`,e),join:e=>n(`meshNetwork`,`join`,`mutation`,e),startLogin:e=>n(`meshNetwork`,`startLogin`,`mutation`,e),leave:e=>n(`meshNetwork`,`leave`,`mutation`,e),logout:e=>n(`meshNetwork`,`logout`,`mutation`,e),listPeers:e=>n(`meshNetwork`,`listPeers`,`query`,e),testConnection:e=>n(`meshNetwork`,`testConnection`,`mutation`,e)},metricsProvider:{collectSnapshot:e=>n(`metricsProvider`,`collectSnapshot`,`query`,e),getCached:e=>n(`metricsProvider`,`getCached`,`query`,e),getCurrent:e=>n(`metricsProvider`,`getCurrent`,`query`,e),getDiskSpace:e=>n(`metricsProvider`,`getDiskSpace`,`query`,e),getGpuInfo:e=>n(`metricsProvider`,`getGpuInfo`,`query`,e),getCpuTemperature:e=>n(`metricsProvider`,`getCpuTemperature`,`query`,e),getProcessStats:e=>n(`metricsProvider`,`getProcessStats`,`query`,e),listAddonInstances:e=>n(`metricsProvider`,`listAddonInstances`,`query`,e),getAddonStats:e=>n(`metricsProvider`,`getAddonStats`,`query`,e),listNodeProcesses:e=>n(`metricsProvider`,`listNodeProcesses`,`query`,e),killProcess:e=>n(`metricsProvider`,`killProcess`,`mutation`,e)},mqttBroker:{listBrokers:e=>n(`mqttBroker`,`listBrokers`,`query`,e),getBrokerConfig:e=>n(`mqttBroker`,`getBrokerConfig`,`query`,e),addBroker:e=>n(`mqttBroker`,`addBroker`,`mutation`,e),removeBroker:e=>n(`mqttBroker`,`removeBroker`,`mutation`,e),testConnection:e=>n(`mqttBroker`,`testConnection`,`mutation`,e),startEmbeddedBroker:e=>n(`mqttBroker`,`startEmbeddedBroker`,`mutation`,e),stopEmbeddedBroker:e=>n(`mqttBroker`,`stopEmbeddedBroker`,`mutation`,e),getStatus:e=>n(`mqttBroker`,`getStatus`,`query`,e)},networkAccess:{start:e=>n(`networkAccess`,`start`,`mutation`,e),stop:e=>n(`networkAccess`,`stop`,`mutation`,e),getEndpoint:e=>n(`networkAccess`,`getEndpoint`,`query`,e),getStatus:e=>n(`networkAccess`,`getStatus`,`query`,e),listEndpoints:e=>n(`networkAccess`,`listEndpoints`,`query`,e)},networkQuality:{getAllStats:e=>n(`networkQuality`,`getAllStats`,`query`,e)},nodes:{topology:e=>n(`nodes`,`topology`,`query`,e),deployAddon:e=>n(`nodes`,`deployAddon`,`mutation`,e),undeployAddon:e=>n(`nodes`,`undeployAddon`,`mutation`,e),restartAddon:e=>n(`nodes`,`restartAddon`,`mutation`,e),restartProcess:e=>n(`nodes`,`restartProcess`,`mutation`,e),restartNode:e=>n(`nodes`,`restartNode`,`mutation`,e),shutdownNode:e=>n(`nodes`,`shutdownNode`,`mutation`,e),renameNode:e=>n(`nodes`,`renameNode`,`mutation`,e),clusterAddonStatus:e=>n(`nodes`,`clusterAddonStatus`,`query`,e),getCapUsageGraph:e=>n(`nodes`,`getCapUsageGraph`,`query`,e),getNodeAddons:e=>n(`nodes`,`getNodeAddons`,`query`,e),setProcessLogLevel:e=>n(`nodes`,`setProcessLogLevel`,`mutation`,e),executeQuery:e=>n(`nodes`,`executeQuery`,`mutation`,e)},notificationOutput:{send:e=>n(`notificationOutput`,`send`,`mutation`,e),sendTest:e=>n(`notificationOutput`,`sendTest`,`mutation`,e)},pipelineExecutor:{getAvailableEngines:e=>n(`pipelineExecutor`,`getAvailableEngines`,`query`,e),getSelectedEngine:e=>n(`pipelineExecutor`,`getSelectedEngine`,`query`,e),getDefaultSteps:e=>n(`pipelineExecutor`,`getDefaultSteps`,`query`,e),reprobeEngine:e=>n(`pipelineExecutor`,`reprobeEngine`,`mutation`,e),getVideoPipelineSteps:e=>n(`pipelineExecutor`,`getVideoPipelineSteps`,`query`,e),setVideoPipelineSteps:e=>n(`pipelineExecutor`,`setVideoPipelineSteps`,`mutation`,e),getSchema:e=>n(`pipelineExecutor`,`getSchema`,`query`,e),getGlobalSteps:e=>n(`pipelineExecutor`,`getGlobalSteps`,`query`,e),getGlobalPipelineConfig:e=>n(`pipelineExecutor`,`getGlobalPipelineConfig`,`query`,e),getOrchestratorConfigSchema:e=>n(`pipelineExecutor`,`getOrchestratorConfigSchema`,`query`,e),listTemplates:e=>n(`pipelineExecutor`,`listTemplates`,`query`,e),saveTemplate:e=>n(`pipelineExecutor`,`saveTemplate`,`mutation`,e),updateTemplate:e=>n(`pipelineExecutor`,`updateTemplate`,`mutation`,e),deleteTemplate:e=>n(`pipelineExecutor`,`deleteTemplate`,`mutation`,e),getCapabilities:e=>n(`pipelineExecutor`,`getCapabilities`,`query`,e),getAddonModels:e=>n(`pipelineExecutor`,`getAddonModels`,`query`,e),downloadModel:e=>n(`pipelineExecutor`,`downloadModel`,`mutation`,e),deleteModel:e=>n(`pipelineExecutor`,`deleteModel`,`mutation`,e),detect:e=>n(`pipelineExecutor`,`detect`,`query`,e),cacheFrameInPool:e=>n(`pipelineExecutor`,`cacheFrameInPool`,`mutation`,e),inferCached:e=>n(`pipelineExecutor`,`inferCached`,`mutation`,e),uncacheFrame:e=>n(`pipelineExecutor`,`uncacheFrame`,`mutation`,e),getEffectiveTuning:e=>n(`pipelineExecutor`,`getEffectiveTuning`,`query`,e),listLoadedEngines:e=>n(`pipelineExecutor`,`listLoadedEngines`,`query`,e),spinEngine:e=>n(`pipelineExecutor`,`spinEngine`,`mutation`,e),killEngine:e=>n(`pipelineExecutor`,`killEngine`,`mutation`,e),listReferenceImages:e=>n(`pipelineExecutor`,`listReferenceImages`,`query`,e),getReferenceImage:e=>n(`pipelineExecutor`,`getReferenceImage`,`query`,e),getReferenceAudioFiles:e=>n(`pipelineExecutor`,`getReferenceAudioFiles`,`query`,e),getReferenceAudio:e=>n(`pipelineExecutor`,`getReferenceAudio`,`query`,e),getAudioCapabilities:e=>n(`pipelineExecutor`,`getAudioCapabilities`,`query`,e),runAudioTest:e=>n(`pipelineExecutor`,`runAudioTest`,`mutation`,e),getDetectionConfigSchema:e=>n(`pipelineExecutor`,`getDetectionConfigSchema`,`query`,e)},pipelineOrchestrator:{rebalance:e=>n(`pipelineOrchestrator`,`rebalance`,`mutation`,e),getPipelineAssignments:e=>n(`pipelineOrchestrator`,`getPipelineAssignments`,`query`,e),getAgentLoad:e=>n(`pipelineOrchestrator`,`getAgentLoad`,`query`,e),getGlobalMetrics:e=>n(`pipelineOrchestrator`,`getGlobalMetrics`,`query`,e),getCapabilityBindings:e=>n(`pipelineOrchestrator`,`getCapabilityBindings`,`query`,e),setCapabilityBinding:e=>n(`pipelineOrchestrator`,`setCapabilityBinding`,`mutation`,e),getDecoderAssignments:e=>n(`pipelineOrchestrator`,`getDecoderAssignments`,`query`,e),getAudioNodeLoad:e=>n(`pipelineOrchestrator`,`getAudioNodeLoad`,`query`,e),getAgentSettings:e=>n(`pipelineOrchestrator`,`getAgentSettings`,`query`,e),listAgentSettings:e=>n(`pipelineOrchestrator`,`listAgentSettings`,`query`,e),setAgentAddonDefaults:e=>n(`pipelineOrchestrator`,`setAgentAddonDefaults`,`mutation`,e),removeAgentSettings:e=>n(`pipelineOrchestrator`,`removeAgentSettings`,`mutation`,e),listTemplates:e=>n(`pipelineOrchestrator`,`listTemplates`,`query`,e),saveTemplate:e=>n(`pipelineOrchestrator`,`saveTemplate`,`mutation`,e),updateTemplate:e=>n(`pipelineOrchestrator`,`updateTemplate`,`mutation`,e),deleteTemplate:e=>n(`pipelineOrchestrator`,`deleteTemplate`,`mutation`,e)},pipelineRunner:{attachCamera:e=>n(`pipelineRunner`,`attachCamera`,`mutation`,e),reportMotion:e=>n(`pipelineRunner`,`reportMotion`,`mutation`,e),getLocalLoad:e=>n(`pipelineRunner`,`getLocalLoad`,`query`,e),getLocalMetrics:e=>n(`pipelineRunner`,`getLocalMetrics`,`query`,e),getAllCameraMetrics:e=>n(`pipelineRunner`,`getAllCameraMetrics`,`query`,e),getLocalCameras:e=>n(`pipelineRunner`,`getLocalCameras`,`query`,e)},plateGallery:{getPlateMedia:e=>n(`plateGallery`,`getPlateMedia`,`query`,e),searchPlates:e=>n(`plateGallery`,`searchPlates`,`query`,e),suggestPlateClusters:e=>n(`plateGallery`,`suggestPlateClusters`,`query`,e),correctPlateText:e=>n(`plateGallery`,`correctPlateText`,`mutation`,e),deletePlate:e=>n(`plateGallery`,`deletePlate`,`mutation`,e)},recording:{getStorageUsage:e=>n(`recording`,`getStorageUsage`,`query`,e)},settingsStore:{get:e=>n(`settingsStore`,`get`,`query`,e),set:e=>n(`settingsStore`,`set`,`mutation`,e),query:e=>n(`settingsStore`,`query`,`query`,e),insert:e=>n(`settingsStore`,`insert`,`mutation`,e),update:e=>n(`settingsStore`,`update`,`mutation`,e),delete:e=>n(`settingsStore`,`delete`,`mutation`,e),count:e=>n(`settingsStore`,`count`,`query`,e),histogram:e=>n(`settingsStore`,`histogram`,`query`,e),isEmpty:e=>n(`settingsStore`,`isEmpty`,`query`,e),declareCollection:e=>n(`settingsStore`,`declareCollection`,`mutation`,e)},storage:{resolve:e=>n(`storage`,`resolve`,`query`,e),write:e=>n(`storage`,`write`,`mutation`,e),read:e=>n(`storage`,`read`,`query`,e),exists:e=>n(`storage`,`exists`,`query`,e),list:e=>n(`storage`,`list`,`query`,e),delete:e=>n(`storage`,`delete`,`mutation`,e),getAvailableSpace:e=>n(`storage`,`getAvailableSpace`,`query`,e),beginUpload:e=>n(`storage`,`beginUpload`,`mutation`,e),writeChunk:e=>n(`storage`,`writeChunk`,`mutation`,e),finalizeUpload:e=>n(`storage`,`finalizeUpload`,`mutation`,e),abortUpload:e=>n(`storage`,`abortUpload`,`mutation`,e),beginDownload:e=>n(`storage`,`beginDownload`,`mutation`,e),readChunk:e=>n(`storage`,`readChunk`,`query`,e),endDownload:e=>n(`storage`,`endDownload`,`mutation`,e),listLocations:e=>n(`storage`,`listLocations`,`query`,e),getDefaultLocation:e=>n(`storage`,`getDefaultLocation`,`query`,e),listLocationDeclarations:e=>n(`storage`,`listLocationDeclarations`,`query`,e),upsertLocation:e=>n(`storage`,`upsertLocation`,`mutation`,e),deleteLocation:e=>n(`storage`,`deleteLocation`,`mutation`,e),testLocation:e=>n(`storage`,`testLocation`,`query`,e),listProviders:e=>n(`storage`,`listProviders`,`query`,e),testConfig:e=>n(`storage`,`testConfig`,`query`,e)},streamBroker:{listAllCameraStreams:e=>n(`streamBroker`,`listAllCameraStreams`,`query`,e),listAllProfileSlots:e=>n(`streamBroker`,`listAllProfileSlots`,`query`,e),getBrokerStats:e=>n(`streamBroker`,`getBrokerStats`,`query`,e),probeStream:e=>n(`streamBroker`,`probeStream`,`mutation`,e),listClients:e=>n(`streamBroker`,`listClients`,`query`,e),killClient:e=>n(`streamBroker`,`killClient`,`mutation`,e),getStreamUrl:e=>n(`streamBroker`,`getStreamUrl`,`query`,e),getStreamWithCodec:e=>n(`streamBroker`,`getStreamWithCodec`,`mutation`,e),releaseStreamWithCodec:e=>n(`streamBroker`,`releaseStreamWithCodec`,`mutation`,e),subscribeAudioChunks:e=>n(`streamBroker`,`subscribeAudioChunks`,`mutation`,e),pullAudioChunks:e=>n(`streamBroker`,`pullAudioChunks`,`query`,e),unsubscribeAudioChunks:e=>n(`streamBroker`,`unsubscribeAudioChunks`,`mutation`,e),subscribeFrames:e=>n(`streamBroker`,`subscribeFrames`,`mutation`,e),pullFrameHandles:e=>n(`streamBroker`,`pullFrameHandles`,`query`,e),unsubscribeFrames:e=>n(`streamBroker`,`unsubscribeFrames`,`mutation`,e),setPreBufferDuration:e=>n(`streamBroker`,`setPreBufferDuration`,`mutation`,e),getPreBufferInfo:e=>n(`streamBroker`,`getPreBufferInfo`,`query`,e),getRtspPort:e=>n(`streamBroker`,`getRtspPort`,`query`,e),getAllRtspEntries:e=>n(`streamBroker`,`getAllRtspEntries`,`query`,e),getRtspEntry:e=>n(`streamBroker`,`getRtspEntry`,`query`,e),regenerateRtspToken:e=>n(`streamBroker`,`regenerateRtspToken`,`mutation`,e),setRtspEnabled:e=>n(`streamBroker`,`setRtspEnabled`,`mutation`,e),isRtspEnabled:e=>n(`streamBroker`,`isRtspEnabled`,`query`,e)},system:{info:e=>n(`system`,`info`,`query`,e),health:e=>n(`system`,`health`,`query`,e),featureFlags:e=>n(`system`,`featureFlags`,`query`,e),networkAddresses:e=>n(`system`,`networkAddresses`,`query`,e),getRetentionConfig:e=>n(`system`,`getRetentionConfig`,`query`,e),setRetentionConfig:e=>n(`system`,`setRetentionConfig`,`mutation`,e),forceRetentionCleanup:e=>n(`system`,`forceRetentionCleanup`,`mutation`,e)},toast:{onToast:(e,t)=>n(`toast`,`onToast`,`subscription`,e,t)},turnProvider:{getTurnServers:e=>n(`turnProvider`,`getTurnServers`,`query`,e)},userManagement:{listUsers:e=>n(`userManagement`,`listUsers`,`query`,e),createUser:e=>n(`userManagement`,`createUser`,`mutation`,e),updateUser:e=>n(`userManagement`,`updateUser`,`mutation`,e),deleteUser:e=>n(`userManagement`,`deleteUser`,`mutation`,e),resetPassword:e=>n(`userManagement`,`resetPassword`,`mutation`,e),setUserScopes:e=>n(`userManagement`,`setUserScopes`,`mutation`,e),validateCredentials:e=>n(`userManagement`,`validateCredentials`,`mutation`,e),listApiKeys:e=>n(`userManagement`,`listApiKeys`,`query`,e),createApiKey:e=>n(`userManagement`,`createApiKey`,`mutation`,e),revokeApiKey:e=>n(`userManagement`,`revokeApiKey`,`mutation`,e),validateApiKey:e=>n(`userManagement`,`validateApiKey`,`mutation`,e),createScopedToken:e=>n(`userManagement`,`createScopedToken`,`mutation`,e),revokeScopedToken:e=>n(`userManagement`,`revokeScopedToken`,`mutation`,e),validateScopedToken:e=>n(`userManagement`,`validateScopedToken`,`query`,e),listScopedTokens:e=>n(`userManagement`,`listScopedTokens`,`query`,e),setupTotp:e=>n(`userManagement`,`setupTotp`,`mutation`,e),confirmTotp:e=>n(`userManagement`,`confirmTotp`,`mutation`,e),disableTotp:e=>n(`userManagement`,`disableTotp`,`mutation`,e),getTotpStatus:e=>n(`userManagement`,`getTotpStatus`,`query`,e),verifyTotp:e=>n(`userManagement`,`verifyTotp`,`mutation`,e),oauthIssueCode:e=>n(`userManagement`,`oauthIssueCode`,`mutation`,e),oauthExchangeCode:e=>n(`userManagement`,`oauthExchangeCode`,`mutation`,e),oauthRefresh:e=>n(`userManagement`,`oauthRefresh`,`mutation`,e),oauthVerifyAccessToken:e=>n(`userManagement`,`oauthVerifyAccessToken`,`query`,e),listOauthSessions:e=>n(`userManagement`,`listOauthSessions`,`query`,e),revokeOauthSession:e=>n(`userManagement`,`revokeOauthSession`,`mutation`,e)}}}var Nw=`device.state-changed`,Pw=`capability.binding-changed`,Fw=`device.registered`,Iw=`device.unregistered`,Lw=`device.updated`,Rw=class{api;stateMirror=new Map;bindings=new Map;devices=new Map;handleListeners=new Map;globalStateListeners=new Set;capListeners=new Map;deviceListeners=new Map;addedListeners=new Set;removedListeners=new Set;pendingWaits=new Set;stateSource;bridges=[];initialized=!1;initPromise=null;constructor(e){this.api=e,this.stateSource=Ow(this.stateMirror,this.handleListeners,this.api)}async init(e=15e3){if(!this.initialized){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{let t=(t,n)=>Number.isFinite(e)?new Promise((r,a)=>{let o=setTimeout(()=>a(Error(`SystemMirror.init: '${n}' timed out after ${e}ms`)),e);t.then(e=>{clearTimeout(o),r(e)},e=>{clearTimeout(o),a(e)})}):t,[n,r,a]=await Promise.all([t(this.api.deviceManager.getAllBindings.query({}),`deviceManager.getAllBindings`),t(this.api.deviceState.getAllSnapshots.query({}),`deviceState.getAllSnapshots`),t(this.api.deviceManager.listAll.query({}),`deviceManager.listAll`)]);for(let e of n)this.bindings.set(e.deviceId,e);for(let[e,t]of Object.entries(r)){let n=Number(e);if(!Number.isFinite(n))continue;let r=new Map;for(let[e,n]of Object.entries(t))r.set(e,n);this.stateMirror.set(n,r)}for(let e of a)this.devices.set(e.id,e);try{this.subscribeBus()}catch{}this.initialized=!0})();try{await this.initPromise}finally{this.initPromise=null}}}isReady(){return this.initialized}async awaitReady(){if(!this.initialized)return this.initPromise?this.initPromise:this.init()}dispose(){for(let e of this.bridges)try{e.unsubscribe()}catch{}this.bridges=[],this.handleListeners.clear(),this.globalStateListeners.clear(),this.capListeners.clear(),this.deviceListeners.clear(),this.addedListeners.clear(),this.removedListeners.clear(),this.pendingWaits.clear(),this.initialized=!1}getDeviceById(e){let t=this.bindings.get(e);return t?jw(this.api,t,{stateSource:this.stateSource}):null}getDeviceByName(e){for(let t of this.devices.values())if(t.name===e)return this.getDeviceById(t.id);return null}getDeviceByStableId(e){for(let t of this.devices.values())if(t.stableId===e)return this.getDeviceById(t.id);return null}getDevicesByAddon(e){return this.query({addonId:e})}getDevicesByType(e){return this.query({type:e})}getDeviceInfo(e){return this.devices.get(e)??null}getAllDevices(){let e=[];for(let t of this.bindings.keys()){let n=this.getDeviceById(t);n&&e.push(n)}return e}filterByCap(e){return this.query({caps:e})}query(e={}){let t=[];for(let[n,r]of this.bindings){let a=this.devices.get(n);if(e.id!==void 0&&!zw(n,e.id)||e.stableId!==void 0&&(!a||!zw(a.stableId,e.stableId))||e.addonId!==void 0&&(!a||!zw(a.addonId,e.addonId))||e.type!==void 0&&(!a||!zw(a.type,e.type)))continue;if(e.caps!==void 0){let t=Bw(e.caps),n=new Set(r.entries.map(e=>e.capName));if(!t.every(e=>n.has(e)))continue}if(e.anyCap!==void 0){let t=Bw(e.anyCap),n=new Set(r.entries.map(e=>e.capName));if(!t.some(e=>n.has(e)))continue}if(e.name!==void 0&&(!a||!Vw(a.name,e.name))||e.online!==void 0&&(!a||a.online!==e.online))continue;if(e.parentDeviceId!==void 0){if(!a)continue;let t=e.parentDeviceId;if((a.parentDeviceId??null)!==t)continue}if(e.feature!==void 0&&(!a||!Bw(e.feature).every(e=>a.features.includes(e)))||e.isCamera!==void 0&&(!a||a.isCamera!==e.isCamera))continue;let o=this.getDeviceById(n);if(o){if(e.where&&a){if(!e.where(a,o))continue}else if(e.where&&!a)continue;t.push(o)}}return t}whereState(e,t){let n=[];for(let[r,a]of this.stateMirror){let o=a.get(e);if(!o||!t(o,r))continue;let s=this.getDeviceById(r);s&&n.push(s)}return n}mapState(e,t){let n=[];for(let[r,a]of this.stateMirror){let o=a.get(e);o&&n.push(t(o,r))}return n}findState(e,t){for(let[n,r]of this.stateMirror){let a=r.get(e);if(a&&t(a,n))return this.getDeviceById(n)}return null}countByCap(e){let t=0;for(let n of this.bindings.values())n.entries.some(t=>t.capName===e)&&t++;return t}countByState(e,t){let n=0;for(let[r,a]of this.stateMirror){let o=a.get(e);o&&t(o,r)&&n++}return n}listen(e){return this.globalStateListeners.add(e),()=>{this.globalStateListeners.delete(e)}}listenCap(e,t){let n=this.capListeners.get(e);return n||(n=new Set,this.capListeners.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&this.capListeners.delete(e)}}listenDevice(e,t){let n=this.deviceListeners.get(e);return n||(n=new Set,this.deviceListeners.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&this.deviceListeners.delete(e)}}onDeviceAdded(e){return this.addedListeners.add(e),()=>{this.addedListeners.delete(e)}}onDeviceRemoved(e){return this.removedListeners.add(e),()=>{this.removedListeners.delete(e)}}waitForState(e,t,n,r=3e4){return new Promise((a,o)=>{let s=(()=>{let r=this.stateMirror.get(e)?.get(t);return r&&n(r)?r:null})();if(s){a(s);return}let c=null,l=this.listenDevice(e,(e,r,o)=>{r===t&&o&&n(o)&&(c&&clearTimeout(c),l(),a(o))});Number.isFinite(r)&&(c=setTimeout(()=>{l(),o(Error(`waitForState timed out after ${r}ms (deviceId=${e}, capName=${t})`))},r))})}waitForDevice(e,t=3e4){return new Promise((n,r)=>{let a=this.getDeviceById(e);if(a){n(a);return}let o=null,s=this.onDeviceAdded(t=>{if(t!==e)return;let r=this.getDeviceById(t);r&&(o&&clearTimeout(o),s(),n(r))});Number.isFinite(t)&&(o=setTimeout(()=>{s(),r(Error(`waitForDevice timed out after ${t}ms (deviceId=${e})`))},t))})}async forEachCap(e,t){for(let n of this.filterByCap(e))await t(n)}async invokeCap(e,t,n,r={}){let a=this.filterByCap(e),o=Math.max(1,r.parallelism??a.length),s=[];for(let r=0;r<a.length;r+=o){let c=a.slice(r,r+o),l=await Promise.allSettled(c.map(async r=>{let a=r[e];if(!a||typeof a[t]!=`function`)throw Error(`device '${r.deviceId}' does not expose '${e}.${t}'`);return await a[t](n)}));for(let e=0;e<l.length;e++){let t=c[e],n=l[e];n.status===`fulfilled`?s.push({deviceId:t.deviceId,ok:!0,result:n.value}):s.push({deviceId:t.deviceId,ok:!1,error:n.reason})}}return s}summary(){let e={},t={},n={},r=0,a=0;for(let t of this.bindings.values())for(let n of t.entries)e[n.capName]=(e[n.capName]??0)+1;for(let e of this.devices.values())t[e.addonId]=(t[e.addonId]??0)+1,n[e.type]=(n[e.type]??0)+1,e.online?r++:a++;return{totalDevices:this.bindings.size,online:r,offline:a,byCap:e,byAddon:t,byType:n,statedDevices:this.stateMirror.size}}dump(e){let t=e=>{let t=this.devices.get(e)??null,n=this.bindings.get(e)??null,r={},a=this.stateMirror.get(e);if(a)for(let[e,t]of a)r[e]={...t};return{deviceId:e,info:t,binding:n?{...n,entries:n.entries.map(e=>({...e}))}:null,state:r}};if(e!==void 0)return t(e);let n=[];for(let e of this.bindings.keys())n.push(t(e));return n}getRawMirror(){return this.stateMirror}getSystemState(){let e=new Map;for(let[t,n]of this.stateMirror){let r=new Map;for(let[e,t]of n)r.set(e,{...t});e.set(t,r)}return e}subscribeBus(){if(!this.api.live?.onEvent)return;let e=this.api.live.onEvent;this.bridges.push(e.subscribe({category:Nw},{onData:e=>{let t=e.data;!t||typeof t.deviceId!=`number`||typeof t.capName!=`string`||this.applyStateUpdate(t.deviceId,t.capName,t.slice)}})),this.bridges.push(e.subscribe({category:Pw},{onData:e=>{let t=e.data,n=typeof t?.deviceId==`number`?t.deviceId:t?.source?.type===`device`&&typeof t.source.id==`number`?t.source.id:null;n!==null&&this.refreshBinding(n)}})),this.bridges.push(e.subscribe({category:Fw},{onData:e=>{let t=e.data;typeof t?.deviceId==`number`&&this.refreshDeviceMetadata(t.deviceId,`added`)}})),this.bridges.push(e.subscribe({category:Iw},{onData:e=>{let t=e.data;typeof t?.deviceId==`number`&&this.applyDeviceRemoval(t.deviceId)}})),this.bridges.push(e.subscribe({category:Lw},{onData:e=>{let t=e.data;typeof t?.deviceId==`number`&&this.refreshDeviceMetadata(t.deviceId,`updated`)}}))}applyStateUpdate(e,t,n){let r=this.stateMirror.get(e);r||(r=new Map,this.stateMirror.set(e,r)),n===void 0?r.delete(t):r.set(t,n);let a=`${e}:${t}`,o=this.handleListeners.get(a);if(o)for(let e of o)try{e(n)}catch{}for(let r of this.globalStateListeners)try{r(e,t,n)}catch{}let s=this.capListeners.get(t);if(s)for(let t of s)try{t(e,n)}catch{}let c=this.deviceListeners.get(e);if(c)for(let r of c)try{r(e,t,n)}catch{}}applyDeviceRemoval(e){let t=this.devices.get(e)??null;this.bindings.delete(e),this.devices.delete(e),this.stateMirror.delete(e);for(let n of this.removedListeners)try{n(e,t)}catch{}}async refreshBinding(e){try{let t=(await this.api.deviceManager.getAllBindings.query({})).find(t=>t.deviceId===e);t?this.bindings.set(e,t):this.applyDeviceRemoval(e)}catch{}}async refreshDeviceMetadata(e,t){try{let n=(await this.api.deviceManager.listAll.query({})).find(t=>t.id===e);if(!n)return;let r=!this.devices.has(e);if(this.devices.set(e,n),t===`added`&&r){await this.refreshBinding(e);for(let t of this.addedListeners)try{t(e,n)}catch{}}}catch{}}};function zw(e,t){return Array.isArray(t)?t.includes(e):e===t}function Bw(e){return Array.isArray(e)?e:[e]}function Vw(e,t){return typeof t==`string`?e===t:t instanceof RegExp?t.test(e):`exact`in t?e===t.exact:`contains`in t?e.toLowerCase().includes(t.contains.toLowerCase()):!1}var Hw=U({id:L(),label:L(),icon:L(),order:R().optional()}),Uw=U({id:L(),title:L(),description:L().optional(),style:G([`card`,`accordion`]).optional(),defaultCollapsed:z().optional(),columns:av([K(1),K(2),K(3),K(4)]).optional(),tab:L().optional(),location:G([`settings`,`top-tab`]).optional(),order:R().optional(),fields:H(Y_())}),Ww=U({tabs:H(Hw).optional(),sections:H(Uw)}),Gw=W(L(),B()),Kw=U({success:K(!0)}),qw={name:`addon-settings`,scope:`system`,mode:`singleton`,nodeIdMode:`data`,methods:{getGlobalSettings:J(U({addonId:L(),nodeId:L().optional(),overlay:W(L(),B()).optional(),cap:L().optional()}),Ww.nullable()),updateGlobalSettings:J(U({addonId:L(),nodeId:L().optional(),patch:Gw}),Kw,{kind:`mutation`,auth:`admin`}),getDeviceSettings:J(U({addonId:L(),deviceId:R(),nodeId:L().optional()}),Ww.nullable()),updateDeviceSettings:J(U({addonId:L(),deviceId:R(),nodeId:L().optional(),patch:Gw}),Kw,{kind:`mutation`,auth:`admin`})}},Jw=G([`info`,`success`,`warning`,`error`]),Yw=G([`active`,`in-progress`,`completed`,`failed`,`dismissed`]),Xw=U({type:L(),id:L()}),Zw=U({id:L(),category:L(),severity:Jw,title:L(),message:L(),status:Yw,progress:R().optional(),read:z(),createdAt:R(),updatedAt:R(),source:Xw.optional(),metadata:W(L(),B()).optional()}),Qw={name:`alerts`,scope:`system`,mode:`singleton`,methods:{emit:J(Zw,V(),{kind:`mutation`}),update:J(U({alertId:L(),patch:Zw.partial()}),V(),{kind:`mutation`}),list:J(U({unreadOnly:z().optional(),limit:R().optional()}).optional(),H(Zw).readonly()),getUnreadCount:J(V(),R()),markRead:J(U({alertId:L()}),V(),{kind:`mutation`}),markAllRead:J(V(),V(),{kind:`mutation`}),dismiss:J(U({alertId:L()}),V(),{kind:`mutation`})}},$w=sv(`shouldSaveDiskSpace`,[U({providerId:L().min(1),displayName:L().min(1),configSchema:B(),nodeLocal:z(),shouldSaveDiskSpace:K(!0),minFreePercent:R().min(0).max(100)}),U({providerId:L().min(1),displayName:L().min(1),configSchema:B(),nodeLocal:z(),shouldSaveDiskSpace:K(!1),minFreePercent:K(null)})]),eT={name:`storage`,scope:`system`,mode:`singleton`,methods:{resolve:J(U({location:Dy,relativePath:L()}),L()),write:J(U({location:Dy,relativePath:L(),data:Hv(Uint8Array)}),V(),{kind:`mutation`}),read:J(U({location:Dy,relativePath:L()}),Hv(Uint8Array)),exists:J(U({location:Dy,relativePath:L()}),z()),list:J(U({location:Dy,prefix:L().optional()}),H(L()).readonly()),delete:J(U({location:Dy,relativePath:L()}),V(),{kind:`mutation`}),getAvailableSpace:J(U({location:Dy}),R().nullable()),beginUpload:J(U({location:Dy,relativePath:L(),sizeBytes:R().optional()}),U({uploadId:L()}),{kind:`mutation`}),writeChunk:J(U({uploadId:L(),offset:R(),data:Hv(Uint8Array)}),V(),{kind:`mutation`}),finalizeUpload:J(U({uploadId:L()}),V(),{kind:`mutation`}),abortUpload:J(U({uploadId:L()}),V(),{kind:`mutation`}),beginDownload:J(U({location:Dy,relativePath:L()}),U({downloadId:L(),sizeBytes:R()}),{kind:`mutation`}),readChunk:J(U({downloadId:L(),offset:R(),length:R()}),Hv(Uint8Array)),endDownload:J(U({downloadId:L()}),V(),{kind:`mutation`}),listLocations:J(U({type:Ty.optional()}),H(Ey).readonly()),getDefaultLocation:J(U({type:Ty}),Ey.nullable()),listLocationDeclarations:J(V(),H(Oy).readonly()),upsertLocation:J(Ey.omit({createdAt:!0,updatedAt:!0}),Ey,{kind:`mutation`,auth:`admin`}),deleteLocation:J(U({id:L()}),V(),{kind:`mutation`,auth:`admin`}),testLocation:J(U({id:L()}),U({ok:z(),error:L().optional()}),{auth:`admin`}),listProviders:J(V(),H($w).readonly()),testConfig:J(U({providerId:L(),config:W(L(),B())}),U({ok:z(),error:L().optional()}),{auth:`admin`})}},tT=sv(`shouldSaveDiskSpace`,[U({providerId:L().min(1),displayName:L().min(1),configSchema:B(),nodeLocal:z(),shouldSaveDiskSpace:K(!0),minFreePercent:R().min(0).max(100)}),U({providerId:L().min(1),displayName:L().min(1),configSchema:B(),nodeLocal:z(),shouldSaveDiskSpace:K(!1),minFreePercent:K(null)})]),nT=U({ok:z(),error:L().optional()}),rT=U({location:Ey,relativePath:L(),sizeBytes:R().optional()}),iT=U({uploadId:L()}),aT=U({uploadId:L(),offset:R(),data:Hv(Uint8Array)}),oT=U({uploadId:L()}),sT=U({uploadId:L()}),cT=U({location:Ey,relativePath:L()}),lT=U({downloadId:L(),sizeBytes:R()}),uT=U({downloadId:L(),offset:R(),length:R()}),dT=U({downloadId:L()}),fT={name:`storage-provider`,scope:`system`,mode:`collection`,internal:!0,methods:{getProviderInfo:J(V(),tT),testLocation:J(U({config:W(L(),B())}),nT,{auth:`admin`}),resolve:J(U({location:Ey,relativePath:L()}),L()),write:J(U({location:Ey,relativePath:L(),data:Hv(Uint8Array)}),V(),{kind:`mutation`}),read:J(U({location:Ey,relativePath:L()}),Hv(Uint8Array)),exists:J(U({location:Ey,relativePath:L()}),z()),list:J(U({location:Ey,prefix:L().optional()}),H(L()).readonly()),delete:J(U({location:Ey,relativePath:L()}),V(),{kind:`mutation`}),getAvailableSpace:J(U({location:Ey}),R().nullable()),beginUpload:J(rT,iT,{kind:`mutation`}),writeChunk:J(aT,V(),{kind:`mutation`}),finalizeUpload:J(oT,V(),{kind:`mutation`}),abortUpload:J(sT,V(),{kind:`mutation`}),beginDownload:J(cT,lT,{kind:`mutation`}),readChunk:J(uT,Hv(Uint8Array)),endDownload:J(dT,V(),{kind:`mutation`})}},pT=U({bytes:R().int().nonnegative()}),mT=U({reclaimedBytes:R().int().nonnegative(),exhausted:z()}),hT={name:`storage-evictable`,scope:`system`,mode:`collection`,internal:!0,methods:{getEvictableUsage:J(U({locationId:L()}),pT),evict:J(U({locationId:L(),targetBytes:R().int().positive()}),mT,{kind:`mutation`})}},gT=U({name:L(),path:L()}),_T=U({path:L(),entries:H(gT).readonly(),freeBytes:R(),totalBytes:R()}),vT={name:`filesystem-browse`,scope:`system`,mode:`singleton`,internal:!0,methods:{listAllowedRoots:J(V(),H(L()).readonly(),{auth:`admin`}),browse:J(U({path:L()}),_T,{auth:`admin`}),createDir:J(U({path:L()}),U({path:L()}),{kind:`mutation`,auth:`admin`})}},yT=U({subId:L(),displayName:L(),description:L().optional(),kind:L(),triggerSupported:z(),restoreSupported:z()}).extend({id:L(),addonId:L(),enabled:z(),retentionCount:R(),label:L().optional(),lastSuccessAt:R().optional(),lastSuccessSizeBytes:R().optional(),cron:L().optional(),nextRunAt:R().optional(),lastRunAt:R().optional()}),bT=U({id:L(),filename:L(),createdAt:R(),sizeBytes:R(),label:L().optional(),locations:H(L()).readonly()}),xT=U({id:L(),destinationId:L().optional(),label:L().optional(),createdAt:R(),sizeBytes:R(),locations:H(L()).optional()}),ST=U({path:L(),kind:G([`file`,`dir`,`symlink`]),sizeBytes:R(),mtime:R()}),CT=U({archiveVersion:K(1),createdAt:R(),dataDir:L(),locations:H(L()),entries:H(ST),totalBytes:R(),totalFiles:R()}),wT=U({name:L(),sizeBytes:R(),fileCount:R(),present:z()}),TT={name:`backup`,scope:`system`,mode:`singleton`,methods:{listDestinations:J(V(),H(yT).readonly(),{auth:`admin`}),trigger:J(U({destinations:H(L()).optional(),locations:H(L()).optional(),label:L().optional()}).optional(),H(xT).readonly(),{kind:`mutation`,auth:`admin`}),list:J(V(),H(xT).readonly(),{auth:`admin`}),listLocations:J(V(),H(wT).readonly(),{auth:`admin`}),getEntries:J(U({destinationId:L(),backupId:L()}),CT.nullable(),{auth:`admin`}),restore:J(U({destinationId:L(),backupId:L(),locations:H(L()).optional()}),V(),{kind:`mutation`,auth:`admin`}),delete:J(U({destinationId:L(),backupId:L()}),V(),{kind:`mutation`,auth:`admin`}),listArchives:J(U({destinationId:L()}),H(bT).readonly(),{auth:`admin`}),upsertDestinationPolicy:J(U({locationId:L(),enabled:z(),retentionCount:R().int().min(1).max(1e3),label:L().optional(),cron:L().optional()}),V(),{kind:`mutation`,auth:`admin`}),previewSchedule:J(U({cron:L(),count:R().int().min(1).max(20).optional()}),U({ok:z(),error:L().optional(),nextRuns:H(R()).readonly()}))}},ET=U({where:W(L(),B()).optional(),whereIn:W(L(),H(B())).optional(),whereBetween:W(L(),dv([B(),B()])).optional(),orderBy:U({field:L(),direction:G([`asc`,`desc`])}).optional(),limit:R().optional(),offset:R().optional()}),DT=U({id:L(),data:W(L(),B())}),OT=U({name:L(),type:G([`TEXT`,`INTEGER`,`REAL`,`JSON`,`BOOLEAN`]),primaryKey:z().optional(),notNull:z().optional(),unique:z().optional()}),kT=U({name:L(),columns:H(L()).readonly(),unique:z().optional()}),AT={name:`settings-store`,scope:`system`,mode:`singleton`,methods:{get:J(U({namespace:L().optional(),collection:L(),key:L()}),B()),set:J(U({namespace:L().optional(),collection:L(),key:L(),value:B()}),V(),{kind:`mutation`}),query:J(U({namespace:L().optional(),collection:L(),filter:ET.optional()}),H(DT).readonly()),insert:J(U({namespace:L().optional(),collection:L(),record:DT}),V(),{kind:`mutation`}),update:J(U({namespace:L().optional(),collection:L(),id:L(),data:W(L(),B())}),V(),{kind:`mutation`}),delete:J(U({namespace:L().optional(),collection:L(),key:L()}),V(),{kind:`mutation`}),count:J(U({namespace:L().optional(),collection:L(),filter:ET.optional()}),R()),histogram:J(U({namespace:L().optional(),collection:L(),field:L(),bucketSize:R().int().positive(),origin:R().int(),filter:ET.optional()}),H(U({bucket:R().int(),count:R().int()})).readonly()),isEmpty:J(U({namespace:L().optional(),collection:L()}),z()),declareCollection:J(U({namespace:L().optional(),collection:L(),columns:H(OT).readonly(),indexes:H(kT).readonly().optional()}),V(),{kind:`mutation`})}},jT=G([`debug`,`info`,`warn`,`error`]),MT=U({timestamp:tv(),level:jT,scope:H(L()),message:L(),meta:W(L(),B()).optional(),tags:W(L(),L()).optional()}),NT={name:`log-destination`,scope:`system`,mode:`collection`,internal:!0,methods:{write:J(MT,V(),{kind:`mutation`}),query:J(U({scope:H(L()).optional(),level:jT.optional(),since:tv().optional(),until:tv().optional(),limit:R().optional(),tags:W(L(),L()).optional()}),H(MT).readonly())}},PT=U({staticDir:L()}),FT=U({version:L()}),IT={name:`admin-ui`,scope:`system`,mode:`singleton`,internal:!0,methods:{getStaticDir:J(V(),PT),getVersion:J(V(),FT)}},LT=G([`view`,`create`,`delete`]),RT=av([K(`*`),H(L())]),zT=W(L(),av([K(`*`),H(L())])),BT=G([`device`,`system`]),VT=sv(`type`,[U({type:K(`category`),target:BT,access:H(LT).min(1)}),U({type:K(`capability`),target:L(),access:H(LT).min(1)}),U({type:K(`addon`),target:L(),access:H(LT).min(1)}),U({type:K(`device`),targets:H(L()).min(1),access:H(LT).min(1)})]);U({id:L(),username:L(),passwordHash:L(),isAdmin:z().default(!1),allowedProviders:RT,allowedDevices:zT,scopes:H(VT).default([]),createdAt:R(),updatedAt:R()}),U({id:L(),label:L(),isAdmin:z().default(!1),allowedProviders:RT,allowedDevices:zT,tokenHash:L(),tokenPrefix:L(),createdAt:R(),lastUsedAt:R().optional()}),U({id:L(),userId:L(),name:L(),tokenHash:L(),tokenPrefix:L(),scopes:H(VT),expiresAt:R().nullish(),lastUsedAt:R().nullish(),createdAt:R()});var HT=U({userId:L(),username:L(),isAdmin:z(),provider:L(),email:L().optional(),displayName:L().optional(),hubUrl:L().optional(),scopes:H(VT).optional(),redirectUri:L().optional(),integrationId:L().optional(),jti:L().optional(),sessionId:L().optional()}),UT={name:`sso-bridge`,scope:`system`,mode:`singleton`,internal:!0,methods:{signBridgeToken:J(U({claims:HT,ttlSec:R().int().positive().optional()}),U({token:L()})),verifyBridgeToken:J(U({token:L()}),HT.nullable())}},WT=U({integrationId:L(),displayName:L(),requestedScopes:H(VT),allowedRedirectPrefixes:H(L()).min(1),hubUrl:L().optional()}),GT={name:`oauth-integration`,scope:`system`,mode:`collection`,internal:!0,methods:{getDescriptor:J(V(),WT)}},KT=U({credentialId:L(),label:L(),createdAt:R(),lastUsedAt:R().nullable(),transports:H(L()).default([])}),qT={name:`user-passkeys`,scope:`system`,mode:`collection`,internal:!0,methods:{beginRegistration:J(U({userId:L(),username:L()}),U({optionsJSON:W(L(),B())}),{kind:`mutation`,auth:`admin`,access:`create`}),finishRegistration:J(U({userId:L(),response:W(L(),B()),label:L()}),U({success:K(!0),credentialId:L()}),{kind:`mutation`,auth:`admin`,access:`create`}),beginAuthentication:J(U({userId:L().optional()}),U({optionsJSON:W(L(),B())}),{kind:`mutation`,access:`view`}),finishAuthentication:J(U({userId:L(),response:W(L(),B())}),U({verified:z()}),{kind:`mutation`,access:`view`}),listPasskeys:J(U({userId:L()}),H(KT),{auth:`admin`}),removePasskey:J(U({userId:L(),credentialId:L()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`,access:`delete`})}},JT=S_(),YT=U({to:av([JT,H(JT).min(1)]),cc:H(JT).optional(),bcc:H(JT).optional(),from:L().optional(),replyTo:L().optional(),subject:L(),text:L(),html:L().optional()}),XT=U({messageId:L(),accepted:H(JT).default([]),rejected:H(JT).default([])}),ZT=U({ready:z(),host:L(),error:L().optional(),lastVerifiedAt:R().optional()}),QT={name:`smtp-provider`,scope:`system`,mode:`collection`,internal:!0,providerKind:`email`,methods:{sendEmail:J(YT,XT,{kind:`mutation`,auth:`admin`,access:`create`}),verify:J(V(),ZT,{kind:`mutation`,auth:`admin`,access:`view`}),getStatus:J(V(),ZT,{auth:`admin`})}},$T=U({id:L(),label:L(),isDefault:z().optional()}),eE=U({search:L().optional(),area:L().optional(),manufacturer:L().optional(),adoptedOnly:z().optional(),unadoptedOnly:z().optional()}),tE=U({integrationId:L(),page:R().int().positive().default(1),pageSize:R().int().positive().max(2e4).default(50),filter:L().optional(),filterText:eE.optional()}),nE=U({candidates:H($b).readonly(),totalCount:R().int().nonnegative(),page:R().int().positive(),pageSize:R().int().positive()}),rE=U({integrationId:L(),childNativeId:L()}),iE=U({lastDiscoveryAt:R().int().nonnegative().nullable(),candidateCount:R().int().nonnegative(),adoptedCount:R().int().nonnegative(),lastError:L().nullable()}),aE=U({name:L().min(1).optional(),hiddenChildIds:H(L()).optional()}),oE=U({integrationId:L(),childNativeIds:H(L()).min(1),filter:L().optional(),importLocations:z().optional(),perCandidate:W(L(),aE).optional()}),sE=U({adopted:H(U({childNativeId:L(),parentDeviceId:R().int().nonnegative(),accessoryDeviceIds:H(R().int().nonnegative()).readonly()})).readonly()}),cE=U({integrationId:L(),camDeviceId:R().int().nonnegative()}),lE=U({camDeviceId:R().int().nonnegative()}),uE=U({changed:z(),rebuiltChildren:R().int().nonnegative()}),dE={name:`device-adoption`,scope:`system`,mode:`singleton`,status:{schema:iE,kind:`poll`},methods:{listCandidateFilters:J(U({integrationId:L()}),U({filters:H($T)}),{auth:`admin`}),listCandidates:J(tE,nE,{auth:`admin`}),getCandidate:J(rE,$b.nullable(),{auth:`admin`}),refresh:J(U({integrationId:L()}),iE,{kind:`mutation`,auth:`admin`}),adopt:J(oE,sE,{kind:`mutation`,auth:`admin`}),release:J(cE,V(),{kind:`mutation`,auth:`admin`}),resync:J(lE,uE,{kind:`mutation`,auth:`admin`})}},fE=G([`connected`,`disconnected`,`connecting`,`auth-failed`,`unreachable`,`error`]),pE=U({id:L(),addonId:L(),name:L(),kind:L(),status:fE,info:W(L(),B()),lastCheckedAt:R().nullable(),error:L().nullable()}),mE=U({brokerCount:R().int().nonnegative(),connectedCount:R().int().nonnegative()}),hE=U({addonId:L(),kinds:H(U({kind:L(),label:L()}))}),gE=U({kind:L().optional()}),_E=U({id:L()}),vE=U({kind:L().min(1),name:L().min(1),settings:W(L(),B())}),yE=U({id:L()}),bE=U({id:L()}),xE=sv(`ok`,[U({ok:K(!0),latencyMs:R().nonnegative()}),U({ok:K(!1),error:L()})]),SE=W(L(),B()),CE=U({kind:L()}),wE=U({kind:L(),settings:SE}),TE=sv(`ok`,[U({ok:K(!0),latencyMs:R().nonnegative().optional()}).strict(),U({ok:K(!1),error:L()})]),EE=B().nullable(),DE=U({brokerId:L(),target:W(L(),B()),payload:B().optional()}),OE=U({brokerId:L(),filter:W(L(),B())}),kE=U({subscriptionId:L()}),AE=U({brokerId:L(),subscriptionId:L()}),jE=U({brokerId:L(),key:L()}),ME={name:`broker`,scope:`system`,mode:`collection`,providerKind:`broker`,status:{schema:mE,kind:`poll`},methods:{list:J(gE,H(pE)),get:J(_E,pE.nullable()),listProviders:J(V(),H(hE),{auth:`admin`}),add:J(vE,yE,{kind:`mutation`,auth:`admin`}),remove:J(bE,V(),{kind:`mutation`,auth:`admin`}),testConnection:J(_E,xE,{kind:`mutation`,auth:`admin`}),getSettings:J(_E,SE.nullable(),{auth:`admin`}),setSettings:J(U({id:L(),settings:SE}),V(),{kind:`mutation`,auth:`admin`}),getBrokerConfig:J(_E,SE.nullable(),{auth:`admin`}),getSettingsSchema:J(CE,EE,{auth:`admin`}),testSettings:J(wE,TE,{kind:`mutation`,auth:`admin`}),publish:J(DE,B(),{kind:`mutation`,auth:`admin`}),subscribe:J(OE,kE,{kind:`mutation`,auth:`admin`}),unsubscribe:J(AE,V(),{kind:`mutation`,auth:`admin`}),getState:J(jE,B().nullable()),getStatus:J(V(),mE)}},NE=G([`external`,`embedded`]),PE=G([`connected`,`disconnected`,`auth-failed`,`unreachable`,`tls-error`]),FE=U({id:L(),name:L(),url:L(),kind:NE,status:PE,latencyMs:R().nullable(),error:L().optional(),connectedClients:R().int().nonnegative().optional(),lastCheckedAt:R().optional()}),IE=U({url:L(),username:L().optional(),password:L().optional(),clientIdPrefix:L().optional()}),LE=U({name:L().min(1),url:L().regex(/^(mqtt|mqtts|ws|wss):\/\//,`URL must start with mqtt(s):// or ws(s)://`),username:L().optional(),password:L().optional(),clientIdPrefix:L().optional()}),RE=U({id:L()}),zE=U({id:L()}),BE=sv(`ok`,[U({ok:K(!0),latencyMs:R()}),U({ok:K(!1),error:L()})]),VE=U({port:R().int().min(1).max(65535).default(1883),allowAnonymous:z().default(!1),username:L().optional(),password:L().optional()}),HE=U({id:L(),url:L()}),UE=U({brokerCount:R(),embeddedRunning:z()}),WE={name:`mqtt-broker`,scope:`system`,mode:`collection`,providerKind:`broker`,status:{schema:UE,kind:`poll`},methods:{listBrokers:J(V(),H(FE)),getBrokerConfig:J(zE,IE),addBroker:J(LE,RE,{kind:`mutation`}),removeBroker:J(zE,V(),{kind:`mutation`}),testConnection:J(zE,BE,{kind:`mutation`}),startEmbeddedBroker:J(VE,HE,{kind:`mutation`}),stopEmbeddedBroker:J(zE,V(),{kind:`mutation`}),getStatus:J(V(),UE)}},GE=G([`unlinked`,`linked`,`error`]),KE=U({label:L(),value:L(),secret:z().optional()}),qE=U({qr:L().optional(),fields:H(KE).readonly().optional(),note:L().optional()}),JE=U({linkState:GE,exposedDeviceCount:R(),error:L().optional(),setup:qE.optional()}),YE=L(),XE=U({deviceId:L(),exposedAs:L().optional(),capabilities:H(L()).optional()}),ZE=U({deviceId:L(),capabilities:H(L()).optional()}),QE=U({deviceId:L()}),$E={name:`device-export`,scope:`system`,mode:`collection`,providerKind:`device-export`,status:{schema:JE,kind:`poll`},exposesDeviceSettings:!0,methods:{getStatus:J(V(),JE),listSupportedDeviceKinds:J(V(),H(YE)),listExposedDevices:J(V(),H(XE)),exposeDevice:J(ZE,V(),{kind:`mutation`}),unexposeDevice:J(QE,V(),{kind:`mutation`})}},eD=U({id:L(),label:L(),icon:L(),path:L(),remoteName:L(),bundle:L()}),tD=U({addonId:L(),page:eD,bundleUrl:L()}),nD={name:`addon-pages`,scope:`system`,mode:`singleton`,methods:{listPages:J(V(),H(tD).readonly())}},rD=U({id:L(),label:L(),icon:L(),path:L(),remoteName:L(),bundle:L()}),iD={name:`addon-pages-source`,scope:`system`,mode:`collection`,internal:!0,methods:{listPages:J(V(),H(rD).readonly())}},aD=G([`device-tab`,`dashboard`,`integration-detail`]),oD=G([`xs`,`sm`,`md`,`lg`,`xl`]),sD=U({remoteName:L(),exposedModule:L(),componentKey:L().optional()}),cD=U({tab:L(),subTab:L().optional(),label:L(),order:R().optional(),kind:K(`remote`),remote:sD,stableId:L(),description:L().optional(),icon:L().optional(),bundle:L(),hosts:H(aD).readonly(),requires:U({deviceContext:z().default(!1),integrationContext:z().default(!1)}),defaultSize:oD.default(`md`),allowedSizes:H(oD).readonly().default([`sm`,`md`,`lg`]),defaultColumns:R().int().min(1).max(12).default(6),defaultRows:R().int().min(1).max(12).default(1)}),lD={name:`addon-widgets-source`,scope:`system`,mode:`collection`,internal:!0,methods:{listWidgets:J(V(),H(cD).readonly())}},uD=cD.extend({addonId:L(),bundleUrl:L()}),dD={name:`addon-widgets`,scope:`system`,mode:`singleton`,methods:{listWidgets:J(V(),H(uD).readonly())}},fD=U({method:G([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`]),path:L(),access:G([`public`,`authenticated`,`admin`]).optional(),description:L().optional()}),pD=U({method:L(),path:L(),params:W(L(),L()),query:W(L(),L()),body:B(),headers:W(L(),L()),user:U({id:L(),username:L(),isAdmin:z()}).optional(),scopedToken:B().optional()}),mD=U({status:R().int(),headers:W(L(),L()),redirectUrl:L().nullable(),body:B().optional(),contentType:L().optional()}),hD={name:`addon-routes`,scope:`system`,mode:`collection`,internal:!0,methods:{getRoutes:J(V(),H(fD)),invoke:J(pD,mD,{kind:`mutation`})}},gD=U({sessionId:L(),slotCount:R().int(),slotByteLength:R().int(),segmentBytes:R().int(),budgetMb:R().int(),framesWritten:R().int(),getFrameHits:R().int(),getFrameMisses:R().int()}),_D={name:`decoder`,scope:`system`,mode:`singleton`,methods:{supportsCodec:J(U({codec:L()}),z()),getInfo:J(V(),U({id:L(),name:L(),isPullMode:z().optional(),priority:R().optional()})),createSession:J(Ay,U({sessionId:L(),nodeId:L()})),destroySession:J(U({sessionId:L()}),V()),pushPacket:J(U({sessionId:L(),packet:ny}),V()),openStream:J(U({sessionId:L(),url:L()}),V()),pullFrames:J(U({sessionId:L(),maxCount:R().default(1)}),H(ry)),pullHandles:J(U({sessionId:L(),maxCount:R().default(1)}),H(iy)),getFrame:J(U({handle:iy}),ry.nullable()),getShmStats:J(U({sessionId:L()}),gD.nullable()),updateConfig:J(U({sessionId:L(),config:Ay.partial()}),V()),getStats:J(U({sessionId:L()}),ky),listActiveSessions:J(V(),H(U({sessionId:L(),codec:L(),outputFormat:L(),createdAtMs:R()})).readonly()),reprobeHwaccel:J(V(),U({backend:L()}),{kind:`mutation`,auth:`admin`})}},vD=U({streamId:L(),label:L().optional(),codec:L(),type:G([`video`,`audio`]),sourceUrl:L()}),yD=U({streamId:L(),format:L(),value:L()}),bD={name:`restreamer`,scope:`system`,mode:`collection`,internal:!0,methods:{registerDevice:J(U({deviceId:R(),streams:H(vD).readonly()}),V(),{kind:`mutation`}),unregisterDevice:J(U({deviceId:R()}),V(),{kind:`mutation`}),getExposedResources:J(U({deviceId:R()}),H(yD).readonly())}},xD=U({viewportWidth:R().int().positive().optional(),viewportHeight:R().int().positive().optional(),devicePixelRatio:R().positive().optional(),downlinkMbps:R().nonnegative().optional(),prefersTier:L().optional()}).partial(),SD={name:`webrtc`,scope:`system`,mode:`collection`,internal:!0,methods:{handleOffer:J(U({streamId:L(),sdpOffer:L()}),L(),{kind:`mutation`}),supportsStream:J(U({streamId:L()}),z()),registerStream:J(U({streamId:L(),codec:L()}),V(),{kind:`mutation`}),unregisterStream:J(U({streamId:L()}),V(),{kind:`mutation`}),createSession:J(U({streamId:L(),hints:xD.optional()}),U({sessionId:L(),sdpOffer:L()}),{kind:`mutation`}),handleAnswer:J(U({sessionId:L(),sdpAnswer:L()}),V(),{kind:`mutation`}),closeSession:J(U({sessionId:L()}),V(),{kind:`mutation`}),hasAdaptiveBitrate:J(U({streamId:L()}),z())}},CD=sv(`kind`,[U({kind:K(`adaptive`)}),U({kind:K(`profile`),profile:Yv}),U({kind:K(`cam-stream`),camStreamId:L().min(1)})]),wD=U({id:L(),label:L(),target:CD,codec:L().nullable(),resolution:U({width:R(),height:R()}).nullable(),status:G([`idle`,`connecting`,`streaming`,`error`,`stopped`]).nullable(),inputFps:R().nullable(),decodeFps:R().nullable(),bitrateKbps:R().nullable()}),TD={name:`webrtc-session`,scope:`device`,mode:`singleton`,kind:`wrapper`,defaultActive:!0,preferredProvider:`stream-broker`,deviceTypes:[q.Camera],methods:{listStreams:J(U({deviceId:R().int().nonnegative()}),H(wD)),createSession:J(U({deviceId:R().int().nonnegative(),target:CD,hints:xD.optional(),relayOnly:z().optional(),consumerAttribution:_b.optional()}),U({sessionId:L(),sdpOffer:L()}),{kind:`mutation`}),handleOffer:J(U({deviceId:R().int().nonnegative(),target:CD.optional(),sdpOffer:L(),sessionId:L().optional(),relayOnly:z().optional(),nonTrickle:z().optional(),disableTurn:z().optional(),disableIpv6:z().optional(),consumerAttribution:_b.optional()}),U({sessionId:L(),sdpAnswer:L()}),{kind:`mutation`}),handleAnswer:J(U({deviceId:R().int().nonnegative(),sessionId:L(),sdpAnswer:L()}),V(),{kind:`mutation`}),addIceCandidate:J(U({deviceId:R().int().nonnegative(),sessionId:L(),candidate:L(),sdpMid:L().nullable().optional(),sdpMLineIndex:R().int().nullable().optional()}),V(),{kind:`mutation`}),getIceCandidates:J(U({deviceId:R().int().nonnegative(),sessionId:L()}),U({candidates:H(U({candidate:L(),sdpMid:L().nullable(),sdpMLineIndex:R().int().nullable()})),done:z()}),{kind:`query`}),closeSession:J(U({deviceId:R().int().nonnegative(),sessionId:L()}),V(),{kind:`mutation`}),hasAdaptiveBitrate:J(U({deviceId:R().int().nonnegative(),profile:Yv}),z()),getSessionState:J(U({deviceId:R().int().nonnegative(),sessionId:L()}),U({pendingRenegotiation:U({target:CD,epoch:R()}).nullable()}))}},ED=U({id:L(),source:L(),kind:G([`motion`,`object`,`audio`,`native`]),timeRange:U({startMs:R(),endMs:R()}),thumbnail:L().optional()}),DD=U({playbackUrl:L(),playbackEndpoints:H(L()).optional(),token:L().optional()}),OD={name:`videoclips`,scope:`device`,mode:`singleton`,kind:`wrapper`,defaultActive:!0,methods:{listClips:J(U({deviceId:R(),since:R(),until:R(),limit:R().int().positive().optional()}),H(ED).readonly(),{kind:`query`,auth:`admin`}),getClipPlayback:J(U({deviceId:R(),clipId:L()}),DD,{kind:`query`,auth:`admin`})}},kD=U({engine:qx,steps:H(iS).readonly(),audio:U({engine:qx,modelId:L(),enabled:z(),settings:W(L(),B()).readonly().optional()}).nullable().optional()}),AD=U({id:L(),name:L(),description:L().optional(),config:kD,createdAt:L(),updatedAt:L()}),jD=U({enabled:z(),modelId:L(),settings:W(L(),B()).readonly()}),MD=U({addonDefaults:W(L(),jD).readonly()}),ND=U({steps:H(iS).readonly(),audio:U({modelId:L(),enabled:z()}).nullable()}),PD=U({enabled:z().optional(),modelId:L().optional(),settings:W(L(),B()).readonly().optional()}),FD=U({pinnedAgentNodeId:L().optional(),stepToggles:W(L(),z()).optional(),stepOverridesByAgent:W(L(),W(L(),PD)).optional(),pipelineByAgent:W(L(),ND).optional()}),ID=U({deviceId:R(),agentNodeId:L(),pinned:z(),reason:G([`manual`,`capacity`,`hardware-affinity`,`failover`,`rebalance`]),assignedAt:R()}),LD=U({deviceId:R(),decoderNodeId:L(),pinned:z(),reason:G([`manual`,`co-located`,`capacity`,`hardware-affinity`])}),RD=U({nodeId:L(),online:z(),load:NS,score:R()}),zD=U({totalAgents:R(),onlineAgents:R(),totalCameras:R(),attachedCameras:R(),activeCameras:R(),avgInferenceTimeMs:R(),queueDepth:R()}),BD=W(L(),L()),VD={name:`pipeline-orchestrator`,scope:`system`,mode:`singleton`,exposesDeviceSettings:!0,methods:{assignPipeline:J(U({deviceId:R(),agentNodeId:L()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),unassignPipeline:J(U({deviceId:R()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),rebalance:J(V(),U({migrated:R()}),{kind:`mutation`,auth:`admin`}),getPipelineAssignments:J(V(),H(ID).readonly()),getPipelineAssignment:J(U({deviceId:R()}),ID.nullable()),getAgentLoad:J(V(),H(RD).readonly()),getGlobalMetrics:J(V(),zD),getCameraMetrics:J(U({deviceId:R()}),Ux.nullable()),getCapabilityBindings:J(U({nodeId:L()}),BD),setCapabilityBinding:J(U({nodeId:L(),capName:L(),addonId:L()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),assignDecoder:J(U({deviceId:R(),nodeId:L()}),V(),{kind:`mutation`,auth:`admin`}),unassignDecoder:J(U({deviceId:R()}),V(),{kind:`mutation`,auth:`admin`}),getDecoderAssignments:J(V(),H(LD).readonly()),assignAudio:J(U({deviceId:R(),nodeId:L()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),unassignAudio:J(U({deviceId:R()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),getAudioAssignment:J(U({deviceId:R()}),U({nodeId:L(),pinned:z(),assignedAt:R()}).nullable()),getAudioNodeLoad:J(V(),H(U({nodeId:L(),deviceCount:R()}))),getAudioAssignments:J(V(),H(U({deviceId:R(),nodeId:L(),pinned:z(),assignedAt:R()}))),getDecoderAssignment:J(U({deviceId:R(),pipelineNodeId:L().optional()}),LD),getAgentSettings:J(U({agentNodeId:L()}),MD.nullable()),listAgentSettings:J(V(),H(U({nodeId:L(),settings:MD})).readonly()),setAgentAddonDefaults:J(U({agentNodeId:L(),defaults:W(L(),jD)}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),removeAgentSettings:J(U({agentNodeId:L()}),U({success:z(),removed:z()}),{kind:`mutation`,auth:`admin`}),getCameraSettings:J(U({deviceId:R()}),FD.nullable()),setCameraStepToggle:J(U({deviceId:R(),addonId:L(),enabled:z().nullable()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),getCameraStepOverrides:J(U({deviceId:R()}),W(L(),W(L(),PD)).nullable()),setCameraStepOverride:J(U({deviceId:R(),agentNodeId:L(),addonId:L(),patch:PD.nullable()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),setCameraPipelineForAgent:J(U({deviceId:R(),agentNodeId:L(),pipeline:ND.nullable()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),resolvePipeline:J(U({deviceId:R(),agentNodeId:L().optional()}),kD),listTemplates:J(V(),H(AD).readonly()),saveTemplate:J(U({name:L(),description:L().optional(),config:kD}),AD,{kind:`mutation`,auth:`admin`}),updateTemplate:J(U({id:L(),name:L().optional(),description:L().optional(),config:kD.optional()}),AD,{kind:`mutation`,auth:`admin`}),deleteTemplate:J(U({id:L()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`})}},HD=U({level:Rx,classification:U({labels:H(zx).readonly(),inferenceMs:R()}).optional(),timestamp:R()}),UD=U({minConfidence:R().min(0).max(1).default(.3),allowedClasses:H(L()).default([])}),WD=U({labels:H(zx).readonly(),rawLabels:H(zx).readonly().optional(),inferenceMs:R()}),GD={name:`audio-analyzer`,scope:`system`,mode:`singleton`,methods:{analyseChunk:J(U({chunk:Lx,settings:UD}),HD.nullable(),{kind:`mutation`}),classify:J(Lx,WD,{timeoutMs:3e4}),isReady:J(V(),z()),dispose:J(V(),V(),{kind:`mutation`}),reprobeAudioEngine:J(V(),U({backend:L()}),{kind:`mutation`,auth:`admin`})}},KD={name:`audio-analysis`,scope:`device`,mode:`singleton`,kind:`wrapper`,defaultActive:!0,deviceTypes:[q.Camera],exposesDeviceSettings:!0,methods:{resolveDeviceSettings:J(U({deviceId:R()}),zv())},events:{onAudioLevel:Gy(U({deviceId:R(),rms:R(),dbfs:R()}))}},qD=G([`f32le`,`s16le`]),JD=U({codec:L(),canDecode:z(),canEncode:z(),label:L().optional()}),YD=U({codec:L(),sourceSampleRate:R().int().positive(),sourceChannels:R().int().positive(),extraData:Hv(Uint8Array).optional(),targetSampleRate:R().int().positive(),targetChannels:R().int().positive(),targetFormat:qD.optional(),idleMs:R().int().positive().optional(),tag:L().optional()}),XD=U({codec:L(),sourceSampleRate:R().int().positive(),sourceChannels:R().int().positive(),sourceFormat:qD.optional(),targetSampleRate:R().int().positive(),targetChannels:R().int().positive(),bitrateKbps:R().int().positive().optional(),idleMs:R().int().positive().optional(),tag:L().optional()}),ZD=U({data:Hv(Uint8Array),sampleRate:R().int().positive(),channels:R().int().positive(),format:qD,pts:R()}),QD=U({data:Hv(Uint8Array),codec:L(),pts:R(),frameComplete:z()}),$D=U({sessionId:L(),kind:G([`decode`,`encode`]),codec:L(),sourceSampleRate:R(),sourceChannels:R(),targetSampleRate:R(),targetChannels:R(),format:qD,tag:L().optional(),createdAtMs:R(),lastActivityMs:R(),framesIn:R(),framesOut:R()}),eO={name:`audio-codec`,scope:`system`,mode:`singleton`,methods:{listSupportedCodecs:J(V(),H(JD).readonly()),canHandle:J(U({codec:L(),kind:G([`decode`,`encode`])}),z()),createDecodeSession:J(YD,U({sessionId:L(),nodeId:L()}),{kind:`mutation`}),createEncodeSession:J(XD,U({sessionId:L(),nodeId:L()}),{kind:`mutation`}),closeSession:J(U({sessionId:L(),nodeId:L().optional()}),V(),{kind:`mutation`}),pushEncodedFrame:J(U({sessionId:L(),nodeId:L().optional(),data:Hv(Uint8Array),pts:R().optional()}),V(),{kind:`mutation`}),pullPcm:J(U({sessionId:L(),nodeId:L().optional(),maxCount:R().int().positive().default(8)}),H(ZD)),pushPcm:J(U({sessionId:L(),nodeId:L().optional(),data:Hv(Uint8Array),pts:R().optional()}),V(),{kind:`mutation`}),pullEncoded:J(U({sessionId:L(),nodeId:L().optional(),maxCount:R().int().positive().default(8)}),H(QD)),flushEncode:J(U({sessionId:L(),nodeId:L().optional()}),H(QD),{kind:`mutation`}),listActiveSessions:J(V(),H($D).readonly())}},tO=U({embedding:H(R()),inferenceMs:R()}),nO=U({modelId:L(),embeddingDim:R(),ready:z()}),rO={name:`embedding-encoder`,scope:`system`,mode:`collection`,internal:!0,methods:{encode:J(U({crop:Hv(Uint8Array),width:R(),height:R()}),tO),encodeText:J(U({text:L()}),tO),getInfo:J(V(),nO)}},iO=U({childKey:L(),section:L(),order:R().optional(),collapsed:z().optional()}),aO=U({id:L(),source:U({sourceKey:L(),cap:L(),fieldPath:L()}),target:U({cap:L(),fieldPath:L(),itemKey:L().optional()}),transform:sv(`kind`,[U({kind:K(`identity`)}),U({kind:K(`enum-map`),mapping:W(L(),av([L(),R(),z()])),fallback:av([L(),R(),z()]).optional()}),U({kind:K(`linear`),scale:R(),offset:R(),clamp:dv([R(),R()]).readonly().optional()})]).optional()}),oO=U({id:R(),stableId:L(),addonId:L(),type:G(q),name:L(),location:L().nullable(),disabled:z(),parentDeviceId:R().nullable(),role:L().nullable().optional(),online:z(),probed:z().optional(),features:H(L()),isCamera:z(),config:W(L(),B()),metadata:W(L(),B()).nullable().optional(),sourceInfo:Zb.optional(),integrationId:L().optional(),linkDeviceId:R().nullable().optional(),primaryChildEntityId:L().nullable().optional(),childLayout:H(iO).readonly().optional(),deviceLinks:H(aO).readonly().optional()}),sO=U({key:L(),value:B(),description:L().optional()}),cO=U({id:R(),stableId:L(),type:L(),name:L(),location:L().nullable(),disabled:z(),parentDeviceId:R().nullable(),role:L().nullable().optional()}),lO=U({id:R(),stableId:L(),addonId:L(),type:L(),name:L(),location:L().nullable(),disabled:z(),parentDeviceId:R().nullable(),metadata:W(L(),B()).nullable().optional(),sourceInfo:Zb.optional(),integrationId:L().optional(),linkDeviceId:R().nullable().optional(),primaryChildEntityId:L().nullable().optional(),childLayout:H(iO).readonly().optional(),deviceLinks:H(aO).readonly().optional(),role:L().nullable().optional()}),uO=B().nullable(),dO=U({streamId:L(),width:R().optional(),height:R().optional(),codec:L().optional(),fps:R().optional(),bitrateKbps:R().optional()}),fO=U({addonId:L(),stableId:L(),id:R(),type:L(),name:L(),location:L().nullable().optional(),disabled:z().optional(),parentDeviceId:R().nullable(),role:L().nullable().optional(),features:H(L()).optional(),config:W(L(),B())}),pO=U({deviceId:R()}),mO=U({deviceId:R(),data:W(L(),B())}),hO={name:`device-manager`,scope:`system`,mode:`singleton`,methods:{allocateDeviceId:J(U({addonId:L(),stableId:L()}),U({id:R()}),{kind:`mutation`}),registerDevice:J(fO,V(),{kind:`mutation`}),removeDevice:J(pO,V(),{kind:`mutation`}),persistConfig:J(mO,V(),{kind:`mutation`}),loadConfig:J(U({deviceId:R()}),W(L(),B())),loadRuntimeState:J(U({deviceId:R()}),W(L(),B())),loadMeta:J(U({deviceId:R()}),lO.nullable()),setName:J(U({deviceId:R(),name:L()}),V(),{kind:`mutation`,auth:`admin`}),setLocation:J(U({deviceId:R(),location:L().nullable()}),V(),{kind:`mutation`,auth:`admin`}),setType:J(U({deviceId:R(),type:G(q)}),V(),{kind:`mutation`,auth:`admin`}),setIntegrationId:J(U({deviceId:R(),integrationId:L()}),V(),{kind:`mutation`,auth:`admin`}),setLinkDeviceId:J(U({deviceId:R(),linkDeviceId:R().nullable()}),V(),{kind:`mutation`,auth:`admin`}),setPrimaryChildEntityId:J(U({deviceId:R(),primaryChildEntityId:L().nullable()}),V(),{kind:`mutation`,auth:`admin`}),setChildLayout:J(U({deviceId:R(),childLayout:H(iO).readonly()}),V(),{kind:`mutation`,auth:`admin`}),setDeviceLinks:J(U({deviceId:R(),deviceLinks:H(aO).readonly()}),V(),{kind:`mutation`,auth:`admin`}),getWireableFields:J(U({deviceId:R()}),U({caps:H(U({cap:L(),fields:H(U({path:L(),kind:G([`string`,`number`,`boolean`,`enum`]),enumValues:H(L()).optional()})).readonly()})).readonly()}),{kind:`query`}),setRole:J(U({deviceId:R(),role:L().nullable()}),V(),{kind:`mutation`,auth:`admin`}),applyInitialMeta:J(U({deviceId:R(),name:L().optional(),location:L().nullable().optional(),type:G(q).optional(),integrationId:L().optional(),linkDeviceId:R().nullable().optional(),role:L().nullable().optional()}),V(),{kind:`mutation`,auth:`admin`}),setMetadata:J(U({deviceId:R(),patch:W(L(),B())}),V(),{kind:`mutation`,auth:`admin`}),listLocations:J(V(),H(L())),addLocation:J(U({name:L()}),V(),{kind:`mutation`,auth:`admin`}),removeLocation:J(U({name:L(),cascade:z().optional()}),V(),{kind:`mutation`,auth:`admin`}),setDisabled:J(U({deviceId:R(),disabled:z()}),V(),{kind:`mutation`,auth:`admin`}),listPersistedByAddon:J(U({addonId:L()}),H(cO)),listAll:J(U({addonId:L().optional()}),H(oO)),getDevice:J(U({deviceId:R()}),oO.nullable()),getChildren:J(U({parentDeviceId:R()}),H(oO)),getStreamSources:J(U({deviceId:R()}),H(ty)),getConfigSchema:J(U({deviceId:R()}),H(sO)),getSettingsSchema:J(U({deviceId:R()}),uO),updateConfig:J(U({deviceId:R(),values:W(L(),B())}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),enable:J(U({deviceId:R()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),disable:J(U({deviceId:R()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),remove:J(U({deviceId:R()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),removeByIntegration:J(U({integrationId:L()}),U({removed:R()}),{kind:`mutation`,auth:`admin`}),getStreamProfileMap:J(U({deviceId:R()}),W(L(),L().nullable())),setStreamProfileMap:J(U({deviceId:R(),profileMap:W(L(),L().nullable())}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),probeStreams:J(U({deviceId:R()}),H(dO),{kind:`mutation`,auth:`admin`}),getBindings:J(U({deviceId:R()}),U({deviceId:R(),entries:H(U({capName:L(),kind:G([`native`,`wrapped`]),providerAddonId:L(),providerNodeId:L(),nativeAddonId:L()}))})),getAllBindings:J(U({}),H(U({deviceId:R(),entries:H(U({capName:L(),kind:G([`native`,`wrapped`]),providerAddonId:L(),providerNodeId:L(),nativeAddonId:L()}))}))),setWrapperActive:J(U({deviceId:R(),capName:L(),wrapperAddonId:L(),active:z()}),V(),{kind:`mutation`,auth:`admin`}),listWrappersForCap:J(U({capName:L()}),H(L())),listBindableCapsForDeviceType:J(U({deviceType:L()}),H(U({capName:L(),wrappers:H(L())}))),getDeviceSettingsAggregate:J(U({deviceId:R()}),Ww.nullable()),getDeviceLiveInfoAggregate:J(U({deviceId:R()}),Ww.nullable()),getDeviceAggregate:J(U({deviceId:R()}),U({settings:Ww.nullable(),live:Ww.nullable()})),runDeviceAction:J(U({deviceId:R().int().nonnegative(),action:L().min(1),input:B()}),B(),{kind:`mutation`}),updateDeviceField:J(U({deviceId:R(),writerCapName:L(),writerAddonId:L(),key:L(),value:B()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),updateDeviceFieldsBatch:J(U({deviceId:R(),changes:H(U({writerCapName:L(),writerAddonId:L(),key:L(),value:B()}))}),U({success:K(!0),failures:H(U({writerCapName:L(),writerAddonId:L(),error:L()}))}),{kind:`mutation`,auth:`admin`}),discoverDevices:J(U({addonId:L()}),H(xw),{kind:`mutation`,auth:`admin`}),adoptDevice:J(U({addonId:L(),candidate:xw,integrationId:L().optional()}),Sw,{kind:`mutation`,auth:`admin`}),getCreationSchema:J(U({addonId:L(),type:G(q)}),B().nullable()),createDevice:J(U({addonId:L(),type:G(q),config:W(L(),B()),integrationId:L().optional()}),Sw,{kind:`mutation`,auth:`admin`}),testCreationField:J(U({addonId:L(),type:G(q),key:L(),value:B(),formValues:W(L(),B()).optional()}),Cw,{kind:`mutation`,auth:`admin`}),adoptionListCandidates:J(tE.extend({addonId:L()}),nE,{auth:`admin`}),adoptionRefresh:J(U({addonId:L(),integrationId:L()}),iE,{kind:`mutation`,auth:`admin`}),adoptionAdopt:J(oE.extend({addonId:L()}),sE,{kind:`mutation`,auth:`admin`}),adoptionRelease:J(cE.extend({addonId:L()}),V(),{kind:`mutation`,auth:`admin`}),testField:J(U({deviceId:R(),key:L(),value:B()}),Cw,{kind:`mutation`,auth:`admin`}),getDeviceStatusAggregate:J(U({deviceId:R(),caps:H(L()).readonly().optional()}),W(L(),B().nullable()))}},gO={name:`device-state`,scope:`system`,mode:`singleton`,methods:{getSnapshot:J(U({deviceId:R()}),W(L(),W(L(),B()))),getCapSlice:J(U({deviceId:R(),capName:L()}),W(L(),B()).nullable()),getAllSnapshots:J(U({}),W(L(),W(L(),W(L(),B())))),setCapSlice:J(U({deviceId:R(),capName:L(),slice:W(L(),B())}),V(),{kind:`mutation`})},events:{onChanged:Gy(U({deviceId:R(),capName:L(),slice:W(L(),B())}))}},_O=U({userId:L(),username:L(),email:L().optional(),displayName:L().optional(),isAdmin:z().default(!1)}),vO={name:`auth-provider`,scope:`system`,mode:`collection`,internal:!0,methods:{validateCredentials:J(U({username:L(),password:L()}),_O.nullable(),{kind:`mutation`}),getLoginUrl:J(U({state:L()}),L()),handleCallback:J(W(L(),L()),_O,{kind:`mutation`}),validateToken:J(U({token:L()}),_O.nullable())}},yO=U({url:L(),hostname:L(),port:R(),protocol:G([`http`,`https`])}),bO=U({connected:z(),endpoint:yO.nullable(),error:L().optional()}),xO=yO.extend({id:L(),label:L(),mode:L().optional(),sourcePort:R().optional()}),SO={name:`network-access`,scope:`system`,mode:`collection`,providerKind:`ingress`,methods:{start:J(V(),yO,{kind:`mutation`}),stop:J(V(),V(),{kind:`mutation`}),getEndpoint:J(V(),yO.nullable()),getStatus:J(V(),bO),listEndpoints:J(V(),H(xO).readonly())}},CO=U({urls:av([L(),H(L())]),username:L().optional(),credential:L().optional()}),wO={name:`turn-provider`,scope:`system`,mode:`collection`,methods:{getTurnServers:J(V(),H(CO).readonly())}},TO=U({base64:L(),contentType:L()}),EO=U({lastCapturedAt:R().nullable(),cacheAgeMs:R().nullable(),lastBytes:R().nullable(),lastStreamId:L().nullable()}),DO={name:`snapshot`,scope:`device`,deviceNative:!0,mode:`singleton`,kind:`wrapper`,defaultActive:!0,deviceTypes:[q.Camera],exposesDeviceSettings:!0,methods:{getSnapshot:J(U({deviceId:R(),streamId:L().optional(),force:z().optional()}),TO.nullable()),invalidateCache:J(U({deviceId:R()}),V(),{kind:`mutation`,auth:`admin`})},status:{schema:EO,kind:`poll`}},OO={name:`snapshot-provider`,scope:`system`,mode:`collection`,methods:{supportsDevice:J(U({deviceId:R()}),z()),getSnapshot:J(U({deviceId:R(),streamId:L().optional()}),TO.nullable())}},kO={name:`notification-output`,scope:`system`,mode:`collection`,methods:{send:J(U({title:L(),body:L(),imageUrl:L().optional(),deviceId:R().optional(),eventId:L().optional(),priority:G([`low`,`normal`,`high`,`critical`]).default(`normal`),metadata:W(L(),B()).optional()}),V(),{kind:`mutation`}),sendTest:J(V(),U({success:z(),error:L().optional()}),{kind:`mutation`})}},AO=U({deviceIds:H(R()).readonly().optional(),classNames:H(L()).readonly().optional(),zoneIds:H(L()).readonly().optional(),minConfidence:R().optional(),source:G([`pipeline`,`onboard`,`any`]).optional(),schedule:U({days:H(R()).readonly(),startHour:R(),endHour:R()}).optional(),cooldownSeconds:R().optional(),minDwellSeconds:R().optional(),eventTypeTokens:H(L()).readonly().optional()}),jO=U({title:L(),body:L(),imageMode:G([`crop`,`annotated`,`full`,`none`])}),MO=U({id:L(),name:L(),enabled:z(),eventTypes:H(L()).readonly(),conditions:AO,outputs:H(L()).readonly(),template:jO.optional(),priority:G([`low`,`normal`,`high`,`critical`])}),NO=U({ruleId:L(),eventId:L(),timestamp:R(),wouldFire:z(),reason:L().optional()}),PO=U({id:L(),ruleId:L(),ruleName:L(),eventId:L(),timestamp:R(),outputs:H(L()).readonly(),success:z(),error:L().optional(),deviceId:R().optional()}),FO=U({ruleId:L().optional(),deviceId:R().optional(),from:R().optional(),to:R().optional(),limit:R().optional()}),IO={name:`advanced-notifier`,scope:`system`,mode:`singleton`,internal:!0,methods:{getRules:J(V(),U({rules:H(MO).readonly()})),upsertRule:J(U({rule:MO}),U({success:K(!0)}),{kind:`mutation`}),deleteRule:J(U({ruleId:L()}),U({success:K(!0)}),{kind:`mutation`}),testRule:J(U({ruleId:L(),lookbackMinutes:R()}),U({results:H(NO).readonly()}),{kind:`mutation`}),getHistory:J(U({filter:FO.optional()}),U({entries:H(PO).readonly()}))}},LO={name:`detection-pipeline`,scope:`device`,mode:`singleton`,kind:`wrapper`,defaultActive:!0,deviceTypes:[q.Camera],exposesDeviceSettings:!0,methods:{}},RO={name:`camera-pipeline-config`,scope:`device`,mode:`singleton`,kind:`wrapper`,defaultActive:!0,deviceTypes:[q.Camera],exposesDeviceSettings:!0,methods:{}},zO=G([`new`,`entered`,`left`,`moving`,`idle`]),BO=G([`motion`,`object`,`audio`]),VO=U({x:R(),y:R(),timestamp:R(),bbox:Fx}),HO=U({timestamp:R(),position:VO,mediaKey:L()}),UO=U({trackId:L(),deviceId:R(),className:L(),label:L().optional(),firstSeen:R(),lastSeen:R(),positions:H(VO).readonly(),snapshots:H(HO).readonly(),zonesVisited:H(L()).readonly(),totalDistance:R(),state:zO,active:z()}),WO={id:L(),deviceId:R(),timestamp:R()},GO=U({...WO,kind:K(`motion`),regionCount:R(),regions:H(U({bbox:Fx,pixelCount:R(),intensity:R()})).readonly().optional(),frameWidth:R().optional(),frameHeight:R().optional(),mediaUrl:L().optional()}),KO=G([`pipeline`,`onboard`]),qO=U({...WO,kind:K(`object`),source:KO.optional(),frameId:L().optional(),trackId:L().optional(),className:L(),label:L().optional(),confidence:R().optional(),bbox:Fx.optional(),zones:H(L()).readonly().optional(),state:zO.optional(),frameWidth:R().optional(),frameHeight:R().optional(),mediaKey:L().optional(),mediaUrl:L().optional()}),JO=U({...WO,kind:K(`audio`),rms:R(),dbfs:R(),classification:U({className:L(),originalClass:L().optional(),score:R()}).optional(),mediaUrl:L().optional()}),YO=G([`crop`,`thumbnail`,`snapshot`,`firstFrame`,`lastFrame`,`fullFrame`,`fullFrameBoxed`,`faceCrop`,`plateCrop`]),XO=U({key:L(),kind:YO,base64:L(),sizeBytes:R(),timestamp:R()}),ZO=U({deviceId:R(),since:R().optional(),until:R().optional(),limit:R().int().min(1).max(5e3).default(1e3),projection:G([`full`,`slim`]).optional()}),QO=ZO.extend({classFilter:L().optional()}),$O=U({trackId:L(),className:L(),confidence:R(),bbox:Fx,zones:H(L()).readonly(),state:zO}),ek={name:`pipeline-analytics`,scope:`device`,mode:`singleton`,kind:`wrapper`,defaultActive:!0,deviceTypes:[q.Camera],exposesDeviceSettings:!0,methods:{getActiveTracks:J(U({deviceId:R()}),H(UO).readonly()),getTrack:J(U({deviceId:R(),trackId:L()}),UO.nullable()),listTracks:J(U({deviceId:R(),since:R().optional(),until:R().optional(),limit:R().optional()}),H(UO).readonly()),clearTracks:J(U({deviceId:R()}),V(),{kind:`mutation`,auth:`admin`}),getMotionEvents:J(ZO,H(GO).readonly()),getObjectEvents:J(QO,H(qO).readonly()),getAudioEvents:J(ZO,H(JO).readonly()),getEventDensity:J(U({deviceId:R(),since:R(),until:R(),bucketMs:R().int().positive()}),H(U({bucketStart:R(),motion:R().int(),object:R().int(),audio:R().int()})).readonly()),pruneEventsBefore:J(U({deviceId:R(),cutoffMs:R()}),U({motion:R().int(),object:R().int(),audio:R().int()}),{kind:`mutation`,auth:`admin`}),getEventMedia:J(U({eventId:L(),kind:YO.optional()}),H(XO).readonly()),getTrackMedia:J(U({trackId:L()}),H(XO).readonly())},events:{onFrameTracked:{data:U({deviceId:R(),timestamp:R(),frameWidth:R(),frameHeight:R(),detections:H($O).readonly()})},onTrackStarted:{data:U({deviceId:R(),trackId:L(),className:L()})},onTrackEnded:{data:U({deviceId:R(),trackId:L(),className:L(),durationMs:R()})},onDetectionEvent:{data:U({deviceId:R(),kind:BO,eventId:L(),timestamp:R()})}}},tk=U({total:R(),user:R(),system:R(),irq:R(),nice:R(),loadAvg:dv([R(),R(),R()]),cores:R()}),nk=U({percent:R(),totalBytes:R(),usedBytes:R(),availableBytes:R(),swapUsedBytes:R(),swapTotalBytes:R()}),rk=U({readBytes:R(),writeBytes:R(),readOps:R(),writeOps:R(),timestampMs:R()}),ik=U({rxBytes:R(),txBytes:R(),rxPackets:R(),txPackets:R(),rxErrors:R(),txErrors:R(),timestampMs:R()}),ak=U({utilization:R(),model:L(),memoryUsedBytes:R(),memoryTotalBytes:R(),temperature:R().nullable()}),ok=U({openFds:R(),threadCount:R(),activeHandles:R(),activeRequests:R()}),sk=U({avg10:R(),avg60:R(),avg300:R()}),ck=U({some:sk,full:sk.nullable()}),lk=U({cpu:tk,memory:nk,gpu:ak.nullable(),network:ik,disk:rk,pressure:U({cpu:ck.nullable(),memory:ck.nullable(),io:ck.nullable()}),process:ok,cpuTemperature:R().nullable(),timestampMs:R()}),uk=U({path:L(),totalBytes:R(),usedBytes:R(),availableBytes:R(),percent:R()}),dk=U({pid:R(),cpu:R(),memory:R()}),fk=U({addonId:L(),nodeId:L(),role:G([`hub`,`worker`]),pid:R(),state:G([`starting`,`running`,`stopping`,`stopped`,`crashed`]),uptimeSec:R()}),pk=U({pid:R(),ppid:R(),pgid:R(),classification:G([`root`,`managed`,`system`,`ghost`]),addonId:L().nullable(),nodeId:L().nullable(),command:L(),cpuPercent:R(),memoryRssBytes:R(),uptimeSec:R(),orphaned:z()}),mk=U({pid:R(),force:z().optional()}),hk=U({success:z(),reason:L().optional(),signal:G([`SIGTERM`,`SIGKILL`]).optional()}),gk=U({cpuPercent:R(),memoryPercent:R(),memoryUsedMB:R(),memoryTotalMB:R(),diskPercent:R().optional(),temperature:R().optional(),gpuPercent:R().optional(),gpuMemoryPercent:R().optional()}),_k={name:`metrics-provider`,scope:`system`,mode:`singleton`,methods:{collectSnapshot:J(V(),lk),getCached:J(V(),lk.nullable()),getCurrent:J(V(),gk),getDiskSpace:J(U({dirPath:L()}),uk),getGpuInfo:J(V(),ak.nullable()),getCpuTemperature:J(V(),R().nullable()),getProcessStats:J(U({pids:H(R())}),H(dk)),listAddonInstances:J(V(),H(fk).readonly()),getAddonStats:J(U({addonId:L()}),dk.nullable()),listNodeProcesses:J(V(),H(pk).readonly()),killProcess:J(mk,hk,{kind:`mutation`,auth:`admin`})}},vk=U({id:L(),name:L()}),yk=U({pan:R(),tilt:R(),zoom:R()}),bk=U({pan:R().optional(),tilt:R().optional(),zoom:R().optional(),speed:R().optional()}),xk=yk.extend({autofocus:z()}),Sk=U({hasPan:z(),hasTilt:z(),hasZoom:z(),supportsPresets:z(),maxPresets:R().optional(),hasAutofocus:z()}),Ck={name:`ptz`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera],deviceConfig:{ui:{kind:`widget`,widgetId:`host/ptz-panel`,tab:`ptz`,topTab:!0,label:`PTZ`,order:0}},methods:{move:J(bk.extend({deviceId:R()}),V(),{kind:`mutation`}),continuousMove:J(bk.extend({deviceId:R()}),V(),{kind:`mutation`}),stop:J(U({deviceId:R()}),V(),{kind:`mutation`}),getPresets:J(U({deviceId:R()}),H(vk)),goToPreset:J(U({deviceId:R(),presetId:L()}),V(),{kind:`mutation`}),savePreset:J(U({deviceId:R(),presetId:L(),name:L()}),V(),{kind:`mutation`,auth:`admin`}),deletePreset:J(U({deviceId:R(),presetId:L()}),V(),{kind:`mutation`,auth:`admin`}),getOptions:J(U({deviceId:R()}),Sk),goHome:J(U({deviceId:R()}),V(),{kind:`mutation`}),getPosition:J(U({deviceId:R()}),yk),setAutofocus:J(U({deviceId:R(),enabled:z()}),V(),{kind:`mutation`})},status:{schema:xk,kind:`command-driven`}},wk=U({id:L(),type:L(),timestamp:R(),label:L().optional(),thumbnailUrl:L().optional(),clipUrl:L().optional(),metadata:W(L(),B()).optional()}),Tk={name:`events`,scope:`device`,mode:`singleton`,deviceTypes:[q.Camera],methods:{getEvents:J(U({deviceId:R(),from:R().optional(),to:R().optional(),limit:R().optional()}),H(wk)),getEventThumbnail:J(U({deviceId:R(),eventId:L()}),U({base64:L(),contentType:L()}).nullable()),getEventClipUrl:J(U({deviceId:R(),eventId:L()}),L().nullable())}},Ek=U({id:L(),name:L(),sampleCount:R().int().nonnegative(),coverMediaKey:L().optional(),coverBase64:L().optional()}),Dk=U({id:L(),source:G([`detected`,`photo`]),addedAt:R().int(),deviceId:R().int().optional(),base64:L().optional()}),Ok=U({faceId:L(),deviceId:R().int(),trackId:L(),timestamp:R().int(),recognizedIdentityId:L().optional(),identityName:L().optional(),assigned:z(),base64:L().optional()}),kk=G([`unassigned`,`recognized`,`all`]),Ak=U({key:L(),kind:L(),base64:L(),sizeBytes:R(),timestamp:R()}),jk={name:`face-gallery`,scope:`system`,mode:`singleton`,methods:{listIdentities:J(V(),H(Ek).readonly()),createIdentity:J(U({name:L().min(1)}),Ek,{kind:`mutation`,auth:`admin`}),renameIdentity:J(U({id:L(),name:L().min(1)}),V(),{kind:`mutation`,auth:`admin`}),deleteIdentity:J(U({id:L()}),V(),{kind:`mutation`,auth:`admin`}),listIdentitySamples:J(U({identityId:L()}),H(Dk).readonly()),removeSample:J(U({identityId:L(),sampleId:L()}),V(),{kind:`mutation`,auth:`admin`}),listRecentFaces:J(U({limit:R().int().positive().optional(),filter:kk.optional()}).optional(),H(Ok).readonly()),getFaceByTrack:J(U({deviceId:R().int(),trackId:L()}),Ok.nullable()),getFaceMedia:J(U({faceId:L()}),H(Ak).readonly()),assignFace:J(U({faceId:L(),identityId:L()}),V(),{kind:`mutation`,auth:`admin`}),unassignFace:J(U({faceId:L()}),V(),{kind:`mutation`,auth:`admin`}),deleteFace:J(U({faceId:L()}),V(),{kind:`mutation`,auth:`admin`}),assignFaces:J(U({faceIds:H(L()).min(1),identityId:L()}),U({assigned:R().int(),failed:H(L()).readonly()}),{kind:`mutation`,auth:`admin`}),unassignFaces:J(U({faceIds:H(L()).min(1)}),U({unassigned:R().int(),failed:H(L()).readonly()}),{kind:`mutation`,auth:`admin`}),suggestFaceClusters:J(U({threshold:R().min(0).max(1).optional(),minClusterSize:R().int().min(2).optional(),limit:R().int().positive().optional()}).optional(),H(U({faceIds:H(L()).readonly(),representativeFaceId:L(),size:R().int(),cohesion:R()})).readonly())}},Mk=U({plateId:L(),deviceId:R().int(),trackId:L(),timestamp:R().int(),text:L(),score:R(),corrected:z(),base64:L().optional()}),Nk=U({key:L(),kind:L(),base64:L(),sizeBytes:R(),timestamp:R()}),Pk=U({plateIds:H(L()).readonly(),representativePlateId:L(),representativeText:L(),size:R().int(),cohesion:R()}),Fk={name:`plate-gallery`,scope:`system`,mode:`singleton`,methods:{listPlates:J(U({deviceId:R().int().optional(),limit:R().int().positive().optional()}).optional(),H(Mk).readonly()),getPlateByTrack:J(U({deviceId:R().int(),trackId:L()}),Mk.nullable()),getPlateMedia:J(U({plateId:L()}),H(Nk).readonly()),searchPlates:J(U({text:L().min(1),maxDistance:R().int().min(0).optional(),limit:R().int().positive().optional()}),H(Mk).readonly()),suggestPlateClusters:J(U({maxDistance:R().int().min(0).optional(),minClusterSize:R().int().min(2).optional(),limit:R().int().positive().optional()}).optional(),H(Pk).readonly()),correctPlateText:J(U({plateId:L(),text:L().min(1)}),V(),{kind:`mutation`,auth:`admin`}),deletePlate:J(U({plateId:L()}),V(),{kind:`mutation`,auth:`admin`})}},Ik=U({deviceId:R(),enabled:z(),activeMode:G([`off`,`continuous`,`events`]),nodeId:L(),storageBytes:R()}),Lk=U({profile:L(),startMs:R(),endMs:R()}),Rk=U({deviceId:R(),ranges:H(Lk)}),zk=U({deviceId:R(),days:H(R())}),Bk=U({deviceId:R(),localMasterPath:L().nullable(),playbackUrl:L().nullable(),playbackEndpoints:H(L())}),Vk=U({deviceId:R(),usedBytes:R()}),Hk=U({locationId:L().nullable(),usedBytes:R(),availableBytes:R().nullable(),totalBytes:R().nullable()}),Uk=U({nodeId:L(),totalUsedBytes:R(),devices:H(Vk),locations:H(Hk)}),Wk=sv(`kind`,[U({kind:K(`segment`),startMs:R(),durMs:R(),bytes:R()}),U({kind:K(`gap`),nearestEdgeMs:R().nullable()})]),Gk=U({data:Hv(Uint8Array)}),Kk={name:`recording`,scope:`system`,mode:`singleton`,exposesDeviceSettings:!0,status:{schema:Ik,kind:`command-driven`},methods:{getAvailability:J(U({deviceId:R(),fromMs:R(),toMs:R()}),Rk,{kind:`query`,auth:`admin`}),getDaysWithRecordings:J(U({deviceId:R(),fromMs:R(),toMs:R(),tzOffsetMinutes:R()}),zk,{kind:`query`,auth:`admin`}),getPlaybackManifest:J(U({deviceId:R(),fromMs:R(),toMs:R()}),Bk,{kind:`query`,auth:`admin`}),getStorageUsage:J(U({}),Uk,{kind:`query`,auth:`admin`}),getDeviceConfig:J(U({deviceId:R()}),wy,{kind:`query`,auth:`admin`}),locateSegment:J(U({deviceId:R(),profile:L(),epochMs:R()}),Wk,{kind:`query`,auth:`admin`}),readSegmentBytes:J(U({deviceId:R(),profile:L(),startMs:R()}),Gk,{kind:`query`,auth:`admin`}),setDeviceConfig:J(U({deviceId:R(),config:wy}),wy,{kind:`mutation`,auth:`admin`}),rescanStorage:J(U({deviceId:R()}),Ik,{kind:`mutation`,auth:`admin`}),pruneFootage:J(U({deviceId:R()}),U({floorMs:R().nullable(),deletedBuckets:R().int(),reclaimedBytes:R().int()}),{kind:`mutation`,auth:`admin`})}},qk=U({id:L(),label:L(),protocol:G([`rtsp`,`rtmp`,`annexb`,`http-mjpeg`,`webrtc`,`custom`]),url:L().optional(),resolution:U({width:R(),height:R()}).optional(),fps:R().optional(),bitrate:R().optional(),codec:L().optional(),profileHint:Yv.optional(),sdp:L().optional()}),Jk=U({key:L(),value:B()}),Yk=U({source:L(),data:W(L(),B())}),Xk={name:`device-ops`,scope:`device`,deviceNative:!0,mode:`singleton`,methods:{getStreamSources:J(U({deviceId:R()}),H(qk)),getConfigEntries:J(U({deviceId:R()}),H(Jk)),setConfig:J(U({deviceId:R(),values:W(L(),B())}),V(),{kind:`mutation`}),runAction:J(U({deviceId:R(),action:L().min(1),input:B()}),B(),{kind:`mutation`}),removeDevice:J(U({deviceId:R()}),V(),{kind:`mutation`}),getSettingsSchema:J(U({deviceId:R()}),B().nullable()),getRawState:J(U({deviceId:R()}),Yk.nullable(),{auth:`protected`})}},Zk=U({host:L(),port:R().int().positive().optional(),onvifPort:R().int().positive().optional(),rtspPort:R().int().positive().optional(),https:z().optional(),username:L().optional(),password:L().optional(),onvifProfile:L().optional()}),Qk=U({host:L(),port:R().int().positive().nullable(),onvifPort:R().int().positive().nullable(),rtspPort:R().int().positive().nullable(),https:z().nullable(),hasUsername:z(),hasPassword:z(),onvifProfile:L().nullable()}),$k={name:`camera-credentials`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera],methods:{getCredentials:J(U({deviceId:R()}),Zk.nullable(),{kind:`query`,auth:`admin`})},status:{schema:Qk,kind:`command-driven`}},eA={name:`reboot`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera,q.Sensor,q.Switch],methods:{reboot:J(U({deviceId:R().int().nonnegative()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`})}},tA={name:`button`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Button],methods:{press:J(U({deviceId:R().int().nonnegative()}),V(),{kind:`mutation`,auth:`admin`})}},nA=G([`text`,`timestamp`,`watermark`]),rA=G([`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`,`custom`]),iA=U({overlays:H(U({id:L(),kind:nA,enabled:z(),text:L().optional(),position:rA.optional(),availablePositions:H(rA).readonly(),readOnly:z().optional()})).readonly()}),aA=U({enabled:z().optional(),text:L().optional(),position:rA.optional()}).partial(),oA={name:`osd`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera],methods:{setOverlay:J(U({deviceId:R(),overlayId:L(),patch:aA}),V(),{kind:`mutation`,auth:`admin`})},events:{onStatusChanged:{data:U({deviceId:R(),status:iA})}},status:{schema:iA,kind:`command-driven`},settings:{bindings:[{kind:`array`,statusPath:`overlays`,idField:`id`,method:`setOverlay`,idArg:`overlayId`,patchArg:`patch`,sectionId:`osd`,sectionTitle:`Video overlays`,itemFields:{enabled:{label:e=>`${String(e.id)} enabled`,kind:`boolean`},text:{label:e=>`${String(e.id)} text`,kind:`text`,when:e=>e.kind!==`timestamp`&&!e.readOnly},position:{label:e=>`${String(e.id)} position`,kind:`select`,options:e=>e.availablePositions??[],when:e=>Array.isArray(e.availablePositions)&&e.availablePositions.length>0}}}]}},sA=U({childDeviceIds:H(R()).readonly(),hiddenChildIds:H(R()).readonly()}),cA={name:`accessories`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera,q.Hub,q.Switch,q.Light,q.Sensor,q.Thermostat,q.Cover,q.Lock,q.Fan,q.MediaPlayer,q.AlarmPanel,q.Generic],methods:{setChildHidden:J(U({deviceId:R().int().nonnegative(),childDeviceId:R().int().nonnegative(),hidden:z()}),V(),{kind:`mutation`,auth:`admin`})},events:{onAccessoriesChanged:{data:U({deviceId:R(),childDeviceIds:H(R()).readonly(),hiddenChildIds:H(R()).readonly()})},onChildVisibilityChanged:{data:U({deviceId:R(),childDeviceId:R(),hidden:z()})}},status:{schema:sA,kind:`command-driven`}},lA=U({codecs:H(L()),sampleRate:R(),duplex:G([`half`,`full`]),maxBacklogMs:R()}),uA=U({talking:z(),lastSessionAt:R().nullable(),ability:lA.nullable()}),dA=G([`opus`,`s16le`,`g711ulaw`,`g711alaw`]),fA={name:`intercom`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera],methods:{startSession:J(U({deviceId:R()}),U({sessionId:L(),sdpOffer:L()}),{kind:`mutation`,auth:`admin`}),handleAnswer:J(U({deviceId:R(),sessionId:L(),sdpAnswer:L()}),V(),{kind:`mutation`,auth:`admin`}),stopSession:J(U({deviceId:R(),sessionId:L()}),V(),{kind:`mutation`,auth:`admin`}),startTalkSession:J(U({deviceId:R()}),U({sessionId:L()}),{kind:`mutation`,auth:`admin`}),pushTalkAudio:J(U({deviceId:R(),audioBase64:L(),codec:dA.optional(),sampleRate:R().int().positive().optional(),channels:R().int().positive().optional(),sequenceNumber:R().int()}),U({accepted:z()}),{kind:`mutation`,auth:`admin`}),endTalkSession:J(U({deviceId:R()}),V(),{kind:`mutation`,auth:`admin`})},events:{onStatusChanged:{data:U({deviceId:R(),status:uA})}},status:{schema:uA,kind:`command-driven`}},pA=U({camStreamId:L().min(1),kind:Xv,url:L().optional(),codec:L().optional(),resolution:Zv.optional(),fps:R().positive().optional(),label:L().optional(),deviceFeatures:H(L()).optional(),autoEligible:z().optional(),metadata:W(L(),B()).optional()}),mA={name:`stream-catalog`,scope:`device`,deviceNative:!0,mode:`singleton`,deviceTypes:[q.Camera],methods:{getCatalog:J(U({deviceId:R().int().nonnegative()}),H(pA).readonly())}},hA=G(qv),gA=G([`videotoolbox`,`cuda`,`nvdec`,`vaapi`,`qsv`,`d3d11va`,`dxva2`,`amf`,`vdpau`,`drm`,`coreml`,`tensorrt`,`openvino`,`directml`,`webgpu`,`none`]).nullable().optional(),_A=U({preferred:H(L()).readonly()}),vA=G([`h264_videotoolbox`,`hevc_videotoolbox`,`h264_vaapi`,`hevc_vaapi`,`h264_nvenc`,`hevc_nvenc`,`h264_qsv`,`hevc_qsv`,`h264_amf`,`hevc_amf`,`libx264`,`libx265`]),yA=U({encoders:H(U({encoder:vA,codec:G([`H264`,`H265`]),family:G([`videotoolbox`,`vaapi`,`nvenc`,`qsv`,`amf`,`software`]),available:z(),reason:L().optional()})).readonly(),defaultH264:vA,defaultH265:vA,probedAt:R()}),bA=U({methods:H(L()).readonly(),probedAt:R()}),xA=G([`darwin`,`linux`,`win32`]),SA=G([`arm64`,`x64`]),CA=U({type:G([`nvidia`,`amd`,`intel`,`apple`]),name:L(),memoryMB:R().optional()}),wA=U({type:G([`apple-ane`,`intel-npu`])}),TA=U({platform:xA,arch:SA,cpuModel:L(),cpuCores:R(),totalRAM_MB:R(),availableRAM_MB:R(),gpu:CA.nullable(),npu:wA.nullable()}),EA=U({runtime:G([`node`,`python`]),backend:L(),format:G([`onnx`,`coreml`,`openvino`]),score:R(),reason:L(),available:z()}),DA=U({hardware:TA,scores:H(EA).readonly(),bestScore:EA,pythonPath:L().nullable()}),OA=U({modelId:L(),name:L(),minRAM_MB:R(),accuracyScore:R(),formats:H(L()).readonly()}),kA=U({modelId:L(),runtime:G([`node`,`python`]),backend:L(),format:hA,reason:L()}),AA={name:`platform-probe`,scope:`system`,mode:`singleton`,methods:{getCapabilities:J(V(),DA),getHardware:J(V(),TA),resolveInferenceConfig:J(U({requirements:H(OA).readonly()}),kA),resolveHwAccel:J(U({prefer:gA,nodeId:L().optional()}),_A),getHardwareEncoders:J(V(),yA),refreshHardwareEncoders:J(V(),yA,{kind:`mutation`,auth:`admin`}),getHardwareDecodeAccels:J(V(),bA),refreshHardwareDecodeAccels:J(V(),bA,{kind:`mutation`,auth:`admin`})}},jA=G([`lan`,`wifi`,`docker`,`vpn`,`loopback`,`other`]),MA=U({name:L(),family:G([`IPv4`,`IPv6`]),address:L(),cidr:L(),netmask:L(),internal:z(),mac:L(),kind:jA,preferred:z(),plausible:z(),plausibleReason:L()}),NA=U({interfaces:H(MA).readonly(),probedAt:R()}),PA=MA.nullable(),FA=U({endpoints:H(U({label:L(),baseUrl:L(),kind:G([`lan-ipv4`,`lan-ipv6`,`public`,`loopback`]),interfaceKind:G([`lan`,`wifi`,`docker`,`vpn`,`other`,`loopback`,`public`]),plausible:z(),plausibleReason:L(),priority:R()})).readonly()}),IA=U({addresses:H(L()).readonly()}),LA={name:`local-network`,scope:`system`,mode:`singleton`,methods:{list:J(V(),NA),getPreferred:J(V(),PA),getConnectionEndpoints:J(U({port:R().int().min(1).max(65535),includeLoopback:z().optional(),ipv4Only:z().optional(),scheme:G([`http`,`https`]).optional()}),FA),getAllowedAddresses:J(V(),IA),setAllowedAddresses:J(IA,U({success:K(!0)}),{kind:`mutation`}),resetAllowlistToBestMatch:J(V(),IA,{kind:`mutation`})}},RA=U({id:L(),label:L(),scope:G([`mesh`,`public`]),url:L(),hostname:L(),port:R(),protocol:G([`http`,`https`])}),zA=U({id:L(),hostname:L(),magicDns:L(),addresses:H(L()).readonly(),os:L().optional(),online:z(),lastSeenMs:R(),isSelf:z(),connection:G([`direct`,`relay`,`idle`]),relay:L().nullable(),lastHandshakeMs:R(),rxBytes:R(),txBytes:R(),tags:H(L()).readonly(),exitNodeOption:z(),advertisedRoutes:H(L()).readonly(),userLogin:L().nullable(),keyExpiry:R().nullable()}),BA=U({joined:z(),meshIp:L(),magicDnsHostname:L(),peerCount:R(),endpoints:H(RA).readonly(),error:L().optional(),tenantName:L(),magicDnsSuffix:L(),userLogin:L().nullable(),controlPlaneUrl:L(),keyExpiry:R().nullable(),daemonSocket:L().optional(),daemonCliPath:L().optional()}),VA={name:`mesh-network`,scope:`system`,mode:`collection`,providerKind:`mesh`,methods:{getStatus:J(V(),BA),join:J(U({authKey:L().min(8),hostname:L().optional()}),U({joined:K(!0)}),{kind:`mutation`}),startLogin:J(U({hostname:L().optional()}),U({loginUrl:L()}),{kind:`mutation`}),leave:J(V(),U({left:K(!0)}),{kind:`mutation`}),logout:J(V(),U({loggedOut:K(!0)}),{kind:`mutation`}),listPeers:J(V(),U({peers:H(zA).readonly()})),testConnection:J(U({authKey:L().optional()}),U({ok:z(),tenant:L().optional(),daemonVersion:L().optional(),error:L().optional()}),{kind:`mutation`})}},HA=U({id:L(),username:L(),isAdmin:z().default(!1),allowedProviders:av([H(L()),K(`*`)]),allowedDevices:W(L(),av([H(L()),K(`*`)])),scopes:H(VT).default([]),totpEnabled:z().default(!1),createdAt:R(),updatedAt:R()}),UA=U({username:L(),password:L().min(6),isAdmin:z().default(!1),allowedProviders:av([H(L()),K(`*`)]).optional(),allowedDevices:W(L(),av([H(L()),K(`*`)])).optional(),scopes:H(VT).optional()}),WA=U({id:L(),isAdmin:z().optional(),allowedProviders:av([H(L()),K(`*`)]).optional(),allowedDevices:W(L(),av([H(L()),K(`*`)])).optional(),scopes:H(VT).optional()}),GA=U({id:L(),label:L(),isAdmin:z().default(!1),allowedProviders:av([H(L()),K(`*`)]).optional(),allowedDevices:W(L(),av([H(L()),K(`*`)])).optional(),tokenPrefix:L(),createdAt:R(),lastUsedAt:R().optional()}),KA=U({label:L(),isAdmin:z().default(!1),allowedProviders:av([H(L()),K(`*`)]).optional(),allowedDevices:W(L(),av([H(L()),K(`*`)])).optional()}),qA=U({token:L(),record:GA}),JA=U({id:L(),userId:L(),name:L(),tokenPrefix:L(),scopes:H(VT),expiresAt:R().nullish(),lastUsedAt:R().nullish(),createdAt:R()}),YA=U({userId:L(),name:L(),scopes:H(VT),expiresAt:R().optional()}),XA=U({token:L(),record:JA}),ZA=U({id:L(),userId:L(),username:L(),integrationId:L(),scopes:H(VT),createdAt:R(),lastUsedAt:R(),revokedAt:R().nullable()}),QA=U({secret:L(),otpauthUrl:L()}),$A=U({enabled:z(),confirmedAt:R().nullable()}),ej={name:`user-management`,scope:`system`,mode:`singleton`,methods:{listUsers:J(V(),H(HA),{auth:`admin`}),createUser:J(UA,HA,{kind:`mutation`,auth:`admin`,access:`create`}),updateUser:J(WA,U({success:K(!0)}),{kind:`mutation`,auth:`admin`,access:`create`}),deleteUser:J(U({id:L()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`,access:`delete`}),resetPassword:J(U({id:L(),newPassword:L().min(6)}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`,access:`create`}),setUserScopes:J(U({userId:L(),scopes:H(VT)}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`,access:`create`}),validateCredentials:J(U({username:L(),password:L()}),HA.extend({passwordHash:L()}).nullable(),{kind:`mutation`,access:`view`}),listApiKeys:J(V(),H(GA),{auth:`admin`}),createApiKey:J(KA,qA,{kind:`mutation`,auth:`admin`,access:`create`}),revokeApiKey:J(U({id:L()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`,access:`delete`}),validateApiKey:J(U({token:L()}),GA.nullable(),{kind:`mutation`,access:`view`}),createScopedToken:J(YA,XA,{kind:`mutation`,auth:`admin`,access:`create`}),revokeScopedToken:J(U({id:L()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`,access:`delete`}),validateScopedToken:J(U({token:L()}),JA.nullable(),{access:`view`}),listScopedTokens:J(U({userId:L()}),H(JA),{auth:`admin`}),setupTotp:J(U({userId:L()}),QA,{kind:`mutation`,auth:`admin`,access:`create`}),confirmTotp:J(U({userId:L(),code:L()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`,access:`create`}),disableTotp:J(U({userId:L()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`,access:`delete`}),getTotpStatus:J(U({userId:L()}),$A,{auth:`admin`}),verifyTotp:J(U({userId:L(),code:L()}),U({valid:z()}),{kind:`mutation`,access:`view`}),oauthIssueCode:J(U({integrationId:L(),userId:L(),username:L(),scopes:H(VT),redirectUri:L(),hubUrl:L()}),U({code:L()}),{kind:`mutation`,access:`create`}),oauthExchangeCode:J(U({code:L(),redirectUri:L()}),U({accessToken:L(),refreshToken:L(),expiresIn:R()}).nullable(),{kind:`mutation`,access:`view`}),oauthRefresh:J(U({refreshToken:L()}),U({accessToken:L(),refreshToken:L(),expiresIn:R()}).nullable(),{kind:`mutation`,access:`view`}),oauthVerifyAccessToken:J(U({token:L()}),U({userId:L(),username:L(),scopes:H(VT)}).nullable(),{access:`view`}),listOauthSessions:J(V(),H(ZA),{auth:`admin`}),revokeOauthSession:J(U({id:L()}),U({success:z()}),{kind:`mutation`,auth:`admin`,access:`delete`})}},tj=U({streaming:z(),notifications:z(),objectDetection:z(),remoteAccess:z(),agentCluster:z(),smartHome:z(),recordings:z(),backup:z(),repl:z()}),nj=U({status:K(`ok`),uptime:R()}),rj=U({name:L(),address:L(),family:L(),internal:z()}),ij={name:`system`,scope:`system`,mode:`singleton`,methods:{info:J(V(),tj),health:J(V(),nj),featureFlags:J(V(),tj),networkAddresses:J(V(),H(rj).readonly()),getRetentionConfig:J(V(),B().nullable(),{auth:`admin`}),setRetentionConfig:J(W(L(),B()),q_(),{kind:`mutation`,auth:`admin`}),forceRetentionCleanup:J(V(),V(),{kind:`mutation`,auth:`admin`})}},aj=U({nominalBitrateKbps:R(),observedBitrateKbps:R(),peakBitrateKbps:R(),packetLossPercent:R(),lastUpdated:R()}),oj=U({rttMs:R(),jitterMs:R(),estimatedBandwidthKbps:R(),packetLossPercent:R().min(0).max(100),lastUpdated:R()}),sj=U({deviceId:R(),streams:W(L(),aj),client:oj.optional()}),cj={name:`network-quality`,scope:`system`,mode:`singleton`,methods:{getDeviceStats:J(U({deviceId:R()}),sj.nullable()),getAllStats:J(V(),H(sj).readonly()),reportClientStats:J(U({deviceId:R(),rttMs:R().min(0).max(6e4),jitterMs:R().min(0).max(1e4),estimatedBandwidthKbps:R().min(0).max(1e6),packetLossPercent:R().min(0).max(100)}),V(),{kind:`mutation`})}},lj=U({title:L(),message:L(),severity:G([`info`,`warning`,`critical`]),duration:R().optional(),action:U({label:L(),url:L()}).optional()}),uj={name:`toast`,scope:`system`,mode:`singleton`,methods:{onToast:J(V(),lj,{kind:`subscription`})}},dj=U({addonId:L(),capabilities:H(L()).readonly(),status:L()}),fj=U({pid:R(),name:L(),state:L(),cpuPercent:R(),memoryRss:R(),uptimeSeconds:R(),services:H(dj).readonly(),groupId:L().optional()}),pj=U({id:L(),status:L(),cpuPercent:R(),memoryRss:R()}),mj=U({category:L(),total:R(),healthy:R(),addons:H(pj).readonly()}),hj=U({id:L(),name:L(),hostname:L(),platform:L(),arch:L(),cpuModel:L().nullable(),cpuCores:R(),memoryMB:R(),engines:H(L()).readonly(),isHub:z(),isOnline:z(),cpuPercent:R(),memoryPercent:R(),uptime:R(),lastSeen:L(),localIps:H(L()).readonly(),addons:H(U({id:L(),capabilities:H(L()).readonly(),status:L()})).readonly(),processes:H(fj).readonly(),categories:H(mj).readonly()}),gj=U({callerAddonId:L(),providerAddonId:L(),capName:L(),callsPerMin:R(),lastCallAtMs:R()}),_j=U({nodeId:L(),name:L(),version:L(),status:L(),synced:z()}),vj=U({hubVersion:L(),nodes:H(_j)}),yj=U({nodeId:L(),addonId:L()}),bj=U({id:L(),status:L(),version:L().optional(),packageName:L().optional()}),xj=U({success:z()}),Sj=U({success:z(),reason:L().optional()}),Cj=U({restarted:H(L()).readonly(),failed:H(L()).readonly()}),wj=U({nodeId:L(),name:L()}),Tj={name:`nodes`,scope:`system`,mode:`singleton`,nodeIdMode:`data`,methods:{topology:J(V(),H(hj).readonly(),{auth:`admin`}),deployAddon:J(yj,xj,{kind:`mutation`,auth:`admin`}),undeployAddon:J(yj,xj,{kind:`mutation`,auth:`admin`}),restartAddon:J(yj,xj,{kind:`mutation`,auth:`admin`}),restartProcess:J(U({nodeId:L(),processName:L()}),Sj,{kind:`mutation`,auth:`admin`}),restartNode:J(U({nodeId:L()}),Cj,{kind:`mutation`,auth:`admin`}),shutdownNode:J(U({nodeId:L()}),xj,{kind:`mutation`,auth:`admin`}),renameNode:J(U({nodeId:L(),name:L().min(1).max(64)}),wj,{kind:`mutation`,auth:`admin`}),clusterAddonStatus:J(V(),W(L(),vj),{auth:`admin`}),getCapUsageGraph:J(U({windowSeconds:R().int().positive().max(300).default(60)}),H(gj).readonly(),{auth:`admin`}),getNodeAddons:J(U({nodeId:L()}),H(bj).readonly(),{auth:`admin`}),setProcessLogLevel:J(U({nodeId:L(),level:L()}),xj,{kind:`mutation`,auth:`admin`}),executeQuery:J(U({nodeId:L(),addonId:L(),queryName:L(),params:W(L(),B()).optional()}),B(),{kind:`mutation`,auth:`admin`})}},Ej=U({id:L(),addonId:L(),name:L(),enabled:z(),info:W(L(),B()).readonly(),createdAt:R(),updatedAt:R(),processState:L()}),Dj=U({id:L(),addonId:L(),name:L(),enabled:z(),info:W(L(),B()).readonly(),createdAt:R(),updatedAt:R()}),Oj=U({addonId:L(),name:L(),description:L(),iconUrl:L().nullable(),color:L(),instanceMode:L(),discoveryMode:L(),kind:G([`device-adoption`,`device-provider`]),brokerKind:L().nullable(),supportsLocationImport:z(),existingInstances:H(U({id:L(),name:L()})),canAdd:z()}),kj=U({success:z(),error:L().optional()}),Aj=U({addonId:L(),name:L(),enabled:z().optional(),info:W(L(),B()).optional(),settings:W(L(),B()).optional(),skipRestart:z().optional()}),jj=U({id:L(),name:L().optional(),enabled:z().optional(),info:W(L(),B()).optional()}),Mj=U({success:z(),deletedId:L()}),Nj={name:`integrations`,scope:`system`,mode:`singleton`,methods:{list:J(V(),H(Ej)),get:J(U({id:L()}),Ej),getByAddonId:J(U({addonId:L()}),Dj.nullable()),create:J(Aj,Dj,{kind:`mutation`,auth:`admin`}),update:J(jj,Dj,{kind:`mutation`,auth:`admin`}),delete:J(U({id:L()}),Mj,{kind:`mutation`,auth:`admin`}),getSettings:J(U({id:L()}),W(L(),B()),{auth:`admin`}),setSettings:J(U({id:L(),settings:W(L(),B())}),U({success:z()}),{kind:`mutation`,auth:`admin`}),getAvailableTypes:J(V(),H(Oj),{auth:`admin`}),testConnection:J(U({addonId:L(),settings:W(L(),B())}),kj,{kind:`mutation`,auth:`admin`})}},Pj=G([`debug`,`info`,`warn`,`error`]),Fj=G([`off`,`latest`,`beta`]),Ij=G([`off`,`latest`,`beta`,`inherit`]),Lj=U({id:L(),name:L().optional(),version:L().optional(),description:L().optional(),icon:L().optional(),color:L().optional(),capabilities:H(B()).readonly().optional(),packageName:L(),packageVersion:L(),packageDisplayName:L().optional(),bundle:U({displayName:L(),description:L().optional(),icon:L().optional()}).optional(),protected:z().optional(),removable:z().optional()}),Rj=U({pid:R().optional(),mode:L(),state:L()}),zj=U({phase:G([`pending`,`healthy`,`failed`]),retryCount:R(),firstFailureAt:R().nullable(),lastAttemptAt:R().nullable(),lastError:U({message:L(),stack:L().optional()}).nullable(),nextRetryAt:R().nullable(),alertEmitted:z(),retrying:z(),inGracePeriod:z()}),Bj=U({manifest:Lj,declaration:B().optional(),source:L(),installSource:L().optional(),process:Rj.optional(),hasBackup:z().optional(),health:zj.nullable().optional()}),Vj=U({name:L(),version:L(),dir:L(),installSource:L().optional()}),Hj=U({name:L(),currentVersion:L(),latestVersion:L(),category:G([`addon`,`core`]),requiresRestart:z(),isSystem:z()}),Uj=U({version:L(),publishedAt:L(),deprecated:L().optional(),distTags:H(L()).readonly()}),Wj=U({name:L(),version:L(),description:L(),keywords:H(L()).readonly(),publishedAt:L(),author:L(),installed:z(),installedVersion:L().optional()}),Gj=U({channel:Fj,intervalSeconds:R()}),Kj=Ij,qj=B(),Jj=B(),Yj=B(),Xj=U({packageName:L(),fromVersion:L(),toVersion:L(),restartingAt:R()}),Zj=G([`queued`,`updating`,`done`,`done-pending-restart`,`failed`]),Qj=U({name:L(),isSystem:z(),fromVersion:L(),toVersion:L(),status:Zj,error:L().optional(),startedAtMs:R().optional(),completedAtMs:R().optional()}),$j=G([`regular`,`system`,`restarting`,`finalizing`]),eM=U({id:L(),nodeId:L(),startedAtMs:R(),completedAtMs:R().optional(),total:R(),completed:R(),failed:R(),current:L().nullable(),phase:$j,cancelled:z(),items:H(Qj).readonly()}),tM=U({packageName:L(),currentVersion:L(),latestVersion:L().nullable(),hasUpdate:z(),description:L().optional()}),nM=U({timestamp:L(),level:L(),message:L(),scope:L().optional()}),rM=B(),iM=U({addonId:L().min(1),action:L().min(1),input:B()}),aM=[cA,nD,iD,hD,qw,dD,lD,{name:`addons`,scope:`system`,mode:`singleton`,nodeIdMode:`data`,methods:{list:J(V(),H(Bj).readonly()),getLogs:J(U({addonId:L(),limit:R().min(1).max(500).default(100),level:Pj.optional()}),H(rM)),listPackages:J(V(),H(Vj).readonly()),installPackage:J(U({packageName:L(),version:L().optional()}),Jj,{kind:`mutation`,auth:`admin`}),installFromWorkspace:J(U({packageName:L()}),Jj,{kind:`mutation`,auth:`admin`}),isWorkspaceAvailable:J(V(),z()),listWorkspacePackages:J(V(),H(B()).readonly()),uninstallPackage:J(U({packageName:L()}),B(),{kind:`mutation`,auth:`admin`}),reloadPackages:J(V(),Yj,{kind:`mutation`,auth:`admin`}),searchAvailable:J(U({query:L().optional()}),H(Wj)),listUpdates:J(U({nodeId:L().optional()}),H(Hj).readonly(),{auth:`admin`}),updatePackage:J(U({name:L().min(1),version:L().optional(),nodeId:L().optional()}),B(),{kind:`mutation`,auth:`admin`}),rollbackPackage:J(U({name:L().min(1)}),U({rolledBackTo:L().nullable()}),{kind:`mutation`,auth:`admin`}),forceRefresh:J(U({nodeId:L().optional()}),B(),{kind:`mutation`,auth:`admin`}),restartServer:J(U({confirm:K(!0)}),B(),{kind:`mutation`,auth:`admin`}),getLastRestart:J(V(),U({kind:G([`framework-update`,`manual`,`system`,`framework-bulk-update`]),packageName:L().optional(),fromVersion:L().optional(),toVersion:L().optional(),requestedBy:L().optional(),requestedAt:R()}).nullable(),{auth:`admin`}),listFrameworkPackages:J(V(),H(tM).readonly(),{auth:`admin`}),listCapabilityProviders:J(U({capName:L().min(1)}),H(U({addonId:L(),mode:G([`singleton`,`collection`]),isActive:z()})).readonly()),setCapabilityProviderEnabled:J(U({capName:L().min(1),addonId:L().min(1),enabled:z()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),updateFrameworkPackage:J(U({packageName:L().min(1),version:L().optional(),deferRestart:z().optional()}),Xj,{kind:`mutation`,auth:`admin`}),startBulkUpdate:J(U({nodeId:L(),items:H(U({name:L(),version:L(),isSystem:z()})).readonly()}),U({id:L()}),{kind:`mutation`,auth:`admin`}),getBulkUpdateState:J(U({id:L()}),eM.nullable(),{auth:`admin`}),cancelBulkUpdate:J(U({id:L()}),U({cancelled:z()}),{kind:`mutation`,auth:`admin`}),listActiveBulkUpdates:J(U({nodeId:L().optional()}),H(eM).readonly(),{auth:`admin`}),getVersions:J(U({name:L()}),H(Uj).readonly()),restartAddon:J(U({addonId:L()}),qj,{kind:`mutation`,auth:`admin`}),retryLoad:J(U({packageName:L()}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),getAutoUpdateSettings:J(V(),Gj,{auth:`admin`}),setAutoUpdateSettings:J(U({channel:Fj,intervalSeconds:R().min(300).max(86400).optional()}),B(),{kind:`mutation`,auth:`admin`}),getAddonAutoUpdate:J(U({addonId:L()}),Kj,{auth:`admin`}),setAddonAutoUpdate:J(U({addonId:L(),channel:Ij}),B(),{kind:`mutation`,auth:`admin`}),applyAutoUpdateToAll:J(U({channel:Fj}),U({success:K(!0)}),{kind:`mutation`,auth:`admin`}),custom:J(iM,B(),{kind:`mutation`}),onAddonLogs:J(U({addonId:L(),level:Pj.optional()}),nM,{kind:`subscription`})}},IT,IO,Uy,Yy,Qw,Zy,KD,GD,eO,tb,vO,rb,TT,ab,sb,lb,ME,tA,$k,RO,kb,jb,Pb,zb,Vb,Ub,Gb,Jb,Xb,_D,LO,dE,tx,$E,hO,Xk,Tw,gO,zy,ix,rO,sx,ux,Tk,jk,px,Vy,vT,hx,_x,yx,xx,Cx,Nj,fA,Tx,LA,Dx,NT,Mx,VA,_k,RS,Hx,VS,$S,WE,iC,SO,cj,Tj,kO,dC,pC,GT,oA,ek,yS,VD,FS,Fk,AA,hC,vC,bC,EC,Ck,jC,eA,Kk,bD,NC,AT,FC,QT,DO,OO,UT,eT,hT,fT,wb,mA,HC,fb,WC,ij,KC,JC,uj,wO,XC,ej,qT,ew,nw,iw,OD,ow,cw,SD,TD,hw,yw,CS];Object.freeze({"accessories.setChildHidden":{capName:`accessories`,capScope:`device`,addonId:null,access:`create`},"addonPages.listPages":{capName:`addon-pages`,capScope:`system`,addonId:null,access:`view`},"addonPagesSource.listPages":{capName:`addon-pages-source`,capScope:`system`,addonId:null,access:`view`},"addonRoutes.getRoutes":{capName:`addon-routes`,capScope:`system`,addonId:null,access:`view`},"addonRoutes.invoke":{capName:`addon-routes`,capScope:`system`,addonId:null,access:`create`},"addons.applyAutoUpdateToAll":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.cancelBulkUpdate":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.custom":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.forceRefresh":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.getAddonAutoUpdate":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.getAutoUpdateSettings":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.getBulkUpdateState":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.getLastRestart":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.getLogs":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.getVersions":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.installFromWorkspace":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.installPackage":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.isWorkspaceAvailable":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.list":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.listActiveBulkUpdates":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.listCapabilityProviders":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.listFrameworkPackages":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.listPackages":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.listUpdates":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.listWorkspacePackages":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.onAddonLogs":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.reloadPackages":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.restartAddon":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.restartServer":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.retryLoad":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.rollbackPackage":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.searchAvailable":{capName:`addons`,capScope:`system`,addonId:null,access:`view`},"addons.setAddonAutoUpdate":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.setAutoUpdateSettings":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.setCapabilityProviderEnabled":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.startBulkUpdate":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.uninstallPackage":{capName:`addons`,capScope:`system`,addonId:null,access:`delete`},"addons.updateFrameworkPackage":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addons.updatePackage":{capName:`addons`,capScope:`system`,addonId:null,access:`create`},"addonSettings.getDeviceSettings":{capName:`addon-settings`,capScope:`system`,addonId:null,access:`view`},"addonSettings.getGlobalSettings":{capName:`addon-settings`,capScope:`system`,addonId:null,access:`view`},"addonSettings.updateDeviceSettings":{capName:`addon-settings`,capScope:`system`,addonId:null,access:`create`},"addonSettings.updateGlobalSettings":{capName:`addon-settings`,capScope:`system`,addonId:null,access:`create`},"addonWidgets.listWidgets":{capName:`addon-widgets`,capScope:`system`,addonId:null,access:`view`},"addonWidgetsSource.listWidgets":{capName:`addon-widgets-source`,capScope:`system`,addonId:null,access:`view`},"adminUi.getStaticDir":{capName:`admin-ui`,capScope:`system`,addonId:null,access:`view`},"adminUi.getVersion":{capName:`admin-ui`,capScope:`system`,addonId:null,access:`view`},"advancedNotifier.deleteRule":{capName:`advanced-notifier`,capScope:`system`,addonId:null,access:`delete`},"advancedNotifier.getHistory":{capName:`advanced-notifier`,capScope:`system`,addonId:null,access:`view`},"advancedNotifier.getRules":{capName:`advanced-notifier`,capScope:`system`,addonId:null,access:`view`},"advancedNotifier.testRule":{capName:`advanced-notifier`,capScope:`system`,addonId:null,access:`create`},"advancedNotifier.upsertRule":{capName:`advanced-notifier`,capScope:`system`,addonId:null,access:`create`},"alarmPanel.arm":{capName:`alarm-panel`,capScope:`device`,addonId:null,access:`create`},"alarmPanel.disarm":{capName:`alarm-panel`,capScope:`device`,addonId:null,access:`create`},"alarmPanel.trigger":{capName:`alarm-panel`,capScope:`device`,addonId:null,access:`create`},"alerts.dismiss":{capName:`alerts`,capScope:`system`,addonId:null,access:`create`},"alerts.emit":{capName:`alerts`,capScope:`system`,addonId:null,access:`create`},"alerts.getUnreadCount":{capName:`alerts`,capScope:`system`,addonId:null,access:`view`},"alerts.list":{capName:`alerts`,capScope:`system`,addonId:null,access:`view`},"alerts.markAllRead":{capName:`alerts`,capScope:`system`,addonId:null,access:`create`},"alerts.markRead":{capName:`alerts`,capScope:`system`,addonId:null,access:`create`},"alerts.update":{capName:`alerts`,capScope:`system`,addonId:null,access:`create`},"audioAnalysis.resolveDeviceSettings":{capName:`audio-analysis`,capScope:`device`,addonId:null,access:`view`},"audioAnalyzer.analyseChunk":{capName:`audio-analyzer`,capScope:`system`,addonId:null,access:`create`},"audioAnalyzer.classify":{capName:`audio-analyzer`,capScope:`system`,addonId:null,access:`view`},"audioAnalyzer.dispose":{capName:`audio-analyzer`,capScope:`system`,addonId:null,access:`create`},"audioAnalyzer.isReady":{capName:`audio-analyzer`,capScope:`system`,addonId:null,access:`view`},"audioAnalyzer.reprobeAudioEngine":{capName:`audio-analyzer`,capScope:`system`,addonId:null,access:`create`},"audioCodec.canHandle":{capName:`audio-codec`,capScope:`system`,addonId:null,access:`view`},"audioCodec.closeSession":{capName:`audio-codec`,capScope:`system`,addonId:null,access:`create`},"audioCodec.createDecodeSession":{capName:`audio-codec`,capScope:`system`,addonId:null,access:`create`},"audioCodec.createEncodeSession":{capName:`audio-codec`,capScope:`system`,addonId:null,access:`create`},"audioCodec.flushEncode":{capName:`audio-codec`,capScope:`system`,addonId:null,access:`create`},"audioCodec.listActiveSessions":{capName:`audio-codec`,capScope:`system`,addonId:null,access:`view`},"audioCodec.listSupportedCodecs":{capName:`audio-codec`,capScope:`system`,addonId:null,access:`view`},"audioCodec.pullEncoded":{capName:`audio-codec`,capScope:`system`,addonId:null,access:`view`},"audioCodec.pullPcm":{capName:`audio-codec`,capScope:`system`,addonId:null,access:`view`},"audioCodec.pushEncodedFrame":{capName:`audio-codec`,capScope:`system`,addonId:null,access:`create`},"audioCodec.pushPcm":{capName:`audio-codec`,capScope:`system`,addonId:null,access:`create`},"audioMetrics.getCurrentSnapshot":{capName:`audio-metrics`,capScope:`device`,addonId:null,access:`view`},"audioMetrics.getHistory":{capName:`audio-metrics`,capScope:`device`,addonId:null,access:`view`},"authProvider.getLoginUrl":{capName:`auth-provider`,capScope:`system`,addonId:null,access:`view`},"authProvider.handleCallback":{capName:`auth-provider`,capScope:`system`,addonId:null,access:`create`},"authProvider.validateCredentials":{capName:`auth-provider`,capScope:`system`,addonId:null,access:`create`},"authProvider.validateToken":{capName:`auth-provider`,capScope:`system`,addonId:null,access:`view`},"automationControl.disable":{capName:`automation-control`,capScope:`device`,addonId:null,access:`create`},"automationControl.enable":{capName:`automation-control`,capScope:`device`,addonId:null,access:`create`},"automationControl.trigger":{capName:`automation-control`,capScope:`device`,addonId:null,access:`create`},"backup.delete":{capName:`backup`,capScope:`system`,addonId:null,access:`delete`},"backup.getEntries":{capName:`backup`,capScope:`system`,addonId:null,access:`view`},"backup.list":{capName:`backup`,capScope:`system`,addonId:null,access:`view`},"backup.listArchives":{capName:`backup`,capScope:`system`,addonId:null,access:`view`},"backup.listDestinations":{capName:`backup`,capScope:`system`,addonId:null,access:`view`},"backup.listLocations":{capName:`backup`,capScope:`system`,addonId:null,access:`view`},"backup.previewSchedule":{capName:`backup`,capScope:`system`,addonId:null,access:`view`},"backup.restore":{capName:`backup`,capScope:`system`,addonId:null,access:`create`},"backup.trigger":{capName:`backup`,capScope:`system`,addonId:null,access:`create`},"backup.upsertDestinationPolicy":{capName:`backup`,capScope:`system`,addonId:null,access:`create`},"battery.wakeForStream":{capName:`battery`,capScope:`device`,addonId:null,access:`create`},"brightness.setBrightness":{capName:`brightness`,capScope:`device`,addonId:null,access:`create`},"broker.add":{capName:`broker`,capScope:`system`,addonId:null,access:`create`},"broker.get":{capName:`broker`,capScope:`system`,addonId:null,access:`view`},"broker.getBrokerConfig":{capName:`broker`,capScope:`system`,addonId:null,access:`view`},"broker.getSettings":{capName:`broker`,capScope:`system`,addonId:null,access:`view`},"broker.getSettingsSchema":{capName:`broker`,capScope:`system`,addonId:null,access:`view`},"broker.getState":{capName:`broker`,capScope:`system`,addonId:null,access:`view`},"broker.getStatus":{capName:`broker`,capScope:`system`,addonId:null,access:`view`},"broker.list":{capName:`broker`,capScope:`system`,addonId:null,access:`view`},"broker.listProviders":{capName:`broker`,capScope:`system`,addonId:null,access:`view`},"broker.publish":{capName:`broker`,capScope:`system`,addonId:null,access:`create`},"broker.remove":{capName:`broker`,capScope:`system`,addonId:null,access:`delete`},"broker.setSettings":{capName:`broker`,capScope:`system`,addonId:null,access:`create`},"broker.subscribe":{capName:`broker`,capScope:`system`,addonId:null,access:`create`},"broker.testConnection":{capName:`broker`,capScope:`system`,addonId:null,access:`create`},"broker.testSettings":{capName:`broker`,capScope:`system`,addonId:null,access:`create`},"broker.unsubscribe":{capName:`broker`,capScope:`system`,addonId:null,access:`create`},"button.press":{capName:`button`,capScope:`device`,addonId:null,access:`create`},"cameraCredentials.getCredentials":{capName:`camera-credentials`,capScope:`device`,addonId:null,access:`view`},"cameraStreams.getBrokerStreams":{capName:`camera-streams`,capScope:`device`,addonId:null,access:`view`},"cameraStreams.getCameraStreams":{capName:`camera-streams`,capScope:`device`,addonId:null,access:`view`},"cameraStreams.getProfileRtspEntries":{capName:`camera-streams`,capScope:`device`,addonId:null,access:`view`},"cameraStreams.getRtspEntries":{capName:`camera-streams`,capScope:`device`,addonId:null,access:`view`},"cameraStreams.pickStream":{capName:`camera-streams`,capScope:`device`,addonId:null,access:`view`},"climateControl.setFanMode":{capName:`climate-control`,capScope:`device`,addonId:null,access:`create`},"climateControl.setMode":{capName:`climate-control`,capScope:`device`,addonId:null,access:`create`},"climateControl.setPreset":{capName:`climate-control`,capScope:`device`,addonId:null,access:`create`},"climateControl.setTarget":{capName:`climate-control`,capScope:`device`,addonId:null,access:`create`},"climateControl.setTargetHumidity":{capName:`climate-control`,capScope:`device`,addonId:null,access:`create`},"climateControl.setTargetRange":{capName:`climate-control`,capScope:`device`,addonId:null,access:`create`},"color.setColor":{capName:`color`,capScope:`device`,addonId:null,access:`create`},"consumables.reset":{capName:`consumables`,capScope:`device`,addonId:null,access:`delete`},"control.setValue":{capName:`control`,capScope:`device`,addonId:null,access:`create`},"cover.close":{capName:`cover`,capScope:`device`,addonId:null,access:`create`},"cover.open":{capName:`cover`,capScope:`device`,addonId:null,access:`create`},"cover.setPosition":{capName:`cover`,capScope:`device`,addonId:null,access:`create`},"cover.setTiltPosition":{capName:`cover`,capScope:`device`,addonId:null,access:`create`},"cover.stop":{capName:`cover`,capScope:`device`,addonId:null,access:`create`},"decoder.createSession":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"decoder.destroySession":{capName:`decoder`,capScope:`system`,addonId:null,access:`delete`},"decoder.getFrame":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"decoder.getInfo":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"decoder.getShmStats":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"decoder.getStats":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"decoder.listActiveSessions":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"decoder.openStream":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"decoder.pullFrames":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"decoder.pullHandles":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"decoder.pushPacket":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"decoder.reprobeHwaccel":{capName:`decoder`,capScope:`system`,addonId:null,access:`create`},"decoder.supportsCodec":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"decoder.updateConfig":{capName:`decoder`,capScope:`system`,addonId:null,access:`view`},"deviceAdoption.adopt":{capName:`device-adoption`,capScope:`system`,addonId:null,access:`create`},"deviceAdoption.getCandidate":{capName:`device-adoption`,capScope:`system`,addonId:null,access:`view`},"deviceAdoption.listCandidateFilters":{capName:`device-adoption`,capScope:`system`,addonId:null,access:`view`},"deviceAdoption.listCandidates":{capName:`device-adoption`,capScope:`system`,addonId:null,access:`view`},"deviceAdoption.refresh":{capName:`device-adoption`,capScope:`system`,addonId:null,access:`create`},"deviceAdoption.release":{capName:`device-adoption`,capScope:`system`,addonId:null,access:`create`},"deviceAdoption.resync":{capName:`device-adoption`,capScope:`system`,addonId:null,access:`create`},"deviceDiscovery.adoptDevice":{capName:`device-discovery`,capScope:`device`,addonId:null,access:`create`},"deviceDiscovery.listDiscovered":{capName:`device-discovery`,capScope:`device`,addonId:null,access:`view`},"deviceDiscovery.refreshDiscovery":{capName:`device-discovery`,capScope:`device`,addonId:null,access:`create`},"deviceDiscovery.releaseDevice":{capName:`device-discovery`,capScope:`device`,addonId:null,access:`create`},"deviceExport.exposeDevice":{capName:`device-export`,capScope:`system`,addonId:null,access:`create`},"deviceExport.getStatus":{capName:`device-export`,capScope:`system`,addonId:null,access:`view`},"deviceExport.listExposedDevices":{capName:`device-export`,capScope:`system`,addonId:null,access:`view`},"deviceExport.listSupportedDeviceKinds":{capName:`device-export`,capScope:`system`,addonId:null,access:`view`},"deviceExport.unexposeDevice":{capName:`device-export`,capScope:`system`,addonId:null,access:`create`},"deviceManager.addLocation":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.adoptDevice":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.adoptionAdopt":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.adoptionListCandidates":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.adoptionRefresh":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.adoptionRelease":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.allocateDeviceId":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.applyInitialMeta":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.createDevice":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.disable":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.discoverDevices":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.enable":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.getAllBindings":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getBindings":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getChildren":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getConfigSchema":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getCreationSchema":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getDevice":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getDeviceAggregate":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getDeviceLiveInfoAggregate":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getDeviceSettingsAggregate":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getDeviceStatusAggregate":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getSettingsSchema":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getStreamProfileMap":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getStreamSources":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.getWireableFields":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.listAll":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.listBindableCapsForDeviceType":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.listLocations":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.listPersistedByAddon":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.listWrappersForCap":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.loadConfig":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.loadMeta":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.loadRuntimeState":{capName:`device-manager`,capScope:`system`,addonId:null,access:`view`},"deviceManager.persistConfig":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.probeStreams":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.registerDevice":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.remove":{capName:`device-manager`,capScope:`system`,addonId:null,access:`delete`},"deviceManager.removeByIntegration":{capName:`device-manager`,capScope:`system`,addonId:null,access:`delete`},"deviceManager.removeDevice":{capName:`device-manager`,capScope:`system`,addonId:null,access:`delete`},"deviceManager.removeLocation":{capName:`device-manager`,capScope:`system`,addonId:null,access:`delete`},"deviceManager.runDeviceAction":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setChildLayout":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setDeviceLinks":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setDisabled":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setIntegrationId":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setLinkDeviceId":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setLocation":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setMetadata":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setName":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setPrimaryChildEntityId":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setRole":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setStreamProfileMap":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setType":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.setWrapperActive":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.testCreationField":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.testField":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.updateConfig":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.updateDeviceField":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceManager.updateDeviceFieldsBatch":{capName:`device-manager`,capScope:`system`,addonId:null,access:`create`},"deviceOps.getConfigEntries":{capName:`device-ops`,capScope:`device`,addonId:null,access:`view`},"deviceOps.getRawState":{capName:`device-ops`,capScope:`device`,addonId:null,access:`view`},"deviceOps.getSettingsSchema":{capName:`device-ops`,capScope:`device`,addonId:null,access:`view`},"deviceOps.getStreamSources":{capName:`device-ops`,capScope:`device`,addonId:null,access:`view`},"deviceOps.removeDevice":{capName:`device-ops`,capScope:`device`,addonId:null,access:`delete`},"deviceOps.runAction":{capName:`device-ops`,capScope:`device`,addonId:null,access:`create`},"deviceOps.setConfig":{capName:`device-ops`,capScope:`device`,addonId:null,access:`create`},"deviceProvider.adoptDiscoveredDevice":{capName:`device-provider`,capScope:`system`,addonId:null,access:`create`},"deviceProvider.createDevice":{capName:`device-provider`,capScope:`system`,addonId:null,access:`create`},"deviceProvider.discoverDevices":{capName:`device-provider`,capScope:`system`,addonId:null,access:`create`},"deviceProvider.getChildCreationSchema":{capName:`device-provider`,capScope:`system`,addonId:null,access:`view`},"deviceProvider.getDevices":{capName:`device-provider`,capScope:`system`,addonId:null,access:`view`},"deviceProvider.getStatus":{capName:`device-provider`,capScope:`system`,addonId:null,access:`view`},"deviceProvider.start":{capName:`device-provider`,capScope:`system`,addonId:null,access:`create`},"deviceProvider.stop":{capName:`device-provider`,capScope:`system`,addonId:null,access:`create`},"deviceProvider.supportsDiscovery":{capName:`device-provider`,capScope:`system`,addonId:null,access:`view`},"deviceProvider.supportsManualCreation":{capName:`device-provider`,capScope:`system`,addonId:null,access:`view`},"deviceProvider.testCreationField":{capName:`device-provider`,capScope:`system`,addonId:null,access:`create`},"deviceState.getAllSnapshots":{capName:`device-state`,capScope:`system`,addonId:null,access:`view`},"deviceState.getCapSlice":{capName:`device-state`,capScope:`system`,addonId:null,access:`view`},"deviceState.getSnapshot":{capName:`device-state`,capScope:`system`,addonId:null,access:`view`},"deviceState.setCapSlice":{capName:`device-state`,capScope:`system`,addonId:null,access:`create`},"embeddingEncoder.encode":{capName:`embedding-encoder`,capScope:`system`,addonId:null,access:`view`},"embeddingEncoder.encodeText":{capName:`embedding-encoder`,capScope:`system`,addonId:null,access:`view`},"embeddingEncoder.getInfo":{capName:`embedding-encoder`,capScope:`system`,addonId:null,access:`view`},"events.getEventClipUrl":{capName:`events`,capScope:`device`,addonId:null,access:`view`},"events.getEvents":{capName:`events`,capScope:`device`,addonId:null,access:`view`},"events.getEventThumbnail":{capName:`events`,capScope:`device`,addonId:null,access:`view`},"faceGallery.assignFace":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`create`},"faceGallery.assignFaces":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`create`},"faceGallery.createIdentity":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`create`},"faceGallery.deleteFace":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`delete`},"faceGallery.deleteIdentity":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`delete`},"faceGallery.getFaceByTrack":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`view`},"faceGallery.getFaceMedia":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`view`},"faceGallery.listIdentities":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`view`},"faceGallery.listIdentitySamples":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`view`},"faceGallery.listRecentFaces":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`view`},"faceGallery.removeSample":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`delete`},"faceGallery.renameIdentity":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`create`},"faceGallery.suggestFaceClusters":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`view`},"faceGallery.unassignFace":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`create`},"faceGallery.unassignFaces":{capName:`face-gallery`,capScope:`system`,addonId:null,access:`create`},"fanControl.setDirection":{capName:`fan-control`,capScope:`device`,addonId:null,access:`create`},"fanControl.setOscillating":{capName:`fan-control`,capScope:`device`,addonId:null,access:`create`},"fanControl.setPercentage":{capName:`fan-control`,capScope:`device`,addonId:null,access:`create`},"fanControl.setPreset":{capName:`fan-control`,capScope:`device`,addonId:null,access:`create`},"filesystemBrowse.browse":{capName:`filesystem-browse`,capScope:`system`,addonId:null,access:`view`},"filesystemBrowse.createDir":{capName:`filesystem-browse`,capScope:`system`,addonId:null,access:`create`},"filesystemBrowse.listAllowedRoots":{capName:`filesystem-browse`,capScope:`system`,addonId:null,access:`view`},"humidifier.setMode":{capName:`humidifier`,capScope:`device`,addonId:null,access:`create`},"humidifier.setOn":{capName:`humidifier`,capScope:`device`,addonId:null,access:`create`},"humidifier.setTargetHumidity":{capName:`humidifier`,capScope:`device`,addonId:null,access:`create`},"integrations.create":{capName:`integrations`,capScope:`system`,addonId:null,access:`create`},"integrations.delete":{capName:`integrations`,capScope:`system`,addonId:null,access:`delete`},"integrations.get":{capName:`integrations`,capScope:`system`,addonId:null,access:`view`},"integrations.getAvailableTypes":{capName:`integrations`,capScope:`system`,addonId:null,access:`view`},"integrations.getByAddonId":{capName:`integrations`,capScope:`system`,addonId:null,access:`view`},"integrations.getSettings":{capName:`integrations`,capScope:`system`,addonId:null,access:`view`},"integrations.list":{capName:`integrations`,capScope:`system`,addonId:null,access:`view`},"integrations.setSettings":{capName:`integrations`,capScope:`system`,addonId:null,access:`create`},"integrations.testConnection":{capName:`integrations`,capScope:`system`,addonId:null,access:`create`},"integrations.update":{capName:`integrations`,capScope:`system`,addonId:null,access:`create`},"intercom.endTalkSession":{capName:`intercom`,capScope:`device`,addonId:null,access:`create`},"intercom.handleAnswer":{capName:`intercom`,capScope:`device`,addonId:null,access:`create`},"intercom.pushTalkAudio":{capName:`intercom`,capScope:`device`,addonId:null,access:`create`},"intercom.startSession":{capName:`intercom`,capScope:`device`,addonId:null,access:`create`},"intercom.startTalkSession":{capName:`intercom`,capScope:`device`,addonId:null,access:`create`},"intercom.stopSession":{capName:`intercom`,capScope:`device`,addonId:null,access:`create`},"lawnMowerControl.dock":{capName:`lawn-mower-control`,capScope:`device`,addonId:null,access:`create`},"lawnMowerControl.pause":{capName:`lawn-mower-control`,capScope:`device`,addonId:null,access:`create`},"lawnMowerControl.startMowing":{capName:`lawn-mower-control`,capScope:`device`,addonId:null,access:`create`},"localNetwork.getAllowedAddresses":{capName:`local-network`,capScope:`system`,addonId:null,access:`view`},"localNetwork.getConnectionEndpoints":{capName:`local-network`,capScope:`system`,addonId:null,access:`view`},"localNetwork.getPreferred":{capName:`local-network`,capScope:`system`,addonId:null,access:`view`},"localNetwork.list":{capName:`local-network`,capScope:`system`,addonId:null,access:`view`},"localNetwork.resetAllowlistToBestMatch":{capName:`local-network`,capScope:`system`,addonId:null,access:`delete`},"localNetwork.setAllowedAddresses":{capName:`local-network`,capScope:`system`,addonId:null,access:`create`},"lockControl.lock":{capName:`lock-control`,capScope:`device`,addonId:null,access:`create`},"lockControl.open":{capName:`lock-control`,capScope:`device`,addonId:null,access:`create`},"lockControl.unlock":{capName:`lock-control`,capScope:`device`,addonId:null,access:`create`},"logDestination.query":{capName:`log-destination`,capScope:`system`,addonId:null,access:`view`},"logDestination.write":{capName:`log-destination`,capScope:`system`,addonId:null,access:`create`},"mediaPlayer.next":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"mediaPlayer.pause":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"mediaPlayer.play":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"mediaPlayer.playMedia":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"mediaPlayer.previous":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"mediaPlayer.seek":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"mediaPlayer.selectSource":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"mediaPlayer.setMute":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"mediaPlayer.setRepeat":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"mediaPlayer.setShuffle":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"mediaPlayer.setVolume":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"mediaPlayer.stop":{capName:`media-player`,capScope:`device`,addonId:null,access:`create`},"meshNetwork.getStatus":{capName:`mesh-network`,capScope:`system`,addonId:null,access:`view`},"meshNetwork.join":{capName:`mesh-network`,capScope:`system`,addonId:null,access:`create`},"meshNetwork.leave":{capName:`mesh-network`,capScope:`system`,addonId:null,access:`create`},"meshNetwork.listPeers":{capName:`mesh-network`,capScope:`system`,addonId:null,access:`view`},"meshNetwork.logout":{capName:`mesh-network`,capScope:`system`,addonId:null,access:`create`},"meshNetwork.startLogin":{capName:`mesh-network`,capScope:`system`,addonId:null,access:`create`},"meshNetwork.testConnection":{capName:`mesh-network`,capScope:`system`,addonId:null,access:`create`},"metricsProvider.collectSnapshot":{capName:`metrics-provider`,capScope:`system`,addonId:null,access:`view`},"metricsProvider.getAddonStats":{capName:`metrics-provider`,capScope:`system`,addonId:null,access:`view`},"metricsProvider.getCached":{capName:`metrics-provider`,capScope:`system`,addonId:null,access:`view`},"metricsProvider.getCpuTemperature":{capName:`metrics-provider`,capScope:`system`,addonId:null,access:`view`},"metricsProvider.getCurrent":{capName:`metrics-provider`,capScope:`system`,addonId:null,access:`view`},"metricsProvider.getDiskSpace":{capName:`metrics-provider`,capScope:`system`,addonId:null,access:`view`},"metricsProvider.getGpuInfo":{capName:`metrics-provider`,capScope:`system`,addonId:null,access:`view`},"metricsProvider.getProcessStats":{capName:`metrics-provider`,capScope:`system`,addonId:null,access:`view`},"metricsProvider.killProcess":{capName:`metrics-provider`,capScope:`system`,addonId:null,access:`create`},"metricsProvider.listAddonInstances":{capName:`metrics-provider`,capScope:`system`,addonId:null,access:`view`},"metricsProvider.listNodeProcesses":{capName:`metrics-provider`,capScope:`system`,addonId:null,access:`view`},"motion.isDetected":{capName:`motion`,capScope:`device`,addonId:null,access:`view`},"motionDetection.analyze":{capName:`motion-detection`,capScope:`device`,addonId:null,access:`create`},"motionDetection.removeCamera":{capName:`motion-detection`,capScope:`device`,addonId:null,access:`delete`},"motionDetection.reset":{capName:`motion-detection`,capScope:`device`,addonId:null,access:`delete`},"motionTrigger.setMotionTrigger":{capName:`motion-trigger`,capScope:`device`,addonId:null,access:`create`},"motionZones.getOptions":{capName:`motion-zones`,capScope:`device`,addonId:null,access:`view`},"motionZones.setZone":{capName:`motion-zones`,capScope:`device`,addonId:null,access:`create`},"mqttBroker.addBroker":{capName:`mqtt-broker`,capScope:`system`,addonId:null,access:`create`},"mqttBroker.getBrokerConfig":{capName:`mqtt-broker`,capScope:`system`,addonId:null,access:`view`},"mqttBroker.getStatus":{capName:`mqtt-broker`,capScope:`system`,addonId:null,access:`view`},"mqttBroker.listBrokers":{capName:`mqtt-broker`,capScope:`system`,addonId:null,access:`view`},"mqttBroker.removeBroker":{capName:`mqtt-broker`,capScope:`system`,addonId:null,access:`delete`},"mqttBroker.startEmbeddedBroker":{capName:`mqtt-broker`,capScope:`system`,addonId:null,access:`create`},"mqttBroker.stopEmbeddedBroker":{capName:`mqtt-broker`,capScope:`system`,addonId:null,access:`create`},"mqttBroker.testConnection":{capName:`mqtt-broker`,capScope:`system`,addonId:null,access:`create`},"nativeObjectDetection.setEnabled":{capName:`native-object-detection`,capScope:`device`,addonId:null,access:`create`},"networkAccess.getEndpoint":{capName:`network-access`,capScope:`system`,addonId:null,access:`view`},"networkAccess.getStatus":{capName:`network-access`,capScope:`system`,addonId:null,access:`view`},"networkAccess.listEndpoints":{capName:`network-access`,capScope:`system`,addonId:null,access:`view`},"networkAccess.start":{capName:`network-access`,capScope:`system`,addonId:null,access:`create`},"networkAccess.stop":{capName:`network-access`,capScope:`system`,addonId:null,access:`create`},"networkQuality.getAllStats":{capName:`network-quality`,capScope:`system`,addonId:null,access:`view`},"networkQuality.getDeviceStats":{capName:`network-quality`,capScope:`system`,addonId:null,access:`view`},"networkQuality.reportClientStats":{capName:`network-quality`,capScope:`system`,addonId:null,access:`create`},"nodes.clusterAddonStatus":{capName:`nodes`,capScope:`system`,addonId:null,access:`view`},"nodes.deployAddon":{capName:`nodes`,capScope:`system`,addonId:null,access:`create`},"nodes.executeQuery":{capName:`nodes`,capScope:`system`,addonId:null,access:`create`},"nodes.getCapUsageGraph":{capName:`nodes`,capScope:`system`,addonId:null,access:`view`},"nodes.getNodeAddons":{capName:`nodes`,capScope:`system`,addonId:null,access:`view`},"nodes.renameNode":{capName:`nodes`,capScope:`system`,addonId:null,access:`create`},"nodes.restartAddon":{capName:`nodes`,capScope:`system`,addonId:null,access:`create`},"nodes.restartNode":{capName:`nodes`,capScope:`system`,addonId:null,access:`create`},"nodes.restartProcess":{capName:`nodes`,capScope:`system`,addonId:null,access:`create`},"nodes.setProcessLogLevel":{capName:`nodes`,capScope:`system`,addonId:null,access:`create`},"nodes.shutdownNode":{capName:`nodes`,capScope:`system`,addonId:null,access:`create`},"nodes.topology":{capName:`nodes`,capScope:`system`,addonId:null,access:`view`},"nodes.undeployAddon":{capName:`nodes`,capScope:`system`,addonId:null,access:`create`},"notificationOutput.send":{capName:`notification-output`,capScope:`system`,addonId:null,access:`create`},"notificationOutput.sendTest":{capName:`notification-output`,capScope:`system`,addonId:null,access:`create`},"notifier.cancel":{capName:`notifier`,capScope:`device`,addonId:null,access:`create`},"notifier.send":{capName:`notifier`,capScope:`device`,addonId:null,access:`create`},"oauthIntegration.getDescriptor":{capName:`oauth-integration`,capScope:`system`,addonId:null,access:`view`},"osd.setOverlay":{capName:`osd`,capScope:`device`,addonId:null,access:`create`},"pipelineAnalytics.clearTracks":{capName:`pipeline-analytics`,capScope:`device`,addonId:null,access:`delete`},"pipelineAnalytics.getActiveTracks":{capName:`pipeline-analytics`,capScope:`device`,addonId:null,access:`view`},"pipelineAnalytics.getAudioEvents":{capName:`pipeline-analytics`,capScope:`device`,addonId:null,access:`view`},"pipelineAnalytics.getEventDensity":{capName:`pipeline-analytics`,capScope:`device`,addonId:null,access:`view`},"pipelineAnalytics.getEventMedia":{capName:`pipeline-analytics`,capScope:`device`,addonId:null,access:`view`},"pipelineAnalytics.getMotionEvents":{capName:`pipeline-analytics`,capScope:`device`,addonId:null,access:`view`},"pipelineAnalytics.getObjectEvents":{capName:`pipeline-analytics`,capScope:`device`,addonId:null,access:`view`},"pipelineAnalytics.getTrack":{capName:`pipeline-analytics`,capScope:`device`,addonId:null,access:`view`},"pipelineAnalytics.getTrackMedia":{capName:`pipeline-analytics`,capScope:`device`,addonId:null,access:`view`},"pipelineAnalytics.listTracks":{capName:`pipeline-analytics`,capScope:`device`,addonId:null,access:`view`},"pipelineAnalytics.pruneEventsBefore":{capName:`pipeline-analytics`,capScope:`device`,addonId:null,access:`create`},"pipelineExecutor.cacheFrameInPool":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.deleteModel":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`delete`},"pipelineExecutor.deleteTemplate":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`delete`},"pipelineExecutor.detect":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.downloadModel":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.getAddonModels":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getAudioCapabilities":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getAvailableEngines":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getCapabilities":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getDefaultSteps":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getDetectionConfigSchema":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getEffectiveTuning":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getGlobalPipelineConfig":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getGlobalSteps":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getOrchestratorConfigSchema":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getReferenceAudio":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getReferenceAudioFiles":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getReferenceImage":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getSchema":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getSelectedEngine":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.getVideoPipelineSteps":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.inferCached":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.killEngine":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.listLoadedEngines":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.listReferenceImages":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.listTemplates":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`view`},"pipelineExecutor.reprobeEngine":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.runAudioTest":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.runPipeline":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.runPipelineBatch":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.saveTemplate":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.setVideoPipelineSteps":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.spinEngine":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.uncacheFrame":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineExecutor.updateTemplate":{capName:`pipeline-executor`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.assignAudio":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.assignDecoder":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.assignPipeline":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.deleteTemplate":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`delete`},"pipelineOrchestrator.getAgentLoad":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getAgentSettings":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getAudioAssignment":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getAudioAssignments":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getAudioNodeLoad":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getCameraMetrics":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getCameraSettings":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getCameraStepOverrides":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getCapabilityBindings":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getDecoderAssignment":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getDecoderAssignments":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getGlobalMetrics":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getPipelineAssignment":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.getPipelineAssignments":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.listAgentSettings":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.listTemplates":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.rebalance":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.removeAgentSettings":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`delete`},"pipelineOrchestrator.resolvePipeline":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`view`},"pipelineOrchestrator.saveTemplate":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.setAgentAddonDefaults":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.setCameraPipelineForAgent":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.setCameraStepOverride":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.setCameraStepToggle":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.setCapabilityBinding":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.unassignAudio":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.unassignDecoder":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.unassignPipeline":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineOrchestrator.updateTemplate":{capName:`pipeline-orchestrator`,capScope:`system`,addonId:null,access:`create`},"pipelineRunner.attachCamera":{capName:`pipeline-runner`,capScope:`system`,addonId:null,access:`create`},"pipelineRunner.detachCamera":{capName:`pipeline-runner`,capScope:`system`,addonId:null,access:`create`},"pipelineRunner.getAllCameraMetrics":{capName:`pipeline-runner`,capScope:`system`,addonId:null,access:`view`},"pipelineRunner.getCameraMetrics":{capName:`pipeline-runner`,capScope:`system`,addonId:null,access:`view`},"pipelineRunner.getLocalCameras":{capName:`pipeline-runner`,capScope:`system`,addonId:null,access:`view`},"pipelineRunner.getLocalLoad":{capName:`pipeline-runner`,capScope:`system`,addonId:null,access:`view`},"pipelineRunner.getLocalMetrics":{capName:`pipeline-runner`,capScope:`system`,addonId:null,access:`view`},"pipelineRunner.reportMotion":{capName:`pipeline-runner`,capScope:`system`,addonId:null,access:`create`},"plateGallery.correctPlateText":{capName:`plate-gallery`,capScope:`system`,addonId:null,access:`create`},"plateGallery.deletePlate":{capName:`plate-gallery`,capScope:`system`,addonId:null,access:`delete`},"plateGallery.getPlateByTrack":{capName:`plate-gallery`,capScope:`system`,addonId:null,access:`view`},"plateGallery.getPlateMedia":{capName:`plate-gallery`,capScope:`system`,addonId:null,access:`view`},"plateGallery.listPlates":{capName:`plate-gallery`,capScope:`system`,addonId:null,access:`view`},"plateGallery.searchPlates":{capName:`plate-gallery`,capScope:`system`,addonId:null,access:`view`},"plateGallery.suggestPlateClusters":{capName:`plate-gallery`,capScope:`system`,addonId:null,access:`view`},"platformProbe.getCapabilities":{capName:`platform-probe`,capScope:`system`,addonId:null,access:`view`},"platformProbe.getHardware":{capName:`platform-probe`,capScope:`system`,addonId:null,access:`view`},"platformProbe.getHardwareDecodeAccels":{capName:`platform-probe`,capScope:`system`,addonId:null,access:`view`},"platformProbe.getHardwareEncoders":{capName:`platform-probe`,capScope:`system`,addonId:null,access:`view`},"platformProbe.refreshHardwareDecodeAccels":{capName:`platform-probe`,capScope:`system`,addonId:null,access:`create`},"platformProbe.refreshHardwareEncoders":{capName:`platform-probe`,capScope:`system`,addonId:null,access:`create`},"platformProbe.resolveHwAccel":{capName:`platform-probe`,capScope:`system`,addonId:null,access:`view`},"platformProbe.resolveInferenceConfig":{capName:`platform-probe`,capScope:`system`,addonId:null,access:`view`},"privacyMask.getOptions":{capName:`privacy-mask`,capScope:`device`,addonId:null,access:`view`},"privacyMask.setMask":{capName:`privacy-mask`,capScope:`device`,addonId:null,access:`create`},"ptz.continuousMove":{capName:`ptz`,capScope:`device`,addonId:null,access:`create`},"ptz.deletePreset":{capName:`ptz`,capScope:`device`,addonId:null,access:`delete`},"ptz.getOptions":{capName:`ptz`,capScope:`device`,addonId:null,access:`view`},"ptz.getPosition":{capName:`ptz`,capScope:`device`,addonId:null,access:`view`},"ptz.getPresets":{capName:`ptz`,capScope:`device`,addonId:null,access:`view`},"ptz.goHome":{capName:`ptz`,capScope:`device`,addonId:null,access:`create`},"ptz.goToPreset":{capName:`ptz`,capScope:`device`,addonId:null,access:`create`},"ptz.move":{capName:`ptz`,capScope:`device`,addonId:null,access:`create`},"ptz.savePreset":{capName:`ptz`,capScope:`device`,addonId:null,access:`create`},"ptz.setAutofocus":{capName:`ptz`,capScope:`device`,addonId:null,access:`create`},"ptz.stop":{capName:`ptz`,capScope:`device`,addonId:null,access:`create`},"ptzAutotrack.getSettings":{capName:`ptz-autotrack`,capScope:`device`,addonId:null,access:`view`},"ptzAutotrack.getStatus":{capName:`ptz-autotrack`,capScope:`device`,addonId:null,access:`view`},"ptzAutotrack.setEnabled":{capName:`ptz-autotrack`,capScope:`device`,addonId:null,access:`create`},"ptzAutotrack.setSettings":{capName:`ptz-autotrack`,capScope:`device`,addonId:null,access:`create`},"reboot.reboot":{capName:`reboot`,capScope:`device`,addonId:null,access:`create`},"recording.getAvailability":{capName:`recording`,capScope:`system`,addonId:null,access:`view`},"recording.getDaysWithRecordings":{capName:`recording`,capScope:`system`,addonId:null,access:`view`},"recording.getDeviceConfig":{capName:`recording`,capScope:`system`,addonId:null,access:`view`},"recording.getPlaybackManifest":{capName:`recording`,capScope:`system`,addonId:null,access:`view`},"recording.getStorageUsage":{capName:`recording`,capScope:`system`,addonId:null,access:`view`},"recording.locateSegment":{capName:`recording`,capScope:`system`,addonId:null,access:`view`},"recording.pruneFootage":{capName:`recording`,capScope:`system`,addonId:null,access:`create`},"recording.readSegmentBytes":{capName:`recording`,capScope:`system`,addonId:null,access:`view`},"recording.rescanStorage":{capName:`recording`,capScope:`system`,addonId:null,access:`create`},"recording.setDeviceConfig":{capName:`recording`,capScope:`system`,addonId:null,access:`create`},"restreamer.getExposedResources":{capName:`restreamer`,capScope:`system`,addonId:null,access:`view`},"restreamer.registerDevice":{capName:`restreamer`,capScope:`system`,addonId:null,access:`create`},"restreamer.unregisterDevice":{capName:`restreamer`,capScope:`system`,addonId:null,access:`delete`},"scriptRunner.run":{capName:`script-runner`,capScope:`device`,addonId:null,access:`create`},"scriptRunner.stop":{capName:`script-runner`,capScope:`device`,addonId:null,access:`create`},"settingsStore.count":{capName:`settings-store`,capScope:`system`,addonId:null,access:`view`},"settingsStore.declareCollection":{capName:`settings-store`,capScope:`system`,addonId:null,access:`create`},"settingsStore.delete":{capName:`settings-store`,capScope:`system`,addonId:null,access:`delete`},"settingsStore.get":{capName:`settings-store`,capScope:`system`,addonId:null,access:`view`},"settingsStore.histogram":{capName:`settings-store`,capScope:`system`,addonId:null,access:`view`},"settingsStore.insert":{capName:`settings-store`,capScope:`system`,addonId:null,access:`create`},"settingsStore.isEmpty":{capName:`settings-store`,capScope:`system`,addonId:null,access:`view`},"settingsStore.query":{capName:`settings-store`,capScope:`system`,addonId:null,access:`view`},"settingsStore.set":{capName:`settings-store`,capScope:`system`,addonId:null,access:`create`},"settingsStore.update":{capName:`settings-store`,capScope:`system`,addonId:null,access:`create`},"smtpProvider.getStatus":{capName:`smtp-provider`,capScope:`system`,addonId:null,access:`view`},"smtpProvider.sendEmail":{capName:`smtp-provider`,capScope:`system`,addonId:null,access:`create`},"smtpProvider.verify":{capName:`smtp-provider`,capScope:`system`,addonId:null,access:`view`},"snapshot.getSnapshot":{capName:`snapshot`,capScope:`device`,addonId:null,access:`view`},"snapshot.invalidateCache":{capName:`snapshot`,capScope:`device`,addonId:null,access:`create`},"snapshotProvider.getSnapshot":{capName:`snapshot-provider`,capScope:`system`,addonId:null,access:`view`},"snapshotProvider.supportsDevice":{capName:`snapshot-provider`,capScope:`system`,addonId:null,access:`view`},"ssoBridge.signBridgeToken":{capName:`sso-bridge`,capScope:`system`,addonId:null,access:`view`},"ssoBridge.verifyBridgeToken":{capName:`sso-bridge`,capScope:`system`,addonId:null,access:`view`},"storage.abortUpload":{capName:`storage`,capScope:`system`,addonId:null,access:`create`},"storage.beginDownload":{capName:`storage`,capScope:`system`,addonId:null,access:`create`},"storage.beginUpload":{capName:`storage`,capScope:`system`,addonId:null,access:`create`},"storage.delete":{capName:`storage`,capScope:`system`,addonId:null,access:`delete`},"storage.deleteLocation":{capName:`storage`,capScope:`system`,addonId:null,access:`delete`},"storage.endDownload":{capName:`storage`,capScope:`system`,addonId:null,access:`create`},"storage.exists":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.finalizeUpload":{capName:`storage`,capScope:`system`,addonId:null,access:`create`},"storage.getAvailableSpace":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.getDefaultLocation":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.list":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.listLocationDeclarations":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.listLocations":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.listProviders":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.read":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.readChunk":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.resolve":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.testConfig":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.testLocation":{capName:`storage`,capScope:`system`,addonId:null,access:`view`},"storage.upsertLocation":{capName:`storage`,capScope:`system`,addonId:null,access:`create`},"storage.write":{capName:`storage`,capScope:`system`,addonId:null,access:`create`},"storage.writeChunk":{capName:`storage`,capScope:`system`,addonId:null,access:`create`},"storageEvictable.evict":{capName:`storage-evictable`,capScope:`system`,addonId:null,access:`create`},"storageEvictable.getEvictableUsage":{capName:`storage-evictable`,capScope:`system`,addonId:null,access:`view`},"storageProvider.abortUpload":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`create`},"storageProvider.beginDownload":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`create`},"storageProvider.beginUpload":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`create`},"storageProvider.delete":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`delete`},"storageProvider.endDownload":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`create`},"storageProvider.exists":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`view`},"storageProvider.finalizeUpload":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`create`},"storageProvider.getAvailableSpace":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`view`},"storageProvider.getProviderInfo":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`view`},"storageProvider.list":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`view`},"storageProvider.read":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`view`},"storageProvider.readChunk":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`view`},"storageProvider.resolve":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`view`},"storageProvider.testLocation":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`view`},"storageProvider.write":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`create`},"storageProvider.writeChunk":{capName:`storage-provider`,capScope:`system`,addonId:null,access:`create`},"streamBroker.assignProfile":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.getAllRtspEntries":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.getBrokerStats":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.getPreBufferInfo":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.getRtspEntry":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.getRtspPort":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.getStreamUrl":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.getStreamWithCodec":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.isRtspEnabled":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.killClient":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.listAllCameraStreams":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.listAllProfileSlots":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.listClients":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.probeStream":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.publishCameraStream":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.pullAudioChunks":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.pullFrameHandles":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`view`},"streamBroker.regenerateRtspToken":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.releaseStreamWithCodec":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.restartProfile":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.retractCameraStream":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.setPreBufferDuration":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.setRtspEnabled":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.subscribeAudioChunks":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.subscribeFrames":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.unassignProfile":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.unsubscribeAudioChunks":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamBroker.unsubscribeFrames":{capName:`stream-broker`,capScope:`system`,addonId:null,access:`create`},"streamCatalog.getCatalog":{capName:`stream-catalog`,capScope:`device`,addonId:null,access:`view`},"streamingEngine.getStreamUrl":{capName:`streaming-engine`,capScope:`system`,addonId:null,access:`view`},"streamingEngine.listStreams":{capName:`streaming-engine`,capScope:`system`,addonId:null,access:`view`},"streamingEngine.registerStream":{capName:`streaming-engine`,capScope:`system`,addonId:null,access:`create`},"streamingEngine.unregisterStream":{capName:`streaming-engine`,capScope:`system`,addonId:null,access:`delete`},"streamParams.getConfigSchema":{capName:`stream-params`,capScope:`device`,addonId:null,access:`view`},"streamParams.getOptions":{capName:`stream-params`,capScope:`device`,addonId:null,access:`view`},"streamParams.setProfile":{capName:`stream-params`,capScope:`device`,addonId:null,access:`create`},"switch.setState":{capName:`switch`,capScope:`device`,addonId:null,access:`create`},"system.featureFlags":{capName:`system`,capScope:`system`,addonId:null,access:`view`},"system.forceRetentionCleanup":{capName:`system`,capScope:`system`,addonId:null,access:`create`},"system.getRetentionConfig":{capName:`system`,capScope:`system`,addonId:null,access:`view`},"system.health":{capName:`system`,capScope:`system`,addonId:null,access:`view`},"system.info":{capName:`system`,capScope:`system`,addonId:null,access:`view`},"system.networkAddresses":{capName:`system`,capScope:`system`,addonId:null,access:`view`},"system.setRetentionConfig":{capName:`system`,capScope:`system`,addonId:null,access:`create`},"toast.onToast":{capName:`toast`,capScope:`system`,addonId:null,access:`view`},"turnProvider.getTurnServers":{capName:`turn-provider`,capScope:`system`,addonId:null,access:`view`},"update.installUpdate":{capName:`update`,capScope:`device`,addonId:null,access:`create`},"userManagement.confirmTotp":{capName:`user-management`,capScope:`system`,addonId:null,access:`create`},"userManagement.createApiKey":{capName:`user-management`,capScope:`system`,addonId:null,access:`create`},"userManagement.createScopedToken":{capName:`user-management`,capScope:`system`,addonId:null,access:`create`},"userManagement.createUser":{capName:`user-management`,capScope:`system`,addonId:null,access:`create`},"userManagement.deleteUser":{capName:`user-management`,capScope:`system`,addonId:null,access:`delete`},"userManagement.disableTotp":{capName:`user-management`,capScope:`system`,addonId:null,access:`delete`},"userManagement.getTotpStatus":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userManagement.listApiKeys":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userManagement.listOauthSessions":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userManagement.listScopedTokens":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userManagement.listUsers":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userManagement.oauthExchangeCode":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userManagement.oauthIssueCode":{capName:`user-management`,capScope:`system`,addonId:null,access:`create`},"userManagement.oauthRefresh":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userManagement.oauthVerifyAccessToken":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userManagement.resetPassword":{capName:`user-management`,capScope:`system`,addonId:null,access:`create`},"userManagement.revokeApiKey":{capName:`user-management`,capScope:`system`,addonId:null,access:`delete`},"userManagement.revokeOauthSession":{capName:`user-management`,capScope:`system`,addonId:null,access:`delete`},"userManagement.revokeScopedToken":{capName:`user-management`,capScope:`system`,addonId:null,access:`delete`},"userManagement.setupTotp":{capName:`user-management`,capScope:`system`,addonId:null,access:`create`},"userManagement.setUserScopes":{capName:`user-management`,capScope:`system`,addonId:null,access:`create`},"userManagement.updateUser":{capName:`user-management`,capScope:`system`,addonId:null,access:`create`},"userManagement.validateApiKey":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userManagement.validateCredentials":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userManagement.validateScopedToken":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userManagement.verifyTotp":{capName:`user-management`,capScope:`system`,addonId:null,access:`view`},"userPasskeys.beginAuthentication":{capName:`user-passkeys`,capScope:`system`,addonId:null,access:`view`},"userPasskeys.beginRegistration":{capName:`user-passkeys`,capScope:`system`,addonId:null,access:`create`},"userPasskeys.finishAuthentication":{capName:`user-passkeys`,capScope:`system`,addonId:null,access:`view`},"userPasskeys.finishRegistration":{capName:`user-passkeys`,capScope:`system`,addonId:null,access:`create`},"userPasskeys.listPasskeys":{capName:`user-passkeys`,capScope:`system`,addonId:null,access:`view`},"userPasskeys.removePasskey":{capName:`user-passkeys`,capScope:`system`,addonId:null,access:`delete`},"vacuumControl.locate":{capName:`vacuum-control`,capScope:`device`,addonId:null,access:`create`},"vacuumControl.pause":{capName:`vacuum-control`,capScope:`device`,addonId:null,access:`create`},"vacuumControl.returnToBase":{capName:`vacuum-control`,capScope:`device`,addonId:null,access:`create`},"vacuumControl.setFanSpeed":{capName:`vacuum-control`,capScope:`device`,addonId:null,access:`create`},"vacuumControl.start":{capName:`vacuum-control`,capScope:`device`,addonId:null,access:`create`},"vacuumControl.stop":{capName:`vacuum-control`,capScope:`device`,addonId:null,access:`create`},"valve.close":{capName:`valve`,capScope:`device`,addonId:null,access:`create`},"valve.open":{capName:`valve`,capScope:`device`,addonId:null,access:`create`},"valve.setPosition":{capName:`valve`,capScope:`device`,addonId:null,access:`create`},"valve.stop":{capName:`valve`,capScope:`device`,addonId:null,access:`create`},"videoclips.getClipPlayback":{capName:`videoclips`,capScope:`device`,addonId:null,access:`view`},"videoclips.listClips":{capName:`videoclips`,capScope:`device`,addonId:null,access:`view`},"waterHeater.setAway":{capName:`water-heater`,capScope:`device`,addonId:null,access:`create`},"waterHeater.setOperationMode":{capName:`water-heater`,capScope:`device`,addonId:null,access:`create`},"waterHeater.setTargetTemp":{capName:`water-heater`,capScope:`device`,addonId:null,access:`create`},"webrtc.closeSession":{capName:`webrtc`,capScope:`system`,addonId:null,access:`create`},"webrtc.createSession":{capName:`webrtc`,capScope:`system`,addonId:null,access:`create`},"webrtc.handleAnswer":{capName:`webrtc`,capScope:`system`,addonId:null,access:`create`},"webrtc.handleOffer":{capName:`webrtc`,capScope:`system`,addonId:null,access:`create`},"webrtc.hasAdaptiveBitrate":{capName:`webrtc`,capScope:`system`,addonId:null,access:`view`},"webrtc.registerStream":{capName:`webrtc`,capScope:`system`,addonId:null,access:`create`},"webrtc.supportsStream":{capName:`webrtc`,capScope:`system`,addonId:null,access:`view`},"webrtc.unregisterStream":{capName:`webrtc`,capScope:`system`,addonId:null,access:`delete`},"webrtcSession.addIceCandidate":{capName:`webrtc-session`,capScope:`device`,addonId:null,access:`create`},"webrtcSession.closeSession":{capName:`webrtc-session`,capScope:`device`,addonId:null,access:`create`},"webrtcSession.createSession":{capName:`webrtc-session`,capScope:`device`,addonId:null,access:`create`},"webrtcSession.getIceCandidates":{capName:`webrtc-session`,capScope:`device`,addonId:null,access:`view`},"webrtcSession.getSessionState":{capName:`webrtc-session`,capScope:`device`,addonId:null,access:`view`},"webrtcSession.handleAnswer":{capName:`webrtc-session`,capScope:`device`,addonId:null,access:`create`},"webrtcSession.handleOffer":{capName:`webrtc-session`,capScope:`device`,addonId:null,access:`create`},"webrtcSession.hasAdaptiveBitrate":{capName:`webrtc-session`,capScope:`device`,addonId:null,access:`view`},"webrtcSession.listStreams":{capName:`webrtc-session`,capScope:`device`,addonId:null,access:`view`},"zoneAnalytics.getCameraHistory":{capName:`zone-analytics`,capScope:`device`,addonId:null,access:`view`},"zoneAnalytics.getCurrentSnapshot":{capName:`zone-analytics`,capScope:`device`,addonId:null,access:`view`},"zoneAnalytics.getUnzonedHistory":{capName:`zone-analytics`,capScope:`device`,addonId:null,access:`view`},"zoneAnalytics.getZoneHistory":{capName:`zone-analytics`,capScope:`device`,addonId:null,access:`view`},"zoneRules.listRules":{capName:`zone-rules`,capScope:`device`,addonId:null,access:`view`},"zoneRules.setRules":{capName:`zone-rules`,capScope:`device`,addonId:null,access:`create`},"zones.addZone":{capName:`zones`,capScope:`device`,addonId:null,access:`create`},"zones.listZones":{capName:`zones`,capScope:`device`,addonId:null,access:`view`},"zones.removeZone":{capName:`zones`,capScope:`device`,addonId:null,access:`delete`},"zones.updateZone":{capName:`zones`,capScope:`device`,addonId:null,access:`create`}}),Object.freeze({broker:`broker`,"device-export":`device-export`,"mesh-network":`mesh`,"mqtt-broker":`broker`,"network-access":`ingress`,"smtp-provider":`email`});var oM=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},sM=class{constructor(e){this.generateIdentifier=e,this.kv=new oM}register(e,t){this.kv.getByValue(e)||(t||=this.generateIdentifier(e),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},cM=class extends sM{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t==`object`?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function lM(e){if(`values`in Object)return Object.values(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function uM(e,t){let n=lM(e);if(`find`in n)return n.find(t);let r=n;for(let e=0;e<r.length;e++){let n=r[e];if(t(n))return n}}function dM(e,t){Object.entries(e).forEach(([e,n])=>t(n,e))}function fM(e,t){return e.indexOf(t)!==-1}function pM(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(t(r))return r}}var mM=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return uM(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},hM=e=>Object.prototype.toString.call(e).slice(8,-1),gM=e=>e===void 0,_M=e=>e===null,vM=e=>typeof e!=`object`||!e||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,yM=e=>vM(e)&&Object.keys(e).length===0,bM=e=>Array.isArray(e),xM=e=>typeof e==`string`,SM=e=>typeof e==`number`&&!isNaN(e),CM=e=>typeof e==`boolean`,wM=e=>e instanceof RegExp,TM=e=>e instanceof Map,EM=e=>e instanceof Set,DM=e=>hM(e)===`Symbol`,OM=e=>e instanceof Date&&!isNaN(e.valueOf()),kM=e=>e instanceof Error,AM=e=>typeof e==`number`&&isNaN(e),jM=e=>CM(e)||_M(e)||gM(e)||SM(e)||xM(e)||DM(e),MM=e=>typeof e==`bigint`,NM=e=>e===1/0||e===-1/0,PM=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),FM=e=>e instanceof URL,IM=e=>e.replace(/\\/g,`\\\\`).replace(/\./g,`\\.`),LM=e=>e.map(String).map(IM).join(`.`),RM=(e,t)=>{let n=[],r=``;for(let a=0;a<e.length;a++){let o=e.charAt(a);if(!t&&o===`\\`){let t=e.charAt(a+1);if(t===`\\`){r+=`\\`,a++;continue}else if(t!==`.`)throw Error(`invalid path`)}if(o===`\\`&&e.charAt(a+1)===`.`){r+=`.`,a++;continue}if(o===`.`){n.push(r),r=``;continue}r+=o}let a=r;return n.push(a),n};function zM(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var BM=[zM(gM,`undefined`,()=>null,()=>void 0),zM(MM,`bigint`,e=>e.toString(),e=>typeof BigInt<`u`?BigInt(e):(console.error(`Please add a BigInt polyfill.`),e)),zM(OM,`Date`,e=>e.toISOString(),e=>new Date(e)),zM(kM,`Error`,(e,t)=>{let n={name:e.name,message:e.message};return`cause`in e&&(n.cause=e.cause),t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n},(e,t)=>{let n=Error(e.message,{cause:e.cause});return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n}),zM(wM,`regexp`,e=>``+e,e=>{let t=e.slice(1,e.lastIndexOf(`/`)),n=e.slice(e.lastIndexOf(`/`)+1);return new RegExp(t,n)}),zM(EM,`set`,e=>[...e.values()],e=>new Set(e)),zM(TM,`map`,e=>[...e.entries()],e=>new Map(e)),zM(e=>AM(e)||NM(e),`number`,e=>AM(e)?`NaN`:e>0?`Infinity`:`-Infinity`,Number),zM(e=>e===0&&1/e==-1/0,`number`,()=>`-0`,Number),zM(FM,`URL`,e=>e.toString(),e=>new URL(e))];function VM(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var HM=VM((e,t)=>DM(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>[`symbol`,t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{let r=n.symbolRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown symbol`);return r}),UM=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),WM=VM(PM,e=>[`typed-array`,e.constructor.name],e=>[...e],(e,t)=>{let n=UM[t[1]];if(!n)throw Error(`Trying to deserialize unknown typed array`);return new n(e)});function GM(e,t){return e?.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var KM=VM(GM,(e,t)=>[`class`,t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{let n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};let r={};return n.forEach(t=>{r[t]=e[t]}),r},(e,t,n)=>{let r=n.classRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(r.prototype),e)}),qM=VM((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>[`custom`,t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{let r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw Error(`Trying to deserialize unknown custom value`);return r.deserialize(e)}),JM=[KM,HM,qM,WM],YM=(e,t)=>{let n=pM(JM,n=>n.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};let r=pM(BM,n=>n.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},XM={};BM.forEach(e=>{XM[e.annotation]=e});var ZM=(e,t,n)=>{if(bM(t))switch(t[0]){case`symbol`:return HM.untransform(e,t,n);case`class`:return KM.untransform(e,t,n);case`custom`:return qM.untransform(e,t,n);case`typed-array`:return WM.untransform(e,t,n);default:throw Error(`Unknown transformation: `+t)}else{let r=XM[t];if(!r)throw Error(`Unknown transformation: `+t);return r.untransform(e,n)}},QM=(e,t)=>{if(t>e.size)throw Error(`index out of bounds`);let n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function $M(e){if(fM(e,`__proto__`))throw Error(`__proto__ is not allowed as a property`);if(fM(e,`prototype`))throw Error(`prototype is not allowed as a property`);if(fM(e,`constructor`))throw Error(`constructor is not allowed as a property`)}var eN=(e,t)=>{$M(t);for(let n=0;n<t.length;n++){let r=t[n];if(EM(e))e=QM(e,+r);else if(TM(e)){let a=+r,o=+t[++n]==0?`key`:`value`,s=QM(e,a);switch(o){case`key`:e=s;break;case`value`:e=e.get(s);break}}else e=e[r]}return e},tN=(e,t,n)=>{if($M(t),t.length===0)return n(e);let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(bM(r)){let e=+n;r=r[e]}else if(vM(r))r=r[n];else if(EM(r)){let e=+n;r=QM(r,e)}else if(TM(r)){if(e===t.length-2)break;let a=+n,o=+t[++e]==0?`key`:`value`,s=QM(r,a);switch(o){case`key`:r=s;break;case`value`:r=r.get(s);break}}}let a=t[t.length-1];if(bM(r)?r[+a]=n(r[+a]):vM(r)&&(r[a]=n(r[a])),EM(r)){let e=QM(r,+a),t=n(e);e!==t&&(r.delete(e),r.add(t))}if(TM(r)){let e=+t[t.length-2],o=QM(r,e);switch(+a==0?`key`:`value`){case`key`:{let e=n(o);r.set(e,r.get(o)),e!==o&&r.delete(o);break}case`value`:r.set(o,n(r.get(o)));break}}return e},nN=e=>e<1;function rN(e,t,n,r=[]){if(!e)return;let a=nN(n);if(!bM(e)){dM(e,(e,o)=>rN(e,t,n,[...r,...RM(o,a)]));return}let[o,s]=e;s&&dM(s,(e,o)=>{rN(e,t,n,[...r,...RM(o,a)])}),t(o,r)}function iN(e,t,n,r){return rN(t,(t,n)=>{e=tN(e,n,e=>ZM(e,t,r))},n),e}function aN(e,t,n){let r=nN(n);function a(t,n){let a=eN(e,RM(n,r));t.map(e=>RM(e,r)).forEach(t=>{e=tN(e,t,()=>a)})}if(bM(t)){let[n,o]=t;n.forEach(t=>{e=tN(e,RM(t,r),()=>e)}),o&&dM(o,a)}else dM(t,a);return e}var oN=(e,t)=>vM(e)||bM(e)||TM(e)||EM(e)||kM(e)||GM(e,t);function sN(e,t,n){let r=n.get(e);r?r.push(t):n.set(e,[t])}function cN(e,t){let n={},r;return e.forEach(e=>{if(e.length<=1)return;t||(e=e.map(e=>e.map(String)).sort((e,t)=>e.length-t.length));let[a,...o]=e;a.length===0?r=o.map(LM):n[LM(a)]=o.map(LM)}),r?yM(n)?[r]:[r,n]:yM(n)?void 0:n}var lN=(e,t,n,r,a=[],o=[],s=new Map)=>{let c=jM(e);if(!c){sN(e,a,t);let n=s.get(e);if(n)return r?{transformedValue:null}:n}if(!oN(e,n)){let t=YM(e,n),r=t?{transformedValue:t.value,annotations:[t.type]}:{transformedValue:e};return c||s.set(e,r),r}if(fM(o,e))return{transformedValue:null};let l=YM(e,n),u=l?.value??e,d=bM(u)?[]:{},f={};dM(u,(c,l)=>{if(l===`__proto__`||l===`constructor`||l===`prototype`)throw Error(`Detected property ${l}. This is a prototype pollution risk, please remove it from your object.`);let u=lN(c,t,n,r,[...a,l],[...o,e],s);d[l]=u.transformedValue,bM(u.annotations)?f[IM(l)]=u.annotations:vM(u.annotations)&&dM(u.annotations,(e,t)=>{f[IM(l)+`.`+t]=e})});let p=yM(f)?{transformedValue:d,annotations:l?[l.type]:void 0}:{transformedValue:d,annotations:l?[l.type,f]:f};return c||s.set(e,p),p};function uN(e){return Object.prototype.toString.call(e).slice(8,-1)}function dN(e){return uN(e)===`Array`}function fN(e){if(uN(e)!==`Object`)return!1;let t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function pN(e,t,n,r,a){let o={}.propertyIsEnumerable.call(r,t)?`enumerable`:`nonenumerable`;o===`enumerable`&&(e[t]=n),a&&o===`nonenumerable`&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function mN(e,t={}){if(dN(e))return e.map(e=>mN(e,t));if(!fN(e))return e;let n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((n,r)=>{if(r===`__proto__`||dN(t.props)&&!t.props.includes(r))return n;let a=e[r];return pN(n,r,mN(a,t),e,t.nonenumerable),n},{})}var hN=class{constructor({dedupe:e=!1}={}){this.classRegistry=new cM,this.symbolRegistry=new sM(e=>e.description??``),this.customTransformerRegistry=new mM,this.allowedErrorProps=[],this.dedupe=e}serialize(e){let t=new Map,n=lN(e,t,this,this.dedupe),r={json:n.transformedValue};n.annotations&&(r.meta={...r.meta,values:n.annotations});let a=cN(t,this.dedupe);return a&&(r.meta={...r.meta,referentialEqualities:a}),r.meta&&(r.meta.v=1),r}deserialize(e,t){let{json:n,meta:r}=e,a=t?.inPlace?n:mN(n);return r?.values&&(a=iN(a,r.values,r.v??0,this)),r?.referentialEqualities&&(a=aN(a,r.referentialEqualities,r.v??0)),a}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e),{inPlace:!0})}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};hN.defaultInstance=new hN,hN.serialize=hN.defaultInstance.serialize.bind(hN.defaultInstance),hN.deserialize=hN.defaultInstance.deserialize.bind(hN.defaultInstance),hN.stringify=hN.defaultInstance.stringify.bind(hN.defaultInstance),hN.parse=hN.defaultInstance.parse.bind(hN.defaultInstance),hN.registerClass=hN.defaultInstance.registerClass.bind(hN.defaultInstance),hN.registerSymbol=hN.defaultInstance.registerSymbol.bind(hN.defaultInstance),hN.registerCustom=hN.defaultInstance.registerCustom.bind(hN.defaultInstance),hN.allowErrorProps=hN.defaultInstance.allowErrorProps.bind(hN.defaultInstance),hN.serialize,hN.deserialize,hN.stringify,hN.parse,hN.registerClass,hN.registerCustom,hN.registerSymbol,hN.allowErrorProps;var gN=1e4,_N=6e3,vN=2e3,yN=3e4,bN=class{_serverUrl;useWs;baseRetryMs;maxRetryMs;onConnectionChange;token;_trpcClient;_wsClient=null;mirror=null;mirrorInit=null;connected=!1;connectedPromise=null;_systemProxy;_connectionVersion=0;connectionListeners=new Set;constructor(e){this._serverUrl=e.serverUrl.replace(/\/+$/,``),this.token=e.token;let t=typeof window<`u`;this.useWs=e.useWebSocket??t,this.onConnectionChange=e.onConnectionChange,this.baseRetryMs=e.retryDelayMs??vN,this.maxRetryMs=e.maxRetryDelayMs??yN,this._trpcClient=this.buildTrpcClient(),this._systemProxy=Mw(this._trpcClient)}get serverUrl(){return this._serverUrl}get connectionVersion(){return this._connectionVersion}subscribeConnectionEvents(e){return this.connectionListeners.add(e),()=>{this.connectionListeners.delete(e)}}emitConnectionEvent(e){try{this.onConnectionChange?.(e)}catch{}for(let t of this.connectionListeners)try{t(e,this._connectionVersion)}catch{}}async awaitConnected(e){if(this.connected)return;if(this.connectedPromise)return this.connectedPromise;let t=e??15e3;this.connectedPromise=(async()=>{let e=this._trpcClient.auth.me.query();Number.isFinite(t)?await new Promise((n,r)=>{let a=setTimeout(()=>r(Error(`System.awaitConnected: probe timed out after ${t}ms`)),t);e.then(()=>{clearTimeout(a),n()},e=>{clearTimeout(a),r(e instanceof Error?e:Error(String(e)))})}):await e,this.connected=!0})();try{await this.connectedPromise}finally{this.connectedPromise=null}}async init(e){if(this.mirror?.isReady())return;if(this.mirrorInit)return this.mirrorInit;let t=new Rw(this._trpcClient);return this.mirror=t,this.mirrorInit=(async()=>{await this.awaitConnected(e),await t.init(e)})().finally(()=>{this.mirrorInit=null}),this.mirrorInit}async awaitReady(){if(!this.mirror?.isReady())return this.mirrorInit?this.mirrorInit:this.init()}isReady(){return this.mirror?.isReady()??!1}isConnected(){return this.connected}reconnect(){this.useWs&&(this.emitConnectionEvent(`connecting`),this._wsClient?.close(),this.disposeMirror(),this.connected=!1,this.connectedPromise=null,this._trpcClient=this.buildTrpcClient(),this._systemProxy=Mw(this._trpcClient))}switchServerUrl(e){let t=e.replace(/\/+$/,``);t!==this._serverUrl&&(this._serverUrl=t,this.reconnect())}async raceConnectionEndpoints(e){let t=e?.perCandidateTimeoutMs??1500,n=(()=>{try{return new URL(this._serverUrl)}catch{return null}})(),r=n?.port?Number(n.port):n?.protocol===`https:`?443:80,a=n?.protocol===`https:`?`https`:`http`,o=this._trpcClient.localNetwork?.getConnectionEndpoints;if(!o)return{winner:this._serverUrl,switched:!1};let s;try{s=(await o.query({port:r,ipv4Only:e?.ipv4Only,scheme:a})).endpoints}catch{return{winner:this._serverUrl,switched:!1}}if(s.length===0)return{winner:this._serverUrl,switched:!1};let c=await SN(s.map(e=>e.baseUrl),t);return!c||c===this._serverUrl?{winner:c??this._serverUrl,switched:!1}:(this.switchServerUrl(c),{winner:c,switched:!0})}close(){this.disposeMirror(),this.connected=!1,this.connectedPromise=null,this._wsClient?.close()}disposeMirror(){this.mirror?.dispose(),this.mirror=null,this.mirrorInit=null}async login(e,t){let n=await this._trpcClient.auth.login.mutate({username:e,password:t});if(typeof n==`object`&&n&&`token`in n){let e=n,t=e.token;typeof t==`string`&&e.requiresTotp!==!0&&this.setToken(t)}return n}async loginVerifyTotp(e,t){let n=await this._trpcClient.auth.loginVerifyTotp.mutate({challengeToken:e,code:t});if(typeof n==`object`&&n&&`token`in n){let e=n.token;typeof e==`string`&&this.setToken(e)}return n}async logout(){await this._trpcClient.auth.logout.mutate()}async getMe(){return await this._trpcClient.auth.me.query()}async changeOwnPassword(e){return await this._trpcClient.auth.changeOwnPassword.mutate(e)}async setupOwnTotp(){return await this._trpcClient.auth.setupOwnTotp.mutate()}async confirmOwnTotp(e){return await this._trpcClient.auth.confirmOwnTotp.mutate(e)}async disableOwnTotp(){return await this._trpcClient.auth.disableOwnTotp.mutate()}async getOwnTotpStatus(){return await this._trpcClient.auth.getOwnTotpStatus.query()}setToken(e){this.token=e}listDevices(e){return this.mirror?(e?this.mirror.query(e):this.mirror.getAllDevices()).map(e=>this.attachBinding(e)):[]}getDeviceInfo(e){return this.mirror?.getDeviceInfo(e)??null}listDeviceInfos(e){let t=this.mirror;if(!t)return[];let n=e?t.query(e):t.getAllDevices(),r=[];for(let e of n){let n=t.getDeviceInfo(e.deviceId);n&&r.push(n)}return r}getDevice(e){let t=this.mirror?.getDeviceById(e)??null;return t?this.attachBinding(t):null}getDeviceByName(e){let t=this.mirror?.getDeviceByName(e)??null;return t?this.attachBinding(t):null}getDeviceByStableId(e){let t=this.mirror?.getDeviceByStableId(e)??null;return t?this.attachBinding(t):null}async waitForDevice(e,t){this.mirror||await this.init();let n=await this.mirror.waitForDevice(e,t??3e4);return this.attachBinding(n)}onDeviceAdded(e){if(!this.mirror)throw Error(`System.onDeviceAdded: call init() before subscribing`);return this.mirror.onDeviceAdded(e)}onDeviceRemoved(e){if(!this.mirror)throw Error(`System.onDeviceRemoved: call init() before subscribing`);return this.mirror.onDeviceRemoved(e)}attachBinding(e){let t=this.lookupBinding(e.deviceId);if(t===e.binding)return e;let n=e;return n.binding=t,e}lookupBinding(e){return this.mirror?this.mirror.getDeviceById(e)?.binding??null:null}get addonPages(){return this._systemProxy.addonPages}get addonSettings(){return this._systemProxy.addonSettings}get alerts(){return this._systemProxy.alerts}get audioAnalyzer(){return this._systemProxy.audioAnalyzer}get audioCodec(){return this._systemProxy.audioCodec}get backup(){return this._systemProxy.backup}get decoder(){return this._systemProxy.decoder}get deviceManager(){return this._systemProxy.deviceManager}get deviceProvider(){return this._systemProxy.deviceProvider}get deviceState(){return this._systemProxy.deviceState}get metricsProvider(){return this._systemProxy.metricsProvider}get notificationOutput(){return this._systemProxy.notificationOutput}get pipelineExecutor(){return this._systemProxy.pipelineExecutor}get pipelineOrchestrator(){return this._systemProxy.pipelineOrchestrator}get pipelineRunner(){return this._systemProxy.pipelineRunner}get settingsStore(){return this._systemProxy.settingsStore}get storage(){return this._systemProxy.storage}get streamBroker(){return this._systemProxy.streamBroker}get turnProvider(){return this._systemProxy.turnProvider}get userManagement(){return this._systemProxy.userManagement}subscribeEvent(e,t){let n=this._trpcClient.live.onEvent.subscribe({category:e},{onData:e=>{try{t(e)}catch{}}});return()=>{try{n.unsubscribe()}catch{}}}get trpcClient(){return this._trpcClient}get wsClient(){return this._wsClient}buildTrpcClient(){let e=()=>{let e={};return this.token&&(e.Authorization=`Bearer ${this.token}`),e};if(this.useWs){let e=this._serverUrl.replace(/^http/,`ws`)+`/trpc`,t=this.baseRetryMs,n=this.maxRetryMs;return this._wsClient=Er({url:e,connectionParams:()=>({token:this.token}),retryDelayMs:e=>Math.min(t*2**e,n),keepAlive:{enabled:!0,intervalMs:gN,pongTimeoutMs:_N},onOpen:()=>{this._connectionVersion+=1,this.emitConnectionEvent(`connected`)},onClose:()=>{this.emitConnectionEvent(`disconnected`)}}),Fr({links:[Dr({client:this._wsClient,transformer:hN})]})}return this._wsClient=null,Fr({links:[ir({url:`${this._serverUrl}/trpc`,headers:e,transformer:hN})]})}};function xN(e){return new bN(e)}async function SN(e,t){if(e.length===0)return null;if(typeof fetch!=`function`)return e[0]??null;let n=typeof window<`u`&&window.location!==void 0&&window.location.protocol===`https:`?e.filter(e=>e.toLowerCase().startsWith(`https://`)):e;if(n.length===0)return null;let r=n.map(()=>new AbortController),a=n.map(async(e,n)=>{let a=r[n],o=setTimeout(()=>a.abort(),t);try{let t=await fetch(`${e.replace(/\/+$/,``)}/trpc/health`,{method:`GET`,signal:a.signal,credentials:`omit`});if(!t.ok)throw Error(`${t.status}`);return e}finally{clearTimeout(o)}});try{let e=await Promise.any(a);for(let e of r)try{e.abort()}catch{}return e}catch{return null}}var CN=function(e){return e.Motion=`motion`,e.Person=`person`,e.Vehicle=`vehicle`,e.Animal=`animal`,e.Audio=`audio`,e.Face=`face`,e.Plate=`plate`,e.Package=`package`,e.Doorbell=`doorbell`,e.Sensor=`sensor`,e}({}),wN=`animal.dog_cat.dog.cat.horse.sheep.cow.elephant.bear.zebra.giraffe.mouse.rabbit.deer.lion.tiger.bird.eagle.owl.pigeon.fish.whale.dolphin.snake.turtle.lizard`.split(`.`),TN=[`person`,`people`,`pedestrian`,`rider`,`driver`,`cyclist`,`skier`,`skateboarder`,`face`,`hand`,`head`,`body`],EN=[`vehicle`,`car`,`truck`,`bus`,`motorcycle`,`bicycle`,`van`,`ambulance`,`police_car`,`fire_truck`,`train`,`subway`,`tram`,`airplane`,`boat`,`ship`,`helicopter`],DN=`face.eyes.nose.mouth.ears.eyebrows.left_eye.right_eye.pupil.iris.eyelid.eye_corner.upper_lip.lower_lip.teeth.chin.cheek.forehead.jaw.glasses.sunglasses.facial_hair.beard.mustache.facial_landmark.facial_keypoint`.split(`.`),ON=[`plate`,`license_plate`,`front_plate`,`rear_plate`,`motorcycle_plate`,`temporary_plate`,`dealer_plate`,`licensePlate`,`plate_number`,`plate_character`,`plate_digit`,`plate_letter`,`plate_symbol`,`plate_region`,`plate_country_identifier`,`plate_frame`,`plate_bolt`,`plate_sticker`,`plate_validation_tag`,`damaged_plate`,`obscured_plate`,`dirty_plate`],kN=[`motion`,`movement`,`other`],AN=[`package`,`packet`],jN=[`audio`],MN=`speech.scream.babbling.yell.bellow.whoop.whispering.laughter.snicker.crying.cry.sigh.singing.choir.chant.mantra.child_singing.rapping.humming.groan.grunt.whistling.breathing.wheeze.snoring.gasp.pant.snort.cough.throat_clearing.sneeze.sniff.cheering.applause.chatter.crowd.children_playing.bark.yip.howl.bow-wow.growling.whimper_dog.purr.meow.hiss.caterwaul.pets.livestock.doorbell.ding-dong.door.slam.knock.alarm.telephone.music.dog.dogs`.split(`.`),NN=[`doorbell`,`ring`],PN=[`lock`,`binary`,`flood`,`entry`,`door`,`leak`,`door_open`,`flooded`,`entry_open`];({...wN.reduce((e,t)=>({...e,[t]:`animal`}),{}),...TN.reduce((e,t)=>({...e,[t]:`person`}),{}),...EN.reduce((e,t)=>({...e,[t]:`vehicle`}),{}),...kN.reduce((e,t)=>({...e,[t]:`motion`}),{}),...AN.reduce((e,t)=>({...e,[t]:`package`}),{}),...DN.reduce((e,t)=>({...e,[t]:`face`}),{}),...ON.reduce((e,t)=>({...e,[t]:`plate`}),{}),...jN.reduce((e,t)=>({...e,[t]:`audio`}),{}),...MN.reduce((e,t)=>({...e,[t]:`audio`}),{}),...NN.reduce((e,t)=>({...e,[t]:`doorbell`}),{}),...PN.reduce((e,t)=>({...e,[t]:`sensor`}),{})}),[...Object.values(CN).filter(e=>e!==`motion`)],new Set([`Entry`,`Light`,`Switch`,`Lock`,`SecuritySystem`,`Buttons`,`WindowCovering`,`Siren`,`Sensor`,`Select`,`Program`]),new Set([`light`,`switch`,`input_boolean`,`cover`,`lock`,`alarm_control_panel`,`input_button`,`button`,`input_select`,`select`,`siren`,`media_player`,`script`]);var FN=`modulepreload`,IN=function(e,t){return new URL(e,t).href},LN={},RN=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),a=document.querySelector(`meta[property=csp-nonce]`),o=a?.nonce||a?.getAttribute(`nonce`);function s(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=s(t.map(t=>{if(t=IN(t,n),t in LN)return;LN[t]=!0;let r=t.endsWith(`.css`),a=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let a=e[n];if(a.href===t&&(!r||a.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${a}`))return;let s=document.createElement(`link`);if(s.rel=r?`stylesheet`:FN,r||(s.as=`script`),s.crossOrigin=``,s.href=t,o&&s.setAttribute(`nonce`,o),document.head.appendChild(s),r)return new Promise((e,n)=>{s.addEventListener(`load`,e),s.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function a(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`&&a(e.reason);return e().catch(a)})};function zN(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=zN(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function BN(){for(var e,t,n=0,r=``,a=arguments.length;n<a;n++)(e=arguments[n])&&(t=zN(e))&&(r&&(r+=` `),r+=t);return r}var VN=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},HN=(e,t)=>({classGroupId:e,validator:t}),UN=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),WN=`-`,GN=[],KN=`arbitrary..`,qN=e=>{let t=XN(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return YN(e);let n=e.split(WN);return JN(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],a=n[e];return t?a?VN(a,t):t:a||GN}return n[e]||GN}}},JN=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let n=JN(e,t+1,a);if(n)return n}let o=n.validators;if(o===null)return;let s=t===0?e.join(WN):e.slice(t).join(WN),c=o.length;for(let e=0;e<c;e++){let t=o[e];if(t.validator(s))return t.classGroupId}},YN=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?KN+r:void 0})(),XN=e=>{let{theme:t,classGroups:n}=e;return ZN(n,t)},ZN=(e,t)=>{let n=UN();for(let r in e){let a=e[r];QN(a,n,r,t)}return n},QN=(e,t,n,r)=>{let a=e.length;for(let o=0;o<a;o++){let a=e[o];$N(a,t,n,r)}},$N=(e,t,n,r)=>{if(typeof e==`string`){eP(e,t,n);return}if(typeof e==`function`){tP(e,t,n,r);return}nP(e,t,n,r)},eP=(e,t,n)=>{let r=e===``?t:rP(t,e);r.classGroupId=n},tP=(e,t,n,r)=>{if(iP(e)){QN(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(HN(n,e))},nP=(e,t,n,r)=>{let a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];QN(s,rP(t,o),n,r)}},rP=(e,t)=>{let n=e,r=t.split(WN),a=r.length;for(let e=0;e<a;e++){let t=r[e],a=n.nextPart.get(t);a||(a=UN(),n.nextPart.set(t,a)),n=a}return n},iP=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,aP=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),a=(a,o)=>{n[a]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return a(e,t),t},set(e,t){e in n?n[e]=t:a(e,t)}}},oP=`!`,sP=`:`,cP=[],lP=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),uP=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,a=0,o,s=e.length;for(let c=0;c<s;c++){let s=e[c];if(n===0&&r===0){if(s===sP){t.push(e.slice(a,c)),a=c+1;continue}if(s===`/`){o=c;continue}}s===`[`?n++:s===`]`?n--:s===`(`?r++:s===`)`&&r--}let c=t.length===0?e:e.slice(a),l=c,u=!1;c.endsWith(oP)?(l=c.slice(0,-1),u=!0):c.startsWith(oP)&&(l=c.slice(1),u=!0);let d=o&&o>a?o-a:void 0;return lP(t,u,l,d)};if(t){let e=t+sP,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):lP(cP,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},dP=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let a=0;a<e.length;a++){let o=e[a],s=o[0]===`[`,c=t.has(o);s||c?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(o)):r.push(o)}return r.length>0&&(r.sort(),n.push(...r)),n}},fP=e=>({cache:aP(e.cacheSize),parseClassName:uP(e),sortModifiers:dP(e),postfixLookupClassGroupIds:pP(e),...qN(e)}),pP=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},mP=/\s+/,hP=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o,postfixLookupClassGroupIds:s}=t,c=[],l=e.trim().split(mP),u=``;for(let e=l.length-1;e>=0;--e){let t=l[e],{isExternal:d,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:h}=n(t);if(d){u=t+(u.length>0?` `+u:u);continue}let g=!!h,_;if(g){_=r(m.substring(0,h));let e=_&&s[_]?r(m):void 0;e&&e!==_&&(_=e,g=!1)}else _=r(m);if(!_){if(!g){u=t+(u.length>0?` `+u:u);continue}if(_=r(m),!_){u=t+(u.length>0?` `+u:u);continue}g=!1}let v=f.length===0?``:f.length===1?f[0]:o(f).join(`:`),y=p?v+oP:v,b=y+_;if(c.indexOf(b)>-1)continue;c.push(b);let x=a(_,g);for(let e=0;e<x.length;++e){let t=x[e];c.push(y+t)}u=t+(u.length>0?` `+u:u)}return u},gP=(...e)=>{let t=0,n,r,a=``;for(;t<e.length;)(n=e[t++])&&(r=_P(n))&&(a&&(a+=` `),a+=r);return a},_P=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=_P(e[r]))&&(n&&(n+=` `),n+=t);return n},vP=(e,...t)=>{let n,r,a,o,s=s=>(n=fP(t.reduce((e,t)=>t(e),e())),r=n.cache.get,a=n.cache.set,o=c,c(s)),c=e=>{let t=r(e);if(t)return t;let o=hP(e,n);return a(e,o),o};return o=s,(...e)=>o(gP(...e))},yP=[],bP=e=>{let t=t=>t[e]||yP;return t.isThemeGetter=!0,t},xP=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,SP=/^\((?:(\w[\w-]*):)?(.+)\)$/i,CP=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,wP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,TP=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,EP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,OP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kP=e=>CP.test(e),AP=e=>!!e&&!Number.isNaN(Number(e)),jP=e=>!!e&&Number.isInteger(Number(e)),MP=e=>e.endsWith(`%`)&&AP(e.slice(0,-1)),NP=e=>wP.test(e),PP=()=>!0,FP=e=>TP.test(e)&&!EP.test(e),IP=()=>!1,LP=e=>DP.test(e),RP=e=>OP.test(e),zP=e=>!HP(e)&&!XP(e),BP=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),VP=e=>iF(e,cF,IP),HP=e=>xP.test(e),UP=e=>iF(e,lF,FP),WP=e=>iF(e,uF,AP),GP=e=>iF(e,fF,PP),KP=e=>iF(e,dF,IP),qP=e=>iF(e,oF,IP),JP=e=>iF(e,sF,RP),YP=e=>iF(e,pF,LP),XP=e=>SP.test(e),ZP=e=>aF(e,lF),QP=e=>aF(e,dF),$P=e=>aF(e,oF),eF=e=>aF(e,cF),tF=e=>aF(e,sF),nF=e=>aF(e,pF,!0),rF=e=>aF(e,fF,!0),iF=(e,t,n)=>{let r=xP.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},aF=(e,t,n=!1)=>{let r=SP.exec(e);return r?r[1]?t(r[1]):n:!1},oF=e=>e===`position`||e===`percentage`,sF=e=>e===`image`||e===`url`,cF=e=>e===`length`||e===`size`||e===`bg-size`,lF=e=>e===`length`,uF=e=>e===`number`,dF=e=>e===`family-name`,fF=e=>e===`number`||e===`weight`,pF=e=>e===`shadow`,mF=vP(()=>{let e=bP(`color`),t=bP(`font`),n=bP(`text`),r=bP(`font-weight`),a=bP(`tracking`),o=bP(`leading`),s=bP(`breakpoint`),c=bP(`container`),l=bP(`spacing`),u=bP(`radius`),d=bP(`shadow`),f=bP(`inset-shadow`),p=bP(`text-shadow`),m=bP(`drop-shadow`),h=bP(`blur`),g=bP(`perspective`),_=bP(`aspect`),v=bP(`ease`),y=bP(`animate`),b=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],x=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],S=()=>[...x(),XP,HP],C=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],w=()=>[`auto`,`contain`,`none`],T=()=>[XP,HP,l],E=()=>[kP,`full`,`auto`,...T()],D=()=>[jP,`none`,`subgrid`,XP,HP],O=()=>[`auto`,{span:[`full`,jP,XP,HP]},jP,XP,HP],ee=()=>[jP,`auto`,XP,HP],te=()=>[`auto`,`min`,`max`,`fr`,XP,HP],ne=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],re=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],ie=()=>[`auto`,...T()],ae=()=>[kP,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...T()],k=()=>[kP,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...T()],oe=()=>[kP,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...T()],A=()=>[e,XP,HP],se=()=>[...x(),$P,qP,{position:[XP,HP]}],ce=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],le=()=>[`auto`,`cover`,`contain`,eF,VP,{size:[XP,HP]}],ue=()=>[MP,ZP,UP],de=()=>[``,`none`,`full`,u,XP,HP],fe=()=>[``,AP,ZP,UP],pe=()=>[`solid`,`dashed`,`dotted`,`double`],me=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],he=()=>[AP,MP,$P,qP],ge=()=>[``,`none`,h,XP,HP],_e=()=>[`none`,AP,XP,HP],ve=()=>[`none`,AP,XP,HP],ye=()=>[AP,XP,HP],be=()=>[kP,`full`,...T()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[NP],breakpoint:[NP],color:[PP],container:[NP],"drop-shadow":[NP],ease:[`in`,`out`,`in-out`],font:[zP],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[NP],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[NP],shadow:[NP],spacing:[`px`,AP],text:[NP],"text-shadow":[NP],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,kP,HP,XP,_]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,XP,HP]}],"container-named":[BP],columns:[{columns:[AP,HP,XP,c]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:S()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:w()}],"overscroll-x":[{"overscroll-x":w()}],"overscroll-y":[{"overscroll-y":w()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[jP,`auto`,XP,HP]}],basis:[{basis:[kP,`full`,`auto`,c,...T()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[AP,kP,`auto`,`initial`,`none`,HP]}],grow:[{grow:[``,AP,XP,HP]}],shrink:[{shrink:[``,AP,XP,HP]}],order:[{order:[jP,`first`,`last`,`none`,XP,HP]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...ne(),`normal`]}],"justify-items":[{"justify-items":[...re(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...re()]}],"align-content":[{content:[`normal`,...ne()]}],"align-items":[{items:[...re(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...re(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...re(),`baseline`]}],"place-self":[{"place-self":[`auto`,...re()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:ie()}],mx:[{mx:ie()}],my:[{my:ie()}],ms:[{ms:ie()}],me:[{me:ie()}],mbs:[{mbs:ie()}],mbe:[{mbe:ie()}],mt:[{mt:ie()}],mr:[{mr:ie()}],mb:[{mb:ie()}],ml:[{ml:ie()}],"space-x":[{"space-x":T()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":T()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ae()}],"inline-size":[{inline:[`auto`,...k()]}],"min-inline-size":[{"min-inline":[`auto`,...k()]}],"max-inline-size":[{"max-inline":[`none`,...k()]}],"block-size":[{block:[`auto`,...oe()]}],"min-block-size":[{"min-block":[`auto`,...oe()]}],"max-block-size":[{"max-block":[`none`,...oe()]}],w:[{w:[c,`screen`,...ae()]}],"min-w":[{"min-w":[c,`screen`,`none`,...ae()]}],"max-w":[{"max-w":[c,`screen`,`none`,`prose`,{screen:[s]},...ae()]}],h:[{h:[`screen`,`lh`,...ae()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ae()]}],"max-h":[{"max-h":[`screen`,`lh`,...ae()]}],"font-size":[{text:[`base`,n,ZP,UP]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,rF,GP]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,MP,HP]}],"font-family":[{font:[QP,KP,t]}],"font-features":[{"font-features":[HP]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[a,XP,HP]}],"line-clamp":[{"line-clamp":[AP,`none`,XP,WP]}],leading:[{leading:[o,...T()]}],"list-image":[{"list-image":[`none`,XP,HP]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,XP,HP]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...pe(),`wavy`]}],"text-decoration-thickness":[{decoration:[AP,`from-font`,`auto`,XP,UP]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[AP,`auto`,XP,HP]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:T()}],"tab-size":[{tab:[jP,XP,HP]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,XP,HP]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,XP,HP]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:ce()}],"bg-size":[{bg:le()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},jP,XP,HP],radial:[``,XP,HP],conic:[jP,XP,HP]},tF,JP]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:de()}],"rounded-s":[{"rounded-s":de()}],"rounded-e":[{"rounded-e":de()}],"rounded-t":[{"rounded-t":de()}],"rounded-r":[{"rounded-r":de()}],"rounded-b":[{"rounded-b":de()}],"rounded-l":[{"rounded-l":de()}],"rounded-ss":[{"rounded-ss":de()}],"rounded-se":[{"rounded-se":de()}],"rounded-ee":[{"rounded-ee":de()}],"rounded-es":[{"rounded-es":de()}],"rounded-tl":[{"rounded-tl":de()}],"rounded-tr":[{"rounded-tr":de()}],"rounded-br":[{"rounded-br":de()}],"rounded-bl":[{"rounded-bl":de()}],"border-w":[{border:fe()}],"border-w-x":[{"border-x":fe()}],"border-w-y":[{"border-y":fe()}],"border-w-s":[{"border-s":fe()}],"border-w-e":[{"border-e":fe()}],"border-w-bs":[{"border-bs":fe()}],"border-w-be":[{"border-be":fe()}],"border-w-t":[{"border-t":fe()}],"border-w-r":[{"border-r":fe()}],"border-w-b":[{"border-b":fe()}],"border-w-l":[{"border-l":fe()}],"divide-x":[{"divide-x":fe()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":fe()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...pe(),`hidden`,`none`]}],"divide-style":[{divide:[...pe(),`hidden`,`none`]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-bs":[{"border-bs":A()}],"border-color-be":[{"border-be":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...pe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[AP,XP,HP]}],"outline-w":[{outline:[``,AP,ZP,UP]}],"outline-color":[{outline:A()}],shadow:[{shadow:[``,`none`,d,nF,YP]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":[`none`,f,nF,YP]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:fe()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[AP,UP]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":fe()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":[`none`,p,nF,YP]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[AP,XP,HP]}],"mix-blend":[{"mix-blend":[...me(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":me()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[AP]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[XP,HP]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[AP]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:ce()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,XP,HP]}],filter:[{filter:[``,`none`,XP,HP]}],blur:[{blur:ge()}],brightness:[{brightness:[AP,XP,HP]}],contrast:[{contrast:[AP,XP,HP]}],"drop-shadow":[{"drop-shadow":[``,`none`,m,nF,YP]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:[``,AP,XP,HP]}],"hue-rotate":[{"hue-rotate":[AP,XP,HP]}],invert:[{invert:[``,AP,XP,HP]}],saturate:[{saturate:[AP,XP,HP]}],sepia:[{sepia:[``,AP,XP,HP]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,XP,HP]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[AP,XP,HP]}],"backdrop-contrast":[{"backdrop-contrast":[AP,XP,HP]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,AP,XP,HP]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[AP,XP,HP]}],"backdrop-invert":[{"backdrop-invert":[``,AP,XP,HP]}],"backdrop-opacity":[{"backdrop-opacity":[AP,XP,HP]}],"backdrop-saturate":[{"backdrop-saturate":[AP,XP,HP]}],"backdrop-sepia":[{"backdrop-sepia":[``,AP,XP,HP]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,XP,HP]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[AP,`initial`,XP,HP]}],ease:[{ease:[`linear`,`initial`,v,XP,HP]}],delay:[{delay:[AP,XP,HP]}],animate:[{animate:[`none`,y,XP,HP]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[g,XP,HP]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:_e()}],"rotate-x":[{"rotate-x":_e()}],"rotate-y":[{"rotate-y":_e()}],"rotate-z":[{"rotate-z":_e()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":[`scale-3d`],skew:[{skew:ye()}],"skew-x":[{"skew-x":ye()}],"skew-y":[{"skew-y":ye()}],transform:[{transform:[XP,HP,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":[`translate-none`],zoom:[{zoom:[jP,XP,HP]}],accent:[{accent:A()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,XP,HP]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":A()}],"scrollbar-track-color":[{"scrollbar-track":A()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,XP,HP]}],fill:[{fill:[`none`,...A()]}],"stroke-w":[{stroke:[AP,ZP,UP,WP]}],stroke:[{stroke:[`none`,...A()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function hF(...e){return mF(BN(e))}var gF=1e3;24*(60*gF*60),30*gF;function _F(e,t){if(typeof globalThis>`u`)return(0,S.createContext)(t);let n=globalThis.__camstackSharedContexts,r=n??new Map;n||(globalThis.__camstackSharedContexts=r);let a=r.get(e);if(a)return a;let o=(0,S.createContext)(t);return r.set(e,o),o}var vF=`FEDERATION_DEBUG`,yF={AT:`@`,HYPHEN:`-`,SLASH:`/`},bF={[yF.AT]:`scope_`,[yF.HYPHEN]:`_`,[yF.SLASH]:`__`};bF[yF.AT],yF.AT,bF[yF.HYPHEN],yF.HYPHEN,bF[yF.SLASH],yF.SLASH;var xF=function(e){return e[e.UNKNOWN=1]=`UNKNOWN`,e[e.CALCULATED=2]=`CALCULATED`,e[e.NO_USE=0]=`NO_USE`,e}({}),SF=typeof ENV_TARGET<`u`?ENV_TARGET===`web`:typeof window<`u`&&window.document!==void 0;function CF(){return SF}function wF(){return typeof navigator<`u`&&navigator?.product===`ReactNative`}function TF(){try{if(CF()&&window.localStorage)return!!localStorage.getItem(vF)}catch{return!1}return!1}function EF(){return typeof process<`u`&&{}.FEDERATION_DEBUG?!!{}.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<`u`&&FEDERATION_DEBUG?!0:TF()}var DF=`[ Federation Runtime ]`,OF=function(...e){return e.length?e.reduce((e,t)=>t?e?`${e}:${t}`:t:e,``):``},kF=(e,t)=>{if(`getPublicPath`in e){let n;return n=e.getPublicPath.startsWith(`function`)?Function(`return `+e.getPublicPath)()():Function(e.getPublicPath)(),`${n}${t}`}else if(`publicPath`in e)return!CF()&&!wF()&&`ssrPublicPath`in e&&typeof e.ssrPublicPath==`string`?`${e.ssrPublicPath}${t}`:`${e.publicPath}${t}`;else return console.warn(`Cannot get resource URL. If in debug mode, please ignore.`,e,t),``},AF=e=>{console.warn(`${DF}: ${e}`)};function jF(e){try{return JSON.stringify(e,null,2)}catch{return``}}var MF=(e,t)=>{if(!e)return t;let n=(e=>{if(e===`.`)return``;if(e.startsWith(`./`))return e.replace(`./`,``);if(e.startsWith(`/`)){let t=e.slice(1);return t.endsWith(`/`)?t.slice(0,-1):t}return e})(e);return n?n.endsWith(`/`)?`${n}${t}`:`${n}/${t}`:t};function NF(e){return e.replace(/#.*$/,``).replace(/\?.*$/,``).replace(/\/[^\/]+$/,`/`)}function PF(e,t={}){let{remotes:n={},overrides:r={},version:a}=t,o,s=()=>`publicPath`in e.metaData?(e.metaData.publicPath===`auto`||e.metaData.publicPath===``)&&a?NF(a):e.metaData.publicPath:e.metaData.getPublicPath,c=Object.keys(r),l={};Object.keys(n).length||(l=e.remotes?.reduce((e,t)=>{let n,a=t.federationContainerName;return n=c.includes(a)?r[a]:`version`in t?t.version:t.entry,e[a]={matchedVersion:n},e},{})||{}),Object.keys(n).forEach(e=>l[e]={matchedVersion:c.includes(e)?r[e]:n[e]});let{remoteEntry:{path:u,name:d,type:f},types:p={path:``,name:``,zip:``,api:``},buildInfo:{buildVersion:m},globalName:h,ssrRemoteEntry:g}=e.metaData,{exposes:_}=e,v={version:a||``,buildVersion:m,globalName:h,remoteEntry:MF(u,d),remoteEntryType:f,remoteTypes:MF(p.path,p.name),remoteTypesZip:p.zip||``,remoteTypesAPI:p.api||``,remotesInfo:l,shared:e?.shared.map(e=>({assets:e.assets,sharedName:e.name,version:e.version,usedExports:e.referenceExports||[]})),modules:_?.map(e=>({moduleName:e.name,modulePath:e.path,assets:e.assets}))};if(`publicPath`in e.metaData?(o={...v,publicPath:s()},typeof e.metaData.ssrPublicPath==`string`&&(o.ssrPublicPath=e.metaData.ssrPublicPath)):o={...v,getPublicPath:s()},g){let e=MF(g.path,g.name);o.ssrRemoteEntry=e,o.ssrRemoteEntryType=g.type||`commonjs-module`}return o}function FF(e){return!!(`remoteEntry`in e&&e.remoteEntry.includes(`.json`))}var IF=`[ Module Federation ]`,LF=console,RF=[`logger.ts`,`logger.js`,`captureStackTrace`,`Logger.emit`,`Logger.log`,`Logger.info`,`Logger.warn`,`Logger.error`,`Logger.debug`];function zF(){try{let e=Error().stack;if(!e)return;let[,...t]=e.split(`
105
- `),n=t.filter(e=>!RF.some(t=>e.includes(t)));return n.length?`Stack trace:\n${n.slice(0,5).join(`
106
- `)}`:void 0}catch{return}}var BF=class{constructor(e,t=LF){this.prefix=e,this.delegate=t??LF}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??LF}emit(e,t){let n=this.delegate,r=EF()?zF():void 0,a=r?[...t,r]:t,o=(()=>{switch(e){case`log`:return[`log`,`info`];case`info`:return[`info`,`log`];case`warn`:return[`warn`,`info`,`log`];case`error`:return[`error`,`warn`,`log`];default:return[`debug`,`log`]}})();for(let e of o){let t=n[e];if(typeof t==`function`){t.call(n,this.prefix,...a);return}}for(let e of o){let t=LF[e];if(typeof t==`function`){t.call(LF,this.prefix,...a);return}}}log(...e){this.emit(`log`,e)}warn(...e){this.emit(`warn`,e)}error(...e){this.emit(`error`,e)}success(...e){this.emit(`info`,e)}info(...e){this.emit(`info`,e)}ready(...e){this.emit(`info`,e)}debug(...e){EF()&&this.emit(`debug`,e)}};function VF(e){return new BF(e)}function HF(e){let t=new BF(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}VF(IF),HF(IF);async function UF(e,t){try{return await e()}catch(e){!t&&AF(e);return}}function WF(e,t){let n=/^(https?:)?\/\//i;return e.replace(n,``).replace(/\/$/,``)===t.replace(n,``).replace(/\/$/,``)}function GF(e){let t=null,n=!0,r=2e4,a,o=document.getElementsByTagName(`script`);for(let r=0;r<o.length;r++){let a=o[r],s=a.getAttribute(`src`);if(s&&WF(s,e.url)){t=a,n=!1;break}}if(!t){let n=e.attrs;t=document.createElement(`script`),t.type=n?.type===`module`?`module`:`text/javascript`;let a;e.createScriptHook&&(a=e.createScriptHook(e.url,e.attrs),a instanceof HTMLScriptElement?t=a:typeof a==`object`&&(`script`in a&&a.script&&(t=a.script),`timeout`in a&&a.timeout&&(r=a.timeout))),t.src||=e.url,n&&!a&&Object.keys(n).forEach(e=>{t&&(e===`async`||e===`defer`?t[e]=n[e]:t.getAttribute(e)||t.setAttribute(e,n[e]))})}let s=null,c=typeof window<`u`?t=>{if(t.filename&&WF(t.filename,e.url)){let n=Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`);n.name=`ScriptExecutionError`,s=n}}:null;c&&window.addEventListener(`error`,c);let l=async(n,r)=>{clearTimeout(a),c&&window.removeEventListener(`error`,c);let o=()=>{if(r?.type===`error`){let t=Error(r?.isTimeout?`ScriptNetworkError: Script "${e.url}" timed out.`:`ScriptNetworkError: Failed to load script "${e.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);t.name=`ScriptNetworkError`,e?.onErrorCallback&&e?.onErrorCallback(t)}else s?e?.onErrorCallback&&e?.onErrorCallback(s):e?.cb&&e?.cb()};if(t&&(t.onerror=null,t.onload=null,UF(()=>{let{needDeleteScript:n=!0}=e;n&&t?.parentNode&&t.parentNode.removeChild(t)}),n&&typeof n==`function`)){let e=n(r);if(e instanceof Promise){let t=await e;return o(),t}return o(),e}o()};return t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),a=setTimeout(()=>{l(null,{type:`error`,isTimeout:!0})},r),{script:t,needAttach:n}}function KF(e){let t=null,n=!0,r=2e4,a,o=document.getElementsByTagName(`link`);for(let r=0;r<o.length;r++){let a=o[r],s=a.getAttribute(`href`),c=a.getAttribute(`rel`);if(s&&WF(s,e.url)&&c===e.attrs.rel){t=a,n=!1;break}}if(!t){t=document.createElement(`link`),t.setAttribute(`href`,e.url);let n,a=!0,o=e.attrs;e.createLinkHook&&(n=e.createLinkHook(e.url,o),n instanceof HTMLLinkElement?(t=n,a=!1):typeof n==`object`&&(`link`in n&&n.link&&(t=n.link,a=!1),`timeout`in n&&n.timeout&&(r=n.timeout))),o&&a&&Object.keys(o).forEach(e=>{t&&!t.getAttribute(e)&&t.setAttribute(e,o[e])})}if(!n)return Promise.resolve().then(()=>{e?.cb&&e?.cb()}),{link:t,needAttach:n};let s=(n,r)=>{a&&clearTimeout(a);let o=()=>{if(r?.type===`error`){let t=Error(r?.isTimeout?`LinkNetworkError: Link "${e.url}" timed out.`:`LinkNetworkError: Failed to load link "${e.url}" - the URL is unreachable or the server returned an error.`);t.name=`LinkNetworkError`,e?.onErrorCallback&&e?.onErrorCallback(t)}else e?.cb&&e?.cb()};if(t&&(t.onerror=null,t.onload=null,UF(()=>{let{needDeleteLink:n=!0}=e;n&&t?.parentNode&&t.parentNode.removeChild(t)}),n)){let e=n(r);return o(),e}o()};return t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),a=setTimeout(()=>{s(null,{type:`error`,isTimeout:!0})},r),{link:t,needAttach:n}}function qF(e,t){let{attrs:n={},createScriptHook:r}=t;return new Promise((t,a)=>{let{script:o,needAttach:s}=GF({url:e,cb:t,onErrorCallback:a,attrs:{fetchpriority:`high`,...n},createScriptHook:r,needDeleteScript:!0});s&&document.head.appendChild(o)})}var JF=new Map;function YF(e){if(!e)throw Error(`import specifier is required`);if(JF.has(e))return JF.get(e);let t=Function(`name`,`return import(name)`)(e).then(e=>e).catch(t=>{throw console.error(`Error importing module ${e}:`,t),JF.delete(e),t});return JF.set(e,t),t}var XF=async()=>{let e=await YF(`node-fetch`);return e.default||e},ZF=async(e,t,n)=>{let r=await((e,t)=>n.lifecycle.fetch.emit(e,t))(e,t||{});return!r||!(r instanceof Response)?(typeof fetch>`u`?await XF():fetch)(e,t||{}):r},QF=typeof ENV_TARGET>`u`||ENV_TARGET!==`web`?(e,t,n,r)=>{if(r?.createScriptHook){let t=r.createScriptHook(e);t&&typeof t==`object`&&`url`in t&&(e=t.url)}let a;try{a=new URL(e)}catch(e){console.error(`Error constructing URL:`,e),t(Error(`Invalid URL: ${e}`));return}let o=async()=>r?.fetch?(e,t)=>ZF(e,t,r):typeof fetch>`u`?XF():fetch,s=async(e,r)=>{try{let a=await(await e(r.href)).text(),[o,s]=await Promise.all([YF(`path`),YF(`vm`)]),c={exports:{},module:{exports:{}}},l=r.pathname.split(`/`).slice(0,-1).join(`/`),u=o.basename(r.pathname),d=new s.Script(`(function(exports, module, require, __dirname, __filename) {${a}\n})`,{filename:u,importModuleDynamically:s.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER??YF}),f;f=(await YF(`node:module`)).createRequire(r.protocol===`file:`||r.protocol===`node:`?r.href:o.join(process.cwd(),`__mf_require_base__.js`)),d.runInThisContext()(c.exports,c.module,f,l,u);let p=c.module.exports||c.exports;if(n&&p&&n.globalName){t(void 0,p[n.globalName]||p);return}t(void 0,p)}catch(e){t(e instanceof Error?e:Error(`Script execution error: ${e}`))}};o().then(async e=>{if(n?.type===`esm`||n?.type===`module`)return tI(a.href,{fetch:e,vm:await YF(`vm`)}).then(async e=>{await e.evaluate(),t(void 0,e.namespace)}).catch(e=>{t(e instanceof Error?e:Error(`Script execution error: ${e}`))});s(e,a)}).catch(e=>{t(e)})}:(e,t,n,r)=>{t(Error(`createScriptNode is disabled in non-Node.js environment`))},$F=typeof ENV_TARGET>`u`||ENV_TARGET!==`web`?(e,t)=>new Promise((n,r)=>{QF(e,(e,a)=>{if(e)r(e);else{let e=t?.attrs?.globalName||`__FEDERATION_${t?.attrs?.name}:custom__`;n(globalThis[e]=a)}},t.attrs,t.loaderHook)}):(e,t)=>{throw Error(`loadScriptNode is disabled in non-Node.js environment`)},eI=new Map;async function tI(e,t){if(eI.has(e))return eI.get(e);let{fetch:n,vm:r}=t,a=await(await n(e)).text(),o=new r.SourceTextModule(a,{importModuleDynamically:async(n,r)=>{let a=new URL(n,e).href;return tI(a,t)}});return eI.set(e,o),await o.link(async n=>{let r=new URL(n,e).href;return await tI(r,t)}),o}var nI=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split(`-`)[0].toLowerCase()}#${e.toLowerCase()}`,rI=(e,t,n,r)=>{let a=[`${[t[e]]} #${e}`];return n&&a.push(`args: ${JSON.stringify(n)}`),a.push(nI(e)),r&&a.push(`Original Error Message:\n ${r}`),a.join(`
107
- `)};function iI(e,t,n,r,a,o){return r(rI(e,t,n,a))}var aI=`[ Federation Runtime ]`,oI=VF(aI);function sI(e,t,n,r,a){e||(n===void 0?cI(t):cI(t,n,r,void 0,a))}function cI(e,t,n,r,a){if(t!==void 0)return iI(e,t,n??{},e=>{throw Error(`${aI}: ${e}`)},r,a);let o=e;throw o instanceof Error?(o.message.startsWith(aI)||(o.message=`${aI}: ${o.message}`),o):Error(`${aI}: ${o}`)}function lI(e){e instanceof Error&&(e.message.startsWith(aI)||(e.message=`${aI}: ${e.message}`)),oI.warn(e)}function uI(e,t){return e.findIndex(e=>e===t)===-1&&e.push(t),e}function dI(e){return`version`in e&&e.version?`${e.name}:${e.version}`:`entry`in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function fI(e){return e.entry!==void 0}function pI(e){return!e.entry.includes(`.json`)}function mI(e){return e&&typeof e==`object`}var hI=Object.prototype.toString;function gI(e){return hI.call(e)===`[object Object]`}function _I(e){return Array.isArray(e)?e:[e]}function vI(e){let t={url:``,type:`global`,globalName:``};return SF||wF()||!(`ssrRemoteEntry`in e)?`remoteEntry`in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:`ssrRemoteEntry`in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}var yI=(e,t)=>{let n;return n=e.endsWith(`/`)?e.slice(0,-1):e,t.startsWith(`.`)&&(t=t.slice(1)),n+=t,n},bI=typeof globalThis==`object`?globalThis:window,xI=(()=>{try{return document.defaultView}catch{return bI}})(),SI=xI;function CI(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!1,writable:!0})}function wI(e,t){return Object.hasOwnProperty.call(e,t)}wI(bI,`__GLOBAL_LOADING_REMOTE_ENTRY__`)||CI(bI,`__GLOBAL_LOADING_REMOTE_ENTRY__`,{});var TI=bI.__GLOBAL_LOADING_REMOTE_ENTRY__;function EI(e){wI(e,`__VMOK__`)&&!wI(e,`__FEDERATION__`)&&CI(e,`__FEDERATION__`,e.__VMOK__),wI(e,`__FEDERATION__`)||(CI(e,`__FEDERATION__`,{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),CI(e,`__VMOK__`,e.__FEDERATION__)),e.__FEDERATION__.__GLOBAL_PLUGIN__??=[],e.__FEDERATION__.__INSTANCES__??=[],e.__FEDERATION__.moduleInfo??={},e.__FEDERATION__.__SHARE__??={},e.__FEDERATION__.__MANIFEST_LOADING__??={},e.__FEDERATION__.__PRELOADED_MAP__??=new Map}EI(bI),EI(xI);function DI(e,t=EF()){t&&(bI.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,bI.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__=`2.5.1`)}function OI(e,t){if(typeof t==`string`){if(e[t])return{value:e[t],key:t};{let n=Object.keys(e);for(let r of n){let[n,a]=r.split(`:`),o=`${n}:${t}`,s=e[o];if(s)return{value:s,key:o}}return{value:void 0,key:t}}}else cI(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}var kI=()=>xI.__FEDERATION__.moduleInfo,AI=(e,t)=>{let n=OI(t,dI(e)).value;if(n&&!n.version&&`version`in e&&e.version&&(n.version=e.version),n)return n;if(`version`in e&&e.version){let{version:t,...n}=e,r=dI(n),a=OI(xI.__FEDERATION__.moduleInfo,r).value;if(a?.version===t)return a}},jI=e=>AI(e,xI.__FEDERATION__.moduleInfo),MI=(e,t)=>{let n=dI(e);return xI.__FEDERATION__.moduleInfo[n]=t,xI.__FEDERATION__.moduleInfo},NI=e=>(xI.__FEDERATION__.moduleInfo={...xI.__FEDERATION__.moduleInfo,...e},()=>{let t=Object.keys(e);for(let e of t)delete xI.__FEDERATION__.moduleInfo[e]}),PI=(e,t)=>{let n=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:n,entryExports:bI[n]}},FI=()=>xI.__FEDERATION__.__GLOBAL_PLUGIN__,II=e=>bI.__FEDERATION__.__PRELOADED_MAP__.get(e),LI=e=>bI.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),RI=`[0-9A-Za-z-]+`,zI=`(?:\\+(${RI}(?:\\.${RI})*))`,BI=`0|[1-9]\\d*`,VI=`[0-9]+`,HI=`\\d*[a-zA-Z-][a-zA-Z0-9-]*`,UI=`(?:${VI}|${HI})`,WI=`(?:-?(${UI}(?:\\.${UI})*))`,GI=`(?:${BI}|${HI})`,KI=`(?:-(${GI}(?:\\.${GI})*))`,qI=`${BI}|x|X|\\*`,JI=`[v=\\s]*(${qI})(?:\\.(${qI})(?:\\.(${qI})(?:${KI})?${zI}?)?)?`,YI=`^\\s*(${JI})\\s+-\\s+(${JI})\\s*$`,XI=`[v=\\s]*${`(${VI})\\.(${VI})\\.(${VI})`}${WI}?${zI}?`,ZI=`((?:<|>)?=?)`,QI=`(\\s*)${ZI}\\s*(${XI}|${JI})`,$I=`(?:~>?)`,eL=`(\\s*)${$I}\\s+`,tL=`(?:\\^)`,nL=`(\\s*)${tL}\\s+`,rL=`(<|>)?=?\\s*\\*`,iL=`^${tL}${JI}$`,aL=`v?${`(${BI})\\.(${BI})\\.(${BI})`}${KI}?${zI}?`,oL=`^${$I}${JI}$`,sL=`^${ZI}\\s*${JI}$`,cL=`^${ZI}\\s*(${aL})$|^$`,lL=`^\\s*>=\\s*0.0.0\\s*$`;function uL(e){return new RegExp(e)}function dL(e){return!e||e.toLowerCase()===`x`||e===`*`}function fL(...e){return t=>e.reduce((e,t)=>t(e),t)}function pL(e){return e.match(uL(cL))}function mL(e,t,n,r){let a=`${e}.${t}.${n}`;return r?`${a}-${r}`:a}function hL(e){return e.replace(uL(YI),(e,t,n,r,a,o,s,c,l,u,d,f)=>(t=dL(n)?``:dL(r)?`>=${n}.0.0`:dL(a)?`>=${n}.${r}.0`:`>=${t}`,c=dL(l)?``:dL(u)?`<${Number(l)+1}.0.0-0`:dL(d)?`<${l}.${Number(u)+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:`<=${c}`,`${t} ${c}`.trim()))}function gL(e){return e.replace(uL(QI),`$1$2$3`)}function _L(e){return e.replace(uL(eL),`$1~`)}function vL(e){return e.replace(uL(nL),`$1^`)}function yL(e){return e.trim().split(/\s+/).map(e=>e.replace(uL(iL),(e,t,n,r,a)=>dL(t)?``:dL(n)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:dL(r)?t===`0`?`>=${t}.${n}.0 <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.0 <${Number(t)+1}.0.0-0`:a?t===`0`?n===`0`?`>=${t}.${n}.${r}-${a} <${t}.${n}.${Number(r)+1}-0`:`>=${t}.${n}.${r}-${a} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${r}-${a} <${Number(t)+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${r} <${t}.${n}.${Number(r)+1}-0`:`>=${t}.${n}.${r} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${r} <${Number(t)+1}.0.0-0`)).join(` `)}function bL(e){return e.trim().split(/\s+/).map(e=>e.replace(uL(oL),(e,t,n,r,a)=>dL(t)?``:dL(n)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:dL(r)?`>=${t}.${n}.0 <${t}.${Number(n)+1}.0-0`:a?`>=${t}.${n}.${r}-${a} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${r} <${t}.${Number(n)+1}.0-0`)).join(` `)}function xL(e){return e.split(/\s+/).map(e=>e.trim().replace(uL(sL),(e,t,n,r,a,o)=>{let s=dL(n),c=s||dL(r),l=c||dL(a);return t===`=`&&l&&(t=``),o=``,s?t===`>`||t===`<`?`<0.0.0-0`:`*`:t&&l?(c&&(r=0),a=0,t===`>`?(t=`>=`,c?(n=Number(n)+1,r=0,a=0):(r=Number(r)+1,a=0)):t===`<=`&&(t=`<`,c?n=Number(n)+1:r=Number(r)+1),t===`<`&&(o=`-0`),`${t+n}.${r}.${a}${o}`):c?`>=${n}.0.0${o} <${Number(n)+1}.0.0-0`:l?`>=${n}.${r}.0${o} <${n}.${Number(r)+1}.0-0`:e})).join(` `)}function SL(e){return e.trim().replace(uL(rL),``)}function CL(e){return e.trim().replace(uL(lL),``)}function wL(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function TL(e,t){let{preRelease:n}=e,{preRelease:r}=t;if(n===void 0&&r)return 1;if(n&&r===void 0)return-1;if(n===void 0&&r===void 0)return 0;for(let e=0,t=n.length;e<=t;e++){let t=n[e],a=r[e];if(t!==a)return t===void 0&&a===void 0?0:t?a?wL(t,a):-1:1}return 0}function EL(e,t){return wL(e.major,t.major)||wL(e.minor,t.minor)||wL(e.patch,t.patch)||TL(e,t)}function DL(e,t){return e.version===t.version}function OL(e,t){switch(e.operator){case``:case`=`:return DL(e,t);case`>`:return EL(e,t)<0;case`>=`:return DL(e,t)||EL(e,t)<0;case`<`:return EL(e,t)>0;case`<=`:return DL(e,t)||EL(e,t)>0;case void 0:return!0;default:return!1}}function kL(e){return fL(yL,bL,xL,SL)(e)}function AL(e){return fL(hL,gL,_L,vL)(e.trim()).split(/\s+/).join(` `)}function jL(e,t){if(!e)return!1;let n=pL(e);if(!n)return!1;let[,r,,a,o,s,c]=n,l={operator:r,version:mL(a,o,s,c),major:a,minor:o,patch:s,preRelease:c?.split(`.`)},u=t.split(`||`);for(let e of u){let t=e.trim();if(!t||t===`*`||t===`x`)return!0;try{let e=AL(t);if(!e.trim())return!0;let n=e.split(` `).map(e=>kL(e)).join(` `);if(!n.trim())return!0;let r=n.split(/\s+/).map(e=>CL(e)).filter(Boolean);if(r.length===0)continue;let a=!0;for(let e of r){let t=pL(e);if(!t){a=!1;break}let[,n,,r,o,s,c]=t;if(!OL({operator:n,version:mL(r,o,s,c),major:r,minor:o,patch:s,preRelease:c?.split(`.`)},l)){a=!1;break}}if(a)return!0}catch(e){console.error(`[semver] Error processing range part "${t}":`,e);continue}}return!1}var ML=`default`,NL=`global`;function PL(e,t,n,r){let a;return a=`get`in e?e.get:`lib`in e?()=>Promise.resolve(e.lib):()=>Promise.resolve(()=>{cI(`Cannot get shared "${n}" from "${t}": neither "get" nor "lib" is provided in the share config.`)}),e.shareConfig?.eager&&e.treeShaking?.mode&&cI(`Invalid shared config for "${n}" from "${t}": cannot use both "eager: true" and "treeShaking.mode" simultaneously. Choose one strategy.`),{deps:[],useIn:[],from:t,loading:null,...e,shareConfig:{requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1,...e.shareConfig},get:a,loaded:e?.loaded||`lib`in e?!0:void 0,version:e.version??`0`,scope:Array.isArray(e.scope)?e.scope:[e.scope??`default`],strategy:(e.strategy??r)||`version-first`,treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??`server-calc`,status:e.treeShaking.status??xF.UNKNOWN,useIn:[]}:void 0}}function FL(e,t){let n=t.shared||{},r=t.name,a=Object.keys(n).reduce((e,a)=>{let o=_I(n[a]);return e[a]=e[a]||[],o.forEach(n=>{e[a].push(PL(n,r,a,t.shareStrategy))}),e},{}),o={...e.shared};return Object.keys(a).forEach(e=>{o[e]?a[e].forEach(t=>{o[e].find(e=>e.version===t.version)||o[e].push(t)}):o[e]=a[e]}),{allShareInfos:o,newShareInfos:a}}function IL(e,t){if(!e)return!1;let{status:n,mode:r}=e;return n===xF.NO_USE?!1:n===xF.CALCULATED?!0:r===`runtime-infer`?t?VL(e,t):!0:!1}function LL(e,t){let n=e=>{if(!Number.isNaN(Number(e))){let t=e.split(`.`),n=e;for(let e=0;e<3-t.length;e++)n+=`.0`;return n}return e};return!!jL(n(e),`<=${n(t)}`)}var RL=(e,t)=>{let n=t||function(e,t){return LL(e,t)};return Object.keys(e).reduce((e,t)=>!e||n(e,t)||e===`0`?t:e,0)},zL=e=>!!e.loaded||typeof e.lib==`function`,BL=e=>!!e.loading,VL=(e,t)=>{if(!e||!t)return!1;let{usedExports:n}=e;return n?!!t.every(e=>n.includes(e)):!1};function HL(e,t,n,r){let a=e[t][n],o=``,s=IL(r),c=function(e,t){return s?a[e].treeShaking?a[t].treeShaking?!zL(a[e].treeShaking)&&LL(e,t):!1:!0:!zL(a[e])&&LL(e,t)};if(s){if(o=RL(e[t][n],c),o)return{version:o,useTreesShaking:s};s=!1}return{version:RL(e[t][n],c),useTreesShaking:s}}var UL=e=>zL(e)||BL(e);function WL(e,t,n,r){let a=e[t][n],o=``,s=IL(r),c=function(e,t){if(s){if(!a[e].treeShaking)return!0;if(!a[t].treeShaking)return!1;if(UL(a[t].treeShaking))return UL(a[e].treeShaking)?!!LL(e,t):!0;if(UL(a[e].treeShaking))return!1}return UL(a[t])?UL(a[e])?!!LL(e,t):!0:UL(a[e])?!1:LL(e,t)};if(s){if(o=RL(e[t][n],c),o)return{version:o,useTreesShaking:s};s=!1}return{version:RL(e[t][n],c),useTreesShaking:s}}function GL(e){return e===`loaded-first`?WL:HL}function KL(e,t,n,r){if(!e)return;let{shareConfig:a,scope:o=ML,strategy:s,treeShaking:c}=n,l=Array.isArray(o)?o:[o];for(let o of l)if(a&&e[o]&&e[o][t]){let{requiredVersion:l}=a,{version:u,useTreesShaking:d}=GL(s)(e,o,t,c),f={shareScopeMap:e,scope:o,pkgName:t,version:u,GlobalFederation:SI.__FEDERATION__,shareInfo:n,resolver:()=>{let r=e[o][t][u];if(a.singleton){if(typeof l==`string`&&!jL(u,l)){let e=`Version ${u} from ${u&&r.from} of shared singleton module ${t} does not satisfy the requirement of ${n.from} which needs ${l})`;a.strictVersion?cI(e):lI(e)}return{shared:r,useTreesShaking:d}}else{if(l===!1||l===`*`||jL(u,l))return{shared:r,useTreesShaking:d};let n=IL(c);if(n){for(let[r,a]of Object.entries(e[o][t]))if(IL(a.treeShaking,c?.usedExports)&&jL(r,l))return{shared:a,useTreesShaking:n}}for(let[n,r]of Object.entries(e[o][t]))if(jL(n,l))return{shared:r,useTreesShaking:!1}}}};return(r.emit(f)||f).resolver()}}function qL(){return SI.__FEDERATION__.__SHARE__}function JL(e){let{pkgName:t,extraOptions:n,shareInfos:r}=e,a=n?.resolver??(e=>{if(!e)return;let t={};return e.forEach(e=>{t[e.version]=e}),t[RL(t,function(e,n){return!zL(t[e])&&LL(e,n)})]}),o=e=>typeof e==`object`&&!!e&&!Array.isArray(e),s=(...e)=>{let t={};for(let n of e)if(n)for(let[e,r]of Object.entries(n)){let n=t[e];o(n)&&o(r)?t[e]=s(n,r):r!==void 0&&(t[e]=r)}return t};return s(a(r[t]),n?.customShareInfo)}var YL=(e,t)=>{e.useIn||=[],uI(e.useIn,t)};function XL(e,t){return t&&e.treeShaking?e.treeShaking:e}function ZL(e,t){return!t||t===`.`?e:`${e}/${t.replace(/^\.\//,``)}`}function QL(e,t){for(let n of e){let e=t.startsWith(n.name),r=t.replace(n.name,``);if(e){if(r.startsWith(`/`)){let e=n.name;return r=`.${r}`,{pkgNameOrAlias:e,expose:r,remote:n}}else if(r===``)return{pkgNameOrAlias:n.name,expose:`.`,remote:n}}let a=n.alias&&t.startsWith(n.alias),o=n.alias&&t.replace(n.alias,``);if(n.alias&&a){if(o&&o.startsWith(`/`)){let e=n.alias;return o=`.${o}`,{pkgNameOrAlias:e,expose:o,remote:n}}else if(o===``)return{pkgNameOrAlias:n.alias,expose:`.`,remote:n}}}}function $L(e,t){for(let n of e)if(t===n.name||n.alias&&t===n.alias)return n}var eR=`RUNTIME-001`,tR=`RUNTIME-002`,nR=`RUNTIME-003`,rR=`RUNTIME-004`,iR=`RUNTIME-005`,aR=`RUNTIME-006`,oR=`RUNTIME-007`,sR=`RUNTIME-008`,cR=`RUNTIME-009`,lR=`RUNTIME-010`,uR=`RUNTIME-011`,dR=`RUNTIME-012`,fR=`RUNTIME-013`,pR=`RUNTIME-014`,mR=`RUNTIME-015`,hR=`TYPE-001`,gR=`BUILD-001`,_R=`BUILD-002`,vR={[eR]:`Failed to get remoteEntry exports.`,[tR]:`The remote entry interface does not contain "init"`,[nR]:`Failed to get manifest.`,[rR]:`Failed to locate remote.`,[iR]:`Invalid loadShareSync function call from bundler runtime`,[aR]:`Invalid loadShareSync function call from runtime`,[oR]:`Failed to get remote snapshot.`,[sR]:`Failed to load script resources.`,[cR]:`Please call createInstance first.`,[lR]:`The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.`,[uR]:`The remoteEntry URL is missing from the remote snapshot.`,[dR]:`The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.`,[fR]:`The manifest is not a valid Module Federation manifest.`,[pR]:`The remote does not expose the requested module.`,[mR]:`Remote container initialization failed.`},yR={[hR]:`Failed to generate type declaration. Execute the below cmd to reproduce and fix the error.`},bR={[gR]:`Failed to find expose module.`,[_R]:`PublicPath is required in prod mode.`};({...vR,...yR,...bR});var xR=`.then(callbacks[0]).catch(callbacks[1])`;async function SR({entry:e,remoteEntryExports:t}){return new Promise((n,r)=>{try{t?n(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<`u`?Function(`callbacks`,`import("${e}")${xR}`)([n,r]):RN(()=>import(e).then(n),[],import.meta.url).catch(r)}catch(t){cI(`Failed to load ESM entry from "${e}". ${t instanceof Error?t.message:String(t)}`)}})}async function CR({entry:e,remoteEntryExports:t}){return new Promise((n,r)=>{try{t?n(t):typeof __system_context__>`u`?System.import(e).then(n).catch(r):Function(`callbacks`,`System.import("${e}")${xR}`)([n,r])}catch(t){cI(`Failed to load SystemJS entry from "${e}". ${t instanceof Error?t.message:String(t)}`)}})}function wR(e,t,n){let{remoteEntryKey:r,entryExports:a}=PI(e,t);return a||cI(eR,vR,{remoteName:e,remoteEntryUrl:n,remoteEntryKey:r}),a}async function TR({name:e,globalName:t,entry:n,remoteInfo:r,loaderHook:a,getEntryUrl:o,resourceContext:s}){let{entryExports:c}=PI(e,t);if(c)return c;let l=o?o(n):n;return qF(l,{attrs:{},createScriptHook:(e,t)=>{let n=a.lifecycle.createScript.emit({url:e,attrs:t,remoteInfo:r,resourceContext:s?{...s,url:e}:void 0});if(n&&(n instanceof HTMLScriptElement||`script`in n||`timeout`in n))return n}}).then(()=>wR(e,t,n),t=>{let n=t instanceof Error?t.message:String(t);cI(sR,vR,{remoteName:e,resourceUrl:l},n)})}async function ER({remoteInfo:e,remoteEntryExports:t,loaderHook:n,getEntryUrl:r,resourceContext:a}){let{entry:o,entryGlobalName:s,name:c,type:l}=e;switch(l){case`esm`:case`module`:return SR({entry:o,remoteEntryExports:t});case`system`:return CR({entry:o,remoteEntryExports:t});default:return TR({entry:o,globalName:s,name:c,remoteInfo:e,loaderHook:n,getEntryUrl:r,resourceContext:a})}}async function DR({remoteInfo:e,loaderHook:t,resourceContext:n}){let{entry:r,entryGlobalName:a,name:o,type:s}=e,{entryExports:c}=PI(o,a);return c||$F(r,{attrs:{name:o,globalName:a,type:s},loaderHook:{createScriptHook:(r,a={})=>{let o=t.lifecycle.createScript.emit({url:r,attrs:a,remoteInfo:e,resourceContext:n?{...n,url:r}:void 0});if(o&&`url`in o)return o}}}).then(()=>wR(o,a,r)).catch(e=>{cI(`Failed to load Node.js entry for remote "${o}" from "${r}". ${e instanceof Error?e.message:String(e)}`)})}function OR(e){let{entry:t,name:n}=e;return OF(n,t)}async function kR(e){let{origin:t,remoteEntryExports:n,remoteInfo:r,getEntryUrl:a,resourceContext:o,_inErrorHandling:s=!1}=e,c=OR(r);if(n)return n;if(!TI[c]){let e=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;TI[c]=e.emit({origin:t,loaderHook:l,remoteInfo:r,remoteEntryExports:n}).then(e=>e||((typeof ENV_TARGET<`u`?ENV_TARGET===`web`:SF)?ER({remoteInfo:r,remoteEntryExports:n,loaderHook:l,getEntryUrl:a,resourceContext:o}):DR({remoteInfo:r,loaderHook:l,resourceContext:o}))).then(async e=>(await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:e}),e)).catch(async e=>{let a=OR(r),o=e instanceof Error&&e.message.includes(`ScriptExecutionError`);if(e instanceof Error&&e.message.includes(`RUNTIME-008`)&&!o&&!s){let e=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:e=>kR({...e,_inErrorHandling:!0}),origin:t,remoteInfo:r,remoteEntryExports:n,globalLoading:TI,uniqueKey:a});if(e)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:e,recovered:!0}),e}throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,error:e}),e})}return TI[c]}function AR(e){return{...e,entry:`entry`in e?e.entry:``,type:e.type||`global`,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||`default`}}function jR(){return typeof FEDERATION_BUILD_IDENTIFIER<`u`?FEDERATION_BUILD_IDENTIFIER:``}function MR(e,t){let n=FI(),r=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return n.length>0&&n.forEach(t=>{e?.find(e=>e.name!==t.name)&&e.push(t)}),e&&e.length>0&&e.forEach(e=>{r.forEach(n=>{n.applyPlugin(e,t)})}),e}function NR(e){return{name:e.name,alias:e.alias,entry:`entry`in e?e.entry:void 0,version:`version`in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function PR(e){let t={};for(let[n,r]of Object.entries(e.shared)){let e=r[0];e&&(t[n]={version:e.version,singleton:e.shareConfig?.singleton,requiredVersion:e.shareConfig?.requiredVersion===!1?!1:e.shareConfig?.requiredVersion,eager:e.eager,strictVersion:e.shareConfig?.strictVersion})}return{project:{name:e.name,mfRole:e.remotes?.length>0?`host`:`unknown`},mfConfig:{name:e.name,remotes:e.remotes?.map(NR)??[],shared:t}}}function FR(e){return{resourceCategory:`sync`,share:!0,depsRemote:!0,...e}}function IR(e,t){return t.map(t=>{let n=$L(e,t.nameOrAlias);return sI(n,`Unable to preload ${t.nameOrAlias} as it is not included in ${!n&&jF({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:FR(t)}})}function LR(e){return e?e.map(e=>e===`.`?e:e.startsWith(`./`)?e.replace(`./`,``):e):[]}function RR(e){return e instanceof Error?e.message.includes(`timed out`)||e.name.includes(`Timeout`):!1}function zR(e,t,n,r){return{url:t,status:n,resourceType:e.resourceType,initiator:e.initiator,id:e.id,error:r}}async function BR(e,t,n,r){let a=e.moduleCache.get(n.name),o=n.entry;if(a?.remoteEntryExports)return zR(r,o,`cached`);try{if(!await kR({origin:e,remoteInfo:n,remoteEntryExports:a?.remoteEntryExports,resourceContext:{...r,url:o}}))throw Error(`Failed to load remoteEntry "${o}".`);return zR(r,o,`success`)}catch(e){return zR(r,o,RR(e)?`timeout`:`error`,e)}}function VR({host:e,remoteInfo:t,url:n,attrs:r,context:a,needDeleteLink:o}){return new Promise(s=>{let{link:c,needAttach:l}=KF({url:n,cb:()=>{s(zR(a,n,l?`success`:`cached`))},onErrorCallback:e=>{s(zR(a,n,RR(e)?`timeout`:`error`,e))},attrs:r,createLinkHook:(n,r)=>{let o=e.loaderHook.lifecycle.createLink.emit({url:n,attrs:r,remoteInfo:t,resourceContext:{...a,url:n}});return o instanceof HTMLLinkElement,o},needDeleteLink:o});l&&document.head.appendChild(c)})}function HR({host:e,remoteInfo:t,url:n,attrs:r,context:a}){return new Promise(o=>{let{script:s,needAttach:c}=GF({url:n,cb:()=>{o(zR(a,n,c?`success`:`cached`))},onErrorCallback:e=>{o(zR(a,n,RR(e)?`timeout`:`error`,e))},attrs:r,createScriptHook:(n,r)=>{let o=e.loaderHook.lifecycle.createScript.emit({url:n,attrs:r,remoteInfo:t,resourceContext:{...a,url:n}});return o instanceof HTMLScriptElement,o},needDeleteScript:!0});c&&document.head.appendChild(s)})}function UR(e,t){return{...e,resourceType:t}}function WR(e,t,n,r=!0,a={initiator:`preloadRemote`,id:e.name}){let{cssAssets:o,jsAssetsWithoutEntry:s,entryAssets:c}=n,l=[];if(t.options.inBrowser){if(c.forEach(n=>{let{moduleInfo:r}=n;l.push(BR(t,e,r,UR(a,`remoteEntry`)))}),r){let n={rel:`preload`,as:`style`};o.forEach(r=>{l.push(VR({host:t,remoteInfo:e,url:r,attrs:n,context:UR(a,`css`)}))})}else{let n={rel:`stylesheet`,type:`text/css`};o.forEach(r=>{l.push(VR({host:t,remoteInfo:e,url:r,attrs:n,needDeleteLink:!1,context:UR(a,`css`)}))})}if(r){let n={rel:`preload`,as:`script`};s.forEach(r=>{l.push(VR({host:t,remoteInfo:e,url:r,attrs:n,context:UR(a,`js`)}))})}else{let n={fetchpriority:`high`,type:e?.type===`module`?`module`:`text/javascript`};s.forEach(r=>{l.push(HR({host:t,remoteInfo:e,url:r,attrs:n,context:UR(a,`js`)}))})}}return Promise.all(l)}function GR(e){if(!e||!(`modules`in e)||!Array.isArray(e.modules))return;let t=e.modules.map(e=>e.moduleName).filter(Boolean);return t.length?t.join(`,`):void 0}function KR(e,t,n){let r=t,a=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];a.length||a.push(`default`),a.forEach(e=>{r[e]||(r[e]={})});let o={version:e.version||``,shareScopeKeys:Array.isArray(e.shareScope)?a:e.shareScope||`default`};return Object.defineProperty(o,"shareScopeMap",{value:r,enumerable:!1}),{remoteEntryInitOptions:o,shareScope:r[a[0]],initScope:n??[]}}var qR=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(e){if(this.remoteEntryExports)return this.remoteEntryExports;let t=await kR({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,resourceContext:{initiator:`loadRemote`,id:ZL(this.remoteInfo.name,e),resourceType:`remoteEntry`}});return sI(t,`remoteEntryExports is undefined \n ${jF(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async init(e,t,n,r){let a=await this.getEntry(r);if(this.inited)return await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,cached:!0,origin:this.host}),a;if(this.initPromise){try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,cached:!0,origin:this.host})}catch(n){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,error:n,cached:!0,origin:this.host}),n}return a}this.initing=!0,this.initPromise=(async()=>{await this.host.loaderHook.lifecycle.beforeInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,origin:this.host});let{remoteEntryInitOptions:r,shareScope:o,initScope:s}=KR(this.remoteInfo,this.host.shareScopeMap,n),c=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:o,remoteEntryInitOptions:r,initScope:s,remoteInfo:this.remoteInfo,origin:this.host});a?.init===void 0&&cI(tR,vR,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,PR(this.host.options));try{await a.init(c.shareScope,c.initScope,c.remoteEntryInitOptions)}catch(e){cI(mR,vR,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName,shareScope:this.remoteInfo.shareScope},`${e}`,PR(this.host.options))}await this.host.hooks.lifecycle.initContainer.emit({...c,id:e,remoteSnapshot:t,remoteEntryExports:a}),this.inited=!0})();try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,origin:this.host})}catch(n){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,error:n,origin:this.host}),n}finally{this.initing=!1,this.initPromise=void 0}return a}async get(e,t,n,r){let{loadFactory:a=!0}=n||{loadFactory:!0},o=await this.init(e,r,void 0,t);this.lib=o,await this.host.loaderHook.lifecycle.beforeGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:o,origin:this.host});let s;try{let n=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:o,expose:t,moduleInfo:this.remoteInfo});s=typeof n==`function`?n:void 0,s||=await o.get(t),s||cI(pR,vR,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,expose:t,requestId:e,availableExposes:GR(r)},void 0,PR(this.host.options)),await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:o,moduleFactory:s,origin:this.host})}catch(n){throw await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:o,error:n,origin:this.host}),n}let c=yI(this.remoteInfo.name,t),l=this.wraperFactory(s,c);if(!a)return l;await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:a,origin:this.host});try{let n=await l();return await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:a,exposeModule:n,origin:this.host}),n}catch(n){throw await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:a,error:n,origin:this.host}),n}}wraperFactory(e,t){function n(e,t){e&&typeof e==`object`&&Object.isExtensible(e)&&!Object.getOwnPropertyDescriptor(e,Symbol.for(`mf_module_id`))&&Object.defineProperty(e,Symbol.for(`mf_module_id`),{value:t,enumerable:!1})}return()=>{let r=e();return r instanceof Promise?r.then(e=>(n(e,t),e)):(n(r,t),r)}}},JR=class{constructor(e){this.type=``,this.listeners=new Set,e&&(this.type=e)}on(e){typeof e==`function`&&this.listeners.add(e)}once(e){let t=this;this.on(function n(...r){return t.remove(n),e.apply(null,r)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(n=>{let r=n(...e);r!==void 0&&(t=r)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},YR=class extends JR{emit(...e){let t,n=Array.from(this.listeners);if(n.length>0){let r=0,a=t=>t===!1?!1:r<n.length?Promise.resolve(n[r++].apply(null,e)).then(n=>n===void 0||e.length===1&&n===e[0]?a(t):a(n)):t;t=a()}return Promise.resolve(t)}};function XR(e,t){if(!mI(t))return!1;if(e!==t){for(let n in e)if(!(n in t))return!1}return!0}var ZR=class extends JR{constructor(e){super(),this.onerror=cI,this.type=e}emit(e){mI(e)||cI(`The data for the "${this.type}" hook should be an object.`);for(let t of this.listeners)try{let n=t(e);if(n===void 0)continue;if(XR(e,n))e=n;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(e){lI(e),this.onerror(e)}return e}},QR=class extends JR{constructor(e){super(),this.onerror=cI,this.type=e}emit(e){mI(e)||cI(`The response data for the "${this.type}" hook must be an object.`);let t=Array.from(this.listeners);if(t.length>0){let n=0,r=t=>(lI(t),this.onerror(t),e),a=o=>{if(o!==void 0&&XR(e,o))e=o;else if(o!==void 0)return this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`),e;if(n<t.length)try{return Promise.resolve(t[n++](e)).then(a,r)}catch(e){return r(e)}return e};return Promise.resolve(a(e))}return Promise.resolve(e)}},$R=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){sI(gI(e),`Plugin configuration is invalid.`);let n=e.name;sI(n,`A name must be provided by the plugin.`),this.registerPlugins[n]||(this.registerPlugins[n]=e,e.apply?.(t),Object.keys(this.lifecycle).forEach(t=>{let n=e[t];n&&this.lifecycle[t].on(n)}))}removePlugin(e){sI(e,`A name is required.`);let t=this.registerPlugins[e];sI(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(e=>{e!==`name`&&this.lifecycle[e].remove(t[e])})}};function ez(e,t){let n=vI(t);n.url||cI(uR,vR,{remoteName:e.name});let r=kF(t,n.url);!SF&&!r.startsWith(`http`)&&(r=`https:${r}`),e.type=n.type,e.entryGlobalName=n.globalName,e.entry=r,e.version=t.version,e.buildVersion=t.buildVersion}function tz(){return{name:`snapshot-plugin`,async afterResolve(e){let{remote:t,pkgNameOrAlias:n,expose:r,origin:a,remoteInfo:o,id:s}=e;if(!fI(t)||!pI(t)){let{remoteSnapshot:c,globalSnapshot:l}=await a.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:ZL(t.name,r)});ez(o,c);let u={remote:t,preloadConfig:{nameOrAlias:n,exposes:[r],resourceCategory:`sync`,share:!1,depsRemote:!1}},d=await a.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:a,preloadOptions:u,remoteInfo:o,remote:t,remoteSnapshot:c,globalSnapshot:l});return d&&WR(o,a,d,!1,{initiator:`loadRemote`,id:s}).catch(()=>void 0),{...e,remoteSnapshot:c}}return e}}}function nz(e){let t=e.split(`:`);return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function rz(e,t,n,r,a={},o){let{value:s}=OI(e,dI(t)),c=o||s;if(c&&!FF(c)&&(n(c,t,r),c.remotesInfo)){let t=Object.keys(c.remotesInfo);for(let r of t){if(a[r])continue;a[r]=!0;let t=nz(r),o=c.remotesInfo[r];rz(e,{name:t.name,version:o.matchedVersion},n,!1,a,void 0)}}}var iz=(e,t)=>document.querySelector(`${e}[${e===`link`?`href`:`src`}="${t}"]`);function az(e,t,n,r,a){let o=[],s=[],c=[],l=new Set,u=new Set,{options:d}=e,{preloadConfig:f}=t,{depsRemote:p}=f;if(rz(r,n,(t,n,r)=>{let a;if(r)a=f;else if(Array.isArray(p)){let e=p.find(e=>e.nameOrAlias===n.name||e.nameOrAlias===n.alias);if(!e)return;a=FR(e)}else if(p===!0)a=f;else return;let l=kF(t,vI(t).url);l&&c.push({name:n.name,moduleInfo:{name:n.name,entry:l,type:`remoteEntryType`in t?t.remoteEntryType:`global`,entryGlobalName:`globalName`in t?t.globalName:n.name,shareScope:``,version:`version`in t?t.version:void 0},url:l});let u=`modules`in t?t.modules:[],d=LR(a.exposes);d.length&&`modules`in t&&(u=t?.modules?.reduce((e,t)=>(d?.indexOf(t.moduleName)!==-1&&e.push(t),e),[]));function m(e){let n=e.map(e=>kF(t,e));return a.filter?n.filter(a.filter):n}if(u){let r=u.length;for(let c=0;c<r;c++){let r=u[c],l=`${n.name}/${r.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:r.moduleName===`.`?n.name:l,name:n.name,remoteSnapshot:t,preloadConfig:a,remote:n,origin:e}),!II(l)&&(a.resourceCategory===`all`?(o.push(...m(r.assets.css.async)),o.push(...m(r.assets.css.sync)),s.push(...m(r.assets.js.async)),s.push(...m(r.assets.js.sync))):a.resourceCategory===`sync`&&(o.push(...m(r.assets.css.sync)),s.push(...m(r.assets.js.sync))),LI(l))}}},!0,{},a),a.shared&&a.shared.length>0){let t=(t,n)=>{let{shared:r}=KL(e.shareScopeMap,n.sharedName,t,e.sharedHandler.hooks.lifecycle.resolveShare)||{};r&&typeof r.lib==`function`&&(n.assets.js.sync.forEach(e=>{l.add(e)}),n.assets.css.sync.forEach(e=>{u.add(e)}))};a.shared.forEach(e=>{let n=d.shared?.[e.sharedName];if(!n)return;let r=e.version?n.find(t=>t.version===e.version):n;r&&_I(r).forEach(n=>{t(n,e)})})}let m=s.filter(e=>!l.has(e)&&!iz(`script`,e));return{cssAssets:o.filter(e=>!u.has(e)&&!iz(`link`,e)),jsAssetsWithoutEntry:m,entryAssets:c.filter(e=>!iz(`script`,e.url))}}var oz=function(){return{name:`generate-preload-assets-plugin`,async generatePreloadAssets(e){let{origin:t,preloadOptions:n,remoteInfo:r,remote:a,globalSnapshot:o,remoteSnapshot:s}=e;return SF?fI(a)&&pI(a)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:a.name,url:a.entry,moduleInfo:{name:r.name,entry:a.entry,type:r.type||`global`,entryGlobalName:``,shareScope:``}}]}:(ez(r,s),az(t,n,r,o,s)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function sz(e,t){let n=jI({name:t.name,version:t.options.version}),r=n&&`remotesInfo`in n&&n.remotesInfo&&OI(n.remotesInfo,e.name).value;return r&&r.matchedVersion?{hostGlobalSnapshot:n,globalSnapshot:kI(),remoteSnapshot:jI({name:e.name,version:r.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:kI(),remoteSnapshot:jI({name:e.name,version:`version`in e?e.version:void 0})}}var cz=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new $R({beforeLoadRemoteSnapshot:new YR(`beforeLoadRemoteSnapshot`),loadSnapshot:new QR(`loadGlobalSnapshot`),loadRemoteSnapshot:new QR(`loadRemoteSnapshot`),afterLoadSnapshot:new QR(`afterLoadSnapshot`)}),this.manifestLoading=SI.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,initiator:n=`loadRemote`}){let{options:r}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:r,moduleInfo:e,origin:this.HostInstance});let a=jI({name:this.HostInstance.options.name,version:this.HostInstance.options.version});a||(a={version:this.HostInstance.options.version||``,remoteEntry:``,remotesInfo:{}},NI({[this.HostInstance.options.name]:a})),a&&`remotesInfo`in a&&!OI(a.remotesInfo,e.name).value&&(`version`in e||`entry`in e)&&(a.remotesInfo={...a?.remotesInfo,[e.name]:{matchedVersion:`version`in e?e.version:e.entry}});let{hostGlobalSnapshot:o,remoteSnapshot:s,globalSnapshot:c}=this.getGlobalRemoteInfo(e),{remoteSnapshot:l,globalSnapshot:u}=await this.hooks.lifecycle.loadSnapshot.emit({options:r,moduleInfo:e,hostGlobalSnapshot:o,remoteSnapshot:s,globalSnapshot:c}),d,f;if(l)if(FF(l)){let r=SF?l.remoteEntry:l.ssrRemoteEntry||l.remoteEntry||``,a=await this.loadManifestSnapshot(r,e,{},{initiator:n,id:t||e.name}),o=MI({...e,entry:r},a);d=a,f=o}else{let{remoteSnapshot:t}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:l,from:`global`});d=t,f=u}else if(fI(e)){let r=await this.loadManifestSnapshot(e.entry,e,{},{initiator:n,id:t||e.name}),a=MI(e,r);d=r,f=a}else cI(oR,vR,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(u)},void 0,PR(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:r,moduleInfo:e,remoteSnapshot:d}),{remoteSnapshot:d,globalSnapshot:f}}getGlobalRemoteInfo(e){return sz(e,this.HostInstance)}async getManifestJson(e,t,n,r){return(async()=>{let n=AR(t),a=this.manifestCache.get(e);if(a)return a;try{let t=await this.loaderHook.lifecycle.fetch.emit(e,{},n,r?{...r,url:e,resourceType:`manifest`}:void 0);(!t||!(t instanceof Response))&&(t=await fetch(e,{})),a=await t.json()}catch(r){a=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:r,from:`runtime`,lifecycle:`afterResolve`,remote:n,origin:this.HostInstance}),a||(delete this.manifestLoading[e],cI(nR,vR,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${r}`,PR(this.HostInstance.options)))}let o=[!a.metaData&&`metaData`,!a.exposes&&`exposes`,!a.shared&&`shared`].filter(Boolean);return o.length>0&&await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:Error(`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${o.join(`, `)}.`),from:`runtime`,lifecycle:`afterResolve`,remote:n,origin:this.HostInstance}),o.length>0&&cI(fR,vR,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name,missingFields:o.join(`,`)},void 0,PR(this.HostInstance.options)),this.manifestCache.set(e,a),a})()}async loadManifestSnapshot(e,t,n,r){let a=async()=>{let a=await this.getManifestJson(e,t,n,r),o=PF(a,{version:e}),{remoteSnapshot:s}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:a,remoteSnapshot:o,manifestUrl:e,from:`manifest`});return s};return this.manifestLoading[e]||(this.manifestLoading[e]=a().then(e=>e)),this.manifestLoading[e]}},lz=class{constructor(e){this.hooks=new $R({beforeRegisterShare:new ZR(`beforeRegisterShare`),afterResolve:new QR(`afterResolve`),beforeLoadShare:new QR(`beforeLoadShare`),loadShare:new YR,afterLoadShare:new JR(`afterLoadShare`),errorLoadShare:new JR(`errorLoadShare`),resolveShare:new ZR(`resolveShare`),initContainerShareScopeMap:new ZR(`initContainerShareScopeMap`)}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}emitAfterLoadShare({lifecycle:e,pkgName:t,shareInfo:n,selectedShared:r}){try{this.hooks.lifecycle.afterLoadShare.emit({pkgName:t,shareInfo:n,selectedShared:r,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host})}catch(e){lI(e)}}emitErrorLoadShare({lifecycle:e,pkgName:t,shareInfo:n,error:r,recovered:a}){try{this.hooks.lifecycle.errorLoadShare.emit({pkgName:t,shareInfo:n,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host,error:r,recovered:a})}catch(e){lI(e)}}registerShared(e,t){let{newShareInfos:n,allShareInfos:r}=FL(e,t);return Object.keys(n).forEach(e=>{n[e].forEach(n=>{n.scope.forEach(r=>{this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:e,shared:n}),this.shareScopeMap[r]?.[e]||this.setShared({pkgName:e,lib:n.lib,get:n.get,loaded:n.loaded||!!n.lib,shared:n,from:t.name})})})}),{newShareInfos:n,allShareInfos:r}}async loadShare(e,t){let{host:n}=this,r=JL({pkgName:e,extraOptions:t,shareInfos:n.options.shared}),a=r;try{r?.scope&&await Promise.all(r.scope.map(async e=>{await Promise.all(this.initializeSharing(e,{strategy:r.strategy}))})),a=(await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:r,shared:n.options.shared,origin:n})).shareInfo,sI(a,`Cannot find shared "${e}" in host "${n.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);let o=a,{shared:s,useTreesShaking:c}=KL(this.shareScopeMap,e,a,this.hooks.lifecycle.resolveShare)||{};if(s){let t=XL(s,c);if(t.lib)return YL(t,n.options.name),this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:o,selectedShared:s}),t.lib;if(t.loading&&!t.loaded){let r=await t.loading;return t.loaded=!0,t.lib||=r,YL(t,n.options.name),this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:o,selectedShared:s}),r}else{let r=(async()=>{let e=await t.get();return YL(t,n.options.name),t.loaded=!0,t.lib=e,e})();this.setShared({pkgName:e,loaded:!1,shared:s,from:n.options.name,lib:null,loading:r,treeShaking:c?t:void 0});let a=await r;return this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:o,selectedShared:s}),a}}else{if(t?.customShareInfo)return this.emitErrorLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:o,recovered:!0}),!1;let r=IL(o.treeShaking),a=XL(o,r),s=(async()=>{let t=await a.get();a.lib=t,a.loaded=!0,YL(a,n.options.name);let{shared:r,useTreesShaking:s}=KL(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(r){let e=XL(r,s);e.lib=t,e.loaded=!0,r.from=o.from}return t})();this.setShared({pkgName:e,loaded:!1,shared:o,from:n.options.name,lib:null,loading:s,treeShaking:r?a:void 0});let c=await s;return this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:o,selectedShared:o}),c}}catch(t){throw this.emitErrorLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:a,error:t}),t}}initializeSharing(e=ML,t){let{host:n}=this,r=t?.from,a=t?.strategy,o=t?.initScope,s=[];if(r!==`build`){let{initTokens:t}=this;o||=[];let n=t[e];if(n||=t[e]={from:this.host.name},o.indexOf(n)>=0)return s;o.push(n)}let c=this.shareScopeMap,l=n.options.name;c[e]||(c[e]={});let u=c[e],d=(e,t)=>{let{version:n,eager:r}=t;u[e]=u[e]||{};let a=u[e],o=a[n]&&XL(a[n]),s=!!(o&&(`eager`in o&&o.eager||`shareConfig`in o&&o.shareConfig?.eager));(!o||o.strategy!==`loaded-first`&&!o.loaded&&(!r==!s?l>a[n].from:r))&&(a[n]=t)},f=async e=>{let{module:t}=await n.remoteHandler.getRemoteModuleAndOptions({id:e}),r;try{r=await t.getEntry()}catch(a){if(r=await n.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:a,from:`runtime`,lifecycle:`beforeLoadShare`,remote:t.remoteInfo,origin:n}),!r)return}finally{r?.init&&!t.initing&&(t.remoteEntryExports=r,await t.init(void 0,void 0,o))}};return Object.keys(n.options.shared).forEach(t=>{n.options.shared[t].forEach(n=>{n.scope.includes(e)&&d(t,n)})}),(n.options.shareStrategy===`version-first`||a===`version-first`)&&n.options.remotes.forEach(t=>{t.shareScope===e&&s.push(f(t.name))}),s}loadShareSync(e,t){let{host:n}=this,r=JL({pkgName:e,extraOptions:t,shareInfos:n.options.shared});try{r?.scope&&r.scope.forEach(e=>{this.initializeSharing(e,{strategy:r.strategy})});let{shared:a}=KL(this.shareScopeMap,e,r,this.hooks.lifecycle.resolveShare)||{};if(a){if(typeof a.lib==`function`)return YL(a,n.options.name),a.loaded||(a.loaded=!0,a.from===n.options.name&&(r.loaded=!0)),this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:r,selectedShared:a}),a.lib;if(typeof a.get==`function`){let t=a.get();if(!(t instanceof Promise))return YL(a,n.options.name),this.setShared({pkgName:e,loaded:!0,from:n.options.name,lib:t,shared:a}),this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:r,selectedShared:a}),t}}if(r.lib)return r.loaded||=!0,this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:r,selectedShared:r}),r.lib;if(r.get){let a=r.get();return a instanceof Promise&&cI(t?.from===`build`?iR:aR,vR,{hostName:n.options.name,sharedPkgName:e},void 0,PR(n.options)),r.lib=a,this.setShared({pkgName:e,loaded:!0,from:n.options.name,lib:r.lib,shared:r}),this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:r,selectedShared:r}),r.lib}cI(aR,vR,{hostName:n.options.name,sharedPkgName:e},void 0,PR(n.options))}catch(t){throw this.emitErrorLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:r,error:t}),t}}initShareScopeMap(e,t,n={}){let{host:r}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:r.options,origin:r,scopeName:e,hostShareScopeMap:n.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:n,lib:r,loading:a,loaded:o,get:s,treeShaking:c}){let{version:l,scope:u=`default`,...d}=t,f=Array.isArray(u)?u:[u],p=e=>{let t=(e,t,n)=>{n&&!e[t]&&(e[t]=n)},n=c?e.treeShaking:e;t(n,`loaded`,o),t(n,`loading`,a),t(n,`get`,s)};f.forEach(t=>{this.shareScopeMap[t]||(this.shareScopeMap[t]={}),this.shareScopeMap[t][e]||(this.shareScopeMap[t][e]={}),this.shareScopeMap[t][e][l]||(this.shareScopeMap[t][e][l]={version:l,scope:[t],...d,lib:r});let a=this.shareScopeMap[t][e][l];p(a),n&&a.from!==n&&(a.from=n)})}_setGlobalShareScopeMap(e){let t=qL(),n=e.id||e.name;n&&!t[n]&&(t[n]=this.shareScopeMap)}},uz=class{constructor(e){this.hooks=new $R({beforeRegisterRemote:new ZR(`beforeRegisterRemote`),registerRemote:new ZR(`registerRemote`),beforeRequest:new QR(`beforeRequest`),afterMatchRemote:new YR(`afterMatchRemote`),onLoad:new YR(`onLoad`),afterLoadRemote:new YR(`afterLoadRemote`),handlePreloadModule:new JR(`handlePreloadModule`),errorLoadRemote:new YR(`errorLoadRemote`),beforePreloadRemote:new YR(`beforePreloadRemote`),generatePreloadAssets:new YR(`generatePreloadAssets`),afterPreloadRemote:new YR(`afterPreloadRemote`),loadEntry:new YR}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((e,t)=>(this.registerRemote(t,e,{force:!1}),e),e.remotes)}setIdToRemoteMap(e,t){let{remote:n,expose:r}=t,{name:a,alias:o}=n;if(this.idToRemoteMap[e]={name:n.name,expose:r},o&&e.startsWith(a)){let t=e.replace(a,o);this.idToRemoteMap[t]={name:n.name,expose:r};return}if(o&&e.startsWith(o)){let t=e.replace(o,a);this.idToRemoteMap[t]={name:n.name,expose:r}}}async loadRemote(e,t){let{host:n}=this,r=QL(n.options.remotes,e),a=e,o=r?.expose,s=r?AR(r.remote):void 0,c;try{let{loadFactory:r=!0}=t||{loadFactory:!0},{module:l,moduleOptions:u,remoteMatchInfo:d}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:f,remote:p,expose:m,id:h,remoteSnapshot:g}=d;a=h,o=m,s=AR(p);let _=await l.get(h,m,t,g),v=await this.hooks.lifecycle.onLoad.emit({id:h,pkgNameOrAlias:f,expose:m,exposeModule:r?_:void 0,exposeModuleFactory:r?void 0:_,remote:p,options:u,moduleInstance:l,origin:n});return this.setIdToRemoteMap(e,d),c={id:a,expose:o,remote:s,options:t,origin:n},typeof v==`function`?v:_}catch(r){let{from:l=`runtime`}=t||{from:`runtime`},u;try{u=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:r,from:l,lifecycle:`onLoad`,expose:o,remote:s,origin:n})}catch(e){throw c={id:a,expose:o,remote:s,options:t,error:e,origin:n},e}if(!u)throw c={id:a,expose:o,remote:s,options:t,error:r,origin:n},r;return c={id:a,expose:o,remote:s,options:t,error:r,origin:n,recovered:!0},u}finally{c&&await this.hooks.lifecycle.afterLoadRemote.emit(c)}}async preloadRemote(e){let{host:t}=this,n=[];await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});let r=IR(t.options.remotes,e),a=e=>{let{preloadConfig:t,remote:n}=e,r=t.exposes||[];return r.length?r.map(r=>({ops:{...e,preloadConfig:{...t,exposes:[r]}},id:ZL(n.name,r)})):[{ops:e,id:`${n.name}/*`}]},o;await Promise.all(r.flatMap(a).map(async e=>{let{ops:r,id:a}=e,{remote:o,preloadConfig:s}=r,c=AR(o);try{let{globalSnapshot:e,remoteSnapshot:l}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:o,id:a,initiator:`preloadRemote`}),u=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:r,remote:o,remoteInfo:c,globalSnapshot:e,remoteSnapshot:l});if(!u)return;let d=await WR(c,t,u,!0,{initiator:`preloadRemote`,id:a});n.push({remote:o,remoteInfo:c,preloadConfig:s,id:a,results:d})}catch(e){n.push({remote:o,remoteInfo:c,preloadConfig:s,id:a,results:[{url:c.entry,status:`error`,resourceType:/\.json(?:$|[?#])/i.test(c.entry)?`manifest`:`remoteEntry`,initiator:`preloadRemote`,id:a,error:e}]})}}));let s=n.flatMap(e=>e.results.filter(e=>e.status===`error`||e.status===`timeout`));if(s.length>0&&(o=Error(`preloadRemote failed to load ${s.length} resource(s).`),Object.assign(o,{results:n,failedResults:s})),await this.hooks.lifecycle.afterPreloadRemote.emit({preloadOps:e,options:t.options,origin:t,results:n,error:o}),o)throw o}registerRemotes(e,t){let{host:n}=this;e.forEach(e=>{this.registerRemote(e,n.options.remotes,{force:t?.force})})}async getRemoteModuleAndOptions(e){let{host:t}=this,{id:n}=e,r;try{r=await this.hooks.lifecycle.beforeRequest.emit({id:n,options:t.options,origin:t})}catch(e){if(r=await this.hooks.lifecycle.errorLoadRemote.emit({id:n,options:t.options,origin:t,from:`runtime`,error:e,lifecycle:`beforeRequest`}),!r)throw e}let{id:a}=r,o=QL(t.options.remotes,a);if(!o)try{cI(rR,vR,{hostName:t.options.name,requestId:a},void 0,PR(t.options))}catch(e){throw await this.hooks.lifecycle.afterMatchRemote.emit({id:a,options:t.options,error:e,origin:t}),e}let{remote:s}=o,c=AR(s);await this.hooks.lifecycle.afterMatchRemote.emit({id:a,...o,options:t.options,remoteInfo:c,origin:t});let l=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:a,...o,options:t.options,origin:t,remoteInfo:c}),{remote:u,expose:d}=l;sI(u&&d,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${a}.`);let f=t.moduleCache.get(u.name),p={host:t,remoteInfo:c};return f||(f=new qR(p),t.moduleCache.set(u.name,f)),{module:f,moduleOptions:p,remoteMatchInfo:l}}registerRemote(e,t,n){let{host:r}=this,a=()=>{if(e.alias){let n=t.find(t=>e.alias&&(t.name.startsWith(e.alias)||t.alias?.startsWith(e.alias)));sI(!n,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${n&&n.name} name or alias`)}`entry`in e&&SF&&typeof window<`u`&&!e.entry.startsWith(`http`)&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||=ML,e.type||=NL};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:r});let o=t.find(t=>t.name===e.name);if(!o)a(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:r});else{let s=[`The remote "${e.name}" is already registered.`,`Please note that overriding it may cause unexpected errors.`];n?.force&&(this.removeRemote(o),a(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:r}),AF(s.join(` `)))}}removeRemote(e){try{let{host:t}=this,{name:n}=e,r=t.options.remotes.findIndex(e=>e.name===n);r!==-1&&t.options.remotes.splice(r,1);let a=t.moduleCache.get(e.name);if(a){let n=a.remoteInfo,r=n.entryGlobalName;bI[r]&&(Object.getOwnPropertyDescriptor(bI,r)?.configurable?delete bI[r]:bI[r]=void 0);let o=OR(a.remoteInfo);TI[o]&&delete TI[o],t.snapshotHandler.manifestCache.delete(n.entry);let s=n.buildVersion?OF(n.name,n.buildVersion):n.name,c=bI.__FEDERATION__.__INSTANCES__.findIndex(e=>n.buildVersion?e.options.id===s:e.name===s);if(c!==-1){let e=bI.__FEDERATION__.__INSTANCES__[c];s=e.options.id||s;let t=qL(),r=!0,a=[];Object.keys(t).forEach(e=>{let o=t[e];o&&Object.keys(o).forEach(t=>{let s=o[t];s&&Object.keys(s).forEach(o=>{let c=s[o];c&&Object.keys(c).forEach(s=>{let l=c[s];l&&typeof l==`object`&&l.from===n.name&&(l.loaded||l.loading?(l.useIn=l.useIn.filter(e=>e!==n.name),l.useIn.length?r=!1:a.push([e,t,o,s])):a.push([e,t,o,s]))})})})}),r&&(e.shareScopeMap={},delete t[s]),a.forEach(([e,n,r,a])=>{delete t[e]?.[n]?.[r]?.[a]}),bI.__FEDERATION__.__INSTANCES__.splice(c,1)}let{hostGlobalSnapshot:l}=sz(e,t);if(l){let t=l&&`remotesInfo`in l&&l.remotesInfo&&OI(l.remotesInfo,e.name).key;t&&(delete l.remotesInfo[t],SI.__FEDERATION__.__MANIFEST_LOADING__[t]&&delete SI.__FEDERATION__.__MANIFEST_LOADING__[t])}t.moduleCache.delete(e.name)}}catch(e){oI.error(`removeRemote failed: ${e instanceof Error?e.message:String(e)}`)}}},dz=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN==`boolean`?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;DI(class{constructor(e){this.hooks=new $R({beforeInit:new ZR(`beforeInit`),init:new JR,beforeInitContainer:new QR(`beforeInitContainer`),initContainer:new QR(`initContainer`)}),this.version=`2.5.1`,this.moduleCache=new Map,this.loaderHook=new $R({getModuleInfo:new JR,createScript:new JR,createLink:new JR,fetch:new YR,loadEntryError:new YR,afterLoadEntry:new YR(`afterLoadEntry`),beforeInitRemote:new YR(`beforeInitRemote`),afterInitRemote:new YR(`afterInitRemote`),beforeGetExpose:new YR(`beforeGetExpose`),afterGetExpose:new YR(`afterGetExpose`),beforeExecuteFactory:new YR(`beforeExecuteFactory`),afterExecuteFactory:new YR(`afterExecuteFactory`),getModuleFactory:new YR}),this.bridgeHook=new $R({beforeBridgeRender:new JR,afterBridgeRender:new JR,beforeBridgeDestroy:new JR,afterBridgeDestroy:new JR});let t=dz?[tz(),oz()]:[],n={id:jR(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:SF};this.name=e.name,this.options=n,this.snapshotHandler=new cz(this),this.sharedHandler=new lz(this),this.remoteHandler=new uz(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...n.plugins,...e.plugins||[]]),this.options=this.formatOptions(n,e)}initOptions(e){e.name&&e.name!==this.options.name&&cI(rI(lR,vR)),this.registerPlugins(e.plugins);let t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=ML,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,n){let r=AR({name:e,entry:t}),a=new qR({host:this,remoteInfo:r});return a.remoteEntryExports=n,this.moduleCache.set(e,a),a}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,n={}){this.sharedHandler.initShareScopeMap(e,t,n)}formatOptions(e,t){let{allShareInfos:n}=FL(e,t),{userOptions:r,options:a}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:n}),o=this.remoteHandler.formatAndRegisterRemote(a,r),{allShareInfos:s}=this.sharedHandler.registerShared(a,r),c=[...a.plugins];r.plugins&&r.plugins.forEach(e=>{c.includes(e)||c.push(e)});let l={...e,...t,plugins:c,remotes:o,shared:s,id:r.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){let t=MR(e,this);this.options.plugins=this.options.plugins.reduce((e,t)=>(t&&e&&!e.find(e=>e.name===t.name)&&e.push(t),e),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}});var fz=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),pz=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),mz=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),hz=e=>{let t=mz(e);return t.charAt(0).toUpperCase()+t.slice(1)},gz={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},_z=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},vz=(0,S.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a=``,children:o,iconNode:s,...c},l)=>(0,S.createElement)(`svg`,{ref:l,...gz,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:fz(`lucide`,a),...!o&&!_z(c)&&{"aria-hidden":`true`},...c},[...s.map(([e,t])=>(0,S.createElement)(e,t)),...Array.isArray(o)?o:[o]])),Y=(e,t)=>{let n=(0,S.forwardRef)(({className:n,...r},a)=>(0,S.createElement)(vz,{ref:a,iconNode:t,className:fz(`lucide-${pz(hz(e))}`,`lucide-${e}`,n),...r}));return n.displayName=hz(e),n},yz=Y(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]);Y(`alarm-smoke`,[[`path`,{d:`M11 21c0-2.5 2-2.5 2-5`,key:`1sicvv`}],[`path`,{d:`M16 21c0-2.5 2-2.5 2-5`,key:`1o3eny`}],[`path`,{d:`m19 8-.8 3a1.25 1.25 0 0 1-1.2 1H7a1.25 1.25 0 0 1-1.2-1L5 8`,key:`1bvca4`}],[`path`,{d:`M21 3a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a1 1 0 0 1 1-1z`,key:`x3qr1j`}],[`path`,{d:`M6 21c0-2.5 2-2.5 2-5`,key:`i3w1gp`}]]),Y(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Y(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Y(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Y(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Y(`arrow-up-to-line`,[[`path`,{d:`M5 3h14`,key:`7usisc`}],[`path`,{d:`m18 13-6-6-6 6`,key:`1kf1n9`}],[`path`,{d:`M12 7v14`,key:`1akyts`}]]),Y(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]);var bz=Y(`bath`,[[`path`,{d:`M10 4 8 6`,key:`1rru8s`}],[`path`,{d:`M17 19v2`,key:`ts1sot`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`M7 19v2`,key:`12npes`}],[`path`,{d:`M9 5 7.621 3.621A2.121 2.121 0 0 0 4 5v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5`,key:`14ym8i`}]]);Y(`battery-full`,[[`path`,{d:`M10 10v4`,key:`1mb2ec`}],[`path`,{d:`M14 10v4`,key:`1nt88p`}],[`path`,{d:`M22 14v-4`,key:`14q9d5`}],[`path`,{d:`M6 10v4`,key:`1n77qd`}],[`rect`,{x:`2`,y:`6`,width:`16`,height:`12`,rx:`2`,key:`13zb55`}]]),Y(`battery-low`,[[`path`,{d:`M22 14v-4`,key:`14q9d5`}],[`path`,{d:`M6 14v-4`,key:`14a6bd`}],[`rect`,{x:`2`,y:`6`,width:`16`,height:`12`,rx:`2`,key:`13zb55`}]]),Y(`battery-medium`,[[`path`,{d:`M10 14v-4`,key:`suye4c`}],[`path`,{d:`M22 14v-4`,key:`14q9d5`}],[`path`,{d:`M6 14v-4`,key:`14a6bd`}],[`rect`,{x:`2`,y:`6`,width:`16`,height:`12`,rx:`2`,key:`13zb55`}]]),Y(`battery-warning`,[[`path`,{d:`M10 17h.01`,key:`nbq80n`}],[`path`,{d:`M10 7v6`,key:`nne03l`}],[`path`,{d:`M14 6h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2`,key:`1m83kb`}],[`path`,{d:`M22 14v-4`,key:`14q9d5`}],[`path`,{d:`M6 18H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2`,key:`h8lgfh`}]]),Y(`battery`,[[`path`,{d:`M 22 14 L 22 10`,key:`nqc4tb`}],[`rect`,{x:`2`,y:`6`,width:`16`,height:`12`,rx:`2`,key:`13zb55`}]]),Y(`bell-ring`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]);var xz=Y(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Sz=Y(`blinds`,[[`path`,{d:`M3 3h18`,key:`o7r712`}],[`path`,{d:`M20 7H8`,key:`gd2fo2`}],[`path`,{d:`M20 11H8`,key:`1ynp89`}],[`path`,{d:`M10 19h10`,key:`19hjk5`}],[`path`,{d:`M8 15h12`,key:`1yqzne`}],[`path`,{d:`M4 3v14`,key:`fggqzn`}],[`circle`,{cx:`4`,cy:`19`,r:`2`,key:`p3m9r0`}]]),Cz=Y(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),wz=Y(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]);Y(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]);var Tz=Y(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]);Y(`cast`,[[`path`,{d:`M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6`,key:`3zrzxg`}],[`path`,{d:`M2 12a9 9 0 0 1 8 8`,key:`g6cvee`}],[`path`,{d:`M2 16a5 5 0 0 1 4 4`,key:`1y1dii`}],[`line`,{x1:`2`,x2:`2.01`,y1:`20`,y2:`20`,key:`xu2jvo`}]]),Y(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);var Ez=Y(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]);Y(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Y(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Y(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Y(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Y(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Y(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Y(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Y(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);var Dz=Y(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]);Y(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),Y(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Y(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Y(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Y(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Y(`cloud-fog`,[[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`M16 17H7`,key:`pygtm1`}],[`path`,{d:`M17 21H9`,key:`1u2q02`}]]),Y(`cloud-lightning`,[[`path`,{d:`M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973`,key:`1cez44`}],[`path`,{d:`m13 12-3 5h4l-3 5`,key:`1t22er`}]]),Y(`cloud-rain`,[[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`M16 14v6`,key:`1j4efv`}],[`path`,{d:`M8 14v6`,key:`17c4r9`}],[`path`,{d:`M12 16v6`,key:`c8a4gj`}]]),Y(`cloud-snow`,[[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`M8 15h.01`,key:`a7atzg`}],[`path`,{d:`M8 19h.01`,key:`puxtts`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M12 21h.01`,key:`h35vbk`}],[`path`,{d:`M16 15h.01`,key:`rnfrdf`}],[`path`,{d:`M16 19h.01`,key:`1vcnzz`}]]);var Oz=Y(`cloud-sun`,[[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}],[`path`,{d:`M15.947 12.65a4 4 0 0 0-5.925-4.128`,key:`dpwdj0`}],[`path`,{d:`M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z`,key:`s09mg5`}]]);Y(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Y(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Y(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Y(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Y(`crosshair`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]),Y(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Y(`door-closed`,[[`path`,{d:`M10 12h.01`,key:`1kxr2c`}],[`path`,{d:`M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14`,key:`36qu9e`}],[`path`,{d:`M2 20h20`,key:`owomy5`}]]),Y(`door-open`,[[`path`,{d:`M11 20H2`,key:`nlcfvz`}],[`path`,{d:`M11 4.562v16.157a1 1 0 0 0 1.242.97L19 20V5.562a2 2 0 0 0-1.515-1.94l-4-1A2 2 0 0 0 11 4.561z`,key:`au4z13`}],[`path`,{d:`M11 4H8a2 2 0 0 0-2 2v14`,key:`74r1mk`}],[`path`,{d:`M14 12h.01`,key:`1jfl7z`}],[`path`,{d:`M22 20h-3`,key:`vhrsz`}]]),Y(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Y(`droplet`,[[`path`,{d:`M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z`,key:`c7niix`}]]),Y(`droplets`,[[`path`,{d:`M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z`,key:`1ptgy4`}],[`path`,{d:`M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97`,key:`1sl1rz`}]]),Y(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Y(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Y(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Y(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);var kz=Y(`fan`,[[`path`,{d:`M10.827 16.379a6.082 6.082 0 0 1-8.618-7.002l5.412 1.45a6.082 6.082 0 0 1 7.002-8.618l-1.45 5.412a6.082 6.082 0 0 1 8.618 7.002l-5.412-1.45a6.082 6.082 0 0 1-7.002 8.618l1.45-5.412Z`,key:`484a7f`}],[`path`,{d:`M12 12v.01`,key:`u5ubse`}]]);Y(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),Y(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),Y(`flashlight`,[[`path`,{d:`M12 13v1`,key:`176q98`}],[`path`,{d:`M17 2a1 1 0 0 1 1 1v4a3 3 0 0 1-.6 1.8l-.6.8A4 4 0 0 0 16 12v8a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2v-8a4 4 0 0 0-.8-2.4l-.6-.8A3 3 0 0 1 6 7V3a1 1 0 0 1 1-1z`,key:`17vh7j`}],[`path`,{d:`M6 6h12`,key:`n6hhss`}]]),Y(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Y(`footprints`,[[`path`,{d:`M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z`,key:`1dudjm`}],[`path`,{d:`M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z`,key:`l2t8xc`}],[`path`,{d:`M16 17h4`,key:`1dejxt`}],[`path`,{d:`M4 13h4`,key:`1bwh8b`}]]),Y(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Y(`gamepad-2`,[[`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`,key:`1gktln`}],[`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`,key:`qnk9ow`}],[`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`,key:`krot7o`}],[`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`,key:`1lcuu1`}],[`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`,key:`mfqc10`}]]),Y(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Y(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),Y(`grip-horizontal`,[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]),Y(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Y(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Y(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),Y(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),Y(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]);var Az=Y(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]);Y(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Y(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Y(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]);var jz=Y(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]);Y(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Y(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Y(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Y(`locate-fixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Y(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]);var Mz=Y(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]);Y(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]);var Nz=Y(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]);Y(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Y(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),Y(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Y(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Y(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),Y(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Y(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]);var Pz=Y(`monitor-play`,[[`path`,{d:`M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z`,key:`vbtd3f`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`,key:`x3v2xh`}]]);Y(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Y(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),Y(`move`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m19 9 3 3-3 3`,key:`1mg7y2`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`j64kie`}],[`path`,{d:`m9 5 3-3 3 3`,key:`l8vdw6`}]]),Y(`music`,[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]),Y(`navigation`,[[`polygon`,{points:`3 11 22 2 13 21 11 13 3 11`,key:`1ltx0t`}]]);var Fz=Y(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]);Y(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Y(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);var Iz=Y(`pipette`,[[`path`,{d:`m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12`,key:`1y3wsu`}],[`path`,{d:`m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z`,key:`110lr1`}],[`path`,{d:`m2 22 .414-.414`,key:`jhxm08`}]]);Y(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Y(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Y(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Y(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Y(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Y(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),Y(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),Y(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]);var Lz=Y(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);Y(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Y(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Y(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Y(`scan`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}]]);var Rz=Y(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]);Y(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Y(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Y(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Y(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]);var zz=Y(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]);Y(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Y(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Y(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Y(`ship`,[[`path`,{d:`M12 10.189V14`,key:`1p8cqu`}],[`path`,{d:`M12 2v3`,key:`qbqxhf`}],[`path`,{d:`M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6`,key:`qpkstq`}],[`path`,{d:`M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76`,key:`7tigtc`}],[`path`,{d:`M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1`,key:`1924j5`}]]);var Bz=Y(`siren`,[[`path`,{d:`M7 18v-6a5 5 0 1 1 10 0v6`,key:`pcx96s`}],[`path`,{d:`M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z`,key:`1b4s83`}],[`path`,{d:`M21 12h1`,key:`jtio3y`}],[`path`,{d:`M18.5 4.5 18 5`,key:`g5sp9y`}],[`path`,{d:`M2 12h1`,key:`1uaihz`}],[`path`,{d:`M12 2v1`,key:`11qlp1`}],[`path`,{d:`m4.929 4.929.707.707`,key:`1i51kw`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}]]);Y(`skip-back`,[[`path`,{d:`M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`15892j`}],[`path`,{d:`M3 20V4`,key:`1ptbpl`}]]),Y(`skip-forward`,[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]);var Vz=Y(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]);Y(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Y(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Y(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Y(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Y(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),Y(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]);var Hz=Y(`thermometer`,[[`path`,{d:`M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z`,key:`17jzev`}]]),Uz=Y(`toggle-left`,[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]),Wz=Y(`tractor`,[[`path`,{d:`m10 11 11 .9a1 1 0 0 1 .8 1.1l-.665 4.158a1 1 0 0 1-.988.842H20`,key:`she1j9`}],[`path`,{d:`M16 18h-5`,key:`bq60fd`}],[`path`,{d:`M18 5a1 1 0 0 0-1 1v5.573`,key:`1kv8ia`}],[`path`,{d:`M3 4h8.129a1 1 0 0 1 .99.863L13 11.246`,key:`1q1ert`}],[`path`,{d:`M4 11V4`,key:`9ft8pt`}],[`path`,{d:`M7 15h.01`,key:`k5ht0j`}],[`path`,{d:`M8 10.1V4`,key:`1jgyzo`}],[`circle`,{cx:`18`,cy:`18`,r:`2`,key:`1emm8v`}],[`circle`,{cx:`7`,cy:`15`,r:`5`,key:`ddtuc`}]]);Y(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Y(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),Y(`trending-down`,[[`path`,{d:`M16 17h6v-6`,key:`t6n2it`}],[`path`,{d:`m22 17-8.5-8.5-5 5L2 7`,key:`x473p`}]]),Y(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Y(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),Y(`unlink-2`,[[`path`,{d:`M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2`,key:`1re2ne`}]]),Y(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Y(`vibrate`,[[`path`,{d:`m2 8 2 2-2 2 2 2-2 2`,key:`sv1b1`}],[`path`,{d:`m22 8-2 2 2 2-2 2 2 2`,key:`101i4y`}],[`rect`,{width:`8`,height:`14`,x:`8`,y:`5`,rx:`1`,key:`1oyrl4`}]]),Y(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),Y(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]);var Gz=Y(`waves`,[[`path`,{d:`M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1`,key:`knzxuh`}],[`path`,{d:`M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1`,key:`2jd2cc`}],[`path`,{d:`M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1`,key:`rd2r6e`}]]);Y(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Y(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),Y(`wind`,[[`path`,{d:`M12.8 19.6A2 2 0 1 0 14 16H2`,key:`148xed`}],[`path`,{d:`M17.5 8a2.5 2.5 0 1 1 2 4H2`,key:`1u4tom`}],[`path`,{d:`M9.8 4.4A2 2 0 1 1 11 8H2`,key:`75valh`}]]);var Kz=Y(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]);Y(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Y(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);var qz=Y(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]);Y(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Y(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]);var Jz=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Yz=BN,Xz=(e,t)=>n=>{if(t?.variants==null)return Yz(e,n?.class,n?.className);let{variants:r,defaultVariants:a}=t,o=Object.keys(r).map(e=>{let t=n?.[e],o=a?.[e];if(t===null)return null;let s=Jz(t)||Jz(o);return r[e][s]}),s=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Yz(e,o,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...o}=t;return Object.entries(o).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...a,...s}[t]):{...a,...s}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Zz=Xz(`inline-flex items-center justify-center rounded-md font-medium transition-colors cursor-pointer disabled:opacity-50 disabled:pointer-events-none`,{variants:{variant:{primary:`bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`bg-surface text-foreground hover:bg-surface-hover`,ghost:`hover:bg-surface-hover text-foreground-muted`,danger:`bg-danger text-white hover:bg-danger/90`,outline:`border border-border bg-transparent hover:bg-surface-hover`},size:{sm:`h-7 px-2.5 text-xs gap-1.5`,md:`h-8 px-3 text-sm gap-2`,lg:`h-9 px-4 text-sm gap-2`}},defaultVariants:{variant:`primary`,size:`sm`}}),Qz=(0,S.forwardRef)(({className:e,variant:t,size:n,...r},a)=>(0,C.jsx)(`button`,{ref:a,className:hF(Zz({variant:t,size:n}),e),...r}));Qz.displayName=`Button`;var $z=Xz(`inline-flex items-center justify-center rounded-md font-medium transition-colors cursor-pointer disabled:opacity-50 disabled:pointer-events-none`,{variants:{variant:{primary:`bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`bg-surface text-foreground hover:bg-surface-hover`,ghost:`hover:bg-surface-hover text-foreground-muted`,danger:`bg-danger text-white hover:bg-danger/90`,outline:`border border-border bg-transparent hover:bg-surface-hover`},size:{sm:`h-7 w-7`,md:`h-8 w-8`,lg:`h-9 w-9`}},defaultVariants:{variant:`primary`,size:`sm`}}),eB=(0,S.forwardRef)(({className:e,variant:t,size:n,icon:r,...a},o)=>(0,C.jsx)(`button`,{ref:o,className:hF($z({variant:t,size:n}),e),...a,children:(0,C.jsx)(r,{className:`h-4 w-4`})}));eB.displayName=`IconButton`;var tB=Xz(`inline-flex items-center rounded-full text-xs font-medium px-2 py-0.5`,{variants:{variant:{default:`bg-surface-hover text-foreground`,success:`bg-success/15 text-success`,warning:`bg-warning/15 text-warning`,danger:`bg-danger/15 text-danger`,info:`bg-info/15 text-info`},styleVariant:{solid:``,outline:`border bg-transparent`}},defaultVariants:{variant:`default`,styleVariant:`solid`}}),nB=(0,S.forwardRef)(({className:e,variant:t,style:n,...r},a)=>(0,C.jsx)(`span`,{ref:a,className:hF(tB({variant:t,styleVariant:n}),e),...r}));nB.displayName=`Badge`;var rB=Xz(`rounded-lg p-3`,{variants:{variant:{flat:`bg-surface`,bordered:`bg-surface border border-border`}},defaultVariants:{variant:`bordered`}}),iB=(0,S.forwardRef)(({className:e,variant:t,...n},r)=>(0,C.jsx)(`div`,{ref:r,className:hF(rB({variant:t}),e),...n}));iB.displayName=`Card`;var aB=(0,S.forwardRef)(({className:e,...t},n)=>(0,C.jsx)(`label`,{ref:n,className:hF(`text-[10px] uppercase tracking-wider text-foreground-muted font-medium`,e),...t}));aB.displayName=`Label`;var oB=Xz(``,{variants:{orientation:{horizontal:`h-px w-full bg-border-subtle`,vertical:`w-px h-full bg-border-subtle`}},defaultVariants:{orientation:`horizontal`}}),sB=(0,S.forwardRef)(({className:e,orientation:t,...n},r)=>(0,C.jsx)(`div`,{ref:r,role:`separator`,className:hF(oB({orientation:t}),e),...n}));sB.displayName=`Separator`;var cB=(0,S.forwardRef)(({className:e,...t},n)=>(0,C.jsx)(`div`,{ref:n,className:hF(`animate-pulse bg-surface-hover rounded-md h-4 w-full`,e),...t}));cB.displayName=`Skeleton`;var lB=Xz(`h-7 w-full px-2.5 text-xs bg-surface border rounded-md text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary transition-colors`,{variants:{state:{default:`border-border`,error:`border-danger`}},defaultVariants:{state:`default`}}),uB=(0,S.forwardRef)(({className:e,state:t,leftSlot:n,rightSlot:r,...a},o)=>n||r?(0,C.jsxs)(`div`,{className:`relative flex items-center w-full`,children:[n&&(0,C.jsx)(`div`,{className:`absolute left-2.5 flex items-center pointer-events-none`,children:n}),(0,C.jsx)(`input`,{ref:o,className:hF(lB({state:t}),n?`pl-7`:``,r?`pr-7`:``,e),...a}),r&&(0,C.jsx)(`div`,{className:`absolute right-2.5 flex items-center pointer-events-none`,children:r})]}):(0,C.jsx)(`input`,{ref:o,className:hF(lB({state:t}),e),...a}));uB.displayName=`Input`;var dB=(0,S.forwardRef)(({className:e,options:t,...n},r)=>(0,C.jsxs)(`div`,{className:`relative w-full`,children:[(0,C.jsx)(`select`,{ref:r,className:hF(`h-7 w-full px-2.5 text-xs bg-surface border border-border rounded-md text-foreground appearance-none pr-7 focus:outline-none focus:ring-1 focus:ring-primary`,e),...n,children:t.map(e=>(0,C.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,C.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none text-foreground-muted`,children:(0,C.jsx)(Ez,{className:`h-3.5 w-3.5`})})]}));dB.displayName=`Select`;var fB=(0,S.forwardRef)(({className:e,...t},n)=>(0,C.jsx)(`input`,{ref:n,type:`checkbox`,className:hF(`w-3.5 h-3.5 rounded-sm border border-border accent-primary`,e),...t}));fB.displayName=`Checkbox`;var pB=(0,S.forwardRef)(({className:e,checked:t,onCheckedChange:n,label:r,...a},o)=>(0,C.jsxs)(`button`,{ref:o,role:`switch`,"aria-checked":t,type:`button`,onClick:()=>n(!t),className:hF(`inline-flex items-center gap-2`,e),...a,children:[(0,C.jsx)(`span`,{className:hF(`w-8 h-4 rounded-full transition-colors`,t?`bg-primary`:`bg-surface-hover`),children:(0,C.jsx)(`span`,{className:hF(`block w-3.5 h-3.5 rounded-full bg-white transition-transform`,t?`translate-x-4`:`translate-x-0.5`)})}),r&&(0,C.jsx)(`span`,{className:`text-xs text-foreground`,children:r})]}));pB.displayName=`Switch`;var mB=(0,S.createContext)(null);function hB(){let e=(0,S.useContext)(mB);if(!e)throw Error(`Dialog compound components must be used within <Dialog>`);return e}var gB=Xz(`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 m-0 w-[calc(100vw-2rem)] bg-background-elevated border border-border rounded-lg p-4 backdrop:bg-black/50 backdrop:backdrop-blur-sm max-h-[calc(100dvh-2rem)] overflow-y-auto`,{variants:{width:{sm:`max-w-sm`,md:`max-w-md`,lg:`max-w-lg`}},defaultVariants:{width:`md`}}),_B=(0,S.forwardRef)(({className:e,width:t,children:n,...r},a)=>{let{open:o,setOpen:s,contentId:c}=hB(),l=(0,S.useRef)(null),u=a??l;return(0,S.useEffect)(()=>{let e=u.current;e&&(o&&!e.open&&e.showModal(),!o&&e.open&&e.close())},[o,u]),(0,C.jsx)(`dialog`,{ref:u,id:c,className:hF(gB({width:t}),e),onClick:e=>{e.target===e.currentTarget&&s(!1)},onClose:()=>s(!1),...r,children:n})});_B.displayName=`DialogContent`,(0,S.createContext)(null),(0,S.createContext)(null),(0,S.createContext)(null),(0,S.createContext)(null);var vB=(0,S.forwardRef)(({className:e,...t},n)=>(0,C.jsx)(`div`,{ref:n,className:hF(`overflow-auto [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-surface-hover [&::-webkit-scrollbar-thumb]:rounded-full`,e),...t}));vB.displayName=`ScrollArea`;var yB=typeof globalThis<`u`?globalThis.__camstackTrpcReact:void 0,X=yB??Oi();typeof globalThis<`u`&&!yB&&(globalThis.__camstackTrpcReact=X);var bB=_F(`camstack:system`,null);function xB({system:e,children:t}){return(0,C.jsx)(bB.Provider,{value:e,children:t})}function SB(){let e=(0,S.useContext)(bB);if(!e)throw Error(`useSystem(): no <SystemProvider> in tree`);return e}function CB(e,t){let n=SB(),r=(0,S.useRef)(t);r.current=t;let[a,o]=(0,S.useState)(n.connectionVersion);(0,S.useEffect)(()=>n.subscribeConnectionEvents((e,t)=>{e===`connected`&&o(t)}),[n]),(0,S.useEffect)(()=>n.subscribeEvent(e,e=>{r.current(e)}),[n,e,a])}_F(`camstack:confirm-dialog`,null);var wB={[q.Camera]:{icon:Tz,label:`Camera`},[q.Hub]:{icon:Fz,label:`Hub`},[q.Light]:{icon:jz,label:`Light`},[q.Siren]:{icon:Bz,label:`Siren`},[q.Switch]:{icon:Uz,label:`Switch`},[q.Sensor]:{icon:yz,label:`Sensor`},[q.Thermostat]:{icon:Hz,label:`Thermostat`},[q.Button]:{icon:Dz,label:`Button`},[q.EventEmitter]:{icon:qz,label:`Event Emitter`},[q.Update]:{icon:Lz,label:`Update`},[q.Generic]:{icon:wz,label:`Generic`},[q.Notifier]:{icon:xz,label:`Notifier`},[q.Script]:{icon:Rz,label:`Script`},[q.Automation]:{icon:Kz,label:`Automation`},[q.Lock]:{icon:Mz,label:`Lock`},[q.Cover]:{icon:Sz,label:`Cover`},[q.Valve]:{icon:Iz,label:`Valve`},[q.Humidifier]:{icon:Gz,label:`Humidifier`},[q.WaterHeater]:{icon:bz,label:`Water heater`},[q.Fan]:{icon:kz,label:`Fan`},[q.MediaPlayer]:{icon:Pz,label:`Media player`},[q.AlarmPanel]:{icon:zz,label:`Alarm panel`},[q.Control]:{icon:Vz,label:`Control`},[q.Presence]:{icon:Nz,label:`Presence`},[q.Weather]:{icon:Oz,label:`Weather`},[q.Vacuum]:{icon:Cz,label:`Vacuum`},[q.LawnMower]:{icon:Wz,label:`Lawn mower`},[q.Container]:{icon:wz,label:`Container`},[q.Image]:{icon:Az,label:`Image`}};Iy.Siren,Iy.Floodlight,Iy.Spotlight,Iy.PirSensor,Iy.Chime,Iy.Autotrack,Iy.Nightvision,Iy.PrivacyMask,Iy.Doorbell,Iy.BinaryHelper,Iy.MotionSensor,Iy.ContactSensor,Iy.LeakSensor,Iy.SmokeSensor,Iy.COSensor,Iy.GasSensor,Iy.TamperSensor,Iy.VibrationSensor,Iy.ConnectivitySensor,Iy.SoundSensor,Iy.BinarySensor,Iy.TemperatureSensor,Iy.HumiditySensor,Iy.AmbientLightSensor,Iy.PressureSensor,Iy.PowerSensor,Iy.EnergySensor,Iy.VoltageSensor,Iy.CurrentSensor,Iy.AirQualitySensor,Iy.BatterySensor,Iy.NumericSensor,Iy.EnumSensor,Iy.DateTimeSensor,Iy.GenericSensor,Iy.NumericControl,Iy.SelectControl,Iy.TextControl,Iy.DateTimeControl,Iy.MobilePushNotifier,Iy.MessagingNotifier,Iy.EmailNotifier,Iy.GenericNotifier,new Set(Object.values(q)),new Set(Object.values(Iy)),Object.values(q).map(e=>({id:e,label:wB[e].label,icon:wB[e].icon})),(0,S.createContext)(null),X.accessories.setChildHidden.useMutation,X.accessories.getStatus.useQuery,X.addonPages.listPages.useQuery,X.addons.list.useQuery,X.addons.getLogs.useQuery,X.addons.listPackages.useQuery,X.addons.installPackage.useMutation,X.addons.installFromWorkspace.useMutation,X.addons.isWorkspaceAvailable.useQuery,X.addons.listWorkspacePackages.useQuery,X.addons.uninstallPackage.useMutation,X.addons.reloadPackages.useMutation,X.addons.searchAvailable.useQuery,X.addons.listUpdates.useQuery,X.addons.updatePackage.useMutation,X.addons.rollbackPackage.useMutation,X.addons.forceRefresh.useMutation,X.addons.restartServer.useMutation,X.addons.getLastRestart.useQuery,X.addons.listFrameworkPackages.useQuery,X.addons.listCapabilityProviders.useQuery,X.addons.setCapabilityProviderEnabled.useMutation,X.addons.updateFrameworkPackage.useMutation,X.addons.startBulkUpdate.useMutation,X.addons.getBulkUpdateState.useQuery,X.addons.cancelBulkUpdate.useMutation,X.addons.listActiveBulkUpdates.useQuery,X.addons.getVersions.useQuery,X.addons.restartAddon.useMutation,X.addons.retryLoad.useMutation,X.addons.getAutoUpdateSettings.useQuery,X.addons.setAutoUpdateSettings.useMutation,X.addons.getAddonAutoUpdate.useQuery,X.addons.setAddonAutoUpdate.useMutation,X.addons.applyAutoUpdateToAll.useMutation,X.addons.custom.useMutation,X.addons.onAddonLogs.useSubscription,X.addonSettings.getGlobalSettings.useQuery,X.addonSettings.updateGlobalSettings.useMutation,X.addonSettings.getDeviceSettings.useQuery,X.addonSettings.updateDeviceSettings.useMutation,X.addonWidgets.listWidgets.useQuery,X.airQualitySensor.getStatus.useQuery,X.alarmPanel.arm.useMutation,X.alarmPanel.disarm.useMutation,X.alarmPanel.trigger.useMutation,X.alarmPanel.getStatus.useQuery,X.alerts.emit.useMutation,X.alerts.update.useMutation,X.alerts.list.useQuery,X.alerts.getUnreadCount.useQuery,X.alerts.markRead.useMutation,X.alerts.markAllRead.useMutation,X.alerts.dismiss.useMutation,X.ambientLightSensor.getStatus.useQuery,X.audioAnalysis.resolveDeviceSettings.useQuery,X.audioAnalysis.getDeviceSettingsContribution.useQuery,X.audioAnalysis.getDeviceLiveContribution.useQuery,X.audioAnalysis.applyDeviceSettingsPatch.useMutation,X.audioAnalyzer.analyseChunk.useMutation,X.audioAnalyzer.classify.useQuery,X.audioAnalyzer.isReady.useQuery,X.audioAnalyzer.dispose.useMutation,X.audioAnalyzer.reprobeAudioEngine.useMutation,X.audioCodec.listSupportedCodecs.useQuery,X.audioCodec.canHandle.useQuery,X.audioCodec.createDecodeSession.useMutation,X.audioCodec.createEncodeSession.useMutation,X.audioCodec.closeSession.useMutation,X.audioCodec.pushEncodedFrame.useMutation,X.audioCodec.pullPcm.useQuery,X.audioCodec.pushPcm.useMutation,X.audioCodec.pullEncoded.useQuery,X.audioCodec.flushEncode.useMutation,X.audioCodec.listActiveSessions.useQuery,X.audioMetrics.getCurrentSnapshot.useQuery,X.audioMetrics.getHistory.useQuery,X.automationControl.enable.useMutation,X.automationControl.disable.useMutation,X.automationControl.trigger.useMutation,X.automationControl.getStatus.useQuery,X.backup.listDestinations.useQuery,X.backup.trigger.useMutation,X.backup.list.useQuery,X.backup.listLocations.useQuery,X.backup.getEntries.useQuery,X.backup.restore.useMutation,X.backup.delete.useMutation,X.backup.listArchives.useQuery,X.backup.upsertDestinationPolicy.useMutation,X.backup.previewSchedule.useQuery,X.battery.wakeForStream.useMutation,X.battery.getStatus.useQuery,X.binary.getStatus.useQuery,X.brightness.setBrightness.useMutation,X.brightness.getStatus.useQuery,X.broker.list.useQuery,X.broker.get.useQuery,X.broker.listProviders.useQuery,X.broker.add.useMutation,X.broker.remove.useMutation,X.broker.testConnection.useMutation,X.broker.getSettings.useQuery,X.broker.setSettings.useMutation,X.broker.getBrokerConfig.useQuery,X.broker.getSettingsSchema.useQuery,X.broker.testSettings.useMutation,X.broker.publish.useMutation,X.broker.subscribe.useMutation,X.broker.unsubscribe.useMutation,X.broker.getState.useQuery,X.broker.getStatus.useQuery,X.button.press.useMutation,X.cameraCredentials.getCredentials.useQuery,X.cameraCredentials.getStatus.useQuery,X.cameraPipelineConfig.getDeviceSettingsContribution.useQuery,X.cameraPipelineConfig.getDeviceLiveContribution.useQuery,X.cameraPipelineConfig.applyDeviceSettingsPatch.useMutation,X.cameraStreams.getCameraStreams.useQuery,X.cameraStreams.getBrokerStreams.useQuery,X.cameraStreams.getRtspEntries.useQuery,X.cameraStreams.getProfileRtspEntries.useQuery,X.cameraStreams.pickStream.useQuery,X.carbonMonoxide.getStatus.useQuery,X.climateControl.setMode.useMutation,X.climateControl.setFanMode.useMutation,X.climateControl.setPreset.useMutation,X.climateControl.setTarget.useMutation,X.climateControl.setTargetRange.useMutation,X.climateControl.setTargetHumidity.useMutation,X.climateControl.getStatus.useQuery,X.color.setColor.useMutation,X.color.getStatus.useQuery,X.connectivity.getStatus.useQuery,X.consumables.reset.useMutation,X.consumables.getStatus.useQuery,X.contact.getStatus.useQuery,X.control.setValue.useMutation,X.control.getStatus.useQuery,X.cover.open.useMutation,X.cover.close.useMutation,X.cover.stop.useMutation,X.cover.setPosition.useMutation,X.cover.setTiltPosition.useMutation,X.cover.getStatus.useQuery,X.decoder.supportsCodec.useQuery,X.decoder.getInfo.useQuery,X.decoder.createSession.useQuery,X.decoder.destroySession.useQuery,X.decoder.pushPacket.useQuery,X.decoder.openStream.useQuery,X.decoder.pullFrames.useQuery,X.decoder.pullHandles.useQuery,X.decoder.getFrame.useQuery,X.decoder.getShmStats.useQuery,X.decoder.updateConfig.useQuery,X.decoder.getStats.useQuery,X.decoder.listActiveSessions.useQuery,X.decoder.reprobeHwaccel.useMutation,X.detectionPipeline.getDeviceSettingsContribution.useQuery,X.detectionPipeline.getDeviceLiveContribution.useQuery,X.detectionPipeline.applyDeviceSettingsPatch.useMutation,X.deviceAdoption.listCandidateFilters.useQuery,X.deviceAdoption.listCandidates.useQuery,X.deviceAdoption.getCandidate.useQuery,X.deviceAdoption.refresh.useMutation,X.deviceAdoption.adopt.useMutation,X.deviceAdoption.release.useMutation,X.deviceAdoption.resync.useMutation,X.deviceAdoption.getStatus.useQuery,X.deviceDiscovery.listDiscovered.useQuery,X.deviceDiscovery.refreshDiscovery.useMutation,X.deviceDiscovery.adoptDevice.useMutation,X.deviceDiscovery.releaseDevice.useMutation,X.deviceDiscovery.getStatus.useQuery,X.deviceExport.getStatus.useQuery,X.deviceExport.listSupportedDeviceKinds.useQuery,X.deviceExport.listExposedDevices.useQuery,X.deviceExport.exposeDevice.useMutation,X.deviceExport.unexposeDevice.useMutation,X.deviceExport.getDeviceSettingsContribution.useQuery,X.deviceExport.getDeviceLiveContribution.useQuery,X.deviceExport.applyDeviceSettingsPatch.useMutation,X.deviceManager.allocateDeviceId.useMutation,X.deviceManager.registerDevice.useMutation,X.deviceManager.removeDevice.useMutation,X.deviceManager.persistConfig.useMutation,X.deviceManager.loadConfig.useQuery,X.deviceManager.loadRuntimeState.useQuery,X.deviceManager.loadMeta.useQuery,X.deviceManager.setName.useMutation,X.deviceManager.setLocation.useMutation,X.deviceManager.setType.useMutation,X.deviceManager.setIntegrationId.useMutation,X.deviceManager.setLinkDeviceId.useMutation,X.deviceManager.setPrimaryChildEntityId.useMutation,X.deviceManager.setChildLayout.useMutation,X.deviceManager.setDeviceLinks.useMutation,X.deviceManager.getWireableFields.useQuery,X.deviceManager.setRole.useMutation,X.deviceManager.applyInitialMeta.useMutation,X.deviceManager.setMetadata.useMutation,X.deviceManager.listLocations.useQuery,X.deviceManager.addLocation.useMutation,X.deviceManager.removeLocation.useMutation,X.deviceManager.setDisabled.useMutation,X.deviceManager.listPersistedByAddon.useQuery,X.deviceManager.listAll.useQuery,X.deviceManager.getDevice.useQuery,X.deviceManager.getChildren.useQuery,X.deviceManager.getStreamSources.useQuery,X.deviceManager.getConfigSchema.useQuery,X.deviceManager.getSettingsSchema.useQuery,X.deviceManager.updateConfig.useMutation,X.deviceManager.enable.useMutation,X.deviceManager.disable.useMutation,X.deviceManager.remove.useMutation,X.deviceManager.removeByIntegration.useMutation,X.deviceManager.getStreamProfileMap.useQuery,X.deviceManager.setStreamProfileMap.useMutation,X.deviceManager.probeStreams.useMutation,X.deviceManager.getBindings.useQuery,X.deviceManager.getAllBindings.useQuery,X.deviceManager.setWrapperActive.useMutation,X.deviceManager.listWrappersForCap.useQuery,X.deviceManager.listBindableCapsForDeviceType.useQuery,X.deviceManager.getDeviceSettingsAggregate.useQuery,X.deviceManager.getDeviceLiveInfoAggregate.useQuery,X.deviceManager.getDeviceAggregate.useQuery,X.deviceManager.runDeviceAction.useMutation,X.deviceManager.updateDeviceField.useMutation,X.deviceManager.updateDeviceFieldsBatch.useMutation,X.deviceManager.discoverDevices.useMutation,X.deviceManager.adoptDevice.useMutation,X.deviceManager.getCreationSchema.useQuery,X.deviceManager.createDevice.useMutation,X.deviceManager.testCreationField.useMutation,X.deviceManager.adoptionListCandidates.useQuery,X.deviceManager.adoptionRefresh.useMutation,X.deviceManager.adoptionAdopt.useMutation,X.deviceManager.adoptionRelease.useMutation,X.deviceManager.testField.useMutation,X.deviceManager.getDeviceStatusAggregate.useQuery,X.deviceOps.getStreamSources.useQuery,X.deviceOps.getConfigEntries.useQuery,X.deviceOps.setConfig.useMutation,X.deviceOps.runAction.useMutation,X.deviceOps.removeDevice.useMutation,X.deviceOps.getSettingsSchema.useQuery,X.deviceOps.getRawState.useQuery,X.deviceProvider.start.useMutation,X.deviceProvider.stop.useMutation,X.deviceProvider.getStatus.useQuery,X.deviceProvider.getDevices.useQuery,X.deviceProvider.supportsDiscovery.useQuery,X.deviceProvider.discoverDevices.useMutation,X.deviceProvider.adoptDiscoveredDevice.useMutation,X.deviceProvider.supportsManualCreation.useQuery,X.deviceProvider.getChildCreationSchema.useQuery,X.deviceProvider.createDevice.useMutation,X.deviceProvider.testCreationField.useMutation,X.deviceState.getSnapshot.useQuery,X.deviceState.getCapSlice.useQuery,X.deviceState.getAllSnapshots.useQuery,X.deviceState.setCapSlice.useMutation,X.deviceStatus.getStatus.useQuery,X.doorbell.getStatus.useQuery,X.enumSensor.getStatus.useQuery,X.eventEmitter.getStatus.useQuery,X.events.getEvents.useQuery,X.events.getEventThumbnail.useQuery,X.events.getEventClipUrl.useQuery,X.faceGallery.listIdentities.useQuery,X.faceGallery.createIdentity.useMutation,X.faceGallery.renameIdentity.useMutation,X.faceGallery.deleteIdentity.useMutation,X.faceGallery.listIdentitySamples.useQuery,X.faceGallery.removeSample.useMutation,X.faceGallery.listRecentFaces.useQuery,X.faceGallery.getFaceByTrack.useQuery,X.faceGallery.getFaceMedia.useQuery,X.faceGallery.assignFace.useMutation,X.faceGallery.unassignFace.useMutation,X.faceGallery.deleteFace.useMutation,X.faceGallery.assignFaces.useMutation,X.faceGallery.unassignFaces.useMutation,X.faceGallery.suggestFaceClusters.useQuery,X.fanControl.setPercentage.useMutation,X.fanControl.setPreset.useMutation,X.fanControl.setDirection.useMutation,X.fanControl.setOscillating.useMutation,X.fanControl.getStatus.useQuery,X.featureProbe.getStatus.useQuery,X.flood.getStatus.useQuery,X.gas.getStatus.useQuery,X.humidifier.setOn.useMutation,X.humidifier.setTargetHumidity.useMutation,X.humidifier.setMode.useMutation,X.humidifier.getStatus.useQuery,X.humiditySensor.getStatus.useQuery,X.image.getStatus.useQuery,X.integrations.list.useQuery,X.integrations.get.useQuery,X.integrations.getByAddonId.useQuery,X.integrations.create.useMutation,X.integrations.update.useMutation,X.integrations.delete.useMutation,X.integrations.getSettings.useQuery,X.integrations.setSettings.useMutation,X.integrations.getAvailableTypes.useQuery,X.integrations.testConnection.useMutation;var TB=X.intercom.startSession.useMutation,EB=X.intercom.handleAnswer.useMutation,DB=X.intercom.stopSession.useMutation;X.intercom.startTalkSession.useMutation,X.intercom.pushTalkAudio.useMutation,X.intercom.endTalkSession.useMutation,X.intercom.getStatus.useQuery,X.lawnMowerControl.startMowing.useMutation,X.lawnMowerControl.pause.useMutation,X.lawnMowerControl.dock.useMutation,X.lawnMowerControl.getStatus.useQuery,X.localNetwork.list.useQuery,X.localNetwork.getPreferred.useQuery,X.localNetwork.getConnectionEndpoints.useQuery,X.localNetwork.getAllowedAddresses.useQuery,X.localNetwork.setAllowedAddresses.useMutation,X.localNetwork.resetAllowlistToBestMatch.useMutation,X.lockControl.lock.useMutation,X.lockControl.unlock.useMutation,X.lockControl.open.useMutation,X.lockControl.getStatus.useQuery,X.mediaPlayer.play.useMutation,X.mediaPlayer.pause.useMutation,X.mediaPlayer.stop.useMutation,X.mediaPlayer.next.useMutation,X.mediaPlayer.previous.useMutation,X.mediaPlayer.seek.useMutation,X.mediaPlayer.setVolume.useMutation,X.mediaPlayer.setMute.useMutation,X.mediaPlayer.setShuffle.useMutation,X.mediaPlayer.setRepeat.useMutation,X.mediaPlayer.selectSource.useMutation,X.mediaPlayer.playMedia.useMutation,X.mediaPlayer.getStatus.useQuery,X.meshNetwork.getStatus.useQuery,X.meshNetwork.join.useMutation,X.meshNetwork.startLogin.useMutation,X.meshNetwork.leave.useMutation,X.meshNetwork.logout.useMutation,X.meshNetwork.listPeers.useQuery,X.meshNetwork.testConnection.useMutation,X.metricsProvider.collectSnapshot.useQuery,X.metricsProvider.getCached.useQuery,X.metricsProvider.getCurrent.useQuery,X.metricsProvider.getDiskSpace.useQuery,X.metricsProvider.getGpuInfo.useQuery,X.metricsProvider.getCpuTemperature.useQuery,X.metricsProvider.getProcessStats.useQuery,X.metricsProvider.listAddonInstances.useQuery,X.metricsProvider.getAddonStats.useQuery,X.metricsProvider.listNodeProcesses.useQuery,X.metricsProvider.killProcess.useMutation,X.motion.isDetected.useQuery,X.motion.getStatus.useQuery,X.motionDetection.analyze.useMutation,X.motionDetection.removeCamera.useMutation,X.motionDetection.reset.useMutation,X.motionDetection.getDeviceSettingsContribution.useQuery,X.motionDetection.getDeviceLiveContribution.useQuery,X.motionDetection.applyDeviceSettingsPatch.useMutation,X.motionTrigger.setMotionTrigger.useMutation,X.motionTrigger.getStatus.useQuery,X.motionZones.getOptions.useQuery,X.motionZones.setZone.useMutation,X.motionZones.getStatus.useQuery,X.mqttBroker.listBrokers.useQuery,X.mqttBroker.getBrokerConfig.useQuery,X.mqttBroker.addBroker.useMutation,X.mqttBroker.removeBroker.useMutation,X.mqttBroker.testConnection.useMutation,X.mqttBroker.startEmbeddedBroker.useMutation,X.mqttBroker.stopEmbeddedBroker.useMutation,X.mqttBroker.getStatus.useQuery,X.nativeObjectDetection.setEnabled.useMutation,X.nativeObjectDetection.getStatus.useQuery,X.networkAccess.start.useMutation,X.networkAccess.stop.useMutation,X.networkAccess.getEndpoint.useQuery,X.networkAccess.getStatus.useQuery,X.networkAccess.listEndpoints.useQuery,X.networkQuality.getDeviceStats.useQuery,X.networkQuality.getAllStats.useQuery,X.networkQuality.reportClientStats.useMutation,X.nodes.topology.useQuery,X.nodes.deployAddon.useMutation,X.nodes.undeployAddon.useMutation,X.nodes.restartAddon.useMutation,X.nodes.restartProcess.useMutation,X.nodes.restartNode.useMutation,X.nodes.shutdownNode.useMutation,X.nodes.renameNode.useMutation,X.nodes.clusterAddonStatus.useQuery,X.nodes.getCapUsageGraph.useQuery,X.nodes.getNodeAddons.useQuery,X.nodes.setProcessLogLevel.useMutation,X.nodes.executeQuery.useMutation,X.notificationOutput.send.useMutation,X.notificationOutput.sendTest.useMutation,X.notifier.send.useMutation,X.notifier.cancel.useMutation,X.notifier.getStatus.useQuery,X.numericSensor.getStatus.useQuery,X.osd.setOverlay.useMutation,X.osd.getStatus.useQuery,X.pipelineAnalytics.getActiveTracks.useQuery,X.pipelineAnalytics.getTrack.useQuery,X.pipelineAnalytics.listTracks.useQuery,X.pipelineAnalytics.clearTracks.useMutation,X.pipelineAnalytics.getMotionEvents.useQuery,X.pipelineAnalytics.getObjectEvents.useQuery,X.pipelineAnalytics.getAudioEvents.useQuery,X.pipelineAnalytics.getEventDensity.useQuery,X.pipelineAnalytics.pruneEventsBefore.useMutation,X.pipelineAnalytics.getEventMedia.useQuery,X.pipelineAnalytics.getTrackMedia.useQuery,X.pipelineAnalytics.getDeviceSettingsContribution.useQuery,X.pipelineAnalytics.getDeviceLiveContribution.useQuery,X.pipelineAnalytics.applyDeviceSettingsPatch.useMutation,X.pipelineExecutor.getAvailableEngines.useQuery,X.pipelineExecutor.getSelectedEngine.useQuery,X.pipelineExecutor.getDefaultSteps.useQuery,X.pipelineExecutor.reprobeEngine.useMutation,X.pipelineExecutor.getVideoPipelineSteps.useQuery,X.pipelineExecutor.setVideoPipelineSteps.useMutation,X.pipelineExecutor.getSchema.useQuery,X.pipelineExecutor.getGlobalSteps.useQuery,X.pipelineExecutor.getGlobalPipelineConfig.useQuery,X.pipelineExecutor.getOrchestratorConfigSchema.useQuery,X.pipelineExecutor.listTemplates.useQuery,X.pipelineExecutor.saveTemplate.useMutation,X.pipelineExecutor.updateTemplate.useMutation,X.pipelineExecutor.deleteTemplate.useMutation,X.pipelineExecutor.getCapabilities.useQuery,X.pipelineExecutor.getAddonModels.useQuery,X.pipelineExecutor.downloadModel.useMutation,X.pipelineExecutor.deleteModel.useMutation,X.pipelineExecutor.detect.useQuery,X.pipelineExecutor.runPipeline.useMutation,X.pipelineExecutor.runPipelineBatch.useMutation,X.pipelineExecutor.cacheFrameInPool.useMutation,X.pipelineExecutor.inferCached.useMutation,X.pipelineExecutor.uncacheFrame.useMutation,X.pipelineExecutor.getEffectiveTuning.useQuery,X.pipelineExecutor.listLoadedEngines.useQuery,X.pipelineExecutor.spinEngine.useMutation,X.pipelineExecutor.killEngine.useMutation,X.pipelineExecutor.listReferenceImages.useQuery,X.pipelineExecutor.getReferenceImage.useQuery,X.pipelineExecutor.getReferenceAudioFiles.useQuery,X.pipelineExecutor.getReferenceAudio.useQuery,X.pipelineExecutor.getAudioCapabilities.useQuery,X.pipelineExecutor.runAudioTest.useMutation,X.pipelineExecutor.getDetectionConfigSchema.useQuery,X.pipelineOrchestrator.assignPipeline.useMutation,X.pipelineOrchestrator.unassignPipeline.useMutation,X.pipelineOrchestrator.rebalance.useMutation,X.pipelineOrchestrator.getPipelineAssignments.useQuery,X.pipelineOrchestrator.getPipelineAssignment.useQuery,X.pipelineOrchestrator.getAgentLoad.useQuery,X.pipelineOrchestrator.getGlobalMetrics.useQuery,X.pipelineOrchestrator.getCameraMetrics.useQuery,X.pipelineOrchestrator.getCapabilityBindings.useQuery,X.pipelineOrchestrator.setCapabilityBinding.useMutation,X.pipelineOrchestrator.assignDecoder.useMutation,X.pipelineOrchestrator.unassignDecoder.useMutation,X.pipelineOrchestrator.getDecoderAssignments.useQuery,X.pipelineOrchestrator.assignAudio.useMutation,X.pipelineOrchestrator.unassignAudio.useMutation,X.pipelineOrchestrator.getAudioAssignment.useQuery,X.pipelineOrchestrator.getAudioNodeLoad.useQuery,X.pipelineOrchestrator.getAudioAssignments.useQuery,X.pipelineOrchestrator.getDecoderAssignment.useQuery,X.pipelineOrchestrator.getAgentSettings.useQuery,X.pipelineOrchestrator.listAgentSettings.useQuery,X.pipelineOrchestrator.setAgentAddonDefaults.useMutation,X.pipelineOrchestrator.removeAgentSettings.useMutation,X.pipelineOrchestrator.getCameraSettings.useQuery,X.pipelineOrchestrator.setCameraStepToggle.useMutation,X.pipelineOrchestrator.getCameraStepOverrides.useQuery,X.pipelineOrchestrator.setCameraStepOverride.useMutation,X.pipelineOrchestrator.setCameraPipelineForAgent.useMutation,X.pipelineOrchestrator.resolvePipeline.useQuery,X.pipelineOrchestrator.listTemplates.useQuery,X.pipelineOrchestrator.saveTemplate.useMutation,X.pipelineOrchestrator.updateTemplate.useMutation,X.pipelineOrchestrator.deleteTemplate.useMutation,X.pipelineOrchestrator.getDeviceSettingsContribution.useQuery,X.pipelineOrchestrator.getDeviceLiveContribution.useQuery,X.pipelineOrchestrator.applyDeviceSettingsPatch.useMutation,X.pipelineRunner.attachCamera.useMutation,X.pipelineRunner.detachCamera.useMutation,X.pipelineRunner.reportMotion.useMutation,X.pipelineRunner.getLocalLoad.useQuery,X.pipelineRunner.getLocalMetrics.useQuery,X.pipelineRunner.getCameraMetrics.useQuery,X.pipelineRunner.getAllCameraMetrics.useQuery,X.pipelineRunner.getLocalCameras.useQuery,X.plateGallery.listPlates.useQuery,X.plateGallery.getPlateByTrack.useQuery,X.plateGallery.getPlateMedia.useQuery,X.plateGallery.searchPlates.useQuery,X.plateGallery.suggestPlateClusters.useQuery,X.plateGallery.correctPlateText.useMutation,X.plateGallery.deletePlate.useMutation,X.powerMeter.getStatus.useQuery,X.presence.getStatus.useQuery,X.pressureSensor.getStatus.useQuery,X.privacyMask.getOptions.useQuery,X.privacyMask.setMask.useMutation,X.privacyMask.getStatus.useQuery,X.ptz.move.useMutation,X.ptz.continuousMove.useMutation,X.ptz.stop.useMutation,X.ptz.getPresets.useQuery,X.ptz.goToPreset.useMutation,X.ptz.savePreset.useMutation,X.ptz.deletePreset.useMutation,X.ptz.getOptions.useQuery,X.ptz.goHome.useMutation,X.ptz.getPosition.useQuery,X.ptz.setAutofocus.useMutation,X.ptz.getStatus.useQuery,X.ptzAutotrack.getStatus.useQuery,X.ptzAutotrack.setEnabled.useMutation,X.ptzAutotrack.getSettings.useQuery,X.ptzAutotrack.setSettings.useMutation,X.reboot.reboot.useMutation,X.recording.getAvailability.useQuery,X.recording.getDaysWithRecordings.useQuery,X.recording.getPlaybackManifest.useQuery,X.recording.getStorageUsage.useQuery,X.recording.getDeviceConfig.useQuery,X.recording.locateSegment.useQuery,X.recording.readSegmentBytes.useQuery,X.recording.setDeviceConfig.useMutation,X.recording.rescanStorage.useMutation,X.recording.pruneFootage.useMutation,X.recording.getStatus.useQuery,X.recording.getDeviceSettingsContribution.useQuery,X.recording.getDeviceLiveContribution.useQuery,X.recording.applyDeviceSettingsPatch.useMutation,X.scriptRunner.run.useMutation,X.scriptRunner.stop.useMutation,X.scriptRunner.getStatus.useQuery,X.settingsStore.get.useQuery,X.settingsStore.set.useMutation,X.settingsStore.query.useQuery,X.settingsStore.insert.useMutation,X.settingsStore.update.useMutation,X.settingsStore.delete.useMutation,X.settingsStore.count.useQuery,X.settingsStore.histogram.useQuery,X.settingsStore.isEmpty.useQuery,X.settingsStore.declareCollection.useMutation,X.smoke.getStatus.useQuery,X.snapshot.getSnapshot.useQuery,X.snapshot.invalidateCache.useMutation,X.snapshot.getStatus.useQuery,X.snapshot.getDeviceSettingsContribution.useQuery,X.snapshot.getDeviceLiveContribution.useQuery,X.snapshot.applyDeviceSettingsPatch.useMutation,X.snapshotProvider.supportsDevice.useQuery,X.snapshotProvider.getSnapshot.useQuery,X.storage.resolve.useQuery,X.storage.write.useMutation,X.storage.read.useQuery,X.storage.exists.useQuery,X.storage.list.useQuery,X.storage.delete.useMutation,X.storage.getAvailableSpace.useQuery,X.storage.beginUpload.useMutation,X.storage.writeChunk.useMutation,X.storage.finalizeUpload.useMutation,X.storage.abortUpload.useMutation,X.storage.beginDownload.useMutation,X.storage.readChunk.useQuery,X.storage.endDownload.useMutation,X.storage.listLocations.useQuery,X.storage.getDefaultLocation.useQuery,X.storage.listLocationDeclarations.useQuery,X.storage.upsertLocation.useMutation,X.storage.deleteLocation.useMutation,X.storage.testLocation.useQuery,X.storage.listProviders.useQuery,X.storage.testConfig.useQuery,X.streamBroker.publishCameraStream.useMutation,X.streamBroker.retractCameraStream.useMutation,X.streamBroker.assignProfile.useMutation,X.streamBroker.unassignProfile.useMutation,X.streamBroker.listAllCameraStreams.useQuery,X.streamBroker.listAllProfileSlots.useQuery,X.streamBroker.getBrokerStats.useQuery,X.streamBroker.probeStream.useMutation,X.streamBroker.listClients.useQuery,X.streamBroker.killClient.useMutation,X.streamBroker.restartProfile.useMutation,X.streamBroker.getStreamUrl.useQuery,X.streamBroker.getStreamWithCodec.useMutation,X.streamBroker.releaseStreamWithCodec.useMutation,X.streamBroker.subscribeAudioChunks.useMutation,X.streamBroker.pullAudioChunks.useQuery,X.streamBroker.unsubscribeAudioChunks.useMutation,X.streamBroker.subscribeFrames.useMutation,X.streamBroker.pullFrameHandles.useQuery,X.streamBroker.unsubscribeFrames.useMutation,X.streamBroker.setPreBufferDuration.useMutation,X.streamBroker.getPreBufferInfo.useQuery,X.streamBroker.getRtspPort.useQuery,X.streamBroker.getAllRtspEntries.useQuery,X.streamBroker.getRtspEntry.useQuery,X.streamBroker.regenerateRtspToken.useMutation,X.streamBroker.setRtspEnabled.useMutation,X.streamBroker.isRtspEnabled.useQuery,X.streamBroker.getDeviceSettingsContribution.useQuery,X.streamBroker.getDeviceLiveContribution.useQuery,X.streamBroker.applyDeviceSettingsPatch.useMutation,X.streamCatalog.getCatalog.useQuery,X.streamParams.getOptions.useQuery,X.streamParams.setProfile.useMutation,X.streamParams.getConfigSchema.useQuery,X.streamParams.getStatus.useQuery,X.switch.setState.useMutation,X.switch.getStatus.useQuery,X.system.info.useQuery,X.system.health.useQuery,X.system.featureFlags.useQuery,X.system.networkAddresses.useQuery,X.system.getRetentionConfig.useQuery,X.system.setRetentionConfig.useMutation,X.system.forceRetentionCleanup.useMutation,X.tamper.getStatus.useQuery,X.temperatureSensor.getStatus.useQuery,X.toast.onToast.useSubscription,X.turnProvider.getTurnServers.useQuery,X.update.installUpdate.useMutation,X.update.getStatus.useQuery,X.userManagement.listUsers.useQuery,X.userManagement.createUser.useMutation,X.userManagement.updateUser.useMutation,X.userManagement.deleteUser.useMutation,X.userManagement.resetPassword.useMutation,X.userManagement.setUserScopes.useMutation,X.userManagement.validateCredentials.useMutation,X.userManagement.listApiKeys.useQuery,X.userManagement.createApiKey.useMutation,X.userManagement.revokeApiKey.useMutation,X.userManagement.validateApiKey.useMutation,X.userManagement.createScopedToken.useMutation,X.userManagement.revokeScopedToken.useMutation,X.userManagement.validateScopedToken.useQuery,X.userManagement.listScopedTokens.useQuery,X.userManagement.setupTotp.useMutation,X.userManagement.confirmTotp.useMutation,X.userManagement.disableTotp.useMutation,X.userManagement.getTotpStatus.useQuery,X.userManagement.verifyTotp.useMutation,X.userManagement.oauthIssueCode.useMutation,X.userManagement.oauthExchangeCode.useMutation,X.userManagement.oauthRefresh.useMutation,X.userManagement.oauthVerifyAccessToken.useQuery,X.userManagement.listOauthSessions.useQuery,X.userManagement.revokeOauthSession.useMutation,X.vacuumControl.start.useMutation,X.vacuumControl.pause.useMutation,X.vacuumControl.stop.useMutation,X.vacuumControl.returnToBase.useMutation,X.vacuumControl.locate.useMutation,X.vacuumControl.setFanSpeed.useMutation,X.vacuumControl.getStatus.useQuery,X.valve.open.useMutation,X.valve.close.useMutation,X.valve.stop.useMutation,X.valve.setPosition.useMutation,X.valve.getStatus.useQuery,X.vibration.getStatus.useQuery,X.videoclips.listClips.useQuery,X.videoclips.getClipPlayback.useQuery,X.waterHeater.setTargetTemp.useMutation,X.waterHeater.setOperationMode.useMutation,X.waterHeater.setAway.useMutation,X.waterHeater.getStatus.useQuery,X.weather.getStatus.useQuery,X.webrtcSession.listStreams.useQuery,X.webrtcSession.createSession.useMutation,X.webrtcSession.handleOffer.useMutation,X.webrtcSession.handleAnswer.useMutation,X.webrtcSession.addIceCandidate.useMutation,X.webrtcSession.getIceCandidates.useQuery,X.webrtcSession.closeSession.useMutation,X.webrtcSession.hasAdaptiveBitrate.useQuery,X.webrtcSession.getSessionState.useQuery,X.zoneAnalytics.getCurrentSnapshot.useQuery,X.zoneAnalytics.getZoneHistory.useQuery,X.zoneAnalytics.getCameraHistory.useQuery,X.zoneAnalytics.getUnzonedHistory.useQuery,X.zoneRules.listRules.useQuery,X.zoneRules.setRules.useMutation,X.zones.listZones.useQuery,X.zones.addZone.useMutation,X.zones.removeZone.useMutation,X.zones.updateZone.useMutation;var OB=176,kB=76;270/360*(2*Math.PI*kB),OB/2-kB-10,270/360*(2*Math.PI*64),q.Cover,q.Valve,q.Humidifier,q.WaterHeater,q.Camera,q.Hub,q.Switch,q.Siren,q.Light,q.Fan,q.Sensor,q.Thermostat,q.Button,q.EventEmitter,q.Update,q.Generic,q.Notifier,q.Script,q.Automation,q.Lock,q.MediaPlayer,q.AlarmPanel,q.Control,q.Presence,q.Weather,q.Vacuum,q.LawnMower,q.Container,q.Image,q.Cover,q.Valve,q.Thermostat,q.Control,q.Button,q.MediaPlayer,q.AlarmPanel,q.Lock,q.Vacuum,q.LawnMower,q.Humidifier,q.Switch,q.Siren,q.Light,q.Fan,q.WaterHeater,q.Sensor,q.Presence,q.EventEmitter,q.Notifier,q.Script,q.Automation,q.Camera,q.Hub,q.Update,q.Generic,q.Weather,q.Container,q.Image,new Set(Object.values(q)),new Set([q.Sensor,q.Presence]),Object.freeze([]);var AB=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},jB=class{constructor(e){this.generateIdentifier=e,this.kv=new AB}register(e,t){this.kv.getByValue(e)||(t||=this.generateIdentifier(e),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},MB=class extends jB{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t==`object`?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function NB(e){if(`values`in Object)return Object.values(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function PB(e,t){let n=NB(e);if(`find`in n)return n.find(t);let r=n;for(let e=0;e<r.length;e++){let n=r[e];if(t(n))return n}}function FB(e,t){Object.entries(e).forEach(([e,n])=>t(n,e))}function IB(e,t){return e.indexOf(t)!==-1}function LB(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(t(r))return r}}var RB=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return PB(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},zB=e=>Object.prototype.toString.call(e).slice(8,-1),BB=e=>e===void 0,VB=e=>e===null,HB=e=>typeof e!=`object`||!e||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,UB=e=>HB(e)&&Object.keys(e).length===0,WB=e=>Array.isArray(e),GB=e=>typeof e==`string`,KB=e=>typeof e==`number`&&!isNaN(e),qB=e=>typeof e==`boolean`,JB=e=>e instanceof RegExp,YB=e=>e instanceof Map,XB=e=>e instanceof Set,ZB=e=>zB(e)===`Symbol`,QB=e=>e instanceof Date&&!isNaN(e.valueOf()),$B=e=>e instanceof Error,eV=e=>typeof e==`number`&&isNaN(e),tV=e=>qB(e)||VB(e)||BB(e)||KB(e)||GB(e)||ZB(e),nV=e=>typeof e==`bigint`,rV=e=>e===1/0||e===-1/0,iV=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),aV=e=>e instanceof URL,oV=e=>e.replace(/\\/g,`\\\\`).replace(/\./g,`\\.`),sV=e=>e.map(String).map(oV).join(`.`),cV=(e,t)=>{let n=[],r=``;for(let a=0;a<e.length;a++){let o=e.charAt(a);if(!t&&o===`\\`){let t=e.charAt(a+1);if(t===`\\`){r+=`\\`,a++;continue}else if(t!==`.`)throw Error(`invalid path`)}if(o===`\\`&&e.charAt(a+1)===`.`){r+=`.`,a++;continue}if(o===`.`){n.push(r),r=``;continue}r+=o}let a=r;return n.push(a),n};function lV(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var uV=[lV(BB,`undefined`,()=>null,()=>void 0),lV(nV,`bigint`,e=>e.toString(),e=>typeof BigInt<`u`?BigInt(e):(console.error(`Please add a BigInt polyfill.`),e)),lV(QB,`Date`,e=>e.toISOString(),e=>new Date(e)),lV($B,`Error`,(e,t)=>{let n={name:e.name,message:e.message};return`cause`in e&&(n.cause=e.cause),t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n},(e,t)=>{let n=Error(e.message,{cause:e.cause});return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n}),lV(JB,`regexp`,e=>``+e,e=>{let t=e.slice(1,e.lastIndexOf(`/`)),n=e.slice(e.lastIndexOf(`/`)+1);return new RegExp(t,n)}),lV(XB,`set`,e=>[...e.values()],e=>new Set(e)),lV(YB,`map`,e=>[...e.entries()],e=>new Map(e)),lV(e=>eV(e)||rV(e),`number`,e=>eV(e)?`NaN`:e>0?`Infinity`:`-Infinity`,Number),lV(e=>e===0&&1/e==-1/0,`number`,()=>`-0`,Number),lV(aV,`URL`,e=>e.toString(),e=>new URL(e))];function dV(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var fV=dV((e,t)=>ZB(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>[`symbol`,t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{let r=n.symbolRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown symbol`);return r}),pV=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),mV=dV(iV,e=>[`typed-array`,e.constructor.name],e=>[...e],(e,t)=>{let n=pV[t[1]];if(!n)throw Error(`Trying to deserialize unknown typed array`);return new n(e)});function hV(e,t){return e?.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var gV=dV(hV,(e,t)=>[`class`,t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{let n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};let r={};return n.forEach(t=>{r[t]=e[t]}),r},(e,t,n)=>{let r=n.classRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(r.prototype),e)}),_V=dV((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>[`custom`,t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{let r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw Error(`Trying to deserialize unknown custom value`);return r.deserialize(e)}),vV=[gV,fV,_V,mV],yV=(e,t)=>{let n=LB(vV,n=>n.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};let r=LB(uV,n=>n.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},bV={};uV.forEach(e=>{bV[e.annotation]=e});var xV=(e,t,n)=>{if(WB(t))switch(t[0]){case`symbol`:return fV.untransform(e,t,n);case`class`:return gV.untransform(e,t,n);case`custom`:return _V.untransform(e,t,n);case`typed-array`:return mV.untransform(e,t,n);default:throw Error(`Unknown transformation: `+t)}else{let r=bV[t];if(!r)throw Error(`Unknown transformation: `+t);return r.untransform(e,n)}},SV=(e,t)=>{if(t>e.size)throw Error(`index out of bounds`);let n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function CV(e){if(IB(e,`__proto__`))throw Error(`__proto__ is not allowed as a property`);if(IB(e,`prototype`))throw Error(`prototype is not allowed as a property`);if(IB(e,`constructor`))throw Error(`constructor is not allowed as a property`)}var wV=(e,t)=>{CV(t);for(let n=0;n<t.length;n++){let r=t[n];if(XB(e))e=SV(e,+r);else if(YB(e)){let a=+r,o=+t[++n]==0?`key`:`value`,s=SV(e,a);switch(o){case`key`:e=s;break;case`value`:e=e.get(s);break}}else e=e[r]}return e},TV=(e,t,n)=>{if(CV(t),t.length===0)return n(e);let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(WB(r)){let e=+n;r=r[e]}else if(HB(r))r=r[n];else if(XB(r)){let e=+n;r=SV(r,e)}else if(YB(r)){if(e===t.length-2)break;let a=+n,o=+t[++e]==0?`key`:`value`,s=SV(r,a);switch(o){case`key`:r=s;break;case`value`:r=r.get(s);break}}}let a=t[t.length-1];if(WB(r)?r[+a]=n(r[+a]):HB(r)&&(r[a]=n(r[a])),XB(r)){let e=SV(r,+a),t=n(e);e!==t&&(r.delete(e),r.add(t))}if(YB(r)){let e=+t[t.length-2],o=SV(r,e);switch(+a==0?`key`:`value`){case`key`:{let e=n(o);r.set(e,r.get(o)),e!==o&&r.delete(o);break}case`value`:r.set(o,n(r.get(o)));break}}return e},EV=e=>e<1;function DV(e,t,n,r=[]){if(!e)return;let a=EV(n);if(!WB(e)){FB(e,(e,o)=>DV(e,t,n,[...r,...cV(o,a)]));return}let[o,s]=e;s&&FB(s,(e,o)=>{DV(e,t,n,[...r,...cV(o,a)])}),t(o,r)}function OV(e,t,n,r){return DV(t,(t,n)=>{e=TV(e,n,e=>xV(e,t,r))},n),e}function kV(e,t,n){let r=EV(n);function a(t,n){let a=wV(e,cV(n,r));t.map(e=>cV(e,r)).forEach(t=>{e=TV(e,t,()=>a)})}if(WB(t)){let[n,o]=t;n.forEach(t=>{e=TV(e,cV(t,r),()=>e)}),o&&FB(o,a)}else FB(t,a);return e}var AV=(e,t)=>HB(e)||WB(e)||YB(e)||XB(e)||$B(e)||hV(e,t);function jV(e,t,n){let r=n.get(e);r?r.push(t):n.set(e,[t])}function MV(e,t){let n={},r;return e.forEach(e=>{if(e.length<=1)return;t||(e=e.map(e=>e.map(String)).sort((e,t)=>e.length-t.length));let[a,...o]=e;a.length===0?r=o.map(sV):n[sV(a)]=o.map(sV)}),r?UB(n)?[r]:[r,n]:UB(n)?void 0:n}var NV=(e,t,n,r,a=[],o=[],s=new Map)=>{let c=tV(e);if(!c){jV(e,a,t);let n=s.get(e);if(n)return r?{transformedValue:null}:n}if(!AV(e,n)){let t=yV(e,n),r=t?{transformedValue:t.value,annotations:[t.type]}:{transformedValue:e};return c||s.set(e,r),r}if(IB(o,e))return{transformedValue:null};let l=yV(e,n),u=l?.value??e,d=WB(u)?[]:{},f={};FB(u,(c,l)=>{if(l===`__proto__`||l===`constructor`||l===`prototype`)throw Error(`Detected property ${l}. This is a prototype pollution risk, please remove it from your object.`);let u=NV(c,t,n,r,[...a,l],[...o,e],s);d[l]=u.transformedValue,WB(u.annotations)?f[oV(l)]=u.annotations:HB(u.annotations)&&FB(u.annotations,(e,t)=>{f[oV(l)+`.`+t]=e})});let p=UB(f)?{transformedValue:d,annotations:l?[l.type]:void 0}:{transformedValue:d,annotations:l?[l.type,f]:f};return c||s.set(e,p),p};function PV(e){return Object.prototype.toString.call(e).slice(8,-1)}function FV(e){return PV(e)===`Array`}function IV(e){if(PV(e)!==`Object`)return!1;let t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function LV(e,t,n,r,a){let o={}.propertyIsEnumerable.call(r,t)?`enumerable`:`nonenumerable`;o===`enumerable`&&(e[t]=n),a&&o===`nonenumerable`&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function RV(e,t={}){if(FV(e))return e.map(e=>RV(e,t));if(!IV(e))return e;let n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((n,r)=>{if(r===`__proto__`||FV(t.props)&&!t.props.includes(r))return n;let a=e[r];return LV(n,r,RV(a,t),e,t.nonenumerable),n},{})}var zV=class{constructor({dedupe:e=!1}={}){this.classRegistry=new MB,this.symbolRegistry=new jB(e=>e.description??``),this.customTransformerRegistry=new RB,this.allowedErrorProps=[],this.dedupe=e}serialize(e){let t=new Map,n=NV(e,t,this,this.dedupe),r={json:n.transformedValue};n.annotations&&(r.meta={...r.meta,values:n.annotations});let a=MV(t,this.dedupe);return a&&(r.meta={...r.meta,referentialEqualities:a}),r.meta&&(r.meta.v=1),r}deserialize(e,t){let{json:n,meta:r}=e,a=t?.inPlace?n:RV(n);return r?.values&&(a=OV(a,r.values,r.v??0,this)),r?.referentialEqualities&&(a=kV(a,r.referentialEqualities,r.v??0)),a}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e),{inPlace:!0})}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};zV.defaultInstance=new zV,zV.serialize=zV.defaultInstance.serialize.bind(zV.defaultInstance),zV.deserialize=zV.defaultInstance.deserialize.bind(zV.defaultInstance),zV.stringify=zV.defaultInstance.stringify.bind(zV.defaultInstance),zV.parse=zV.defaultInstance.parse.bind(zV.defaultInstance),zV.registerClass=zV.defaultInstance.registerClass.bind(zV.defaultInstance),zV.registerSymbol=zV.defaultInstance.registerSymbol.bind(zV.defaultInstance),zV.registerCustom=zV.defaultInstance.registerCustom.bind(zV.defaultInstance),zV.allowErrorProps=zV.defaultInstance.allowErrorProps.bind(zV.defaultInstance),zV.serialize,zV.deserialize,zV.stringify,zV.parse,zV.registerClass,zV.registerCustom,zV.registerSymbol,zV.allowErrorProps,(0,S.createContext)(null),_F(`camstack:custom-field-renderers`,{}),_F(`camstack:device-context`,null),_F(`camstack:widget-registry`,null),_F(`camstack:player-overlays-state`,null),_F(`camstack:player-overlays-actions`,null);var BV={rect:`#ef4444`,polygon:`#3b82f6`,grid:`#6366f1`,line:`#f59e0b`},VV=`33`,HV=`66`,UV=`#6366f1`,WV=3,GV=2,KV=12,qV=16,JV=9;function YV(e,t,n){return{x:e.x*t,y:e.y*n}}function XV(e,t,n){return{x:e.x/t,y:e.y/n}}function ZV(e,t,n){return e.flatMap(e=>[e.x*t,e.y*n])}function QV(e){return!Number.isFinite(e)||e<0?0:e>1?1:e}function $V(e){return e.color??BV[e.shape.kind]}function eH(e,t){let n=e[t],r=e[(t+1)%e.length];if(!n||!r)return[...e];let a={x:(n.x+r.x)/2,y:(n.y+r.y)/2};return[...e.slice(0,t+1),a,...e.slice(t+1)]}function tH(e,t){return e.length===t.length?e.every((e,n)=>{let r=t[n];return Math.abs(e.x-r.x)<1e-6&&Math.abs(e.y-r.y)<1e-6}):!1}function nH(e){return e.kind===`polygon`||e.kind===`line`}function rH({items:e,selectedId:t,onSelect:n,onShapeChange:r,onDrawComplete:a,drawingKind:o,supportedShapes:s,transparent:c=!1,backdrop:l,polygonVertices:u,grid:d}){let f=(0,S.useRef)(null),[p,m]=(0,S.useState)({w:800,h:450}),[h,g]=(0,S.useState)([]),[_,v]=(0,S.useState)(null),[y,b]=(0,S.useState)(null),[x,w]=(0,S.useState)(null),T=o!==null&&s.includes(o);(0,S.useEffect)(()=>{if(!x)return;let t=e.find(e=>e.id===x.itemId);if(!t||!nH(t.shape)){w(null);return}tH(t.shape.points,x.points)&&w(null)},[e,x]),(0,S.useEffect)(()=>{let e=f.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0];if(!t)return;let{width:n,height:r}=t.contentRect;m(c?{w:n,h:r}:{w:n,h:n*9/16})});return t.observe(e),()=>t.disconnect()},[c]),(0,S.useEffect)(()=>{!T&&_!==null&&v(null)},[T,_]);let E=(0,S.useCallback)(e=>{a(e),g([])},[a]),D=(0,S.useCallback)(e=>{if(!T||o===null){n(null);return}let t=e.target.getStage();if(!t)return;let r=t.getPointerPosition();if(!r)return;let a=XV(r,p.w,p.h);if(o===`rect`){let e=QV(a.x),t=QV(a.y);E({kind:`rect`,x:e,y:t,width:Math.min(.2,1-e),height:Math.min(.2,1-t)});return}if(o===`grid`){let e=d?.width??qV,t=d?.height??JV;E({kind:`grid`,gridWidth:e,gridHeight:t,cells:Array.from({length:e*t},()=>!1)});return}if(o===`line`){if(h.length===0){g([a]);return}E({kind:`line`,points:[...h,a]});return}if(o===`polygon`){if(h.length===0){g([a]);return}if(h.length>=WV){let e=YV(h[0],p.w,p.h);if(Math.hypot(r.x-e.x,r.y-e.y)<KV){E({kind:`polygon`,points:h});return}}g(e=>[...e,a])}},[T,o,h,p,d,E,n]),O=(0,S.useCallback)(e=>{!T||o!==`polygon`||h.length<WV||(e.cancelBubble=!0,E({kind:`polygon`,points:h}))},[T,o,h,E]),ee=(0,S.useRef)(null),te=(0,S.useRef)(null);(0,S.useEffect)(()=>()=>{ee.current!==null&&cancelAnimationFrame(ee.current)},[]);let ne=(0,S.useCallback)(e=>{if(!T)return;let t=e.target.getStage();t&&(te.current=t.getPointerPosition()??null,ee.current===null&&(ee.current=requestAnimationFrame(()=>{ee.current=null,v(te.current)})))},[T]),re=(0,S.useRef)(!1),ie=(0,S.useRef)(!0),ae=(0,S.useRef)(new Set),k=(0,S.useCallback)((e,t,n,a)=>{let o=t.gridWidth*t.gridHeight;if(n<0||n>=o||t.cells[n]===a)return;let s=[...t.cells];for(;s.length<o;)s.push(!1);s.length=o,s[n]=a,r(e,{...t,cells:s})},[r]),oe=[];if(!c){for(let e=1;e<qV;e++){let t=p.w/qV*e;oe.push((0,C.jsx)(Td,{points:[t,0,t,p.h],stroke:`#ffffff`,strokeWidth:.5,opacity:.08},`gv-${e}`))}for(let e=1;e<JV;e++){let t=p.h/JV*e;oe.push((0,C.jsx)(Td,{points:[0,t,p.w,t],stroke:`#ffffff`,strokeWidth:.5,opacity:.08},`gh-${e}`))}}return(0,C.jsxs)(`div`,{ref:f,className:c?`absolute inset-0`:`relative w-full bg-zinc-900 rounded-lg overflow-hidden`,style:{cursor:T?`crosshair`:`default`},children:[l&&!c?(0,C.jsx)(`div`,{className:`absolute inset-0 pointer-events-none [&>*]:w-full [&>*]:h-full [&>img]:object-cover [&>video]:object-cover`,style:{width:p.w,height:p.h},children:l}):null,(0,C.jsxs)(kd,{width:p.w,height:p.h,onClick:D,onDblClick:O,onMouseMove:ne,children:[(0,C.jsxs)(xd,{listening:!1,children:[(0,C.jsx)(Td,{points:[0,0,p.w,0,p.w,p.h,0,p.h,0,0],stroke:`transparent`,strokeWidth:0}),oe]}),(0,C.jsx)(xd,{children:e.map(e=>{let a=e.id===t,o=e.enabled===!1,s=$V(e),c=a&&!T&&!o;if(e.shape.kind===`rect`)return(0,C.jsx)(oH,{item:e,shape:e.shape,color:s,selected:a,dimmed:o,editable:c,isDrawing:T,size:p,onSelect:n,onShapeChange:r},e.id);if(e.shape.kind===`grid`)return(0,C.jsx)(sH,{item:e,shape:e.shape,color:s,dimmed:o,editable:c,size:p,onSelect:n,paintingRef:re,paintValueRef:ie,paintedRef:ae,paintCell:k},e.id);let l=e.shape.kind===`line`,d=l?GV:Math.max(WV,u?.min??WV),f=l?GV:u?.max,m=x&&x.itemId===e.id?x.points:e.shape.points;return(0,C.jsx)(cH,{item:e,shape:e.shape,color:s,selected:a,dimmed:o,editable:c,isLine:l,isDrawing:T,size:p,effectivePoints:m,minVertices:d,maxVertices:f,isDragging:y===e.id,onSelect:n,onShapeChange:r,setDragOverride:w,setDraggingItemId:b},e.id)})}),(0,C.jsx)(xd,{listening:!1,children:T&&h.length>0&&(0,C.jsxs)(`Group`,{children:[o===`polygon`&&h.length>=2&&(0,C.jsx)(`Line`,{points:ZV(h,p.w,p.h),stroke:UV,strokeWidth:1.5,dash:[6,3],opacity:.8}),o===`line`&&h.length===1&&_&&(0,C.jsx)(`Line`,{points:[h[0].x*p.w,h[0].y*p.h,_.x,_.y],stroke:BV.line,strokeWidth:1.5,dash:[6,3],opacity:.7}),o===`polygon`&&_&&h.length>=1&&(0,C.jsx)(`Line`,{points:[h[h.length-1].x*p.w,h[h.length-1].y*p.h,_.x,_.y],stroke:UV,strokeWidth:1,dash:[4,4],opacity:.5}),h.map((e,t)=>{let n=YV(e,p.w,p.h),r=t===0&&o===`polygon`&&h.length>=WV;return(0,C.jsx)(`Circle`,{x:n.x,y:n.y,radius:r?7:4,fill:r?UV:`#ffffff`,stroke:UV,strokeWidth:1.5,opacity:.9},t)})]})})]}),T?(0,C.jsx)(`div`,{className:`px-3 py-1.5 bg-zinc-800/80 text-[11px] text-zinc-400 border-t border-zinc-700`,children:o===`line`?`Click to set the start point, click again to complete the line`:o===`rect`?`Click to drop a rectangle, then drag the corner to resize`:o===`grid`?`Click to add the grid, then paint cells`:h.length<WV?`Click to add points (min 3). Double-click or click the first point to close.`:`Continue adding points. Double-click or click the first point to close.`}):null]})}var iH=.02;function aH(e,t){return Math.abs(e.x-t.x)<1e-6&&Math.abs(e.y-t.y)<1e-6&&Math.abs(e.width-t.width)<1e-6&&Math.abs(e.height-t.height)<1e-6}function oH({item:e,shape:t,color:n,selected:r,dimmed:a,editable:o,isDrawing:s,size:c,onSelect:l,onShapeChange:u}){let[d,f]=(0,S.useState)(null),p={x:t.x,y:t.y,width:t.width,height:t.height};(0,S.useEffect)(()=>{d&&aH(p,d)&&f(null)},[t.x,t.y,t.width,t.height,d]);let m=d??p,h=m.x*c.w,g=m.y*c.h,_=m.width*c.w,v=m.height*c.h,y=a?.35:r?1:.85,b=t=>{f(t),u(e.id,{kind:`rect`,x:t.x,y:t.y,width:t.width,height:t.height})};return(0,C.jsx)(Sd,{onClick:t=>{t.cancelBubble=!0,s||l(e.id)},children:(0,C.jsxs)(Sd,{draggable:o,dragBoundFunc:o?e=>({x:Math.max(-h,Math.min(c.w-(h+_),e.x)),y:Math.max(-g,Math.min(c.h-(g+v),e.y))}):void 0,onDragEnd:o?e=>{let t=e.target,n=t.x()/c.w,r=t.y()/c.h;if(t.position({x:0,y:0}),n===0&&r===0)return;let a=Math.min(Math.max(0,m.x+n),Math.max(0,1-m.width)),o=Math.min(Math.max(0,m.y+r),Math.max(0,1-m.height));b({...m,x:a,y:o})}:void 0,onMouseEnter:e=>{if(!o)return;let t=e.target.getStage();t&&(t.container().style.cursor=`move`)},onMouseLeave:e=>{if(!o)return;let t=e.target.getStage();t&&(t.container().style.cursor=s?`crosshair`:`default`)},children:[(0,C.jsx)(Cd,{x:h,y:g,width:_,height:v,fill:n+(r?HV:VV),stroke:n,strokeWidth:r?2.5:1.5,opacity:y}),e.label?(0,C.jsx)(Ed,{x:h,y:g-16,text:e.label,fontSize:12,fill:n,stroke:`#000000`,strokeWidth:3,fillAfterStrokeEnabled:!0,fontStyle:`bold`,listening:!1}):null,o?(0,C.jsx)(wd,{x:h+_,y:g+v,radius:6,fill:n,stroke:`#ffffff`,strokeWidth:1.5,draggable:!0,dragBoundFunc:e=>({x:Math.min(c.w,Math.max(h,e.x)),y:Math.min(c.h,Math.max(g,e.y))}),onDragStart:e=>{e.cancelBubble=!0},onDragMove:e=>{let t=e.target,n=QV(t.x()/c.w-m.x),r=QV(t.y()/c.h-m.y);f({...m,width:Math.max(iH,Math.min(n,1-m.x)),height:Math.max(iH,Math.min(r,1-m.y))})},onDragEnd:e=>{let t=e.target,n=QV(t.x()/c.w-m.x),r=QV(t.y()/c.h-m.y);b({...m,width:Math.max(iH,Math.min(n,1-m.x)),height:Math.max(iH,Math.min(r,1-m.y))})},onMouseEnter:e=>{let t=e.target.getStage();t&&(t.container().style.cursor=`nwse-resize`)},onMouseLeave:e=>{let t=e.target.getStage();t&&(t.container().style.cursor=`default`)}}):null]})})}function sH({item:e,shape:t,color:n,dimmed:r,editable:a,size:o,onSelect:s,paintingRef:c,paintValueRef:l,paintedRef:u,paintCell:d}){let{gridWidth:f,gridHeight:p,cells:m}=t,h=o.w/f,g=o.h/p,_=f*p,v=r?.3:1,y=n=>{if(!a){s(e.id);return}let r=m[n]!==!0;c.current=!0,l.current=r,u.current=new Set([n]),d(e.id,t,n,r)},b=n=>{!c.current||!a||u.current.has(n)||(u.current.add(n),d(e.id,t,n,l.current))},x=()=>{c.current&&(c.current=!1,u.current=new Set)};return(0,C.jsx)(Sd,{opacity:v,onMouseUp:x,onMouseLeave:x,children:Array.from({length:_},(e,t)=>{let r=t%f,a=Math.floor(t/f),o=m[t]===!0;return(0,C.jsx)(Cd,{x:r*h,y:a*g,width:h,height:g,fill:o?n+HV:`#ffffff10`,stroke:o?n:`#ffffff40`,strokeWidth:.5,onMouseDown:e=>{e.cancelBubble=!0,y(t)},onMouseEnter:()=>b(t)},t)})})}function cH({item:e,shape:t,color:n,selected:r,dimmed:a,editable:o,isLine:s,isDrawing:c,size:l,effectivePoints:u,minVertices:d,maxVertices:f,isDragging:p,onSelect:m,onShapeChange:h,setDragOverride:g,setDraggingItemId:_}){let v=ZV(u,l.w,l.h),y=a?.35:r?1:s?.8:.85,b=e=>s?{kind:`line`,points:[...e]}:{kind:`polygon`,points:[...e]},x=u.map(e=>e.x*l.w),S=u.map(e=>e.y*l.h),w=x.length>0?Math.min(...x):0,T=x.length>0?Math.max(...x):0,E=S.length>0?Math.min(...S):0,D=S.length>0?Math.max(...S):0,O=e=>({x:Math.max(-w,Math.min(l.w-T,e.x)),y:Math.max(-E,Math.min(l.h-D,e.y))}),ee=n=>{let r=n.target,a=r.x()/l.w,o=r.y()/l.h;if(r.position({x:0,y:0}),_(null),a===0&&o===0)return;let s=t.points.map(e=>({x:e.x+a,y:e.y+o}));g({itemId:e.id,points:s}),h(e.id,b(s))},te=!s&&u.length>d,ne=!s&&(f===void 0||u.length<f);return(0,C.jsxs)(Sd,{onClick:t=>{t.cancelBubble=!0,c||m(e.id)},children:[(0,C.jsxs)(Sd,{draggable:o,dragBoundFunc:o?O:void 0,onDragStart:o?()=>_(e.id):void 0,onDragEnd:o?ee:void 0,onMouseEnter:e=>{if(!o)return;let t=e.target.getStage();t&&(t.container().style.cursor=`move`)},onMouseLeave:e=>{if(!o)return;let t=e.target.getStage();t&&(t.container().style.cursor=c?`crosshair`:`default`)},children:[s?(0,C.jsx)(Dd,{points:v,stroke:n,strokeWidth:r?3:2,fill:n,pointerLength:10,pointerWidth:8,opacity:y}):(0,C.jsx)(Td,{points:v,closed:!0,fill:n+(r?HV:VV),stroke:n,strokeWidth:r?2.5:1.5,opacity:y}),e.label&&u.length>0?(()=>{let t=YV({x:u.reduce((e,t)=>e+t.x,0)/u.length,y:u.reduce((e,t)=>e+t.y,0)/u.length},l.w,l.h),r=Math.max(40,e.label.length*11*.62);return(0,C.jsx)(Ed,{x:t.x-r/2,y:t.y-7,width:r,align:`center`,text:e.label,fontSize:12,fill:n,stroke:`#000000`,strokeWidth:3,fillAfterStrokeEnabled:!0,fontStyle:`bold`,listening:!1})})():null]}),o&&!p&&u.map((r,a)=>{let o=YV(r,l.w,l.h);return(0,C.jsx)(`Circle`,{x:o.x,y:o.y,radius:5,fill:n,stroke:`#ffffff`,strokeWidth:1.5,draggable:!0,onDragMove:n=>{let r=XV({x:n.target.x(),y:n.target.y()},l.w,l.h);g(n=>{let o=n&&n.itemId===e.id?n.points:t.points;return{itemId:e.id,points:o.map((e,t)=>t===a?r:e)}})},onDragEnd:n=>{let r=XV({x:n.target.x(),y:n.target.y()},l.w,l.h),o=t.points.map((e,t)=>t===a?r:e);g({itemId:e.id,points:o}),h(e.id,b(o))},onContextMenu:n=>{n.evt.preventDefault(),n.cancelBubble=!0,te&&h(e.id,b(t.points.filter((e,t)=>t!==a)))}},`pt-${a}`)}),o&&!p&&ne&&u.length>=2&&u.map((r,a)=>{let o=u[(a+1)%u.length],s=YV({x:(r.x+o.x)/2,y:(r.y+o.y)/2},l.w,l.h);return(0,C.jsx)(`Circle`,{x:s.x,y:s.y,radius:4,fill:`#ffffff`,stroke:n,strokeWidth:1.5,opacity:.6,onMouseEnter:e=>{let t=e.target;t.to({radius:6,opacity:1,duration:.1});let n=t.getStage();n&&(n.container().style.cursor=`copy`)},onMouseLeave:e=>{let t=e.target;t.to({radius:4,opacity:.6,duration:.1});let n=t.getStage();n&&(n.container().style.cursor=c?`crosshair`:`default`)},onClick:n=>{n.cancelBubble=!0,h(e.id,b(eH(t.points,a)))}},`mid-${a}`)})]})}(0,S.memo)(rH),_F(`camstack:vod-playback`,{request:null,play:()=>{},clear:()=>{}});var lH=Object.defineProperty,uH=Object.getOwnPropertySymbols,dH=Object.prototype.hasOwnProperty,fH=Object.prototype.propertyIsEnumerable,pH=(e,t,n)=>t in e?lH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mH=(e,t)=>{for(var n in t||={})dH.call(t,n)&&pH(e,n,t[n]);if(uH)for(var n of uH(t))fH.call(t,n)&&pH(e,n,t[n]);return e},hH=(e,t)=>{var n={};for(var r in e)dH.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&uH)for(var r of uH(e))t.indexOf(r)<0&&fH.call(e,r)&&(n[r]=e[r]);return n},gH;(e=>{let t=class t{constructor(e,n,r,o){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(o<-1||o>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let s=[];for(let e=0;e<this.size;e++)s.push(!1);for(let e=0;e<this.size;e++)this.modules.push(s.slice()),this.isFunction.push(s.slice());this.drawFunctionPatterns();let c=this.addEccAndInterleave(r);if(this.drawCodewords(c),o==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(o=t,e=n),this.applyMask(t)}}a(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(n,r){let a=e.QrSegment.makeSegments(n);return t.encodeSegments(a,r)}static encodeBinary(n,r){let a=e.QrSegment.makeBytes(n);return t.encodeSegments([a],r)}static encodeSegments(e,r,o=1,c=40,l=-1,u=!0){if(!(t.MIN_VERSION<=o&&o<=c&&c<=t.MAX_VERSION)||l<-1||l>7)throw RangeError(`Invalid value`);let d,f;for(d=o;;d++){let n=t.getNumDataCodewords(d,r)*8,a=s.getTotalBits(e,d);if(a<=n){f=a;break}if(d>=c)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])u&&f<=t.getNumDataCodewords(d,e)*8&&(r=e);let p=[];for(let t of e){n(t.mode.modeBits,4,p),n(t.numChars,t.mode.numCharCountBits(d),p);for(let e of t.getData())p.push(e)}a(p.length==f);let m=t.getNumDataCodewords(d,r)*8;a(p.length<=m),n(0,Math.min(4,m-p.length),p),n(0,(8-p.length%8)%8,p),a(p.length%8==0);for(let e=236;p.length<m;e^=253)n(e,8,p);let h=[];for(;h.length*8<p.length;)h.push(0);return p.forEach((e,t)=>h[t>>>3]|=e<<7-(t&7)),new t(d,r,h,l)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let o=(t<<10|n)^21522;a(o>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(o,e));this.setFunctionModule(8,7,r(o,6)),this.setFunctionModule(8,8,r(o,7)),this.setFunctionModule(7,8,r(o,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(o,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(o,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(o,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;a(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),a=this.size-11+e%3,o=Math.floor(e/3);this.setFunctionModule(a,o,n),this.setFunctionModule(o,a,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let a=Math.max(Math.abs(r),Math.abs(n)),o=e+r,s=t+n;0<=o&&o<this.size&&0<=s&&s<this.size&&this.setFunctionModule(o,s,a!=2&&a!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let o=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],s=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],c=Math.floor(t.getNumRawDataModules(n)/8),l=o-c%o,u=Math.floor(c/o),d=[],f=t.reedSolomonComputeDivisor(s);for(let n=0,r=0;n<o;n++){let a=e.slice(r,r+u-s+(n<l?0:1));r+=a.length;let o=t.reedSolomonComputeRemainder(a,f);n<l&&a.push(0),d.push(a.concat(o))}let p=[];for(let e=0;e<d[0].length;e++)d.forEach((t,n)=>{(e!=u-s||n>=l)&&p.push(t[e])});return a(p.length==c),p}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let a=0;a<this.size;a++)for(let o=0;o<2;o++){let s=t-o,c=t+1&2?a:this.size-1-a;!this.isFunction[c][s]&&n<e.length*8&&(this.modules[c][s]=r(e[n>>>3],7-(n&7)),n++)}}a(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,a=0,o=[0,0,0,0,0,0,0];for(let s=0;s<this.size;s++)this.modules[n][s]==r?(a++,a==5?e+=t.PENALTY_N1:a>5&&e++):(this.finderPenaltyAddHistory(a,o),r||(e+=this.finderPenaltyCountPatterns(o)*t.PENALTY_N3),r=this.modules[n][s],a=1);e+=this.finderPenaltyTerminateAndCount(r,a,o)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,a=0,o=[0,0,0,0,0,0,0];for(let s=0;s<this.size;s++)this.modules[s][n]==r?(a++,a==5?e+=t.PENALTY_N1:a>5&&e++):(this.finderPenaltyAddHistory(a,o),r||(e+=this.finderPenaltyCountPatterns(o)*t.PENALTY_N3),r=this.modules[s][n],a=1);e+=this.finderPenaltyTerminateAndCount(r,a,o)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let a=this.modules[n][r];a==this.modules[n][r+1]&&a==this.modules[n+1][r]&&a==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,o=Math.ceil(Math.abs(n*20-r*10)/r)-1;return a(0<=o&&o<=9),e+=o*t.PENALTY_N4,a(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return a(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let a=0;a<e;a++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let a of e){let e=a^r.shift();r.push(0),n.forEach((n,a)=>r[a]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return a(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];a(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function a(e){if(!e)throw Error(`Assertion error`)}let o=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let a=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+a),10),a*3+1,r),e+=a}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],a;for(a=0;a+2<=t.length;a+=2){let o=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(a))*45;o+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(a+1)),n(o,11,r)}return a<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(a)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};o.NUMERIC_REGEX=/^[0-9]*$/,o.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,o.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let s=o;e.QrSegment=o})(gH||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(gH||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(gH||={});var _H=gH,vH={L:_H.QrCode.Ecc.LOW,M:_H.QrCode.Ecc.MEDIUM,Q:_H.QrCode.Ecc.QUARTILE,H:_H.QrCode.Ecc.HIGH},yH=128,bH=`L`,xH=`#FFFFFF`,SH=`#000000`,CH=!1,wH=1,TH=4,EH=0,DH=.1;function OH(e,t=0){let n=[];return e.forEach(function(e,r){let a=null;e.forEach(function(o,s){if(!o&&a!==null){n.push(`M${a+t} ${r+t}h${s-a}v1H${a+t}z`),a=null;return}if(s===e.length-1){if(!o)return;a===null?n.push(`M${s+t},${r+t} h1v1H${s+t}z`):n.push(`M${a+t},${r+t} h${s+1-a}v1H${a+t}z`);return}o&&a===null&&(a=s)})}),n.join(``)}function kH(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function AH(e,t,n,r){if(r==null)return null;let a=e.length+n*2,o=Math.floor(t*DH),s=a/t,c=(r.width||o)*s,l=(r.height||o)*s,u=r.x==null?e.length/2-c/2:r.x*s,d=r.y==null?e.length/2-l/2:r.y*s,f=r.opacity==null?1:r.opacity,p=null;if(r.excavate){let e=Math.floor(u),t=Math.floor(d);p={x:e,y:t,w:Math.ceil(c+u-e),h:Math.ceil(l+d-t)}}let m=r.crossOrigin;return{x:u,y:d,h:l,w:c,excavation:p,opacity:f,crossOrigin:m}}function jH(e,t){return t==null?e?TH:EH:Math.max(Math.floor(t),0)}function MH({value:e,level:t,minVersion:n,includeMargin:r,marginSize:a,imageSettings:o,size:s,boostLevel:c}){let l=S.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(..._H.QrSegment.makeSegments(t)),e),[]);return _H.QrCode.encodeSegments(r,vH[t],n,void 0,void 0,c)},[e,t,n,c]),{cells:u,margin:d,numCells:f,calculatedImageSettings:p}=S.useMemo(()=>{let e=l.getModules(),t=jH(r,a);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:AH(e,s,t,o)}},[l,s,o,r,a]);return{qrcode:l,margin:d,cells:u,numCells:f,calculatedImageSettings:p}}var NH=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),PH=S.forwardRef(function(e,t){let n=e,{value:r,size:a=yH,level:o=bH,bgColor:s=xH,fgColor:c=SH,includeMargin:l=CH,minVersion:u=wH,boostLevel:d,marginSize:f,imageSettings:p}=n,m=hH(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:h}=m,g=hH(m,[`style`]),_=p?.src,v=S.useRef(null),y=S.useRef(null),b=S.useCallback(e=>{v.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[x,C]=S.useState(!1),{margin:w,cells:T,numCells:E,calculatedImageSettings:D}=MH({value:r,level:o,minVersion:u,boostLevel:d,includeMargin:l,marginSize:f,imageSettings:p,size:a});S.useEffect(()=>{if(v.current!=null){let e=v.current,t=e.getContext(`2d`);if(!t)return;let n=T,r=y.current,o=D!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;o&&D.excavation!=null&&(n=kH(T,D.excavation));let l=window.devicePixelRatio||1;e.height=e.width=a*l;let u=a/E*l;t.scale(u,u),t.fillStyle=s,t.fillRect(0,0,E,E),t.fillStyle=c,NH?t.fill(new Path2D(OH(n,w))):T.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+w,n+w,1,1)})}),D&&(t.globalAlpha=D.opacity),o&&t.drawImage(r,D.x+w,D.y+w,D.w,D.h)}}),S.useEffect(()=>{C(!1)},[_]);let O=mH({height:a,width:a},h),ee=null;return _!=null&&(ee=S.createElement(`img`,{src:_,key:_,style:{display:`none`},onLoad:()=>{C(!0)},ref:y,crossOrigin:D?.crossOrigin})),S.createElement(S.Fragment,null,S.createElement(`canvas`,mH({style:O,height:a,width:a,ref:b,role:`img`},g)),ee)});PH.displayName=`QRCodeCanvas`;var FH=S.forwardRef(function(e,t){let n=e,{value:r,size:a=yH,level:o=bH,bgColor:s=xH,fgColor:c=SH,includeMargin:l=CH,minVersion:u=wH,boostLevel:d,title:f,marginSize:p,imageSettings:m}=n,h=hH(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:g,cells:_,numCells:v,calculatedImageSettings:y}=MH({value:r,level:o,minVersion:u,boostLevel:d,includeMargin:l,marginSize:p,imageSettings:m,size:a}),b=_,x=null;m!=null&&y!=null&&(y.excavation!=null&&(b=kH(_,y.excavation)),x=S.createElement(`image`,{href:m.src,height:y.h,width:y.w,x:y.x+g,y:y.y+g,preserveAspectRatio:`none`,opacity:y.opacity,crossOrigin:y.crossOrigin}));let C=OH(b,g);return S.createElement(`svg`,mH({height:a,width:a,viewBox:`0 0 ${v} ${v}`,ref:t,role:`img`},h),!!f&&S.createElement(`title`,null,f),S.createElement(`path`,{fill:s,d:`M0,0 h${v}v${v}H0z`,shapeRendering:`crispEdges`}),S.createElement(`path`,{fill:c,d:C,shapeRendering:`crispEdges`}),x)});FH.displayName=`QRCodeSVG`;function IH(){return typeof window>`u`?!1:window.matchMedia(`(hover: none) and (pointer: coarse)`).matches||typeof navigator<`u`&&navigator.maxTouchPoints>0||`ontouchstart`in window}function LH(e,t,n){let r=0;for(let a=0;a<8;a++)for(let o=0;o<8;o++){let s=Math.min(t-1,Math.floor((o+.5)/8*t)),c=Math.min(n-1,Math.floor((a+.5)/8*n)),{data:l}=e.getImageData(s,c,1,1);.2126*(l[0]??0)+.7152*(l[1]??0)+.0722*(l[2]??0)>12&&r++}return r<=1}function RH(e){let t={};if(typeof window<`u`){if(e){let n=e.getBoundingClientRect();n.width>0&&n.height>0&&(t.viewportWidth=Math.round(n.width),t.viewportHeight=Math.round(n.height))}t.viewportWidth===void 0&&(t.viewportWidth=window.innerWidth,t.viewportHeight=window.innerHeight),t.devicePixelRatio=window.devicePixelRatio||1;let n=navigator.connection;n?.downlink&&n.downlink>0&&(t.downlinkMbps=n.downlink)}return t}var zH=1500,BH=15e3,VH=40;function HH({serverUrl:e,streamKey:t,label:n,autoPlay:r=!0,muted:a=!0,showControls:o=!0,showStats:s=!1,onPlaybackStats:c,className:l=``,onStateChange:u,onError:d,overlay:f,createSession:p,sendAnswer:m,handleOffer:h,getIceServers:g,addIceCandidate:_,getIceCandidates:v,closeSession:y,getSessionState:b,reoffer:x,posterUrl:w,hintsOverride:T,reconnectSignal:E,onControlChannel:D}){let O=(0,S.useRef)(null),ee=(0,S.useRef)(null),te=(0,S.useRef)(null),ne=(0,S.useRef)(new Set),re=(0,S.useRef)(null),ie=(0,S.useRef)(null),ae=(0,S.useRef)(0),k=(0,S.useRef)(!0),oe=(0,S.useRef)(D);oe.current=D;let A=(0,S.useRef)(null),se=(0,S.useRef)(null),ce=(0,S.useRef)(0),le=(0,S.useRef)(!1),ue=(0,S.useRef)(async()=>{}),[de,fe]=(0,S.useState)(`idle`),[pe,me]=(0,S.useState)(``),[he,ge]=(0,S.useState)(a),[_e,ve]=(0,S.useState)(!1),[ye,be]=(0,S.useState)(!1),xe=IH(),[Se,Ce]=(0,S.useState)(!0),we=(0,S.useRef)(null),Te=(0,S.useRef)(!1);(m||p)&&(Te.current=!0);let Ee=Te.current,De=(0,S.useRef)(!1);h&&(De.current=!0);let Oe=De.current,[ke,Ae]=(0,S.useState)(!1),je=(0,S.useRef)(null),[Me,Ne]=(0,S.useState)(null),[Pe,Fe]=(0,S.useState)(!1),Ie=(0,S.useCallback)(()=>{let e=O.current;if(!(!e||e.readyState<2||!e.videoWidth||!e.videoHeight))try{let t=document.createElement(`canvas`);t.width=e.videoWidth,t.height=e.videoHeight;let n=t.getContext(`2d`);if(!n||(n.drawImage(e,0,0),LH(n,t.width,t.height)))return;je.current=t.toDataURL(`image/jpeg`,.6)}catch{}},[]),Le=(0,S.useCallback)(e=>{fe(e),e===`playing`&&Ae(!0),u?.(e)},[u]),Re=(0,S.useCallback)(()=>{if(re.current?.abort(),re.current=null,ie.current&&=(clearTimeout(ie.current),null),se.current&&=(clearTimeout(se.current),null),A.current=null,le.current=!1,ce.current=0,te.current&&=(te.current.close(),null),y&&ne.current.size>0){for(let e of ne.current)y(e).catch(()=>{});ne.current.clear()}},[y]),ze=(0,S.useCallback)(()=>{re.current?.abort(),re.current=null,ie.current&&=(clearTimeout(ie.current),null),se.current&&=(clearTimeout(se.current),null),A.current=null,le.current=!1,ce.current=0},[]),Be=1e3,Ve=(0,S.useCallback)(e=>{if(!b||!x)return;se.current&&=(clearTimeout(se.current),null);let t=async()=>{if(k.current&&A.current===e){if(!le.current)try{let{pendingRenegotiation:t}=await b(e);if(k.current&&A.current===e&&t&&t.epoch>ce.current&&!le.current){ce.current=t.epoch,await ue.current(e,t.target);return}}catch{}!k.current||A.current!==e||(se.current=setTimeout(()=>{t()},Be))}};se.current=setTimeout(()=>{t()},Be)},[b,x]),He=(0,S.useCallback)(async(e=!1)=>{if(!k.current||!p||!m)return;let t=e?te.current:null,n=e?new Set(ne.current):null;e?ze():Re(),Le(`connecting`);let r=new AbortController;re.current=r;try{let{sessionId:a,sdpOffer:o,iceServers:s}=await p({...RH(ee.current),...T});if(ne.current.add(a),!k.current||r.signal.aborted){y?.(a).catch(()=>{}),ne.current.delete(a);return}let c=new RTCPeerConnection({iceServers:[...s??[],{urls:`stun:stun.l.google.com:19302`}]});e||(te.current=c);let l=new MediaStream,u=!1,d=()=>{if(!(u||!k.current)){if(u=!0,te.current=c,O.current&&(O.current.srcObject=l,O.current.play().catch(()=>{})),t&&t!==c)try{t.close()}catch{}if(n)for(let e of n)ne.current.delete(e),y?.(e).catch(()=>{})}};c.ontrack=t=>{if(console.debug(`[WebRTC] ontrack`,t.track.kind,t.track.readyState),l.addTrack(t.track),e){d();return}O.current&&(O.current.srcObject=l,O.current.play().catch(()=>{}))},c.oniceconnectionstatechange=()=>{if(!k.current)return;let t=c.iceConnectionState;if(console.debug(`[WebRTC] ICE state:`,t),t===`connected`||t===`completed`)ae.current=0,e&&d(),Le(`playing`),O.current?.paused&&(console.debug(`[WebRTC] video was paused at ICE connected — calling play()`),O.current.play().catch(()=>{}));else if(t===`failed`||t===`disconnected`||t===`closed`){if(e&&!u)try{c.close()}catch{}Le(`disconnected`),qe()}},c.onicecandidateerror=e=>{console.debug(`[WebRTC] ICE candidate error:`,e)},console.debug(`[WebRTC] Setting remote description (server offer)...`),await c.setRemoteDescription({type:`offer`,sdp:o});let f=await c.createAnswer();if(await c.setLocalDescription(f),console.debug(`[WebRTC] Local description set, waiting for ICE gathering...`),await WH(c),!k.current)return;let h=(c.localDescription?.sdp??``).split(`
108
- `).filter(e=>e.startsWith(`a=candidate:`)).length;console.debug(`[WebRTC] Sending answer to server`,{localCandidates:h,sessionId:a.slice(0,8)}),await m(a,c.localDescription?.sdp??``),console.debug(`[WebRTC] Answer sent successfully`);let g=c,_=()=>{let e=g.connectionState;if(e===`closed`||e===`failed`)return;let t=O.current;t&&t.readyState===0&&console.log(`[WebRTC] no video data yet (ice=${g.iceConnectionState})`)};setTimeout(_,3e3),setTimeout(_,8e3)}catch(e){if(!k.current)return;let t=e instanceof Error?e.message:String(e);me(t),Le(`error`),d?.(t),qe()}},[e,t,p,m,Re,ze,y,Le,d,T]),Ue=(0,S.useCallback)(async()=>{if(k.current){Re(),Le(`connecting`);try{let n=new RTCPeerConnection({iceServers:[{urls:`stun:stun.l.google.com:19302`}]});te.current=n,n.addTransceiver(`video`,{direction:`recvonly`}),n.addTransceiver(`audio`,{direction:`recvonly`});let r=new MediaStream;n.ontrack=e=>{r.addTrack(e.track),O.current&&(O.current.srcObject=r,O.current.play().catch(()=>{}))},n.oniceconnectionstatechange=()=>{if(!k.current)return;let e=n.iceConnectionState;e===`connected`||e===`completed`?(ae.current=0,Le(`playing`),O.current?.paused&&O.current.play().catch(()=>{})):(e===`failed`||e===`disconnected`||e===`closed`)&&(Le(`disconnected`),qe())};let a=await n.createOffer();if(await n.setLocalDescription(a),await WH(n),!k.current)return;let o=`${e}/api/webrtc?src=${encodeURIComponent(t)}`,s=await fetch(o,{method:`POST`,headers:{"Content-Type":`application/sdp`},body:n.localDescription?.sdp??``});if(!s.ok)throw Error(`WHEP ${s.status}: ${s.statusText}`);let c=await s.text();await n.setRemoteDescription({type:`answer`,sdp:c})}catch(e){if(!k.current)return;let t=e instanceof Error?e.message:String(e);me(t),Le(`error`),d?.(t),qe()}}},[e,t,Re,Le,d]),We=(0,S.useCallback)(async(e=!1)=>{if(!k.current||!h)return;let t=e?te.current:null,n=e?new Set(ne.current):null;e?ze():Re(),Le(`connecting`);let r=new AbortController;re.current=r;try{let a=await g?.();if(!k.current||r.signal.aborted)return;let o=new RTCPeerConnection({iceServers:[...a??[],{urls:`stun:stun.l.google.com:19302`}]});e||(te.current=o);let s=new MediaStream,c=!1,l=()=>{if(!(c||!k.current)){if(c=!0,te.current=o,O.current&&(O.current.srcObject=s,O.current.play().catch(()=>{})),t&&t!==o)try{t.close()}catch{}if(n)for(let e of n)ne.current.delete(e),y?.(e).catch(()=>{})}};o.ontrack=t=>{if(console.debug(`[WebRTC] ontrack (client-offer)`,t.track.kind,t.track.readyState),s.addTrack(t.track),e){l();return}O.current&&(O.current.srcObject=s,O.current.play().catch(()=>{}))},o.oniceconnectionstatechange=()=>{if(!k.current)return;let t=o.iceConnectionState;if(console.debug(`[WebRTC] ICE state (client-offer):`,t),t===`connected`||t===`completed`)ae.current=0,e&&l(),Le(`playing`),O.current?.paused&&O.current.play().catch(()=>{});else if(t===`failed`||t===`disconnected`||t===`closed`){if(e&&!c)try{o.close()}catch{}Le(`disconnected`),qe()}};let u=null,d=[];if(o.onicecandidate=e=>{if(!e.candidate)return;let t=e.candidate.toJSON();u&&_?_(u,t).catch(()=>{}):d.push(t)},o.addTransceiver(`video`,{direction:`recvonly`}),o.addTransceiver(`audio`,{direction:`recvonly`}),oe.current){let e=o.createDataChannel(`camstack-control`);oe.current(e)}let f=await o.createOffer();if(await o.setLocalDescription(f),!k.current||r.signal.aborted)return;let{sessionId:p,sdpAnswer:m}=await h(o.localDescription?.sdp??f.sdp??``);if(u=p,ne.current.add(p),A.current=p,!k.current||r.signal.aborted){y?.(p).catch(()=>{}),ne.current.delete(p);return}if(_)for(let e of d)_(p,e).catch(()=>{});if(d.length=0,await o.setRemoteDescription({type:`answer`,sdp:m}),console.debug(`[WebRTC] Client-offer answer set (trickle)`,{sessionId:p.slice(0,8)}),v){let e=new Set,t=Date.now(),n=async()=>{if(!(!k.current||r.signal.aborted)&&!(o.connectionState===`closed`||o.signalingState===`closed`)){try{let{candidates:n,done:r}=await v(p);for(let t of n){let n=t.candidate??``;n&&!e.has(n)&&(e.add(n),o.addIceCandidate(new RTCIceCandidate(t)).catch(()=>{}))}let a=o.iceConnectionState;if(r||Date.now()-t>1e4||a===`connected`||a===`completed`)return}catch{}setTimeout(()=>{n()},200)}};n()}Ve(p)}catch(e){if(!k.current)return;let t=e instanceof Error?e.message:String(e);me(t),Le(`error`),d?.(t),qe()}},[h,g,_,v,y,Re,ze,Le,d,Ve]);ue.current=(0,S.useCallback)(async(e,t)=>{let n=x;if(!k.current||!n)return;let r=te.current;le.current=!0;try{let a=await g?.();if(!k.current)return;let o=new RTCPeerConnection({iceServers:[...a??[],{urls:`stun:stun.l.google.com:19302`}]}),s=new MediaStream,c=!1,l=()=>{c||!k.current||(c=!0,te.current=o,O.current&&(O.current.srcObject=s,O.current.play().catch(()=>{})),r&&r!==o&&r.close())};o.ontrack=e=>{console.debug(`[WebRTC] ontrack (reoffer)`,e.track.kind,e.track.readyState),s.addTrack(e.track),l()},o.oniceconnectionstatechange=()=>{if(!k.current)return;let e=o.iceConnectionState;console.debug(`[WebRTC] ICE state (reoffer):`,e),e===`connected`||e===`completed`?(ae.current=0,l(),Le(`playing`),O.current?.paused&&O.current.play().catch(()=>{})):(e===`failed`||e===`closed`)&&(!c&&e===`failed`&&o.close(),Le(`disconnected`),qe())};let u=null,d=[];if(o.onicecandidate=e=>{if(!e.candidate)return;let t=e.candidate.toJSON();u&&_?_(u,t).catch(()=>{}):d.push(t)},o.addTransceiver(`video`,{direction:`recvonly`}),o.addTransceiver(`audio`,{direction:`recvonly`}),oe.current){let e=o.createDataChannel(`camstack-control`);oe.current(e)}let f=await o.createOffer();if(await o.setLocalDescription(f),!k.current){o.close();return}let{sessionId:p,sdpAnswer:m}=await n(e,o.localDescription?.sdp??f.sdp??``,t);if(!k.current){o.close();return}if(u=p,ne.current.add(p),A.current=p,_)for(let e of d)_(p,e).catch(()=>{});if(d.length=0,await o.setRemoteDescription({type:`answer`,sdp:m}),v){let e=new Set,t=Date.now(),n=async()=>{if(k.current&&!(o.connectionState===`closed`||o.signalingState===`closed`)){try{let{candidates:n,done:r}=await v(p);for(let t of n){let n=t.candidate??``;n&&!e.has(n)&&(e.add(n),o.addIceCandidate(new RTCIceCandidate(t)).catch(()=>{}))}let a=o.iceConnectionState;if(r||Date.now()-t>1e4||a===`connected`||a===`completed`)return}catch{}setTimeout(()=>{n()},200)}};n()}Ve(p)}catch(t){console.debug(`[WebRTC] reoffer failed; keeping last frame, re-arming poll`,t instanceof Error?t.message:String(t)),Ve(e)}finally{le.current=!1}},[x,g,_,v,Le,Ve]);let Ge=Oe?We:Ee?He:Ue,Ke=(0,S.useRef)(()=>{});Ke.current=Ge;let qe=(0,S.useCallback)(()=>{if(!k.current||ae.current>=VH)return;let e=ae.current;ae.current+=1;let t=Math.min(BH,zH*2**e),n=Math.round(t*(.8+Math.random()*.4));ie.current=setTimeout(()=>{k.current&&Ke.current()},n)},[]);(0,S.useEffect)(()=>(k.current=!0,ae.current=0,r&&Ge(),()=>{k.current=!1,Re()}),[e,t]);let Je=(0,S.useRef)(!1);(0,S.useEffect)(()=>{if(r){if(Oe){if(!h)return}else if(Ee){if(!p||!m)return}else return;Je.current||te.current||(Je.current=!0,Ge())}},[r,Oe,Ee,h,p,m,Ge]);let Ye=()=>{ae.current=0,Ge()},Xe=()=>{if(ae.current=0,te.current&&Oe){We(!0);return}if(te.current&&Ee){He(!0);return}Ge()},Ze=(0,S.useRef)(E);(0,S.useEffect)(()=>{Ze.current!==E&&(Ze.current=E,k.current&&Xe())},[E]);let Qe=()=>{O.current&&(O.current.muted=!O.current.muted,ge(O.current.muted))},$e=async()=>{if(ee.current)try{if(document.fullscreenElement){await document.exitFullscreen();return}if(ee.current.requestFullscreen){await ee.current.requestFullscreen();return}let e=O.current;e?.webkitEnterFullscreen&&e.webkitEnterFullscreen()}catch(e){console.warn(`Fullscreen toggle failed: ${e instanceof Error?e.message:e}`)}},et=async()=>{let e=O.current;if(e)try{if(typeof e.webkitSetPresentationMode==`function`){e.webkitSetPresentationMode(e.webkitPresentationMode===`picture-in-picture`?`inline`:`picture-in-picture`);return}document.pictureInPictureElement?await document.exitPictureInPicture():await e.requestPictureInPicture()}catch(e){console.warn(`PiP toggle failed: ${e instanceof Error?e.message:String(e)}`)}},tt=()=>{if(!O.current)return;let e=document.createElement(`canvas`);e.width=O.current.videoWidth||1280,e.height=O.current.videoHeight||720;let n=e.getContext(`2d`);if(!n)return;n.drawImage(O.current,0,0);let r=document.createElement(`a`);r.download=`${t.replace(/[/:]/g,`-`)}-${Date.now()}.jpg`,r.href=e.toDataURL(`image/jpeg`,.92),r.click()};(0,S.useEffect)(()=>{let e=()=>ve(!!document.fullscreenElement);document.addEventListener(`fullscreenchange`,e);let t=O.current;return t?.addEventListener(`webkitbeginfullscreen`,e),t?.addEventListener(`webkitendfullscreen`,e),()=>{document.removeEventListener(`fullscreenchange`,e),t?.removeEventListener(`webkitbeginfullscreen`,e),t?.removeEventListener(`webkitendfullscreen`,e)}},[]),(0,S.useEffect)(()=>{let e=O.current,t=typeof document<`u`&&document.pictureInPictureEnabled===!0,n=e!==null&&typeof e.webkitSetPresentationMode==`function`;be(t||n)},[]);let[nt,rt]=(0,S.useState)(``),it=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(!s){rt(``),it.current=null;return}let e=async()=>{let e=te.current;if(e)try{let t=await e.getStats(),n=0,r=0,a=0,o=0,s=0,c=0;t.forEach(e=>{let t=e;t.type===`inbound-rtp`&&(t.kind??t.mediaType)===`video`?(n=t.bytesReceived??0,r=t.timestamp,a=t.framesPerSecond??0,o=t.frameWidth??0,s=t.frameHeight??0):t.type===`candidate-pair`&&t.nominated&&typeof t.currentRoundTripTime==`number`&&(c=t.currentRoundTripTime)});let l=0;it.current&&r>it.current.ts&&(l=Math.round((n-it.current.bytes)*8/(r-it.current.ts))),it.current={bytes:n,ts:r};let u=[];o&&s&&u.push(`${o}×${s}`),a&&u.push(`${Math.round(a)}fps`),l>0&&u.push(`${l} kbps`),c&&u.push(`${Math.round(c*1e3)}ms`),rt(u.join(` · `))}catch{}};e();let t=setInterval(()=>{e()},1e3);return()=>clearInterval(t)},[s]);let at=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(!c){at.current=null;return}let e=async()=>{let e=te.current,t=O.current;if(e)try{let n=await e.getStats(),r=0,a=0,o=0,s=0,l=0,u=0,d=0,f=0;n.forEach(e=>{let t=e;t.type===`inbound-rtp`&&(t.kind??t.mediaType)===`video`&&(r=t.framesReceived??0,a=t.framesDecoded??0,o=t.framesDropped??0,s=t.framesPerSecond??0,l=t.freezeCount??0,u=t.totalFreezesDuration??0,d=t.jitterBufferDelay??0,f=t.jitterBufferEmittedCount??0)});let p=t?.currentTime??0,m=Date.now(),h=at.current,g=f>0?Math.round(d/f*1e3):0;h&&c({dRecv:r-h.recv,dDec:a-h.dec,dDrop:o-h.drop,fps:Math.round(s),dFreeze:l-h.freeze,freezeTotalMs:Math.round(u*1e3),avgJitterMs:g,dCtMs:Math.round((p-h.ct)*1e3),dtMs:m-h.ts,readyState:t?.readyState??-1}),at.current={recv:r,dec:a,drop:o,freeze:l,ct:p,ts:m}}catch{}};e();let t=setInterval(()=>{e()},1e3);return()=>clearInterval(t)},[c]),(0,S.useEffect)(()=>{ge(a);let e=O.current;e&&(e.muted=a,a||e.play().catch(()=>{}))},[a]);let ot=()=>{xe||(Ce(!0),we.current&&clearTimeout(we.current),we.current=setTimeout(()=>Ce(!1),3e3))},st=()=>{Ce(e=>!e),we.current&&clearTimeout(we.current)};(0,S.useEffect)(()=>{if(de===`playing`){Ie();let e=setInterval(Ie,2e3);return()=>clearInterval(e)}ke&&je.current&&Ne(je.current)},[de,ke,Ie]),(0,S.useEffect)(()=>{if(de!==`playing`){Fe(!1);return}let e=O.current;if(!e)return;let t=!1,n=()=>{t||Fe(!0)},r;typeof e.requestVideoFrameCallback==`function`&&(r=e.requestVideoFrameCallback(()=>n())),e.addEventListener(`loadeddata`,n,{once:!0});let a=setTimeout(n,12e3);return()=>{t=!0,clearTimeout(a),r!==void 0&&typeof e.cancelVideoFrameCallback==`function`&&e.cancelVideoFrameCallback(r),e.removeEventListener(`loadeddata`,n)}},[de]);let ct=ke&&Me?Me:w??null,lt=!Pe&&ct!==null;return(0,C.jsxs)(`div`,{ref:ee,className:`relative isolate bg-black overflow-hidden group ${l}`,onMouseMove:ot,onMouseEnter:ot,onTouchStart:st,children:[(0,C.jsx)(`video`,{ref:O,autoPlay:r,muted:he,playsInline:!0,className:`w-full h-full object-contain relative z-0`}),lt&&ct&&(0,C.jsx)(`img`,{src:ct,alt:``,className:`absolute inset-0 w-full h-full object-contain z-[5] transform-gpu pointer-events-none`}),n&&de===`playing`&&(0,C.jsx)(`div`,{className:`absolute top-2 left-2 z-10 transform-gpu px-2 py-0.5 rounded bg-black/60 text-[10px] text-white font-medium`,children:n}),s&&nt&&(0,C.jsx)(`div`,{className:`absolute top-2 right-2 z-10 transform-gpu px-2 py-0.5 rounded bg-black/60 text-[10px] text-white font-mono`,children:nt}),f,!ct&&de===`connecting`&&(0,C.jsxs)(`div`,{className:`absolute inset-0 z-10 transform-gpu flex flex-col items-center justify-center bg-black/70 gap-2`,children:[(0,C.jsx)(`svg`,{className:`h-6 w-6 text-white/60 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,children:(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeDasharray:`32`,strokeDashoffset:`32`,className:`animate-[dash_1.5s_ease-in-out_infinite]`})}),(0,C.jsx)(`span`,{className:`text-xs text-white/60`,children:`Connecting…`})]}),!ct&&(de===`error`||de===`disconnected`)&&(0,C.jsxs)(`div`,{className:`absolute inset-0 z-10 transform-gpu flex flex-col items-center justify-center bg-black/70 gap-2`,children:[(0,C.jsx)(`svg`,{className:`h-6 w-6 text-red-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,C.jsx)(`path`,{d:`M1 1l5.5 5.5M23 23l-5.5-5.5M8.11 15.89a8 8 0 0110.78-10.78M3.64 3.64A12 12 0 0020.36 20.36`,strokeLinecap:`round`})}),(0,C.jsx)(`span`,{className:`text-xs text-red-400 text-center px-4`,children:de===`error`?pe||`Connection failed`:`Disconnected`}),(0,C.jsx)(`button`,{onClick:Ye,className:`mt-1 inline-flex items-center gap-1.5 rounded px-3 py-1 text-xs bg-white/10 text-white hover:bg-white/20 transition-colors`,children:`Reconnect`})]}),ct&&(de===`connecting`||de===`disconnected`)&&(0,C.jsx)(`div`,{className:`absolute top-2 left-2 z-10 transform-gpu flex h-6 w-6 items-center justify-center rounded-full bg-black/55`,children:(0,C.jsx)(`svg`,{className:`h-3.5 w-3.5 text-white/90 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,children:(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeDasharray:`32`,strokeDashoffset:`32`,className:`animate-[dash_1.5s_ease-in-out_infinite]`})})}),ct&&de===`error`&&(0,C.jsx)(`button`,{onClick:Ye,title:pe||`Reconnect`,className:`absolute top-2 left-2 z-10 transform-gpu flex h-6 w-6 items-center justify-center rounded-full bg-black/55 text-white/90 hover:bg-black/75 transition-colors`,children:(0,C.jsxs)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,C.jsx)(`path`,{d:`M23 4v6h-6M1 20v-6h6`}),(0,C.jsx)(`path`,{d:`M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15`})]})}),o&&de!==`idle`&&de!==`error`&&(0,C.jsxs)(`div`,{className:`absolute bottom-0 inset-x-0 z-20 transform-gpu flex items-center justify-between px-3 py-1.5 bg-gradient-to-t from-black/80 to-transparent transition-opacity duration-200 ${xe||Se?`opacity-100 pointer-events-auto`:`opacity-0 pointer-events-none`}`,children:[(0,C.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,C.jsx)(UH,{onClick:Qe,title:he?`Unmute`:`Mute`,children:he?(0,C.jsxs)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,C.jsx)(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),(0,C.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,C.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}):(0,C.jsxs)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,C.jsx)(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),(0,C.jsx)(`path`,{d:`M19.07 4.93a10 10 0 010 14.14M15.54 8.46a5 5 0 010 7.07`})]})})}),(0,C.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,C.jsx)(UH,{onClick:tt,title:`Take snapshot`,children:(0,C.jsxs)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,C.jsx)(`path`,{d:`M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2z`}),(0,C.jsx)(`circle`,{cx:`12`,cy:`13`,r:`4`})]})}),ye&&(0,C.jsx)(UH,{onClick:et,title:`Picture-in-Picture`,children:(0,C.jsxs)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,C.jsx)(`path`,{d:`M21 9V6a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2h4`}),(0,C.jsx)(`rect`,{width:`10`,height:`7`,x:`12`,y:`13`,rx:`2`})]})}),(0,C.jsx)(UH,{onClick:$e,title:_e?`Exit fullscreen`:`Fullscreen`,children:_e?(0,C.jsx)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:(0,C.jsx)(`path`,{d:`M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3`})}):(0,C.jsx)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:(0,C.jsx)(`path`,{d:`M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3`})})})]})]})]})}function UH({onClick:e,title:t,children:n}){return(0,C.jsx)(`button`,{onClick:e,title:t,className:`rounded-full p-1.5 min-w-[44px] min-h-[44px] flex items-center justify-center text-white/80 hover:text-white hover:bg-white/20 active:bg-white/30 transition-colors`,children:n})}async function WH(e){if(e.iceGatheringState!==`complete`)return new Promise(t=>{let n=!1,r,a=()=>{n||(n=!0,r&&clearInterval(r),e.removeEventListener(`icegatheringstatechange`,o),t())},o=()=>{e.iceGatheringState===`complete`&&a()};e.addEventListener(`icegatheringstatechange`,o);let s=Date.now();r=setInterval(()=>{let t=e.localDescription?.sdp??``;/ typ host/.test(t)&&Date.now()-s>=600&&a()},100),setTimeout(a,2500)})}var GH=Number.isFinite||function(e){return typeof e==`number`&&isFinite(e)},KH=Number.isSafeInteger||function(e){return typeof e==`number`&&Math.abs(e)<=qH},qH=2**53-1||9007199254740991,JH=function(e){return e.NETWORK_ERROR=`networkError`,e.MEDIA_ERROR=`mediaError`,e.KEY_SYSTEM_ERROR=`keySystemError`,e.MUX_ERROR=`muxError`,e.OTHER_ERROR=`otherError`,e}({}),Z=function(e){return e.KEY_SYSTEM_NO_KEYS=`keySystemNoKeys`,e.KEY_SYSTEM_NO_ACCESS=`keySystemNoAccess`,e.KEY_SYSTEM_NO_SESSION=`keySystemNoSession`,e.KEY_SYSTEM_NO_CONFIGURED_LICENSE=`keySystemNoConfiguredLicense`,e.KEY_SYSTEM_LICENSE_REQUEST_FAILED=`keySystemLicenseRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED=`keySystemServerCertificateRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED=`keySystemServerCertificateUpdateFailed`,e.KEY_SYSTEM_SESSION_UPDATE_FAILED=`keySystemSessionUpdateFailed`,e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED=`keySystemStatusOutputRestricted`,e.KEY_SYSTEM_STATUS_INTERNAL_ERROR=`keySystemStatusInternalError`,e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR=`keySystemDestroyMediaKeysError`,e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR=`keySystemDestroyCloseSessionError`,e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR=`keySystemDestroyRemoveSessionError`,e.MANIFEST_LOAD_ERROR=`manifestLoadError`,e.MANIFEST_LOAD_TIMEOUT=`manifestLoadTimeOut`,e.MANIFEST_PARSING_ERROR=`manifestParsingError`,e.MANIFEST_INCOMPATIBLE_CODECS_ERROR=`manifestIncompatibleCodecsError`,e.LEVEL_EMPTY_ERROR=`levelEmptyError`,e.LEVEL_LOAD_ERROR=`levelLoadError`,e.LEVEL_LOAD_TIMEOUT=`levelLoadTimeOut`,e.LEVEL_PARSING_ERROR=`levelParsingError`,e.LEVEL_SWITCH_ERROR=`levelSwitchError`,e.AUDIO_TRACK_LOAD_ERROR=`audioTrackLoadError`,e.AUDIO_TRACK_LOAD_TIMEOUT=`audioTrackLoadTimeOut`,e.SUBTITLE_LOAD_ERROR=`subtitleTrackLoadError`,e.SUBTITLE_TRACK_LOAD_TIMEOUT=`subtitleTrackLoadTimeOut`,e.FRAG_LOAD_ERROR=`fragLoadError`,e.FRAG_LOAD_TIMEOUT=`fragLoadTimeOut`,e.FRAG_DECRYPT_ERROR=`fragDecryptError`,e.FRAG_PARSING_ERROR=`fragParsingError`,e.FRAG_GAP=`fragGap`,e.REMUX_ALLOC_ERROR=`remuxAllocError`,e.KEY_LOAD_ERROR=`keyLoadError`,e.KEY_LOAD_TIMEOUT=`keyLoadTimeOut`,e.BUFFER_ADD_CODEC_ERROR=`bufferAddCodecError`,e.BUFFER_INCOMPATIBLE_CODECS_ERROR=`bufferIncompatibleCodecsError`,e.BUFFER_APPEND_ERROR=`bufferAppendError`,e.BUFFER_APPENDING_ERROR=`bufferAppendingError`,e.BUFFER_STALLED_ERROR=`bufferStalledError`,e.BUFFER_FULL_ERROR=`bufferFullError`,e.BUFFER_SEEK_OVER_HOLE=`bufferSeekOverHole`,e.BUFFER_NUDGE_ON_STALL=`bufferNudgeOnStall`,e.ASSET_LIST_LOAD_ERROR=`assetListLoadError`,e.ASSET_LIST_LOAD_TIMEOUT=`assetListLoadTimeout`,e.ASSET_LIST_PARSING_ERROR=`assetListParsingError`,e.INTERSTITIAL_ASSET_ITEM_ERROR=`interstitialAssetItemError`,e.INTERNAL_EXCEPTION=`internalException`,e.INTERNAL_ABORTED=`aborted`,e.ATTACH_MEDIA_ERROR=`attachMediaError`,e.UNKNOWN=`unknown`,e}({}),Q=function(e){return e.MEDIA_ATTACHING=`hlsMediaAttaching`,e.MEDIA_ATTACHED=`hlsMediaAttached`,e.MEDIA_DETACHING=`hlsMediaDetaching`,e.MEDIA_DETACHED=`hlsMediaDetached`,e.MEDIA_ENDED=`hlsMediaEnded`,e.STALL_RESOLVED=`hlsStallResolved`,e.BUFFER_RESET=`hlsBufferReset`,e.BUFFER_CODECS=`hlsBufferCodecs`,e.BUFFER_CREATED=`hlsBufferCreated`,e.BUFFER_APPENDING=`hlsBufferAppending`,e.BUFFER_APPENDED=`hlsBufferAppended`,e.BUFFER_EOS=`hlsBufferEos`,e.BUFFERED_TO_END=`hlsBufferedToEnd`,e.BUFFER_FLUSHING=`hlsBufferFlushing`,e.BUFFER_FLUSHED=`hlsBufferFlushed`,e.MANIFEST_LOADING=`hlsManifestLoading`,e.MANIFEST_LOADED=`hlsManifestLoaded`,e.MANIFEST_PARSED=`hlsManifestParsed`,e.LEVEL_SWITCHING=`hlsLevelSwitching`,e.LEVEL_SWITCHED=`hlsLevelSwitched`,e.LEVEL_LOADING=`hlsLevelLoading`,e.LEVEL_LOADED=`hlsLevelLoaded`,e.LEVEL_UPDATED=`hlsLevelUpdated`,e.LEVEL_PTS_UPDATED=`hlsLevelPtsUpdated`,e.LEVELS_UPDATED=`hlsLevelsUpdated`,e.AUDIO_TRACKS_UPDATED=`hlsAudioTracksUpdated`,e.AUDIO_TRACK_SWITCHING=`hlsAudioTrackSwitching`,e.AUDIO_TRACK_SWITCHED=`hlsAudioTrackSwitched`,e.AUDIO_TRACK_LOADING=`hlsAudioTrackLoading`,e.AUDIO_TRACK_LOADED=`hlsAudioTrackLoaded`,e.AUDIO_TRACK_UPDATED=`hlsAudioTrackUpdated`,e.SUBTITLE_TRACKS_UPDATED=`hlsSubtitleTracksUpdated`,e.SUBTITLE_TRACKS_CLEARED=`hlsSubtitleTracksCleared`,e.SUBTITLE_TRACK_SWITCH=`hlsSubtitleTrackSwitch`,e.SUBTITLE_TRACK_LOADING=`hlsSubtitleTrackLoading`,e.SUBTITLE_TRACK_LOADED=`hlsSubtitleTrackLoaded`,e.SUBTITLE_TRACK_UPDATED=`hlsSubtitleTrackUpdated`,e.SUBTITLE_FRAG_PROCESSED=`hlsSubtitleFragProcessed`,e.CUES_PARSED=`hlsCuesParsed`,e.NON_NATIVE_TEXT_TRACKS_FOUND=`hlsNonNativeTextTracksFound`,e.INIT_PTS_FOUND=`hlsInitPtsFound`,e.FRAG_LOADING=`hlsFragLoading`,e.FRAG_LOAD_EMERGENCY_ABORTED=`hlsFragLoadEmergencyAborted`,e.FRAG_LOADED=`hlsFragLoaded`,e.FRAG_DECRYPTED=`hlsFragDecrypted`,e.FRAG_PARSING_INIT_SEGMENT=`hlsFragParsingInitSegment`,e.FRAG_PARSING_USERDATA=`hlsFragParsingUserdata`,e.FRAG_PARSING_METADATA=`hlsFragParsingMetadata`,e.FRAG_PARSED=`hlsFragParsed`,e.FRAG_BUFFERED=`hlsFragBuffered`,e.FRAG_CHANGED=`hlsFragChanged`,e.FPS_DROP=`hlsFpsDrop`,e.FPS_DROP_LEVEL_CAPPING=`hlsFpsDropLevelCapping`,e.MAX_AUTO_LEVEL_UPDATED=`hlsMaxAutoLevelUpdated`,e.ERROR=`hlsError`,e.DESTROYING=`hlsDestroying`,e.KEY_LOADING=`hlsKeyLoading`,e.KEY_LOADED=`hlsKeyLoaded`,e.LIVE_BACK_BUFFER_REACHED=`hlsLiveBackBufferReached`,e.BACK_BUFFER_REACHED=`hlsBackBufferReached`,e.STEERING_MANIFEST_LOADED=`hlsSteeringManifestLoaded`,e.ASSET_LIST_LOADING=`hlsAssetListLoading`,e.ASSET_LIST_LOADED=`hlsAssetListLoaded`,e.INTERSTITIALS_UPDATED=`hlsInterstitialsUpdated`,e.INTERSTITIALS_BUFFERED_TO_BOUNDARY=`hlsInterstitialsBufferedToBoundary`,e.INTERSTITIAL_ASSET_PLAYER_CREATED=`hlsInterstitialAssetPlayerCreated`,e.INTERSTITIAL_STARTED=`hlsInterstitialStarted`,e.INTERSTITIAL_ASSET_STARTED=`hlsInterstitialAssetStarted`,e.INTERSTITIAL_ASSET_ENDED=`hlsInterstitialAssetEnded`,e.INTERSTITIAL_ASSET_ERROR=`hlsInterstitialAssetError`,e.INTERSTITIAL_ENDED=`hlsInterstitialEnded`,e.INTERSTITIALS_PRIMARY_RESUMED=`hlsInterstitialsPrimaryResumed`,e.PLAYOUT_LIMIT_REACHED=`hlsPlayoutLimitReached`,e.EVENT_CUE_ENTER=`hlsEventCueEnter`,e}({}),YH={MANIFEST:`manifest`,LEVEL:`level`,AUDIO_TRACK:`audioTrack`,SUBTITLE_TRACK:`subtitleTrack`},XH={MAIN:`main`,AUDIO:`audio`,SUBTITLE:`subtitle`},ZH=class{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){let n=this.alpha_**+e;this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){let e=1-this.alpha_**+this.totalWeight_;if(e)return this.estimate_/e}return this.estimate_}},QH=class{constructor(e,t,n,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ZH(e),this.fast_=new ZH(t),this.defaultTTFB_=r,this.ttfb_=new ZH(e)}update(e,t){let{slow_:n,fast_:r,ttfb_:a}=this;n.halfLife!==e&&(this.slow_=new ZH(e,n.getEstimate(),n.getTotalWeight())),r.halfLife!==t&&(this.fast_=new ZH(t,r.getEstimate(),r.getTotalWeight())),a.halfLife!==e&&(this.ttfb_=new ZH(e,a.getEstimate(),a.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);let n=8*t,r=e/1e3,a=n/r;this.fast_.sample(r,a),this.slow_.sample(r,a)}sampleTTFB(e){let t=e/1e3,n=Math.sqrt(2)*Math.exp(-(t**2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}};function $H(e,t,n){return(t=iU(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eU(){return eU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},eU.apply(null,arguments)}function tU(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 nU(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?tU(Object(n),!0).forEach(function(t){$H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tU(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rU(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 iU(e){var t=rU(e,`string`);return typeof t==`symbol`?t:t+``}var aU=class{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;let n=`[${e}]:`;this.trace=oU,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}},oU=function(){},sU={trace:oU,debug:oU,log:oU,warn:oU,info:oU,error:oU};function cU(){return eU({},sU)}function lU(e,t){let n=self.console[e];return n?n.bind(self.console,`${t?`[`+t+`] `:``}[${e}] >`):oU}function uU(e,t,n){return t[e]?t[e].bind(t):lU(e,n)}var dU=cU();function fU(e,t,n){let r=cU();if(typeof console==`object`&&e===!0||typeof e==`object`){let a=[`debug`,`log`,`info`,`warn`,`error`];a.forEach(t=>{r[t]=uU(t,e,n)});try{r.log(`Debug logs enabled for "${t}" in hls.js version 1.6.16`)}catch{return cU()}a.forEach(t=>{dU[t]=uU(t,e)})}else eU(dU,r);return r}var pU=dU;function mU(e=!0){if(!(typeof self>`u`))return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function hU(e){return typeof self<`u`&&e===self.ManagedMediaSource}function gU(e,t){let n=Object.keys(e),r=Object.keys(t),a=n.length,o=r.length;return!a||!o||a===o&&!n.some(e=>r.indexOf(e)===-1)}function _U(e,t=!1){if(typeof TextDecoder<`u`){let n=new TextDecoder(`utf-8`).decode(e);if(t){let e=n.indexOf(`\0`);return e===-1?n:n.substring(0,e)}return n.replace(/\0/g,``)}let n=e.length,r,a,o,s=``,c=0;for(;c<n;){if(r=e[c++],r===0&&t)return s;if(!(r===0||r===3))switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:s+=String.fromCharCode(r);break;case 12:case 13:a=e[c++],s+=String.fromCharCode((r&31)<<6|a&63);break;case 14:a=e[c++],o=e[c++],s+=String.fromCharCode((r&15)<<12|(a&63)<<6|(o&63)<<0);break}}return s}function vU(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n].toString(16);r.length<2&&(r=`0`+r),t+=r}return t}function yU(e){return Uint8Array.from(e.replace(/^0x/,``).replace(/([\da-fA-F]{2}) ?/g,`0x$1 `).replace(/ +$/,``).split(` `)).buffer}function bU(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var xU={exports:{}},SU;function CU(){return SU?xU.exports:(SU=1,(function(e,t){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,a=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(e,t,n){if(n||={},e=e.trim(),t=t.trim(),!t){if(!n.alwaysNormalize)return e;var a=s.parseURL(e);if(!a)throw Error(`Error trying to parse base URL.`);return a.path=s.normalizePath(a.path),s.buildURLFromParts(a)}var o=s.parseURL(t);if(!o)throw Error(`Error trying to parse relative URL.`);if(o.scheme)return n.alwaysNormalize?(o.path=s.normalizePath(o.path),s.buildURLFromParts(o)):t;var c=s.parseURL(e);if(!c)throw Error(`Error trying to parse base URL.`);if(!c.netLoc&&c.path&&c.path[0]!==`/`){var l=r.exec(c.path);c.netLoc=l[1],c.path=l[2]}c.netLoc&&!c.path&&(c.path=`/`);var u={scheme:c.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(u.netLoc=c.netLoc,o.path[0]!==`/`))if(!o.path)u.path=c.path,o.params||(u.params=c.params,o.query||(u.query=c.query));else{var d=c.path,f=d.substring(0,d.lastIndexOf(`/`)+1)+o.path;u.path=s.normalizePath(f)}return u.path===null&&(u.path=n.alwaysNormalize?s.normalizePath(o.path):o.path),s.buildURLFromParts(u)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||``,netLoc:t[2]||``,path:t[3]||``,params:t[4]||``,query:t[5]||``,fragment:t[6]||``}:null},normalizePath:function(e){for(e=e.split(``).reverse().join(``).replace(a,``);e.length!==(e=e.replace(o,``)).length;);return e.split(``).reverse().join(``)},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=s})()})(xU),xU.exports)}var wU=CU(),TU=class{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},EU={AUDIO:`audio`,VIDEO:`video`,AUDIOVIDEO:`audiovideo`},DU=class{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e==`string`&&(e={url:e}),this.base=e,MU(this,`stats`)}setByteRange(e,t){let n=e.split(`@`,2),r;r=n.length===1?t?.byteRangeEndOffset||0:parseInt(n[1]),this._byteRange=[r,parseInt(n[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[EU.AUDIO]:null,[EU.VIDEO]:null,[EU.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new TU),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=wU.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||``}set url(e){this._url=e}clearElementaryStreamInfo(){let{elementaryStreams:e}=this;e[EU.AUDIO]=null,e[EU.VIDEO]=null,e[EU.AUDIOVIDEO]=null}};function OU(e){return e.sn!==`initSegment`}var kU=class extends DU{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){let e=this.stats.total;if(e)return e}if(this.byteRange.length){let e=this.byteRange[0],t=this.byteRange[1];if(GH(e)&&GH(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;let{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||=t.identity.getDecryptData(this.sn);else if(!((e=this._decryptdata)!=null&&e.keyId)){let e=Object.keys(t);if(e.length===1){let n=this._decryptdata=t[e[0]]||null;n&&(this._decryptdata=n.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;let e=GH(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;let e=Object.keys(this.levelkeys),n=e.length;if(n>1||n===1&&(t=this.levelkeys[e[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!GH(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return OU(this)?(this._ref||={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime},this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){let t=this.levelkeys;if(t){var n;let r=t[e];r&&!((n=this._decryptdata)!=null&&n.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,n,r,a,o=!1){let{elementaryStreams:s}=this,c=s[e];if(!c){s[e]={startPTS:t,endPTS:n,startDTS:r,endDTS:a,partial:o};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,n),c.startDTS=Math.min(c.startDTS,r),c.endDTS=Math.max(c.endDTS,a)}},AU=class extends DU{constructor(e,t,n,r,a){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint(`DURATION`),this.gap=e.bool(`GAP`),this.independent=e.bool(`INDEPENDENT`),this.relurl=e.enumeratedString(`URI`),this.fragment=t,this.index=r;let o=e.enumeratedString(`BYTERANGE`);o&&this.setByteRange(o,a),a&&(this.fragOffset=a.fragOffset+a.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){let{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}};function jU(e,t){let n=Object.getPrototypeOf(e);if(n)return Object.getOwnPropertyDescriptor(n,t)||jU(n,t)}function MU(e,t){let n=jU(e,t);n&&(n.enumerable=!0,Object.defineProperty(e,t,n))}var NU=2**32-1,PU=[].push,FU={video:1,audio:2,id3:3,text:4};function IU(e){return String.fromCharCode.apply(null,e)}function LU(e,t){let n=e[t]<<8|e[t+1];return n<0?65536+n:n}function RU(e,t){let n=BU(e,t);return n<0?4294967296+n:n}function zU(e,t){let n=RU(e,t);return n*=2**32,n+=RU(e,t+4),n}function BU(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function VU(e){let t=e.byteLength;for(let n=0;n<t;){let r=RU(e,n);if(r>8&&e[n+4]===109&&e[n+5]===111&&e[n+6]===111&&e[n+7]===102)return!0;n=r>1?n+r:t}return!1}function HU(e,t){let n=[];if(!t.length)return n;let r=e.byteLength;for(let a=0;a<r;){let o=RU(e,a),s=IU(e.subarray(a+4,a+8)),c=o>1?a+o:r;if(s===t[0])if(t.length===1)n.push(e.subarray(a+8,c));else{let r=HU(e.subarray(a+8,c),t.slice(1));r.length&&PU.apply(n,r)}a=c}return n}function UU(e){let t=[],n=e[0],r=8,a=RU(e,r);r+=4;let o=0,s=0;n===0?(o=RU(e,r),s=RU(e,r+4),r+=8):(o=zU(e,r),s=zU(e,r+8),r+=16),r+=2;let c=e.length+s,l=LU(e,r);r+=2;for(let n=0;n<l;n++){let n=r,o=RU(e,n);n+=4;let s=o&2147483647;if((o&2147483648)>>>31==1)return pU.warn(`SIDX has hierarchical references (not supported)`),null;let l=RU(e,n);n+=4,t.push({referenceSize:s,subsegmentDuration:l,info:{duration:l/a,start:c,end:c+s-1}}),c+=s,n+=4,r=n}return{earliestPresentationTime:o,timescale:a,version:n,referencesCount:l,references:t}}function WU(e){let t=[],n=HU(e,[`moov`,`trak`]);for(let e=0;e<n.length;e++){let r=n[e],a=HU(r,[`tkhd`])[0];if(a){let e=a[0],n=RU(a,e===0?12:20),o=HU(r,[`mdia`,`mdhd`])[0];if(o){e=o[0];let a=RU(o,e===0?12:20),s=HU(r,[`mdia`,`hdlr`])[0];if(s){let e=IU(s.subarray(8,12)),o={soun:EU.AUDIO,vide:EU.VIDEO}[e],c=HU(r,[`mdia`,`minf`,`stbl`,`stsd`])[0],l=GU(c);o?(t[n]={timescale:a,type:o,stsd:l},t[o]=nU({timescale:a,id:n},l)):t[n]={timescale:a,type:e,stsd:l}}}}}return HU(e,[`moov`,`mvex`,`trex`]).forEach(e=>{let n=t[RU(e,4)];n&&(n.default={duration:RU(e,12),flags:RU(e,20)})}),t}function GU(e){let t=e.subarray(8),n=t.subarray(86),r=IU(t.subarray(4,8)),a=r,o,s=r===`enca`||r===`encv`;s&&HU(HU(t,[r])[0].subarray(r===`enca`?28:78),[`sinf`]).forEach(e=>{let t=HU(e,[`schm`])[0];if(t){let n=IU(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=HU(e,[`frma`])[0];t&&(a=IU(t))}}});let c=a;switch(a){case`avc1`:case`avc2`:case`avc3`:case`avc4`:{let e=HU(n,[`avcC`])[0];e&&e.length>3&&(a+=`.`+YU(e[1])+YU(e[2])+YU(e[3]),o=KU(c===`avc1`?`dva1`:`dvav`,n));break}case`mp4a`:{let e=HU(t,[r])[0],n=HU(e.subarray(28),[`esds`])[0];if(n&&n.length>7){let e=4;if(n[e++]!==3)break;e=JU(n,e),e+=2;let t=n[e++];if(t&128&&(e+=2),t&64&&(e+=n[e++]),n[e++]!==4)break;e=JU(n,e);let r=n[e++];if(r===64)a+=`.`+YU(r);else break;if(e+=12,n[e++]!==5)break;e=JU(n,e);let o=n[e++],s=(o&248)>>3;s===31&&(s+=1+((o&7)<<3)+((n[e]&224)>>5)),a+=`.`+s}break}case`hvc1`:case`hev1`:{let e=HU(n,[`hvcC`])[0];if(e&&e.length>12){let t=e[1],n=[``,`A`,`B`,`C`][t>>6],r=t&31,o=RU(e,2),s=(t&32)>>5?`H`:`L`,c=e[12],l=e.subarray(6,12);a+=`.`+n+r,a+=`.`+qU(o).toString(16).toUpperCase(),a+=`.`+s+c;let u=``;for(let e=l.length;e--;){let t=l[e];(t||u)&&(u=`.`+t.toString(16).toUpperCase()+u)}a+=u}o=KU(c==`hev1`?`dvhe`:`dvh1`,n);break}case`dvh1`:case`dvhe`:case`dvav`:case`dva1`:case`dav1`:a=KU(a,n)||a;break;case`vp09`:{let e=HU(n,[`vpcC`])[0];if(e&&e.length>6){let t=e[4],n=e[5],r=e[6]>>4&15;a+=`.`+XU(t)+`.`+XU(n)+`.`+XU(r)}break}case`av01`:{let e=HU(n,[`av1C`])[0];if(e&&e.length>2){let t=e[1]>>>5,r=e[1]&31,s=e[2]>>>7?`H`:`M`,c=(e[2]&64)>>6,l=(e[2]&32)>>5,u=t===2&&c?l?12:10:c?10:8,d=(e[2]&16)>>4,f=(e[2]&8)>>3,p=(e[2]&4)>>2,m=e[2]&3;a+=`.`+t+`.`+XU(r)+s+`.`+XU(u)+`.`+d+`.`+f+p+m+`.`+XU(1)+`.`+XU(1)+`.`+XU(1)+`.0`,o=KU(`dav1`,n)}break}}return{codec:a,encrypted:s,supplemental:o}}function KU(e,t){let n=HU(t,[`dvvC`]),r=n.length?n[0]:HU(t,[`dvcC`])[0];if(r){let t=r[2]>>1&127,n=r[2]<<5&32|r[3]>>3&31;return e+`.`+XU(t)+`.`+XU(n)}}function qU(e){let t=0;for(let n=0;n<32;n++)t|=(e>>n&1)<<31-n;return t>>>0}function JU(e,t){let n=t+5;for(;e[t++]&128&&t<n;);return t}function YU(e){return(`0`+e.toString(16).toUpperCase()).slice(-2)}function XU(e){return(e<10?`0`:``)+e}function ZU(e,t){if(!e||!t)return;let n=t.keyId;n&&t.isCommonEncryption&&$U(e,(e,t)=>{let r=e.subarray(8,24);r.some(e=>e!==0)||(pU.log(`[eme] Patching keyId in 'enc${t?`a`:`v`}>sinf>>tenc' box: ${vU(r)} -> ${vU(n)}`),e.set(n,8))})}function QU(e){let t=[];return $U(e,e=>t.push(e.subarray(8,24))),t}function $U(e,t){HU(e,[`moov`,`trak`]).forEach(e=>{let n=HU(e,[`mdia`,`minf`,`stbl`,`stsd`])[0];if(!n)return;let r=n.subarray(8),a=HU(r,[`enca`]),o=a.length>0;o||(a=HU(r,[`encv`])),a.forEach(e=>{HU(o?e.subarray(28):e.subarray(78),[`sinf`]).forEach(e=>{let n=eW(e);n&&t(n,o)})})})}function eW(e){let t=HU(e,[`schm`])[0];if(t){let n=IU(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=HU(e,[`schi`,`tenc`])[0];if(t)return t}}}function tW(e,t,n){let r={},a=HU(e,[`moof`,`traf`]);for(let e=0;e<a.length;e++){let o=a[e],s=HU(o,[`tfhd`])[0],c=RU(s,4),l=t[c];if(!l)continue;r[c]||(r[c]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type});let u=r[c],d=HU(o,[`tfdt`])[0];if(d){let e=d[0],t=RU(d,4);e===1&&(t===NU?n.warn(`[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time`):(t*=NU+1,t+=RU(d,8))),GH(t)&&(!GH(u.start)||t<u.start)&&(u.start=t)}let f=l.default,p=RU(s,0)|f?.flags,m=f?.duration||0;p&8&&(m=p&2?RU(s,12):RU(s,8));let h=HU(o,[`trun`]),g=u.start||0,_=0,v=m;for(let e=0;e<h.length;e++){let t=h[e],n=RU(t,4),r=u.sampleCount;u.sampleCount+=n;let a=t[3]&1,o=t[3]&4,s=t[2]&1,c=t[2]&2,l=t[2]&4,d=t[2]&8,f=8,p=n;for(a&&(f+=4),o&&n&&(!(t[f+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=r),f+=4,s?(v=RU(t,f),f+=4):v=m,c&&(f+=4),d&&(f+=4),g+=v,_+=v,p--);p--;)s?(v=RU(t,f),f+=4):v=m,c&&(f+=4),l&&(t[f+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleCount-(p+1),u.keyFrameStart=g),f+=4),d&&(f+=4),g+=v,_+=v;!_&&m&&(_+=m*n)}u.duration+=_}if(!Object.keys(r).some(e=>r[e].duration)){let t=1/0,n=0,a=HU(e,[`sidx`]);for(let e=0;e<a.length;e++){let r=UU(a[e]);if(r!=null&&r.references){t=Math.min(t,r.earliestPresentationTime/r.timescale);let e=r.references.reduce((e,t)=>e+t.info.duration||0,0);n=Math.max(n,e+r.earliestPresentationTime/r.timescale)}}n&&GH(n)&&Object.keys(r).forEach(e=>{r[e].duration||(r[e].duration=n*r[e].timescale-r[e].start)})}return r}function nW(e){let t={valid:null,remainder:null},n=HU(e,[`moof`]);if(n.length<2)return t.remainder=e,t;let r=n[n.length-1];return t.valid=e.slice(0,r.byteOffset-8),t.remainder=e.slice(r.byteOffset-8),t}function rW(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function iW(e,t){let n=[],r=t.samples,a=t.timescale,o=t.id,s=!1;return HU(r,[`moof`]).map(c=>{let l=c.byteOffset-8;HU(c,[`traf`]).map(c=>{let u=HU(c,[`tfdt`]).map(e=>{let t=e[0],n=RU(e,4);return t===1&&(n*=2**32,n+=RU(e,8)),n/a})[0];return u!==void 0&&(e=u),HU(c,[`tfhd`]).map(u=>{let d=RU(u,4),f=RU(u,0)&16777215,p=(f&1)!=0,m=(f&2)!=0,h=(f&8)!=0,g=0,_=(f&16)!=0,v=0,y=(f&32)!=0,b=8;d===o&&(p&&(b+=8),m&&(b+=4),h&&(g=RU(u,b),b+=4),_&&(v=RU(u,b),b+=4),y&&(b+=4),t.type===`video`&&(s=aW(t.codec)),HU(c,[`trun`]).map(o=>{let c=o[0],u=RU(o,0)&16777215,d=(u&1)!=0,f=0,p=(u&4)!=0,m=(u&256)!=0,h=0,_=(u&512)!=0,y=0,b=(u&1024)!=0,x=(u&2048)!=0,S=0,C=RU(o,4),w=8;d&&(f=RU(o,w),w+=4),p&&(w+=4);let T=f+l;for(let l=0;l<C;l++){if(m?(h=RU(o,w),w+=4):h=g,_?(y=RU(o,w),w+=4):y=v,b&&(w+=4),x&&(S=c===0?RU(o,w):BU(o,w),w+=4),t.type===EU.VIDEO){let t=0;for(;t<y;){let o=RU(r,T);T+=4,oW(s,r[T])&&sW(r.subarray(T,T+o),s?2:1,e+S/a,n),T+=o,t+=o+4}}e+=h/a}}))})})}),n}function aW(e){if(!e)return!1;let t=e.substring(0,4);return t===`hvc1`||t===`hev1`||t===`dvh1`||t===`dvhe`}function oW(e,t){if(e){let e=t>>1&63;return e===39||e===40}else return(t&31)==6}function sW(e,t,n,r){let a=cW(e),o=0;o+=t;let s=0,c=0,l=0;for(;o<a.length;){s=0;do{if(o>=a.length)break;l=a[o++],s+=l}while(l===255);c=0;do{if(o>=a.length)break;l=a[o++],c+=l}while(l===255);let e=a.length-o,t=o;if(c<e)o+=c;else if(c>e){pU.error(`Malformed SEI payload. ${c} is too small, only ${e} bytes left to parse.`);break}if(s===4){if(a[t++]===181){let e=LU(a,t);if(t+=2,e===49){let e=RU(a,t);if(t+=4,e===1195456820){let e=a[t++];if(e===3){let o=a[t++],c=31&o,l=64&o,u=l?2+c*3:0,d=new Uint8Array(u);if(l){d[0]=o;for(let e=1;e<u;e++)d[e]=a[t++]}r.push({type:e,payloadType:s,pts:n,bytes:d})}}}}}else if(s===5&&c>16){let e=[];for(let n=0;n<16;n++){let r=a[t++].toString(16);e.push(r.length==1?`0`+r:r),(n===3||n===5||n===7||n===9)&&e.push(`-`)}let o=c-16,l=new Uint8Array(o);for(let e=0;e<o;e++)l[e]=a[t++];r.push({payloadType:s,pts:n,uuid:e.join(``),userData:_U(l),userDataBytes:l})}}}function cW(e){let t=e.byteLength,n=[],r=1;for(;r<t-2;)e[r]===0&&e[r+1]===0&&e[r+2]===3?(n.push(r+2),r+=2):r++;if(n.length===0)return e;let a=t-n.length,o=new Uint8Array(a),s=0;for(r=0;r<a;s++,r++)s===n[0]&&(s++,n.shift()),o[r]=e[s];return o}function lW(e){let t=e[0],n=``,r=``,a=0,o=0,s=0,c=0,l=0,u=0;if(t===0){for(;IU(e.subarray(u,u+1))!==`\0`;)n+=IU(e.subarray(u,u+1)),u+=1;for(n+=IU(e.subarray(u,u+1)),u+=1;IU(e.subarray(u,u+1))!==`\0`;)r+=IU(e.subarray(u,u+1)),u+=1;r+=IU(e.subarray(u,u+1)),u+=1,a=RU(e,12),o=RU(e,16),c=RU(e,20),l=RU(e,24),u=28}else if(t===1){u+=4,a=RU(e,u),u+=4;let t=RU(e,u);u+=4;let o=RU(e,u);for(u+=4,s=2**32*t+o,KH(s)||(s=2**53-1,pU.warn(`Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box`)),c=RU(e,u),u+=4,l=RU(e,u),u+=4;IU(e.subarray(u,u+1))!==`\0`;)n+=IU(e.subarray(u,u+1)),u+=1;for(n+=IU(e.subarray(u,u+1)),u+=1;IU(e.subarray(u,u+1))!==`\0`;)r+=IU(e.subarray(u,u+1)),u+=1;r+=IU(e.subarray(u,u+1)),u+=1}let d=e.subarray(u,e.byteLength);return{schemeIdUri:n,value:r,timeScale:a,presentationTime:s,presentationTimeDelta:o,eventDuration:c,id:l,payload:d}}function uW(e,...t){let n=t.length,r=8,a=n;for(;a--;)r+=t[a].byteLength;let o=new Uint8Array(r);for(o[0]=r>>24&255,o[1]=r>>16&255,o[2]=r>>8&255,o[3]=r&255,o.set(e,4),a=0,r=8;a<n;a++)o.set(t[a],r),r+=t[a].byteLength;return o}function dW(e,t,n){if(e.byteLength!==16)throw RangeError(`Invalid system id`);let r,a;r=0,a=new Uint8Array;let o;r>0?(o=new Uint8Array(4),t.length>0&&new DataView(o.buffer).setUint32(0,t.length,!1)):o=new Uint8Array;let s=new Uint8Array(4);return n.byteLength>0&&new DataView(s.buffer).setUint32(0,n.byteLength,!1),uW([112,115,115,104],new Uint8Array([r,0,0,0]),e,o,a,s,n)}function fW(e){let t=[];if(e instanceof ArrayBuffer){let n=e.byteLength,r=0;for(;r+32<n;){let n=pW(new DataView(e,r));t.push(n),r+=n.size}}return t}function pW(e){let t=e.getUint32(0),n=e.byteOffset,r=e.byteLength;if(r<t)return{offset:n,size:r};if(e.getUint32(4)!==1886614376)return{offset:n,size:t};let a=e.getUint32(8)>>>24;if(a!==0&&a!==1)return{offset:n,size:t};let o=e.buffer,s=vU(new Uint8Array(o,n+12,16)),c=null,l=null,u=0;if(a===0)u=28;else{let a=e.getUint32(28);if(!a||r<32+a*16)return{offset:n,size:t};c=[];for(let e=0;e<a;e++)c.push(new Uint8Array(o,n+32+e*16,16));u=32+a*16}if(!u)return{offset:n,size:t};let d=e.getUint32(u);return t-32<d?{offset:n,size:t}:(l=new Uint8Array(o,n+u+4,d),{version:a,systemId:s,kids:c,data:l,offset:n,size:t})}var mW=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),hW={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function gW(e,t){let n=hW[t];return!!n&&!!n[e.slice(0,4)]}function _W(e,t,n=!0){return!e.split(`,`).some(e=>!vW(e,t,n))}function vW(e,t,n=!0){return mU(n)?.isTypeSupported(yW(e,t))??!1}function yW(e,t){return`${t}/mp4;codecs=${e}`}function bW(e){if(e){let t=e.substring(0,4);return hW.video[t]}return 2}function xW(e){let t=mW();return e.split(`,`).reduce((e,n)=>{let r=t&&aW(n)?9:hW.video[n];return r?(r*2+e)/(e?3:2):(hW.audio[n]+e)/(e?2:1)},0)}var SW={};function CW(e,t=!0){if(SW[e])return SW[e];let n={flac:[`flac`,`fLaC`,`FLAC`],opus:[`opus`,`Opus`],"mp4a.40.34":[`mp3`]}[e];for(let a=0;a<n.length;a++){var r;if(vW(n[a],`audio`,t))return SW[e]=n[a],n[a];if(n[a]===`mp3`&&(r=mU(t))!=null&&r.isTypeSupported(`audio/mpeg`))return``}return e}var wW=/flac|opus|mp4a\.40\.34/i;function TW(e,t=!0){return e.replace(wW,e=>CW(e.toLowerCase(),t))}function EW(e,t){let n=[];if(e){let t=e.split(`,`);for(let e=0;e<t.length;e++)gW(t[e],`video`)||n.push(t[e])}return t&&n.push(t),n.join(`,`)}function DW(e,t){if(e&&(e.length>4||[`ac-3`,`ec-3`,`alac`,`fLaC`,`Opus`].indexOf(e)!==-1)&&(OW(e,`audio`)||OW(e,`video`)))return e;if(t){let n=t.split(`,`);if(n.length>1){if(e){for(let t=n.length;t--;)if(n[t].substring(0,4)===e.substring(0,4))return n[t]}return n[0]}}return t||e}function OW(e,t){return gW(e,t)&&vW(e,t)}function kW(e){let t=e.split(`,`);for(let e=0;e<t.length;e++){let n=t[e].split(`.`);n.length>2&&n[0]===`avc1`&&(t[e]=`avc1.${parseInt(n[1]).toString(16)}${(`000`+parseInt(n[2]).toString(16)).slice(-4)}`)}return t.join(`,`)}function AW(e){if(e.startsWith(`av01.`)){let t=e.split(`.`),n=[`0`,`111`,`01`,`01`,`01`,`0`];for(let e=t.length;e>4&&e<10;e++)t[e]=n[e-4];return t.join(`.`)}return e}function jW(e){let t=mU(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported(`audio/mpeg`),mp3:t.isTypeSupported(`audio/mp4; codecs="mp3"`),ac3:t.isTypeSupported(`audio/mp4; codecs="ac-3"`)}}function MW(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,`$1`)}var NW={supported:!0,powerEfficient:!0,smooth:!0},PW={supported:!1,smooth:!1,powerEfficient:!1},FW={supported:!0,configurations:[],decodingInfoResults:[NW]};function IW(e,t){return{supported:!1,configurations:t,decodingInfoResults:[PW],error:e}}function LW(e,t,n,r,a,o){let s=e.videoCodec,c=e.audioCodec?e.audioGroups:null,l=o?.audioCodec,u=o?.channels,d=u?parseInt(u):l?1/0:2,f=null;if(c!=null&&c.length)try{f=c.length===1&&c[0]?t.groups[c[0]].channels:c.reduce((e,n)=>{if(n){let r=t.groups[n];if(!r)throw Error(`Audio track group ${n} not found`);Object.keys(r.channels).forEach(t=>{e[t]=(e[t]||0)+r.channels[t]})}return e},{2:0})}catch{return!0}return s!==void 0&&(s.split(`,`).some(e=>aW(e))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(r,30)||e.videoRange!==`SDR`&&e.videoRange!==n||e.bitrate>Math.max(a,8e6))||!!f&&GH(d)&&Object.keys(f).some(e=>parseInt(e)>d)}function RW(e,t,n,r={}){let a=e.videoCodec;if(!a&&!e.audioCodec||!n)return Promise.resolve(FW);let o=[],s=zW(e),c=s.length,l=BW(e,t,c>0),u=l.length;for(let e=c||1*u||1;e--;){let t={type:`media-source`};if(c&&(t.video=s[e%c]),u){t.audio=l[e%u];let n=t.audio.bitrate;t.video&&n&&(t.video.bitrate-=n)}o.push(t)}if(a){let e=navigator.userAgent;if(a.split(`,`).some(e=>aW(e))&&mW())return Promise.resolve(IW(Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${e})`),o))}return Promise.all(o.map(e=>{let t=UW(e);return r[t]||(r[t]=n.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:o,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:o,decodingInfoResults:[],error:e}))}function zW(e){let t=e.videoCodec?.split(`,`),n=HW(e),r=e.width||640,a=e.height||480,o=e.frameRate||30,s=e.videoRange.toLowerCase();return t?t.map(e=>{let t={contentType:yW(AW(e),`video`),width:r,height:a,bitrate:n,framerate:o};return s!==`sdr`&&(t.transferFunction=s),t}):[]}function BW(e,t,n){let r=e.audioCodec?.split(`,`),a=HW(e);return r&&e.audioGroups?e.audioGroups.reduce((e,o)=>{let s=o?t.groups[o]?.tracks:null;return s?s.reduce((e,t)=>{if(t.groupId===o){let o=parseFloat(t.channels||``);r.forEach(t=>{let r={contentType:yW(t,`audio`),bitrate:n?VW(t,a):a};o&&(r.channels=``+o),e.push(r)})}return e},e):e},[]):[]}function VW(e,t){if(t<=1)return 1;let n=128e3;return e===`ec-3`?n=768e3:e===`ac-3`&&(n=64e4),Math.min(t/2,n)}function HW(e){return Math.ceil(Math.max(e.bitrate*.9,e.averageBitrate)/1e3)*1e3||1}function UW(e){let t=``,{audio:n,video:r}=e;if(r){let e=MW(r.contentType);t+=`${e}_r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||`sd`}_${Math.ceil(r.bitrate/1e5)}`}if(n){let e=MW(n.contentType);t+=`${r?`_`:``}${e}_c${n.channels}`}return t}var WW=[`NONE`,`TYPE-0`,`TYPE-1`,null];function GW(e){return WW.indexOf(e)>-1}var KW=[`SDR`,`PQ`,`HLG`];function qW(e){return!!e&&KW.indexOf(e)>-1}var JW={No:``,Yes:`YES`,v2:`v2`};function YW(e){let{canSkipUntil:t,canSkipDateRanges:n,age:r}=e,a=r<t/2;return t&&a?n?JW.v2:JW.Yes:JW.No}var XW=class{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){let t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set(`_HLS_msn`,this.msn.toString()),this.part!==void 0&&t.searchParams.set(`_HLS_part`,this.part.toString()),this.skip&&t.searchParams.set(`_HLS_skip`,this.skip),t.href}},ZW=class{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat(`FRAME-RATE`,0),this._avgBitrate=e.attrs.decimalInteger(`AVERAGE-BANDWIDTH`),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(e=>!!e).map(e=>e.substring(0,4)).join(`,`),`supplemental`in e){this.supplemental=e.supplemental;let t=e.supplemental?.videoCodec;t&&t!==e.videoCodec&&(this.codecSet+=`,${t.substring(0,4)}`)}this.addGroupId(`audio`,e.attrs.AUDIO),this.addGroupId(`text`,e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||``}get pathwayId(){return this.attrs[`PATHWAY-ID`]||`.`}get videoRange(){return this.attrs[`VIDEO-RANGE`]||`SDR`}get score(){return this.attrs.optionalFloat(`SCORE`,0)}get uri(){return this.url[0]||``}hasAudioGroup(e){return QW(this._audioGroups,e)}hasSubtitleGroup(e){return QW(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e===`audio`){let e=this._audioGroups;e||=this._audioGroups=[],e.indexOf(t)===-1&&e.push(t)}else if(e===`text`){let e=this._subtitleGroups;e||=this._subtitleGroups=[],e.indexOf(t)===-1&&e.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){return this.audioGroups?.[0]}get textGroupId(){return this.subtitleGroups?.[0]}addFallback(){}};function QW(e,t){return!t||!e?!1:e.indexOf(t)!==-1}function $W(){if(typeof matchMedia==`function`){let e=matchMedia(`(dynamic-range: high)`),t=matchMedia(`bad query`);if(e.media!==t.media)return e.matches===!0}return!1}function eG(e,t){let n=!1,r=[];if(e&&(n=e!==`SDR`,r=[e]),t){r=t.allowedVideoRanges||KW.slice(0);let e=r.join(``)!==`SDR`&&!t.videoCodec;n=t.preferHDR===void 0?e&&$W():t.preferHDR,n||(r=[`SDR`])}return{preferHDR:n,allowedVideoRanges:r}}var tG=e=>{let t=new WeakSet;return(n,r)=>{if(e&&(r=e(n,r)),typeof r==`object`&&r){if(t.has(r))return;t.add(r)}return r}},nG=(e,t)=>JSON.stringify(e,tG(t));function rG(e,t,n,r,a){let o=Object.keys(e),s=r?.channels,c=r?.audioCodec,l=a?.videoCodec,u=s&&parseInt(s)===2,d=!1,f=!1,p=1/0,m=1/0,h=1/0,g=1/0,_=0,v=[],{preferHDR:y,allowedVideoRanges:b}=eG(t,a);for(let t=o.length;t--;){let n=e[o[t]];d||=n.channels[2]>0,p=Math.min(p,n.minHeight),m=Math.min(m,n.minFramerate),h=Math.min(h,n.minBitrate),b.filter(e=>n.videoRanges[e]>0).length>0&&(f=!0)}p=GH(p)?p:0,m=GH(m)?m:0;let x=Math.max(1080,p),S=Math.max(30,m);h=GH(h)?h:n,n=Math.max(h,n),f||(t=void 0);let C=o.length>1;return{codecSet:o.reduce((t,r)=>{let a=e[r];if(r===t)return t;if(v=f?b.filter(e=>a.videoRanges[e]>0):[],C){if(a.minBitrate>n)return iG(r,`min bitrate of ${a.minBitrate} > current estimate of ${n}`),t;if(!a.hasDefaultAudio)return iG(r,`no renditions with default or auto-select sound found`),t;if(c&&r.indexOf(c.substring(0,4))%5!=0)return iG(r,`audio codec preference "${c}" not found`),t;if(s&&!u){if(!a.channels[s])return iG(r,`no renditions with ${s} channel sound found (channels options: ${Object.keys(a.channels)})`),t}else if((!c||u)&&d&&a.channels[2]===0)return iG(r,`no renditions with stereo sound found`),t;if(a.minHeight>x)return iG(r,`min resolution of ${a.minHeight} > maximum of ${x}`),t;if(a.minFramerate>S)return iG(r,`min framerate of ${a.minFramerate} > maximum of ${S}`),t;if(!v.some(e=>a.videoRanges[e]>0))return iG(r,`no variants with VIDEO-RANGE of ${nG(v)} found`),t;if(l&&r.indexOf(l.substring(0,4))%5!=0)return iG(r,`video codec preference "${l}" not found`),t;if(a.maxScore<_)return iG(r,`max score of ${a.maxScore} < selected max of ${_}`),t}return t&&(xW(r)>=xW(t)||a.fragmentError>e[t].fragmentError)?t:(g=a.minIndex,_=a.maxScore,r)},void 0),videoRanges:v,preferHDR:y,minFramerate:m,minBitrate:h,minIndex:g}}function iG(e,t){pU.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function aG(e){return e.reduce((e,t)=>{let n=e.groups[t.groupId];n||=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1},n.tracks.push(t);let r=t.channels||`2`;return n.channels[r]=(n.channels[r]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function oG(e,t,n,r){return e.slice(n,r+1).reduce((e,n,r)=>{if(!n.codecSet)return e;let a=n.audioGroups,o=e[n.codecSet];o||(e[n.codecSet]=o={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!a,fragmentError:0}),o.minBitrate=Math.min(o.minBitrate,n.bitrate);let s=Math.min(n.height,n.width);return o.minHeight=Math.min(o.minHeight,s),o.minFramerate=Math.min(o.minFramerate,n.frameRate),o.minIndex=Math.min(o.minIndex,r),o.maxScore=Math.max(o.maxScore,n.score),o.fragmentError+=n.fragmentError,o.videoRanges[n.videoRange]=(o.videoRanges[n.videoRange]||0)+1,a&&a.forEach(e=>{if(!e)return;let n=t.groups[e];n&&(o.hasDefaultAudio=o.hasDefaultAudio||t.hasDefaultAudio?n.hasDefault:n.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(n.channels).forEach(e=>{o.channels[e]=(o.channels[e]||0)+n.channels[e]}))}),e},{})}function sG(e){if(!e)return e;let{lang:t,assocLang:n,characteristics:r,channels:a,audioCodec:o}=e;return{lang:t,assocLang:n,characteristics:r,channels:a,audioCodec:o}}function cG(e,t,n){if(`attrs`in e){let n=t.indexOf(e);if(n!==-1)return n}for(let r=0;r<t.length;r++){let a=t[r];if(lG(e,a,n))return r}return-1}function lG(e,t,n){let{groupId:r,name:a,lang:o,assocLang:s,default:c}=e,l=e.forced;return(r===void 0||t.groupId===r)&&(a===void 0||t.name===a)&&(o===void 0||uG(o,t.lang))&&(o===void 0||t.assocLang===s)&&(c===void 0||t.default===c)&&(l===void 0||t.forced===l)&&(!(`characteristics`in e)||dG(e.characteristics||``,t.characteristics))&&(n===void 0||n(e,t))}function uG(e,t=`--`){return e.length===t.length?e===t:e.startsWith(t)||t.startsWith(e)}function dG(e,t=``){let n=e.split(`,`),r=t.split(`,`);return n.length===r.length&&!n.some(e=>r.indexOf(e)===-1)}function fG(e,t){let{audioCodec:n,channels:r}=e;return(n===void 0||(t.audioCodec||``).substring(0,4)===n.substring(0,4))&&(r===void 0||r===(t.channels||`2`))}function pG(e,t,n,r,a){let o=t[r],s=t.reduce((e,t,n)=>{let r=t.uri;return(e[r]||(e[r]=[])).push(n),e},{})[o.uri];s.length>1&&(r=Math.max.apply(Math,s));let c=o.videoRange,l=o.frameRate,u=o.codecSet.substring(0,4),d=mG(t,r,t=>{if(t.videoRange!==c||t.frameRate!==l||t.codecSet.substring(0,4)!==u)return!1;let r=t.audioGroups;return cG(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),a)>-1});return d>-1?d:mG(t,r,t=>{let r=t.audioGroups;return cG(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),a)>-1})}function mG(e,t,n){for(let r=t;r>-1;r--)if(n(e[r]))return r;for(let r=t+1;r<e.length;r++)if(n(e[r]))return r;return-1}function hG(e,t){return!!e&&e!==t.loadLevelObj?.uri}var gG=class extends aU{constructor(e){super(`abr`,e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey=``,this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{let{fragCurrent:t,partCurrent:n,hls:r}=this,{autoLevelEnabled:a,media:o}=r;if(!t||!o)return;let s=performance.now(),c=n?n.stats:t.stats,l=n?n.duration:t.duration,u=s-c.loading.start,d=r.minAutoLevel,f=t.level,p=this._nextAutoLevel;if(c.aborted||c.loaded&&c.loaded===c.total||f<=d){this.clearTimer(),this._nextAutoLevel=-1;return}if(!a)return;let m=p>-1&&p!==f,h=!!e||m;if(!h&&(o.paused||!o.playbackRate||!o.readyState))return;let g=r.mainForwardBufferInfo;if(!h&&g===null)return;let _=this.bwEstimator.getEstimateTTFB(),v=Math.abs(o.playbackRate);if(u<=Math.max(_,1e3*(l/(v*2))))return;let y=g?g.len/v:0,b=c.loading.first?c.loading.first-c.loading.start:-1,x=c.loaded&&b>-1,S=this.getBwEstimate(),C=r.levels,w=C[f],T=Math.max(c.loaded,Math.round(l*(t.bitrate||w.averageBitrate)/8)),E=x?u-b:u;E<1&&x&&(E=Math.min(u,c.loaded*8/S));let D=x?c.loaded*1e3/E:0,O=_/1e3,ee=D?(T-c.loaded)/D:T*8/S+O;if(ee<=y)return;let te=D?D*8:S,ne=(e?.details||this.hls.latestLevelDetails)?.live===!0,re=this.hls.config.abrBandWidthUpFactor,ie=1/0,ae;for(ae=f-1;ae>d;ae--){let e=C[ae].maxBitrate,t=!C[ae].details||ne;if(ie=this.getTimeToLoadFrag(O,te,l*e,t),ie<Math.min(y,l+O))break}if(ie>=ee||ie>l*10)return;x?this.bwEstimator.sample(u-Math.min(_,b),c.loaded):this.bwEstimator.sampleTTFB(u);let k=C[ae].maxBitrate;this.getBwEstimate()*re>k&&this.resetEstimator(k);let oe=this.findBestLevel(k,d,ae,0,y,1,1);oe>-1&&(ae=oe),this.warn(`Fragment ${t.sn}${n?` part `+n.index:``} of level ${f} is loading too slowly;
109
- Fragment duration: ${t.duration.toFixed(3)}
110
- Time to underbuffer: ${y.toFixed(3)} s
111
- Estimated load time for current fragment: ${ee.toFixed(3)} s
112
- Estimated load time for down switch fragment: ${ie.toFixed(3)} s
113
- TTFB estimate: ${b|0} ms
114
- Current BW estimate: ${GH(S)?S|0:`Unknown`} bps
115
- New BW estimate: ${this.getBwEstimate()|0} bps
116
- Switching to level ${ae} @ ${k|0} bps`),r.nextLoadLevel=r.nextAutoLevel=ae,this.clearTimer();let A=()=>{if(this.clearTimer(),this.fragCurrent===t&&this.hls.loadLevel===ae&&ae>0){let e=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${ae>0?`and switching down`:``}
117
- Fragment duration: ${t.duration.toFixed(3)} s
118
- Time to underbuffer: ${e.toFixed(3)} s`),t.abortRequests(),this.fragCurrent=this.partCurrent=null,ae>d){let t=this.findBestLevel(this.hls.levels[d].bitrate,d,ae,0,e,1,1);t===-1&&(t=d),this.hls.nextLoadLevel=this.hls.nextAutoLevel=t,this.resetEstimator(this.hls.levels[t].bitrate)}}};m||ee>ie*2?A():this.timer=self.setInterval(A,ie*1e3),r.trigger(Q.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:n,stats:c})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){let e=this.hls.config;return new QH(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){let{hls:e}=this;e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.FRAG_LOADING,this.onFragLoading,this),e.on(Q.FRAG_LOADED,this.onFragLoaded,this),e.on(Q.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Q.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Q.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(Q.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e&&(e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.FRAG_LOADING,this.onFragLoading,this),e.off(Q.FRAG_LOADED,this.onFragLoaded,this),e.off(Q.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Q.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Q.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(Q.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=``}onFragLoading(e,t){let n=t.frag;this.ignoreFragment(n)||(n.bitrateTest||(this.fragCurrent=n,this.partCurrent=t.part??null),this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100))}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case Z.BUFFER_ADD_CODEC_ERROR:case Z.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Z.FRAG_LOAD_TIMEOUT:{let e=t.frag,{fragCurrent:n,partCurrent:r}=this;if(e&&n&&e.sn===n.sn&&e.level===n.level){let t=performance.now(),n=r?r.stats:e.stats,a=t-n.loading.start,o=n.loading.first?n.loading.first-n.loading.start:-1;if(n.loaded&&o>-1){let e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(a-Math.min(e,o),n.loaded)}else this.bwEstimator.sampleTTFB(a)}break}}}getTimeToLoadFrag(e,t,n,r){return e+n/t+(r?e+this.lastLevelLoadSec:0)}onLevelLoaded(e,t){let n=this.hls.config,{loading:r}=t.stats,a=r.end-r.first;GH(a)&&(this.lastLevelLoadSec=a/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:n}){let r=n?n.stats:t.stats;if(t.type===XH.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){let e=n?n.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+r.loaded,s=(a.loaded?a.loaded.duration:0)+e;a.loaded={bytes:o,duration:s},a.realBitrate=Math.round(8*o/s)}if(t.bitrateTest){let e={stats:r,frag:t,part:n,id:t.type};this.onFragBuffered(Q.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){let{frag:n,part:r}=t,a=r!=null&&r.stats.loaded?r.stats:n.stats;if(a.aborted||this.ignoreFragment(n))return;let o=a.parsing.end-a.loading.start-Math.min(a.loading.first-a.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,a.loaded),a.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==XH.MAIN||e.sn===`initSegment`}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){let{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,a=this.findBestLevel(n,t,e,0,r,1,1);if(a>-1)return a;let o=this.hls.firstLevel,s=Math.min(Math.max(o,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${s}`),s}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){let e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(e!==-1&&(!t||!n||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;let r=t&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){let t=this.hls.levels;if(t.length>Math.max(e,r)&&t[e].loadError<=t[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){let{fragCurrent:e,partCurrent:t,hls:n}=this;if(n.levels.length<=1)return n.loadLevel;let{maxAutoLevel:r,config:a,minAutoLevel:o}=n,s=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),l=this.getStarvationDelay(),u=a.abrBandWidthFactor,d=a.abrBandWidthUpFactor;if(l){let e=this.findBestLevel(c,o,r,l,0,u,d);if(e>=0)return this.rebufferNotice=-1,e}let f=s?Math.min(s,a.maxStarvationDelay):a.maxStarvationDelay;if(!l){let e=this.bitrateTestDelay;e&&(f=(s?Math.min(s,a.maxLoadingDelay):a.maxLoadingDelay)-e,this.info(`bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*f)} ms`),u=d=1)}let p=this.findBestLevel(c,o,r,l,f,u,d);if(this.rebufferNotice!==p&&(this.rebufferNotice=p,this.info(`${l?`rebuffering expected`:`buffer is empty`}, optimal quality level ${p}`)),p>-1)return p;let m=n.levels[o],h=n.loadLevelObj;return h&&m?.bitrate<h.bitrate?o:n.loadLevel}getStarvationDelay(){let e=this.hls,t=e.media;if(!t)return 1/0;let n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,r,a,o,s){var c;let l=r+a,u=this.lastLoadedFragLevel,d=u===-1?this.hls.firstLevel:u,{fragCurrent:f,partCurrent:p}=this,{levels:m,allAudioTracks:h,loadLevel:g,config:_}=this.hls;if(m.length===1)return 0;let v=m[d],y=!!((c=this.hls.latestLevelDetails)!=null&&c.live),b=g===-1||u===-1,x,S=`SDR`,C=v?.frameRate||0,{audioPreference:w,videoPreference:T}=_,E=this.audioTracksByGroup||=aG(h),D=-1;if(b){if(this.firstSelection!==-1)return this.firstSelection;let r=rG(this.codecTiers||=oG(m,E,t,n),S,e,w,T),{codecSet:a,videoRanges:o,minFramerate:s,minBitrate:c,minIndex:l,preferHDR:u}=r;D=l,x=a,S=u?o[o.length-1]:o[0],C=s,e=Math.max(e,c),this.log(`picked start tier ${nG(r)}`)}else x=v?.codecSet,S=v?.videoRange;let O=p?p.duration:f?f.duration:0,ee=this.bwEstimator.getEstimateTTFB()/1e3,te=[];for(let c=n;c>=t;c--){var ne;let t=m[c],f=c>d;if(!t)continue;if(_.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){let n=navigator.mediaCapabilities;typeof n?.decodingInfo==`function`&&LW(t,E,S,C,e,w)?(t.supportedPromise=RW(t,E,n,this.supportedCache),t.supportedPromise.then(e=>{if(!this.hls)return;t.supportedResult=e;let n=this.hls.levels,r=n.indexOf(t);e.error?this.warn(`MediaCapabilities decodingInfo error: "${e.error}" for level ${r} ${nG(e)}`):e.supported?e.decodingInfoResults.some(e=>e.smooth===!1||e.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${r} not smooth or powerEfficient: ${nG(e)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${r} ${nG(e)}`),r>-1&&n.length>1&&(this.log(`Removing unsupported level ${r}`),this.hls.removeLevel(r),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(e=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${e}`)})):t.supportedResult=FW}if((x&&t.codecSet!==x||S&&t.videoRange!==S||f&&C>t.frameRate||!f&&C>0&&C<t.frameRate||(ne=t.supportedResult)!=null&&(ne=ne.decodingInfoResults)!=null&&ne.some(e=>e.smooth===!1))&&(!b||c!==D)){te.push(c);continue}let h=t.details,v=(p?h?.partTarget:h?.averagetargetduration)||O,T;T=f?s*e:o*e;let re=O&&r>=O*2&&a===0?t.averageBitrate:t.maxBitrate,ie=this.getTimeToLoadFrag(ee,T,re*v,h===void 0);if(T>=re&&(c===u||t.loadError===0&&t.fragmentError===0)&&(ie<=ee||!GH(ie)||y&&!this.bitrateTestDelay||ie<l)){let e=this.forcedAutoLevel;return c!==g&&(e===-1||e!==g)&&(te.length&&this.trace(`Skipped level(s) ${te.join(`,`)} of ${n} max with CODECS and VIDEO-RANGE:"${m[te[0]].codecs}" ${m[te[0]].videoRange}; not compatible with "${x}" ${S}`),this.info(`switch candidate:${d}->${c} adjustedbw(${Math.round(T)})-bitrate=${Math.round(T-re)} ttfb:${ee.toFixed(1)} avgDuration:${v.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${ie.toFixed(1)} firstSelection:${b} codecSet:${t.codecSet} videoRange:${t.videoRange} hls.loadLevel:${g}`)),b&&(this.firstSelection=c),c}}return-1}set nextAutoLevel(e){let t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey=``,this._nextAutoLevel=t)}deriveNextAutoLevel(e){let{maxAutoLevel:t,minAutoLevel:n}=this.hls;return Math.min(Math.max(e,n),t)}},_G={search:function(e,t){let n=0,r=e.length-1,a=null,o=null;for(;n<=r;){a=(n+r)/2|0,o=e[a];let s=t(o);if(s>0)n=a+1;else if(s<0)r=a-1;else return o}return null}};function vG(e,t,n){if(t===null||!Array.isArray(e)||!e.length||!GH(t)||t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))return null;for(let r=0;r<e.length;++r){let a=e[r];if(SG(t,n,a))return a}return null}function yG(e,t,n=0,r=0,a=.005){let o=null;if(e){o=t[1+e.sn-t[0].sn]||null;let r=e.endDTS-n;r>0&&r<15e-7&&(n+=15e-7),o&&e.level!==o.level&&o.end<=e.end&&(o=t[2+e.sn-t[0].sn]||null)}else n===0&&t[0].start===0&&(o=t[0]);if(o&&((!e||e.level===o.level)&&xG(n,r,o)===0||bG(o,e,Math.min(a,r))))return o;let s=_G.search(t,xG.bind(null,n,r));return s&&(s!==e||!o)?s:o}function bG(e,t,n){if(t&&t.start===0&&t.level<e.level&&(t.endPTS||0)>0){let r=t.tagList.reduce((e,t)=>(t[0]===`INF`&&(e+=parseFloat(t[1])),e),n);return e.start<=r}return!1}function xG(e=0,t=0,n){if(n.start<=e&&n.start+n.duration>e)return 0;let r=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-r<=e?1:n.start-r>e&&n.start?-1:0}function SG(e,t,n){let r=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3;return(n.endProgramDateTime||0)-r>e}function CG(e,t,n){if(e&&e.startCC<=t&&e.endCC>=t){let r=e.fragments,{fragmentHint:a}=e;a&&(r=r.concat(a));let o;return _G.search(r,e=>e.cc<t?1:e.cc>t?-1:(o=e,e.end<=n?1:e.start>n?-1:0)),o||null}return null}function wG(e){switch(e.details){case Z.FRAG_LOAD_TIMEOUT:case Z.KEY_LOAD_TIMEOUT:case Z.LEVEL_LOAD_TIMEOUT:case Z.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function TG(e){return e.details.startsWith(`key`)}function EG(e){return TG(e)&&!!e.frag&&!e.frag.decryptdata}function DG(e,t){let n=wG(t);return e.default[`${n?`timeout`:`error`}Retry`]}function OG(e,t){let n=e.backoff===`linear`?1:2**t;return Math.min(n*e.retryDelayMs,e.maxRetryDelayMs)}function kG(e){return nU(nU({},e),{errorRetry:null,timeoutRetry:null})}function AG(e,t,n,r){if(!e)return!1;let a=r?.code,o=t<e.maxNumRetry&&(jG(a)||!!n);return e.shouldRetry?e.shouldRetry(e,t,n,r,o):o}function jG(e){return MG(e)||!!e&&(e<400||e>499)}function MG(e){return e===0&&navigator.onLine===!1}var NG={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},PG={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8},FG=class extends aU{constructor(e){super(`error-controller`,e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){let e=this.hls;e.on(Q.ERROR,this.onError,this),e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){let e=this.hls;e&&(e.off(Q.ERROR,this.onError,this),e.off(Q.ERROR,this.onErrorOut,this),e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===XH.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;let t=this.hls,n=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||n===-1?t.loadLevel:n}variantHasKey(e,t){if(e){var n;if((n=e.details)!=null&&n.hasKey(t))return!0;let r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(e=>r.indexOf(e.groupId)>=0).some(e=>e.details?.hasKey(t))}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var n;if(t.fatal)return;let r=this.hls,a=t.context;switch(t.details){case Z.FRAG_LOAD_ERROR:case Z.FRAG_LOAD_TIMEOUT:case Z.KEY_LOAD_ERROR:case Z.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case Z.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction=IG();return}case Z.FRAG_GAP:case Z.FRAG_DECRYPT_ERROR:t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=NG.SendAlternateToPenaltyBox;return;case Z.LEVEL_EMPTY_ERROR:case Z.LEVEL_PARSING_ERROR:{var o;let e=t.parent===XH.MAIN?t.level:r.loadLevel;t.details===Z.LEVEL_EMPTY_ERROR&&(o=t.context)!=null&&(o=o.levelDetails)!=null&&o.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case Z.LEVEL_LOAD_ERROR:case Z.LEVEL_LOAD_TIMEOUT:typeof a?.level==`number`&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.level));return;case Z.AUDIO_TRACK_LOAD_ERROR:case Z.AUDIO_TRACK_LOAD_TIMEOUT:case Z.SUBTITLE_LOAD_ERROR:case Z.SUBTITLE_TRACK_LOAD_TIMEOUT:if(a){let e=r.loadLevelObj;if(e&&(a.type===YH.AUDIO_TRACK&&e.hasAudioGroup(a.groupId)||a.type===YH.SUBTITLE_TRACK&&e.hasSubtitleGroup(a.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=NG.SendAlternateToPenaltyBox,t.errorAction.flags=PG.MoveAllAlternatesMatchingHost;return}}return;case Z.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:NG.SendAlternateToPenaltyBox,flags:PG.MoveAllAlternatesMatchingHDCP};return;case Z.KEY_SYSTEM_SESSION_UPDATE_FAILED:case Z.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case Z.KEY_SYSTEM_NO_SESSION:t.errorAction={action:NG.SendAlternateToPenaltyBox,flags:PG.MoveAllAlternatesMatchingKey};return;case Z.BUFFER_ADD_CODEC_ERROR:case Z.REMUX_ALLOC_ERROR:case Z.BUFFER_APPEND_ERROR:t.errorAction||=this.getLevelSwitchAction(t,t.level??r.loadLevel);return;case Z.INTERNAL_EXCEPTION:case Z.BUFFER_APPENDING_ERROR:case Z.BUFFER_FULL_ERROR:case Z.LEVEL_SWITCH_ERROR:case Z.BUFFER_STALLED_ERROR:case Z.BUFFER_SEEK_OVER_HOLE:case Z.BUFFER_NUDGE_ON_STALL:t.errorAction=IG();return}t.type===JH.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=IG())}getPlaylistRetryOrSwitchAction(e,t){let n=this.hls,r=DG(n.config.playlistLoadPolicy,e),a=this.playlistError++;if(AG(r,a,wG(e),e.response))return{action:NG.RetryRequest,flags:PG.None,retryConfig:r,retryCount:a};let o=this.getLevelSwitchAction(e,t);return r&&(o.retryConfig=r,o.retryCount=a),o}getFragRetryOrSwitchAction(e){let t=this.hls,n=this.getVariantLevelIndex(e.frag),r=t.levels[n],{fragLoadPolicy:a,keyLoadPolicy:o}=t.config,s=DG(TG(e)?o:a,e),c=t.levels.reduce((e,t)=>e+t.fragmentError,0);if(r&&(e.details!==Z.FRAG_GAP&&r.fragmentError++,!EG(e)&&AG(s,c,wG(e),e.response)))return{action:NG.RetryRequest,flags:PG.None,retryConfig:s,retryCount:c};let l=this.getLevelSwitchAction(e,n);return s&&(l.retryConfig=s,l.retryCount=c),l}getLevelSwitchAction(e,t){let n=this.hls;t??=n.loadLevel;let r=this.hls.levels[t];if(r){let t=e.details;r.loadError++,t===Z.BUFFER_APPEND_ERROR&&r.fragmentError++;let s=-1,{levels:c,loadLevel:l,minAutoLevel:u,maxAutoLevel:d}=n;!n.autoLevelEnabled&&!n.config.preserveManualLevelOnError&&(n.loadLevel=-1);let f=e.frag?.type,p=(f===XH.AUDIO&&t===Z.FRAG_PARSING_ERROR||e.sourceBufferName===`audio`&&(t===Z.BUFFER_ADD_CODEC_ERROR||t===Z.BUFFER_APPEND_ERROR))&&c.some(({audioCodec:e})=>r.audioCodec!==e),m=e.sourceBufferName===`video`&&(t===Z.BUFFER_ADD_CODEC_ERROR||t===Z.BUFFER_APPEND_ERROR)&&c.some(({codecSet:e,audioCodec:t})=>r.codecSet!==e&&r.audioCodec===t),{type:h,groupId:g}=e.context??{};for(let n=c.length;n--;){let _=(n+l)%c.length;if(_!==l&&_>=u&&_<=d&&c[_].loadError===0){var a,o;let n=c[_];if(t===Z.FRAG_GAP&&f===XH.MAIN&&e.frag){let t=c[_].details;if(t){let n=yG(e.frag,t.fragments,e.frag.start);if(n!=null&&n.gap)continue}}else if(h===YH.AUDIO_TRACK&&n.hasAudioGroup(g)||h===YH.SUBTITLE_TRACK&&n.hasSubtitleGroup(g))continue;else if(f===XH.AUDIO&&(a=r.audioGroups)!=null&&a.some(e=>n.hasAudioGroup(e))||f===XH.SUBTITLE&&(o=r.subtitleGroups)!=null&&o.some(e=>n.hasSubtitleGroup(e))||p&&r.audioCodec===n.audioCodec||m&&r.codecSet===n.codecSet||!p&&r.codecSet!==n.codecSet)continue;s=_;break}}if(s>-1&&n.loadLevel!==s)return e.levelRetry=!0,this.playlistError=0,{action:NG.SendAlternateToPenaltyBox,flags:PG.None,nextAutoLevel:s}}return{action:NG.SendAlternateToPenaltyBox,flags:PG.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){switch(t.errorAction?.action){case NG.DoNothing:break;case NG.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==Z.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case NG.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){let t=this.hls,n=e.errorAction;if(!n)return;let{flags:r}=n,a=n.nextAutoLevel;switch(r){case PG.None:this.switchLevel(e,a);break;case PG.MoveAllAlternatesMatchingHDCP:{let r=this.getVariantLevelIndex(e.frag),a=t.levels[r]?.attrs[`HDCP-LEVEL`];if(n.hdcpLevel=a,a===`NONE`)this.warn(`HDCP policy resticted output with HDCP-LEVEL=NONE`);else if(a){t.maxHdcpLevel=WW[WW.indexOf(a)-1],n.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case PG.MoveAllAlternatesMatchingKey:{let t=e.decryptdata;if(t){let r=this.hls.levels,a=r.length;for(let n=a;n--;)this.variantHasKey(r[n],t)&&(this.log(`Banned key found in level ${n} (${r[n].bitrate}bps) or audio group "${r[n].audioGroups?.join(`,`)}" (${e.frag?.type} fragment) ${vU(t.keyId||[])}`),r[n].fragmentError++,r[n].loadError++,this.log(`Removing level ${n} with key error (${e.error})`),this.hls.removeLevel(n));let o=e.frag;if(this.hls.levels.length<a)n.resolved=!0;else if(o&&o.type!==XH.MAIN){let e=o.decryptdata;e&&!t.matches(e)&&(n.resolved=!0)}}break}}n.resolved||this.switchLevel(e,a)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===Z.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!==`audiovideo`)){let t=MW(e.mimeType),n=this.hls.levels;for(let r=n.length;r--;)n[r][`${e.sourceBufferName}Codec`]===t&&(this.log(`Removing level ${r} for ${e.details} ("${t}" not supported)`),this.hls.removeLevel(r))}}};function IG(e){let t={action:NG.DoNothing,flags:PG.None};return e&&(t.resolved=!0),t}var LG={NOT_LOADED:`NOT_LOADED`,APPENDING:`APPENDING`,PARTIAL:`PARTIAL`,OK:`OK`},RG=class{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){let{hls:e}=this;e&&(e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.BUFFER_APPENDED,this.onBufferAppended,this),e.on(Q.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Q.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){let{hls:e}=this;e&&(e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.BUFFER_APPENDED,this.onBufferAppended,this),e.off(Q.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Q.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){let n=this.activePartLists[t];if(n)for(let t=n.length;t--;){let r=n[t];if(!r)break;if(r.start<=e&&e<=r.end&&r.loaded)return r}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,n){let{fragments:r}=this,a=Object.keys(r);for(let o=a.length;o--;){let s=r[a[o]];if(s?.body.type===t&&(!n||s.buffered)){let t=s.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,n,r,a){this.timeRanges&&(this.timeRanges[e]=t);let o=r?.fragment.sn||-1;Object.keys(this.fragments).forEach(r=>{let s=this.fragments[r];if(!s||o>=s.body.sn)return;if(!s.buffered&&(!s.loaded||a)){s.body.type===n&&this.removeFragment(s.body);return}let c=s.range[e];if(c){if(c.time.length===0){this.removeFragment(s.body);return}c.time.some(e=>{let n=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return n&&this.removeFragment(s.body),n})}})}detectPartialFragments(e){let t=this.timeRanges;if(!t||e.frag.sn===`initSegment`)return;let n=e.frag,r=BG(n),a=this.fragments[r];if(!a||a.buffered&&n.gap)return;let o=!n.relurl;Object.keys(t).forEach(r=>{let s=n.elementaryStreams[r];if(!s)return;let c=t[r],l=o||s.partial===!0;a.range[r]=this.getBufferedTimes(n,e.part,l,c)}),a.loaded=null,Object.keys(a.range).length?(this.bufferedEnd(a,n),zG(a)||this.removeParts(n.sn-1,n.type)):this.removeFragment(a.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){let n=this.activePartLists[t];n&&(this.activePartLists[t]=VG(n,t=>t.fragment.sn>=e))}fragBuffered(e,t){let n=BG(e),r=this.fragments[n];!r&&t&&(r=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,this.bufferedEnd(r,e))}getBufferedTimes(e,t,n,r){let a={time:[],partial:n},o=e.start,s=e.end,c=e.minEndPTS||s,l=e.maxStartPTS||o;for(let e=0;e<r.length;e++){let t=r.start(e)-this.bufferPadding,n=r.end(e)+this.bufferPadding;if(l>=t&&c<=n){a.time.push({startPTS:Math.max(o,r.start(e)),endPTS:Math.min(s,r.end(e))});break}else if(o<n&&s>t){let t=Math.max(o,r.start(e)),n=Math.min(s,r.end(e));n>t&&(a.partial=!0,a.time.push({startPTS:t,endPTS:n}))}else if(s<=t)break}return a}getPartialFragment(e){let t=null,n,r,a,o=0,{bufferPadding:s,fragments:c}=this;return Object.keys(c).forEach(l=>{let u=c[l];u&&zG(u)&&(r=u.body.start-s,a=u.body.end+s,e>=r&&e<=a&&(n=Math.min(e-r,a-e),o<=n&&(t=u.body,o=n)))}),t}isEndListAppended(e){let t=this.endListFragments[e];return t!==void 0&&(t.buffered||zG(t))}getState(e){let t=BG(e),n=this.fragments[t];return n?n.buffered?zG(n)?LG.PARTIAL:LG.OK:LG.APPENDING:LG.NOT_LOADED}isTimeBuffered(e,t,n){let r,a;for(let o=0;o<n.length;o++){if(r=n.start(o)-this.bufferPadding,a=n.end(o)+this.bufferPadding,e>=r&&t<=a)return!0;if(t<=r)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn===`initSegment`||t.frag.bitrateTest)return;let n=t.frag,r=t.part?null:t,a=BG(n);this.fragments[a]={body:n,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){let{frag:n,part:r,timeRanges:a,type:o}=t;if(n.sn===`initSegment`)return;let s=n.type;if(r){let e=this.activePartLists[s];e||(this.activePartLists[s]=e=[]),e.push(r)}this.timeRanges=a;let c=a[o];this.detectEvictedFragments(o,c,s,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){let t=BG(e);return!!this.fragments[t]}hasFragments(e){let{fragments:t}=this,n=Object.keys(t);if(!e)return n.length>0;for(let r=n.length;r--;)if(t[n[r]]?.body.type===e)return!0;return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,n,r,a){r&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{let s=this.fragments[o];if(!s)return;let c=s.body;c.type!==n||r&&!c.gap||c.start<t&&c.end>e&&(s.buffered||a)&&this.removeFragment(c)})}removeFragment(e){let t=BG(e);e.clearElementaryStreamInfo();let n=this.activePartLists[e.type];if(n){let t=e.sn;this.activePartLists[e.type]=VG(n,e=>e.fragment.sn!==t)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;let t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(e=>e.clearElementaryStreamInfo())}};function zG(e){var t,n,r;return e.buffered&&!!(e.body.gap||(t=e.range.video)!=null&&t.partial||(n=e.range.audio)!=null&&n.partial||(r=e.range.audiovideo)!=null&&r.partial)}function BG(e){return`${e.type}_${e.level}_${e.sn}`}function VG(e,t){return e.filter(e=>{let n=t(e);return n||e.clearElementaryStreamInfo(),n})}var HG={cbc:0,ctr:1},UG=class{constructor(e,t,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=n}decrypt(e,t){switch(this.aesMode){case HG.cbc:return this.subtle.decrypt({name:`AES-CBC`,iv:this.aesIV},t,e);case HG.ctr:return this.subtle.decrypt({name:`AES-CTR`,counter:this.aesIV,length:64},t,e);default:throw Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}};function WG(e){let t=e.byteLength,n=t&&new DataView(e.buffer).getUint8(t-1);return n?e.slice(0,t-n):e}var GG=class{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array,this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){let t=new DataView(e),n=new Uint32Array(4);for(let e=0;e<4;e++)n[e]=t.getUint32(e*4);return n}initTable(){let e=this.sBox,t=this.invSBox,n=this.subMix,r=n[0],a=n[1],o=n[2],s=n[3],c=this.invSubMix,l=c[0],u=c[1],d=c[2],f=c[3],p=new Uint32Array(256),m=0,h=0,g=0;for(g=0;g<256;g++)g<128?p[g]=g<<1:p[g]=g<<1^283;for(g=0;g<256;g++){let n=h^h<<1^h<<2^h<<3^h<<4;n=n>>>8^n&255^99,e[m]=n,t[n]=m;let c=p[m],g=p[c],_=p[g],v=p[n]*257^n*16843008;r[m]=v<<24|v>>>8,a[m]=v<<16|v>>>16,o[m]=v<<8|v>>>24,s[m]=v,v=_*16843009^g*65537^c*257^m*16843008,l[n]=v<<24|v>>>8,u[n]=v<<16|v>>>16,d[n]=v<<8|v>>>24,f[n]=v,m?(m=c^p[p[p[_^c]]],h^=p[p[h]]):m=h=1}}expandKey(e){let t=this.uint8ArrayToUint32Array_(e),n=!0,r=0;for(;r<t.length&&n;)n=t[r]===this.key[r],r++;if(n)return;this.key=t;let a=this.keySize=t.length;if(a!==4&&a!==6&&a!==8)throw Error(`Invalid aes key size=`+a);let o=this.ksRows=(a+6+1)*4,s,c,l=this.keySchedule=new Uint32Array(o),u=this.invKeySchedule=new Uint32Array(o),d=this.sBox,f=this.rcon,p=this.invSubMix,m=p[0],h=p[1],g=p[2],_=p[3],v,y;for(s=0;s<o;s++){if(s<a){v=l[s]=t[s];continue}y=v,s%a===0?(y=y<<8|y>>>24,y=d[y>>>24]<<24|d[y>>>16&255]<<16|d[y>>>8&255]<<8|d[y&255],y^=f[s/a|0]<<24):a>6&&s%a===4&&(y=d[y>>>24]<<24|d[y>>>16&255]<<16|d[y>>>8&255]<<8|d[y&255]),l[s]=v=(l[s-a]^y)>>>0}for(c=0;c<o;c++)s=o-c,y=c&3?l[s]:l[s-4],c<4||s<=4?u[c]=y:u[c]=m[d[y>>>24]]^h[d[y>>>16&255]]^g[d[y>>>8&255]]^_[d[y&255]],u[c]=u[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){let r=this.keySize+6,a=this.invKeySchedule,o=this.invSBox,s=this.invSubMix,c=s[0],l=s[1],u=s[2],d=s[3],f=this.uint8ArrayToUint32Array_(n),p=f[0],m=f[1],h=f[2],g=f[3],_=new Int32Array(e),v=new Int32Array(_.length),y,b,x,S,C,w,T,E,D,O,ee,te,ne,re,ie=this.networkToHostOrderSwap;for(;t<_.length;){for(D=ie(_[t]),O=ie(_[t+1]),ee=ie(_[t+2]),te=ie(_[t+3]),C=D^a[0],w=te^a[1],T=ee^a[2],E=O^a[3],ne=4,re=1;re<r;re++)y=c[C>>>24]^l[w>>16&255]^u[T>>8&255]^d[E&255]^a[ne],b=c[w>>>24]^l[T>>16&255]^u[E>>8&255]^d[C&255]^a[ne+1],x=c[T>>>24]^l[E>>16&255]^u[C>>8&255]^d[w&255]^a[ne+2],S=c[E>>>24]^l[C>>16&255]^u[w>>8&255]^d[T&255]^a[ne+3],C=y,w=b,T=x,E=S,ne+=4;y=o[C>>>24]<<24^o[w>>16&255]<<16^o[T>>8&255]<<8^o[E&255]^a[ne],b=o[w>>>24]<<24^o[T>>16&255]<<16^o[E>>8&255]<<8^o[C&255]^a[ne+1],x=o[T>>>24]<<24^o[E>>16&255]<<16^o[C>>8&255]<<8^o[w&255]^a[ne+2],S=o[E>>>24]<<24^o[C>>16&255]<<16^o[w>>8&255]<<8^o[T&255]^a[ne+3],v[t]=ie(y^p),v[t+1]=ie(S^m),v[t+2]=ie(x^h),v[t+3]=ie(b^g),p=D,m=O,h=ee,g=te,t+=4}return v.buffer}},KG=class{constructor(e,t,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=n}expandKey(){let e=qG(this.aesMode);return this.subtle.importKey(`raw`,this.key,{name:e},!1,[`encrypt`,`decrypt`])}};function qG(e){switch(e){case HG.cbc:return`AES-CBC`;case HG.ctr:return`AES-CTR`;default:throw Error(`[FastAESKey] invalid aes mode ${e}`)}}var JG=16,YG=class{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{let e=self.crypto;e&&(this.subtle=e.subtle||e.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){let{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;let n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?WG(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&=null}decrypt(e,t,n,r){return this.useSoftware?new Promise((a,o)=>{let s=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(s,t,n,r);let c=this.flush();c?a(c.buffer):o(Error(`[softwareDecrypt] Failed to decrypt data`))}):this.webCryptoDecrypt(new Uint8Array(e),t,n,r)}softwareDecrypt(e,t,n,r){let{currentIV:a,currentResult:o,remainderData:s}=this;if(r!==HG.cbc||t.byteLength!==16)return pU.warn(`SoftwareDecrypt: can only handle AES-128-CBC`),null;this.logOnce(`JS AES decrypt`),s&&(e=rW(s,e),this.remainderData=null);let c=this.getValidChunk(e);if(!c.length)return null;a&&(n=a);let l=this.softwareDecrypter;l||=this.softwareDecrypter=new GG,l.expandKey(t);let u=o;return this.currentResult=l.decrypt(c.buffer,0,n),this.currentIV=c.slice(-16).buffer,u||null}webCryptoDecrypt(e,t,n,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n,r));this.key=t,this.fastAesKey=new KG(this.subtle,t,r)}return this.fastAesKey.expandKey().then(t=>this.subtle?(this.logOnce(`WebCrypto AES decrypt`),new UG(this.subtle,new Uint8Array(n),r).decrypt(e.buffer,t)):Promise.reject(Error(`web crypto not initialized`))).catch(a=>(pU.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${a.name}: ${a.message}`),this.onWebCryptoError(e,t,n,r)))}onWebCryptoError(e,t,n,r){let a=this.enableSoftwareAES;if(a){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n,r);let a=this.flush();if(a)return a.buffer}throw Error(`WebCrypto`+(a?` and softwareDecrypt`:``)+`: failed to decrypt data`)}getValidChunk(e){let t=e,n=e.length-e.length%JG;return n!==e.length&&(t=e.slice(0,n),this.remainderData=e.slice(n)),t}logOnce(e){this.logEnabled&&=(pU.log(`[decrypter]: ${e}`),!1)}},XG=2**17,ZG=class{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&=(this.loader.destroy(),null)}abort(){this.loader&&this.loader.abort()}load(e,t){let n=e.url;if(!n)return Promise.reject(new tK({type:JH.NETWORK_ERROR,details:Z.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:Error(`Fragment does not have a ${n?`part list`:`url`}`),networkDetails:null}));this.abort();let r=this.config,a=r.fLoader,o=r.loader;return new Promise((s,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(e=>e[0]===`GAP`)){c($G(e));return}else e.gap=!1;let l=this.loader=a?new a(r):new o(r),u=QG(e);e.loader=l;let d=kG(r.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn===`initSegment`?1/0:XG};e.stats=l.stats;let p={onSuccess:(t,n,r,a)=>{this.resetLoader(e,l);let o=t.data;r.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(o.slice(0,16)),o=o.slice(16)),s({frag:e,part:null,payload:o,networkDetails:a})},onError:(t,r,a,o)=>{this.resetLoader(e,l),c(new tK({type:JH.NETWORK_ERROR,details:Z.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:nU({url:n,data:void 0},t),error:Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:a,stats:o}))},onAbort:(t,n,r)=>{this.resetLoader(e,l),c(new tK({type:JH.NETWORK_ERROR,details:Z.INTERNAL_ABORTED,fatal:!1,frag:e,error:Error(`Aborted`),networkDetails:r,stats:t}))},onTimeout:(t,n,r)=>{this.resetLoader(e,l),c(new tK({type:JH.NETWORK_ERROR,details:Z.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:Error(`Timeout after ${f.timeout}ms`),networkDetails:r,stats:t}))}};t&&(p.onProgress=(n,r,a,o)=>t({frag:e,part:null,payload:a,networkDetails:o})),l.load(u,f,p)})}loadPart(e,t,n){this.abort();let r=this.config,a=r.fLoader,o=r.loader;return new Promise((s,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c($G(e,t));return}let l=this.loader=a?new a(r):new o(r),u=QG(e,t);e.loader=l;let d=kG(r.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:XG};t.stats=l.stats,l.load(u,f,{onSuccess:(r,a,o,c)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);let u={frag:e,part:t,payload:r.data,networkDetails:c};n(u),s(u)},onError:(n,r,a,o)=>{this.resetLoader(e,l),c(new tK({type:JH.NETWORK_ERROR,details:Z.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:nU({url:u.url,data:void 0},n),error:Error(`HTTP Error ${n.code} ${n.text}`),networkDetails:a,stats:o}))},onAbort:(n,r,a)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),c(new tK({type:JH.NETWORK_ERROR,details:Z.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:Error(`Aborted`),networkDetails:a,stats:n}))},onTimeout:(n,r,a)=>{this.resetLoader(e,l),c(new tK({type:JH.NETWORK_ERROR,details:Z.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:Error(`Timeout after ${f.timeout}ms`),networkDetails:a,stats:n}))}})})}updateStatsFromPart(e,t){let n=e.stats,r=t.stats,a=r.total;if(n.loaded+=r.loaded,a){let r=Math.round(e.duration/t.duration),o=Math.min(Math.round(n.loaded/a),r),s=(r-o)*Math.round(n.loaded/o);n.total=n.loaded+s}else n.total=Math.max(n.loaded,n.total);let o=n.loading,s=r.loading;o.start?o.first+=s.first-s.start:(o.start=s.start,o.first=s.first),o.end=s.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}};function QG(e,t=null){let n=t||e,r={frag:e,part:t,responseType:`arraybuffer`,url:n.url,headers:{},rangeStart:0,rangeEnd:0},a=n.byteRangeStartOffset,o=n.byteRangeEndOffset;if(GH(a)&&GH(o)){let t=a,n=o;if(e.sn===`initSegment`&&eK(e.decryptdata?.method)){let e=o-a;e%16&&(n=o+(16-e%16)),a!==0&&(r.resetIV=!0,t=a-16)}r.rangeStart=t,r.rangeEnd=n}return r}function $G(e,t){let n=Error(`GAP ${e.gap?`tag`:`attribute`} found`),r={type:JH.MEDIA_ERROR,details:Z.FRAG_GAP,fatal:!1,frag:e,error:n,networkDetails:null};return t&&(r.part=t),(t||e).stats.aborted=!0,new tK(r)}function eK(e){return e===`AES-128`||e===`AES-256`}var tK=class extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}},nK=class extends aU{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}},rK=class{constructor(e,t,n,r=0,a=-1,o=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=iK(),this.buffering={audio:iK(),video:iK(),audiovideo:iK()},this.level=e,this.sn=t,this.id=n,this.size=r,this.part=a,this.partial=o}};function iK(){return{start:0,executeStart:0,executeEnd:0,end:0}}var aK={length:0,start:()=>0,end:()=>0},oK=class e{static isBuffered(t,n){if(t){let r=e.getBuffered(t);for(let e=r.length;e--;)if(n>=r.start(e)&&n<=r.end(e))return!0}return!1}static bufferedRanges(t){if(t){let n=e.getBuffered(t);return e.timeRangesToArray(n)}return[]}static timeRangesToArray(e){let t=[];for(let n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}static bufferInfo(t,n,r){if(t){let a=e.bufferedRanges(t);if(a.length)return e.bufferedInfo(a,n,r)}return{len:0,start:n,end:n,bufferedIndex:-1}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.length>1&&e.sort((e,t)=>e.start-t.start||t.end-e.end);let r=-1,a=[];if(n)for(let o=0;o<e.length;o++){t>=e[o].start&&t<=e[o].end&&(r=o);let s=a.length;if(s){let t=a[s-1].end;e[o].start-t<n?e[o].end>t&&(a[s-1].end=e[o].end):a.push(e[o])}else a.push(e[o])}else a=e;let o=0,s,c=t,l=t;for(let e=0;e<a.length;e++){let u=a[e].start,d=a[e].end;if(r===-1&&t>=u&&t<=d&&(r=e),t+n>=u&&t<d)c=u,l=d,o=l-t;else if(t+n<u){s=u;break}}return{len:o,start:c||0,end:l||0,nextStart:s,buffered:e,bufferedIndex:r}}static getBuffered(e){try{return e.buffered||aK}catch(e){return pU.log(`failed to get media.buffered`,e),aK}}},sK=/\{\$([a-zA-Z0-9-_]+)\}/g;function cK(e){return sK.test(e)}function lK(e,t){if(e.variableList!==null||e.hasVariableRefs){let n=e.variableList;return t.replace(sK,t=>{let r=t.substring(2,t.length-1),a=n?.[r];return a===void 0?(e.playlistParsingError||=Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`),t):a})}return t}function uK(e,t,n){let r=e.variableList;r||(e.variableList=r={});let a,o;if(`QUERYPARAM`in t){a=t.QUERYPARAM;try{let e=new self.URL(n).searchParams;if(e.has(a))o=e.get(a);else throw Error(`"${a}" does not match any query parameter in URI: "${n}"`)}catch(t){e.playlistParsingError||=Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`)}}else a=t.NAME,o=t.VALUE;a in r?e.playlistParsingError||=Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${a}"`):r[a]=o||``}function dK(e,t,n){let r=t.IMPORT;if(n&&r in n){let t=e.variableList;t||(e.variableList=t={}),t[r]=n[r]}else e.playlistParsingError||=Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${r}"`)}var fK=/^(\d+)x(\d+)$/,pK=/(.+?)=(".*?"|.*?)(?:,|$)/g,mK=class e{constructor(t,n){typeof t==`string`&&(t=e.parseAttrList(t,n)),eU(this,t)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)===`X-`)}decimalInteger(e){let t=parseInt(this[e],10);return t>2**53-1?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||`0x`).slice(2);t=(t.length&1?`0`:``)+t;let n=new Uint8Array(t.length/2);for(let e=0;e<t.length/2;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return n}return null}hexadecimalIntegerAsNumber(e){let t=parseInt(this[e],16);return t>2**53-1?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){let n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){let n=this[e];return(n?n.split(/[ ,]+/):[]).reduce((e,t)=>(e[t.toLowerCase()]=!0,e),t)}bool(e){return this[e]===`YES`}decimalResolution(e){let t=fK.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let n,r={};for(pK.lastIndex=0;(n=pK.exec(e))!==null;){let a=n[1].trim(),o=n[2],s=o.indexOf(`"`)===0&&o.lastIndexOf(`"`)===o.length-1,c=!1;if(s)o=o.slice(1,-1);else switch(a){case`IV`:case`SCTE35-CMD`:case`SCTE35-IN`:case`SCTE35-OUT`:c=!0}if(t&&(s||c))o=lK(t,o);else if(!c&&!s)switch(a){case`CLOSED-CAPTIONS`:if(o===`NONE`)break;case`ALLOWED-CPC`:case`CLASS`:case`ASSOC-LANGUAGE`:case`AUDIO`:case`BYTERANGE`:case`CHANNELS`:case`CHARACTERISTICS`:case`CODECS`:case`DATA-ID`:case`END-DATE`:case`GROUP-ID`:case`ID`:case`IMPORT`:case`INSTREAM-ID`:case`KEYFORMAT`:case`KEYFORMATVERSIONS`:case`LANGUAGE`:case`NAME`:case`PATHWAY-ID`:case`QUERYPARAM`:case`RECENTLY-REMOVED-DATERANGES`:case`SERVER-URI`:case`STABLE-RENDITION-ID`:case`STABLE-VARIANT-ID`:case`START-DATE`:case`SUBTITLES`:case`SUPPLEMENTAL-CODECS`:case`URI`:case`VALUE`:case`VIDEO`:case`X-ASSET-LIST`:case`X-ASSET-URI`:pU.warn(`${e}: attribute ${a} is missing quotes`)}r[a]=o}return r}},hK=`com.apple.hls.interstitial`;function gK(e){return e!==`ID`&&e!==`CLASS`&&e!==`CUE`&&e!==`START-DATE`&&e!==`DURATION`&&e!==`END-DATE`&&e!==`END-ON-NEXT`}function _K(e){return e===`SCTE35-OUT`||e===`SCTE35-IN`||e===`SCTE35-CMD`}var vK=class{constructor(e,t,n=0){if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=t?.tagOrder??n,t){let n=t.attr;for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==n[t]){pU.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=eU(new mK({}),n,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e[`START-DATE`]),`END-DATE`in this.attr){let e=t?.endDate||new Date(this.attr[`END-DATE`]);GH(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){let e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?`CUE`:`X-CUE`,{pre:!1,post:!1,once:!1}):e}get startTime(){let{tagAnchor:e}=this;return e===null||e.programDateTime===null?(pU.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){let e=this._endDate||this._dateAtEnd;if(e)return e;let t=this.duration;return t===null?null:this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3)}get duration(){if(`DURATION`in this.attr){let e=this.attr.decimalFloatingPoint(`DURATION`);if(GH(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return`PLANNED-DURATION`in this.attr?this.attr.decimalFloatingPoint(`PLANNED-DURATION`):null}get endOnNext(){return this.attr.bool(`END-ON-NEXT`)}get isInterstitial(){return this.class===hK}get isValid(){return!!this.id&&!this._badValueForSameId&&GH(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||`X-ASSET-URI`in this.attr||`X-ASSET-LIST`in this.attr)}},yK=10,bK=class{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8=``,this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}let t=this.lastPartSn-e.lastPartSn,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let n=t.decryptdata;return n||=(t.setKeyFormat(e.keyFormat),t.decryptdata),!!n&&e.matches(n)})}get hasProgramDateTime(){return this.fragments.length?GH(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||yK}get drift(){let e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){let e=this.partList;if(e){let t=this.lastPartIndex;if(t!==-1){for(let n=e.length;n--;)if(e[n].index>t)return e[n].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){let e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}};function xK(e,t){return e.length===t.length?!e.some((e,n)=>e!==t[n]):!1}function SK(e,t){return!e&&!t?!0:!e||!t?!1:xK(e,t)}function CK(e){return e===`AES-128`||e===`AES-256`||e===`AES-256-CTR`}function wK(e){switch(e){case`AES-128`:case`AES-256`:return HG.cbc;case`AES-256-CTR`:return HG.ctr;default:throw Error(`invalid full segment method ${e}`)}}function TK(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function EK(e){return Uint8Array.from(unescape(encodeURIComponent(e)),e=>e.charCodeAt(0))}function DK(e){let t=EK(e).subarray(0,16),n=new Uint8Array(16);return n.set(t,16-t.length),n}function OK(e){let t=function(e,t,n){let r=e[t];e[t]=e[n],e[n]=r};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function kK(e){let t=e.split(`:`),n=null;if(t[0]===`data`&&t.length===2){let e=t[1].split(`;`),r=e[e.length-1].split(`,`);if(r.length===2){let t=r[0]===`base64`,a=r[1];t?(e.splice(-1,1),n=TK(a)):n=DK(a)}}return n}var AK=typeof self<`u`?self:void 0,jK={CLEARKEY:`org.w3.clearkey`,FAIRPLAY:`com.apple.fps`,PLAYREADY:`com.microsoft.playready`,WIDEVINE:`com.widevine.alpha`},MK={CLEARKEY:`org.w3.clearkey`,FAIRPLAY:`com.apple.streamingkeydelivery`,PLAYREADY:`com.microsoft.playready`,WIDEVINE:`urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed`};function NK(e){switch(e){case MK.FAIRPLAY:return jK.FAIRPLAY;case MK.PLAYREADY:return jK.PLAYREADY;case MK.WIDEVINE:return jK.WIDEVINE;case MK.CLEARKEY:return jK.CLEARKEY}}function PK(e){switch(e){case jK.FAIRPLAY:return MK.FAIRPLAY;case jK.PLAYREADY:return MK.PLAYREADY;case jK.WIDEVINE:return MK.WIDEVINE;case jK.CLEARKEY:return MK.CLEARKEY}}function FK(e){let{drmSystems:t,widevineLicenseUrl:n}=e,r=t?[jK.FAIRPLAY,jK.WIDEVINE,jK.PLAYREADY,jK.CLEARKEY].filter(e=>!!t[e]):[];return!r[jK.WIDEVINE]&&n&&r.push(jK.WIDEVINE),r}var IK=function(e){return AK!=null&&(e=AK.navigator)!=null&&e.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function LK(e,t,n,r){let a;switch(e){case jK.FAIRPLAY:a=[`cenc`,`sinf`];break;case jK.WIDEVINE:case jK.PLAYREADY:a=[`cenc`];break;case jK.CLEARKEY:a=[`cenc`,`keyids`];break;default:throw Error(`Unknown key-system: ${e}`)}return RK(a,t,n,r)}function RK(e,t,n,r){return[{initDataTypes:e,persistentState:r.persistentState||`optional`,distinctiveIdentifier:r.distinctiveIdentifier||`optional`,sessionTypes:r.sessionTypes||[r.sessionType||`temporary`],audioCapabilities:t.map(e=>({contentType:`audio/mp4; codecs=${e}`,robustness:r.audioRobustness||``,encryptionScheme:r.audioEncryptionScheme||null})),videoCapabilities:n.map(e=>({contentType:`video/mp4; codecs=${e}`,robustness:r.videoRobustness||``,encryptionScheme:r.videoEncryptionScheme||null}))}]}function zK(e){var t;return!!e&&(e.sessionType===`persistent-license`||!!((t=e.sessionTypes)!=null&&t.some(e=>e===`persistent-license`)))}function BK(e){let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),n=String.fromCharCode.apply(null,Array.from(t)),r=n.substring(n.indexOf(`<`),n.length),a=new DOMParser().parseFromString(r,`text/xml`).getElementsByTagName(`KID`)[0];if(a){let e=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute(`VALUE`);if(e){let t=TK(e).subarray(0,16);return OK(t),t}}return null}var VK={},HK=class e{static clearKeyUriToKeyIdMap(){VK={}}static setKeyIdForUri(e,t){VK[e]=t}static addKeyIdForUri(e){let t=Object.keys(VK).length%(2**53-1),n=new Uint8Array(16);return new DataView(n.buffer,12,4).setUint32(0,t),VK[e]=n,n}constructor(e,t,n,r=[1],a=null,o){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=n,this.keyFormatVersions=r,this.iv=a,this.encrypted=e?e!==`NONE`:!1,this.isCommonEncryption=this.encrypted&&!CK(e),o!=null&&o.startsWith(`0x`)&&(this.keyId=new Uint8Array(yU(o)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&xK(e.keyFormatVersions,this.keyFormatVersions)&&SK(e.iv,this.iv)&&SK(e.keyId,this.keyId)}isSupported(){if(this.method){if(CK(this.method)||this.method===`NONE`)return!0;if(this.keyFormat===`identity`)return this.method===`SAMPLE-AES`;switch(this.keyFormat){case MK.FAIRPLAY:case MK.WIDEVINE:case MK.PLAYREADY:case MK.CLEARKEY:return[`SAMPLE-AES`,`SAMPLE-AES-CENC`,`SAMPLE-AES-CTR`].indexOf(this.method)!==-1}}return!1}getDecryptData(t,n){if(!this.encrypted||!this.uri)return null;if(CK(this.method)){let n=this.iv;return n||=(typeof t!=`number`&&(pU.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),t=0),GK(t)),new e(this.method,this.uri,`identity`,this.keyFormatVersions,n)}if(this.keyId){let t=VK[this.uri];if(t&&!xK(this.keyId,t)&&e.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}let r=kK(this.uri);if(r)switch(this.keyFormat){case MK.WIDEVINE:if(this.pssh=r,!this.keyId){let e=fW(r.buffer);if(e.length){var a;let t=e[0];this.keyId=(a=t.kids)!=null&&a.length?t.kids[0]:null}}this.keyId||=WK(n);break;case MK.PLAYREADY:{let e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=dW(e,null,r),this.keyId=BK(r);break}default:{let e=r.subarray(0,16);if(e.length!==16){let t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||this.keyId.byteLength!==16){let t;t=UK(n),t||(t=WK(n),t||=VK[this.uri]),t&&(this.keyId=t,e.setKeyIdForUri(this.uri,t))}return this}};function UK(e){let t=e?.[MK.WIDEVINE];return t?t.keyId:null}function WK(e){let t=e?.[MK.PLAYREADY];if(t){let e=kK(t.uri);if(e)return BK(e)}return null}function GK(e){let t=new Uint8Array(16);for(let n=12;n<16;n++)t[n]=e>>8*(15-n)&255;return t}var KK=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,qK=/#EXT-X-MEDIA:(.*)/g,JK=/^#EXT(?:INF|-X-TARGETDURATION):/m,YK=new RegExp([`#EXTINF:\\s*(\\d*(?:\\.\\d+)?)(?:,(.*)\\s+)?`,`(?!#) *(\\S[^\\r\\n]*)`,`#.*`].join(`|`),`g`),XK=new RegExp([`#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)`,`#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\\d+)`,`#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)`,`(#)([^:]*):(.*)`,`(#)(.*)(?:.*)\\r?\\n?`].join(`|`)),ZK=class e{static findGroup(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r.id===t)return r}}static resolve(e,t){return wU.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return JK.test(e)}static parseMasterPlaylist(t,n){let r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:cK(t)},a=[];if(KK.lastIndex=0,!t.startsWith(`#EXTM3U`))return r.playlistParsingError=Error(`no EXTM3U delimiter`),r;let o;for(;(o=KK.exec(t))!=null;)if(o[1]){var s;let t=new mK(o[1],r),c=lK(r,o[2]),l={attrs:t,bitrate:t.decimalInteger(`BANDWIDTH`)||t.decimalInteger(`AVERAGE-BANDWIDTH`),name:t.NAME,url:e.resolve(c,n)},u=t.decimalResolution(`RESOLUTION`);u&&(l.width=u.width,l.height=u.height),nq(t.CODECS,l);let d=t[`SUPPLEMENTAL-CODECS`];d&&(l.supplemental={},nq(d,l.supplemental)),(s=l.unknownCodecs)!=null&&s.length||a.push(l),r.levels.push(l)}else if(o[3]){let t=o[3],a=o[4];switch(t){case`SESSION-DATA`:{let e=new mK(a,r),t=e[`DATA-ID`];t&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[t]=e);break}case`SESSION-KEY`:{let e=eq(a,n,r);e.encrypted&&e.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(e)):pU.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${a}"`);break}case`DEFINE`:uK(r,new mK(a,r),n);break;case`CONTENT-STEERING`:{let t=new mK(a,r);r.contentSteering={uri:e.resolve(t[`SERVER-URI`],n),pathwayId:t[`PATHWAY-ID`]||`.`};break}case`START`:r.startTimeOffset=tq(a);break}}return r.levels=a.length>0&&a.length<r.levels.length?a:r.levels,r.levels.length===0&&(r.playlistParsingError=Error(`no levels found in manifest`)),r}static parseMasterPlaylistMedia(t,n,r){let a,o={},s=r.levels,c={AUDIO:s.map(e=>({id:e.attrs.AUDIO,audioCodec:e.audioCodec})),SUBTITLES:s.map(e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec})),"CLOSED-CAPTIONS":[]},l=0;for(qK.lastIndex=0;(a=qK.exec(t))!==null;){let t=new mK(a[1],r),s=t.TYPE;if(s){let r=c[s],a=o[s]||[];o[s]=a;let u=t.LANGUAGE,d=t[`ASSOC-LANGUAGE`],f=t.CHANNELS,p=t.CHARACTERISTICS,m=t[`INSTREAM-ID`],h={attrs:t,bitrate:0,id:l++,groupId:t[`GROUP-ID`]||``,name:t.NAME||u||``,type:s,default:t.bool(`DEFAULT`),autoselect:t.bool(`AUTOSELECT`),forced:t.bool(`FORCED`),lang:u,url:t.URI?e.resolve(t.URI,n):``};if(d&&(h.assocLang=d),f&&(h.channels=f),p&&(h.characteristics=p),m&&(h.instreamId=m),r!=null&&r.length){let t=e.findGroup(r,h.groupId)||r[0];rq(h,t,`audioCodec`),rq(h,t,`textCodec`)}a.push(h)}}return o}static parseLevelPlaylist(e,t,n,r,a,o){let s={url:t},c=new bK(t),l=c.fragments,u=[],d=null,f=0,p=0,m=0,h=0,g=0,_=null,v=new kU(r,s),y,b,x,S=-1,C=!1,w=null,T;if(YK.lastIndex=0,c.m3u8=e,c.hasVariableRefs=cK(e),YK.exec(e)?.[0]!==`#EXTM3U`)return c.playlistParsingError=Error(`Missing format identifier #EXTM3U`),c;for(;(y=YK.exec(e))!==null;){C&&(C=!1,v=new kU(r,s),v.playlistOffset=m,v.setStart(m),v.sn=f,v.cc=h,g&&(v.bitrate=g),v.level=n,d&&(v.initSegment=d,d.rawProgramDateTime&&(v.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null),w&&=(v.setByteRange(w),null)));let e=y[1];if(e){v.duration=parseFloat(e);let t=(` `+y[2]).slice(1);v.title=t||null,v.tagList.push(t?[`INF`,e,t]:[`INF`,e])}else if(y[3]){if(GH(v.duration)){v.playlistOffset=m,v.setStart(m),x&&sq(v,x,c),v.sn=f,v.level=n,v.cc=h,l.push(v);let e=(` `+y[3]).slice(1);v.relurl=lK(c,e),aq(v,_,u),_=v,m+=v.duration,f++,p=0,C=!0}}else{if(y=y[0].match(XK),!y){pU.warn(`No matches on slow regex match for level playlist!`);continue}for(b=1;b<y.length&&y[b]===void 0;b++);let e=(` `+y[b]).slice(1),a=(` `+y[b+1]).slice(1),u=y[b+2]?(` `+y[b+2]).slice(1):null;switch(e){case`BYTERANGE`:_?v.setByteRange(a,_):v.setByteRange(a);break;case`PROGRAM-DATE-TIME`:v.rawProgramDateTime=a,v.tagList.push([`PROGRAM-DATE-TIME`,a]),S===-1&&(S=l.length);break;case`PLAYLIST-TYPE`:c.type&&cq(c,e,y),c.type=a.toUpperCase();break;case`MEDIA-SEQUENCE`:c.startSN===0?l.length>0&&lq(c,e,y):cq(c,e,y),f=c.startSN=parseInt(a);break;case`SKIP`:{c.skippedSegments&&cq(c,e,y);let t=new mK(a,c),n=t.decimalInteger(`SKIPPED-SEGMENTS`);if(GH(n)){c.skippedSegments+=n;for(let e=n;e--;)l.push(null);f+=n}let r=t.enumeratedString(`RECENTLY-REMOVED-DATERANGES`);r&&(c.recentlyRemovedDateranges=(c.recentlyRemovedDateranges||[]).concat(r.split(` `)));break}case`TARGETDURATION`:c.targetduration!==0&&cq(c,e,y),c.targetduration=Math.max(parseInt(a),1);break;case`VERSION`:c.version!==null&&cq(c,e,y),c.version=parseInt(a);break;case`INDEPENDENT-SEGMENTS`:break;case`ENDLIST`:c.live||cq(c,e,y),c.live=!1;break;case`#`:(a||u)&&v.tagList.push(u?[a,u]:[a]);break;case`DISCONTINUITY`:h++,v.tagList.push([`DIS`]);break;case`GAP`:v.gap=!0,v.tagList.push([e]);break;case`BITRATE`:v.tagList.push([e,a]),g=parseInt(a)*1e3,GH(g)?v.bitrate=g:g=0;break;case`DATERANGE`:{let e=new mK(a,c),t=new vK(e,c.dateRanges[e.ID],c.dateRangeTagCount);c.dateRangeTagCount++,t.isValid||c.skippedSegments?c.dateRanges[t.id]=t:pU.warn(`Ignoring invalid DATERANGE tag: "${a}"`),v.tagList.push([`EXT-X-DATERANGE`,a]);break}case`DEFINE`:{let e=new mK(a,c);`IMPORT`in e?dK(c,e,o):uK(c,e,t)}break;case`DISCONTINUITY-SEQUENCE`:c.startCC===0?l.length>0&&lq(c,e,y):cq(c,e,y),c.startCC=h=parseInt(a);break;case`KEY`:{let e=eq(a,t,c);if(e.isSupported()){if(e.method===`NONE`){x=void 0;break}x||={};let t=x[e.keyFormat];t!=null&&t.matches(e)||(t&&(x=eU({},x)),x[e.keyFormat]=e)}else pU.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${a}"`);break}case`START`:c.startTimeOffset=tq(a);break;case`MAP`:{let e=new mK(a,c);if(v.duration){let t=new kU(r,s);oq(t,e,n,x),d=t,v.initSegment=d,d.rawProgramDateTime&&!v.rawProgramDateTime&&(v.rawProgramDateTime=d.rawProgramDateTime)}else{let t=v.byteRangeEndOffset;if(t){let e=v.byteRangeStartOffset;w=`${t-e}@${e}`}else w=null;oq(v,e,n,x),d=v,C=!0}d.cc=h;break}case`SERVER-CONTROL`:T&&cq(c,e,y),T=new mK(a),c.canBlockReload=T.bool(`CAN-BLOCK-RELOAD`),c.canSkipUntil=T.optionalFloat(`CAN-SKIP-UNTIL`,0),c.canSkipDateRanges=c.canSkipUntil>0&&T.bool(`CAN-SKIP-DATERANGES`),c.partHoldBack=T.optionalFloat(`PART-HOLD-BACK`,0),c.holdBack=T.optionalFloat(`HOLD-BACK`,0);break;case`PART-INF`:c.partTarget&&cq(c,e,y),c.partTarget=new mK(a).decimalFloatingPoint(`PART-TARGET`);break;case`PART`:{let e=c.partList;e||=c.partList=[];let t=p>0?e[e.length-1]:void 0,n=p++,r=new AU(new mK(a,c),v,s,n,t);e.push(r),v.duration+=r.duration;break}case`PRELOAD-HINT`:c.preloadHint=new mK(a,c);break;case`RENDITION-REPORT`:{let e=new mK(a,c);c.renditionReports=c.renditionReports||[],c.renditionReports.push(e);break}default:pU.warn(`line parsed but not handled: ${y}`);break}}}_&&!_.relurl?(l.pop(),m-=_.duration,c.partList&&(c.fragmentHint=_)):c.partList&&(aq(v,_,u),v.cc=h,c.fragmentHint=v,x&&sq(v,x,c)),c.targetduration||(c.playlistParsingError=Error(`Missing Target Duration`));let E=l.length,D=l[0],O=l[E-1];if(m+=c.skippedSegments*c.targetduration,m>0&&E&&O){c.averagetargetduration=m/E;let e=O.sn;c.endSN=e===`initSegment`?0:e,c.live||(O.endList=!0),S>0&&(iq(l,S),D&&u.unshift(D))}return c.fragmentHint&&(m+=c.fragmentHint.duration),c.totalduration=m,u.length&&c.dateRangeTagCount&&D&&QK(u,c),c.endCC=h,c}};function QK(e,t){let n=e.length;if(!n)if(t.hasProgramDateTime){let r=t.fragments[t.fragments.length-1];e.push(r),n++}else return;let r=e[n-1],a=t.live?1/0:t.totalduration,o=Object.keys(t.dateRanges);for(let s=o.length;s--;){let c=t.dateRanges[o[s]],l=c.startDate.getTime();c.tagAnchor=r.ref;for(let r=n;r--&&!(e[r]?.sn<t.startSN);){let n=$K(t,l,e,r,a);if(n!==-1){c.tagAnchor=t.fragments[n].ref;break}}}}function $K(e,t,n,r,a){let o=n[r];if(o){let s=o.programDateTime;if((t>=s||r===0)&&t<=s+((n[r+1]?.start||a)-o.start)*1e3){let a=n[r].sn-e.startSN;if(a<0)return-1;let o=e.fragments;if(o.length>n.length){let s=(n[r+1]||o[o.length-1]).sn-e.startSN;for(let e=s;e>a;e--){let n=o[e].programDateTime;if(t>=n&&t<n+o[e].duration*1e3)return e}}return a}}return-1}function eq(e,t,n){let r=new mK(e,n),a=r.METHOD??``,o=r.URI,s=r.hexadecimalInteger(`IV`),c=r.KEYFORMATVERSIONS,l=r.KEYFORMAT??`identity`;return o&&r.IV&&!s&&pU.error(`Invalid IV: ${r.IV}`),new HK(a,o?ZK.resolve(o,t):``,l,(c||`1`).split(`/`).map(Number).filter(Number.isFinite),s,r.KEYID)}function tq(e){let t=new mK(e).decimalFloatingPoint(`TIME-OFFSET`);return GH(t)?t:null}function nq(e,t){let n=(e||``).split(/[ ,]+/).filter(e=>e);[`video`,`audio`,`text`].forEach(e=>{let r=n.filter(t=>gW(t,e));r.length&&(t[`${e}Codec`]=r.map(e=>e.split(`/`)[0]).join(`,`),n=n.filter(e=>r.indexOf(e)===-1))}),t.unknownCodecs=n}function rq(e,t,n){let r=t[n];r&&(e[n]=r)}function iq(e,t){let n=e[t];for(let r=t;r--;){let t=e[r];if(!t)return;t.programDateTime=n.programDateTime-t.duration*1e3,n=t}}function aq(e,t,n){e.rawProgramDateTime?n.push(e):t!=null&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function oq(e,t,n,r){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=n,e.sn=`initSegment`,r&&(e.levelkeys=r),e.initSegment=null}function sq(e,t,n){e.levelkeys=t;let{encryptedFragments:r}=n;(!r.length||r[r.length-1].levelkeys!==t)&&Object.keys(t).some(e=>t[e].isCommonEncryption)&&r.push(e)}function cq(e,t,n){e.playlistParsingError=Error(`#EXT-X-${t} must not appear more than once (${n[0]})`)}function lq(e,t,n){e.playlistParsingError=Error(`#EXT-X-${t} must appear before the first Media Segment (${n[0]})`)}function uq(e,t){let n=t.startPTS;if(GH(n)){let r=0,a;t.sn>e.sn?(r=n-e.start,a=e):(r=e.start-n,a=t),a.duration!==r&&a.setDuration(r)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration):t.setStart(Math.max(e.start-t.duration,0))}function dq(e,t,n,r,a,o,s){r-n<=0&&(s.warn(`Fragment should have a positive duration`,t),r=n+t.duration,o=a+t.duration);let c=n,l=r,u=t.startPTS,d=t.endPTS;if(GH(u)){let f=Math.abs(u-n);e&&f>e.totalduration?s.warn(`media timestamps and playlist times differ by ${f}s for level ${t.level} ${e.url}`):GH(t.deltaPTS)?t.deltaPTS=Math.max(f,t.deltaPTS):t.deltaPTS=f,c=Math.max(n,u),n=Math.min(n,u),a=t.startDTS===void 0?a:Math.min(a,t.startDTS),l=Math.min(r,d),r=Math.max(r,d),o=t.endDTS===void 0?o:Math.max(o,t.endDTS)}let f=n-t.start;t.start!==0&&t.setStart(n),t.setDuration(r-t.start),t.startPTS=n,t.maxStartPTS=c,t.startDTS=a,t.endPTS=r,t.minEndPTS=l,t.endDTS=o;let p=t.sn;if(!e||p<e.startSN||p>e.endSN)return 0;let m,h=p-e.startSN,g=e.fragments;for(g[h]=t,m=h;m>0;m--)uq(g[m],g[m-1]);for(m=h;m<g.length-1;m++)uq(g[m],g[m+1]);return e.fragmentHint&&uq(g[g.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,f}function fq(e,t,n){if(e===t)return;let r=null,a=e.fragments;for(let e=a.length-1;e>=0;e--){let t=a[e].initSegment;if(t){r=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;let o;hq(e,t,(e,n,a,s)=>{if((!t.startCC||t.skippedSegments)&&n.cc!==e.cc){let r=e.cc-n.cc;for(let e=a;e<s.length;e++)s[e].cc+=r;t.endCC=s[s.length-1].cc}GH(e.startPTS)&&GH(e.endPTS)&&(n.setStart(n.startPTS=e.startPTS),n.startDTS=e.startDTS,n.maxStartPTS=e.maxStartPTS,n.endPTS=e.endPTS,n.endDTS=e.endDTS,n.minEndPTS=e.minEndPTS,n.setDuration(e.endPTS-e.startPTS),n.duration&&(o=n),t.PTSKnown=t.alignedSliding=!0),e.hasStreams&&(n.elementaryStreams=e.elementaryStreams),n.loader=e.loader,e.hasStats&&(n.stats=e.stats),e.initSegment&&(n.initSegment=e.initSegment,r=e.initSegment)});let s=t.fragments,c=t.fragmentHint?s.concat(t.fragmentHint):s;if(r&&c.forEach(e=>{e&&(!e.initSegment||e.initSegment.relurl===r?.relurl)&&(e.initSegment=r)}),t.skippedSegments){if(t.deltaUpdateFailed=s.some(e=>!e),t.deltaUpdateFailed){n.warn(`[level-helper] Previous playlist missing segments skipped in delta playlist`);for(let e=t.skippedSegments;e--;)s.shift();t.startSN=s[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=pq(e.dateRanges,t,n));let r=e.fragments.filter(e=>e.rawProgramDateTime);if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(let e=1;e<c.length;e++)c[e].programDateTime===null&&aq(c[e],c[e-1],r);QK(r,t)}t.endCC=s[s.length-1].cc}t.startCC||=bq(e,t.startSN-1)?.cc??s[0].cc,mq(e.partList,t.partList,(e,t)=>{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats}),o?dq(t,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS,n):_q(e,t),s.length&&(t.totalduration=t.edge-s[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;let l=t.advancedDateTime;if(t.advanced&&l){let e=t.edge;t.driftStart||=(t.driftStartTime=l,e),t.driftEndTime=l,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;t.requestScheduled===-1&&(t.requestScheduled=e.requestScheduled)}function pq(e,t,n){let{dateRanges:r,recentlyRemovedDateranges:a}=t,o=eU({},e);a&&a.forEach(e=>{delete o[e]});let s=Object.keys(o).length;return s?(Object.keys(r).forEach(e=>{let t=o[e],a=new vK(r[e].attr,t);a.isValid?(o[e]=a,t||(a.tagOrder+=s)):n.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${nG(r[e].attr)}"`)}),o):r}function mq(e,t,n){if(e&&t){let r=0;for(let a=0,o=e.length;a<=o;a++){let o=e[a],s=t[a+r];o&&s&&o.index===s.index&&o.fragment.sn===s.fragment.sn?n(o,s):r--}}}function hq(e,t,n){let r=t.skippedSegments,a=Math.max(e.startSN,t.startSN)-t.startSN,o=+!!e.fragmentHint+(r?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,s=t.startSN-e.startSN,c=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let u=a;u<=o;u++){let a=l[s+u],o=c[u];if(r&&!o&&a&&(o=t.fragments[u]=a),a&&o){n(a,o,u,c);let r=a.relurl,s=o.relurl;if(r&&wq(r,s)){t.playlistParsingError=gq(`media sequence mismatch ${o.sn}:`,e,t,a,o);return}else if(a.cc!==o.cc){t.playlistParsingError=gq(`discontinuity sequence mismatch (${a.cc}!=${o.cc})`,e,t,a,o);return}}}}function gq(e,t,n,r,a){return Error(`${e} ${a.url}
119
- Playlist starting @${t.startSN}
120
- ${t.m3u8}
121
-
122
- Playlist starting @${n.startSN}
123
- ${n.m3u8}`)}function _q(e,t,n=!0){let r=t.startSN+t.skippedSegments-e.startSN,a=e.fragments,o=r>=0,s=0;if(o&&r<a.length)s=a[r].start;else if(o&&t.startSN===e.endSN+1)s=e.fragmentEnd;else if(o&&n)s=e.fragmentStart+r*t.levelTargetDuration;else if(!t.skippedSegments&&t.fragmentStart===0)s=e.fragmentStart;else return;vq(t,s)}function vq(e,t){if(t){let n=e.fragments;for(let r=e.skippedSegments;r<n.length;r++)n[r].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}function yq(e,t=1/0){let n=1e3*e.targetduration;if(e.updated){let r=e.fragments;if(r.length&&n*4>t){let e=r[r.length-1].duration*1e3;e<n&&(n=e)}}else n/=2;return Math.round(n)}function bq(e,t,n){if(!e)return null;let r=e.fragments[t-e.startSN];return r||(r=e.fragmentHint,r&&r.sn===t)?r:t<e.startSN&&n&&n.sn===t?n:null}function xq(e,t,n){return e?Sq(e.partList,t,n):null}function Sq(e,t,n){if(e)for(let r=e.length;r--;){let a=e[r];if(a.index===n&&a.fragment.sn===t)return a}return null}function Cq(e){e.forEach((e,t)=>{var n;(n=e.details)==null||n.fragments.forEach(e=>{e.level=t,e.initSegment&&(e.initSegment.level=t)})})}function wq(e,t){return e!==t&&t?Tq(e)!==Tq(t):!1}function Tq(e){return e.replace(/\?[^?]*$/,``)}function Eq(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n]?.cc===t)return e[n];return null}function Dq(e,t){return!!(e&&t.startCC<e.endCC&&t.endCC>e.startCC)}function Oq(e,t){let n=e.start+t;e.startPTS=n,e.setStart(n),e.endPTS=n+e.duration}function kq(e,t){let n=t.fragments;for(let t=0,r=n.length;t<r;t++)Oq(n[t],e);t.fragmentHint&&Oq(t.fragmentHint,e),t.alignedSliding=!0}function Aq(e,t){e&&(jq(t,e),t.alignedSliding||Mq(t,e),!t.alignedSliding&&!t.skippedSegments&&_q(e,t,!1))}function jq(e,t){if(!Dq(t,e))return;let n=Math.min(t.endCC,e.endCC),r=Eq(t.fragments,n),a=Eq(e.fragments,n);!r||!a||(pU.log(`Aligning playlist at start of dicontinuity sequence ${n}`),kq(r.start-a.start,e))}function Mq(e,t){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;let n=e.fragments,r=t.fragments;if(!n.length||!r.length)return;let a,o,s=Math.min(t.endCC,e.endCC);t.startCC<s&&e.startCC<s&&(a=Eq(r,s),o=Eq(n,s)),(!a||!o)&&(a=r[Math.floor(r.length/2)],o=Eq(n,a.cc)||n[Math.floor(n.length/2)]);let c=a.programDateTime,l=o.programDateTime;!c||!l||kq((l-c)/1e3-(o.start-a.start),e)}function Nq(e,t,n){Pq(e,t,n),e.addEventListener(t,n)}function Pq(e,t,n){e.removeEventListener(t,n)}var Fq={toString:function(e){let t=``,n=e.length;for(let r=0;r<n;r++)t+=`[${e.start(r).toFixed(3)}-${e.end(r).toFixed(3)}]`;return t}},$={STOPPED:`STOPPED`,IDLE:`IDLE`,KEY_LOADING:`KEY_LOADING`,FRAG_LOADING:`FRAG_LOADING`,FRAG_LOADING_WAITING_RETRY:`FRAG_LOADING_WAITING_RETRY`,WAITING_TRACK:`WAITING_TRACK`,PARSING:`PARSING`,PARSED:`PARSED`,ENDED:`ENDED`,ERROR:`ERROR`,WAITING_INIT_PTS:`WAITING_INIT_PTS`,WAITING_LEVEL:`WAITING_LEVEL`},Iq=class extends nK{constructor(e,t,n,r,a){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=$.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{let{config:e,fragCurrent:t,media:n,mediaBuffer:r,state:a}=this,o=n?n.currentTime:0,s=oK.bufferInfo(r||n,o,e.maxBufferHole),c=!s.len;if(this.log(`Media seeking to ${GH(o)?o.toFixed(3):o}, state: ${a}, ${c?`out of`:`in`} buffer`),this.state===$.ENDED)this.resetLoadingState();else if(t){let n=e.maxFragLookUpTolerance,r=t.start-n,a=t.start+t.duration+n;if(c||a<s.start||r>s.end){let e=o>a;(o<r||e)&&(e&&t.loader&&(this.log(`Cancelling fragment load for seek (sn: ${t.sn})`),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(n&&(this.fragmentTracker.removeFragmentsInRange(o,1/0,this.playlistType,!0),o>this.lastCurrentTime&&(this.lastCurrentTime=o),!this.loadingParts)){let e=Math.max(s.end,o),t=this.shouldLoadParts(this.getLevelDetails(),e);t&&(this.log(`LL-Part loading ON after seeking to ${o.toFixed(2)} with buffer @${e.toFixed(2)}`),this.loadingParts=t)}this.hls.hasEnoughToStart||(this.log(`Setting ${c?`startPosition`:`nextLoadPosition`} to ${o} for seek without enough to start`),this.nextLoadPosition=o,c&&(this.startPosition=o)),c&&this.state===$.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log(`setting startPosition to 0 because media ended`),this.startPosition=this.lastCurrentTime=0},this.playlistType=a,this.hls=e,this.fragmentLoader=new ZG(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new YG(e.config)}registerListeners(){let{hls:e}=this;e.on(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Q.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Q.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===$.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);let e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=$.STOPPED}get startPositionValue(){let{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;let n=e.end||0,r=this.config.timelineOffset||0;if(n<=r)return!1;let a=e.buffered;this.config.maxBufferHole&&a&&a.length>1&&(e=oK.bufferedInfo(a,e.start,0));let o=e.nextStart;if(o&&o>r&&o<t.edge||this.media.currentTime<e.start)return!1;let s=t.partList;if(s!=null&&s.length){let e=s[s.length-1];return oK.isBuffered(this.media,e.start+e.duration/2)}let c=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(c)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){let e=this.config.timelineOffset;return e?this.getLevelDetails()?.appliedTimelineOffset||e:0}onMediaAttached(e,t){let n=this.media=this.mediaBuffer=t.media;Nq(n,`seeking`,this.onMediaSeeking),Nq(n,`ended`,this.onMediaEnded);let r=this.config;this.levels&&r.autoStartLoad&&this.state===$.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(e,t){let n=!!t.transferMedia,r=this.media;if(r!==null){if(r.ended&&(this.log(`MSE detaching and video ended, reset startPosition`),this.startPosition=this.lastCurrentTime=0),Pq(r,`seeking`,this.onMediaSeeking),Pq(r,`ended`,this.onMediaEnded),this.keyLoader&&!n&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,n){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&=(this.transmuxer.destroy(),null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=$.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,n){this.startFragRequested=!0,this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){this._doFragLoad(e,t,n,e=>{let t=e.frag;if(this.fragContextChanged(t)){this.warn(`${t.type} sn: ${t.sn}${e.part?` part: `+e.part.index:``} of ${this.fragInfo(t,!1,e.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(t);return}t.stats.chunkCount++,this._handleFragmentLoadProgress(e)}).then(e=>{if(!e)return;let t=this.state,n=e.frag;if(this.fragContextChanged(n)){(t===$.FRAG_LOADING||!this.fragCurrent&&t===$.PARSING)&&(this.fragmentTracker.removeFragment(n),this.state=$.IDLE);return}`payload`in e&&(this.log(`Loaded ${n.type} sn: ${n.sn} of ${this.playlistLabel()} ${n.level}`),this.hls.trigger(Q.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e)}).catch(t=>{this.state===$.STOPPED||this.state===$.ERROR||(this.warn(`Frag error: ${t?.message||t}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){let{fragmentTracker:t}=this;if(t.getState(e)===LG.APPENDING){let n=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,n),a=Math.max(e.duration,r?r.len:this.config.maxBufferLength),o=this.backtrackFragment;((o?e.sn-o.sn:0)===1||this.reduceMaxBufferLength(a,e.duration))&&t.removeFragment(e)}else this.mediaBuffer?.buffered.length===0?t.removeAllFragments():t.hasParts(e.type)&&(t.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),t.getState(e)===LG.PARTIAL&&t.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){let t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){let t=e.details;return t?.live&&t.type!==`EVENT`&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,n=null){if(!(e-t))return;let r={startOffset:e,endOffset:t,type:n};this.hls.trigger(Q.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(e=>{let t=e?.frag;if(!t||this.fragContextChanged(t)||!this.levels)throw Error(`init load aborted`);return e}).then(e=>{let{hls:t}=this,{frag:n,payload:r}=e,a=n.decryptdata;if(r&&r.byteLength>0&&a!=null&&a.key&&a.iv&&CK(a.method)){let o=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),a.key.buffer,a.iv.buffer,wK(a.method)).catch(e=>{throw t.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:n}),e}).then(r=>{let a=self.performance.now();return t.trigger(Q.FRAG_DECRYPTED,{frag:n,payload:r,stats:{tstart:o,tdecrypt:a}}),e.payload=r,this.completeInitSegmentLoad(e)})}return this.completeInitSegmentLoad(e)}).catch(t=>{this.state===$.STOPPED||this.state===$.ERROR||(this.warn(t),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){let{levels:t}=this;if(!t)throw Error(`init load aborted, missing levels`);let n=e.frag.stats;this.state!==$.STOPPED&&(this.state=$.IDLE),e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var n,r;let a=e.tracks;if(a&&!t.encrypted&&((n=a.audio)!=null&&n.encrypted||(r=a.video)!=null&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){let e=this.media,n=Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${e?`attached mediaKeys: `+e.mediaKeys:`detached`})`);return this.warn(n.message),!e||e.mediaKeys?!1:(this.hls.trigger(Q.ERROR,{type:JH.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_KEYS,fatal:!1,error:n,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){let{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){let n=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?` part: `+t.index:``} of ${this.fragInfo(e,!1,t)} > buffer:${n?Fq.toString(oK.getBuffered(n)):`(detached)`})`),OU(e)){if(e.type!==XH.SUBTITLE){let t=e.elementaryStreams;if(!Object.keys(t).some(e=>!!t[e])){this.state=$.IDLE;return}}let t=this.levels?.[e.level];t!=null&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=$.IDLE}_handleFragmentLoadComplete(e){let{transmuxer:t}=this;if(!t)return;let{frag:n,part:r,partsLoaded:a}=e,o=!a||a.length===0||a.some(e=>!e),s=new rK(n.level,n.sn,n.stats.chunkCount+1,0,r?r.index:-1,!o);t.flush(s)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,r){var a;this.fragCurrent=e;let o=t.details;if(!this.levels||!o)throw Error(`frag load aborted, missing level${o?``:` detail`}s`);let s=null;if(e.encrypted&&!((a=e.decryptdata)!=null&&a.key)){if(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=$.KEY_LOADING,this.fragCurrent=e,s=this.keyLoader.load(e).then(e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(Q.KEY_LOADED,e),this.state===$.KEY_LOADING&&(this.state=$.IDLE),e}),this.hls.trigger(Q.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log(`context changed in KEY_LOADING`),Promise.resolve(null)}else e.encrypted||(s=this.keyLoader.loadClear(e,o.encryptedFragments,this.startFragRequested),s&&this.log(`[eme] blocking frag load until media-keys acquired`));let c=this.fragPrevious;if(OU(e)&&(!c||e.sn!==c.sn)){let n=this.shouldLoadParts(t.details,e.end);n!==this.loadingParts&&(this.log(`LL-Part loading ${n?`ON`:`OFF`} loading sn ${c?.sn}->${e.sn}`),this.loadingParts=n)}if(n=Math.max(e.start,n||0),this.loadingParts&&OU(e)){let a=o.partList;if(a&&r){n>o.fragmentEnd&&o.fragmentHint&&(e=o.fragmentHint);let c=this.getNextPart(a,e,n);if(c>-1){let l=a[c];e=this.fragCurrent=l.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${l.index} (${c}/${a.length-1}) of ${this.fragInfo(e,!1,l)}) cc: ${e.cc} [${o.startSN}-${o.endSN}], target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=$.FRAG_LOADING;let u;return u=s?s.then(n=>!n||this.fragContextChanged(n.frag)?null:this.doFragPartsLoad(e,l,t,r)).catch(e=>this.handleFragLoadError(e)):this.doFragPartsLoad(e,l,t,r).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(Q.FRAG_LOADING,{frag:e,part:l,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(Error(`frag load aborted, context changed in FRAG_LOADING parts`)):u}else if(!e.url||this.loadedEndOfParts(a,n))return Promise.resolve(null)}}if(OU(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${n.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${o.partList?.filter(e=>e.loaded).map(e=>`[${e.start}-${e.end}]`)}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${`[`+o.startSN+`-`+o.endSN+`]`}, target: ${parseFloat(n.toFixed(3))}`),GH(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=$.FRAG_LOADING;let l=this.config.progressive&&e.type!==XH.SUBTITLE,u;return u=l&&s?s.then(t=>!t||this.fragContextChanged(t.frag)?null:this.fragmentLoader.load(e,r)).catch(e=>this.handleFragLoadError(e)):Promise.all([this.fragmentLoader.load(e,l?r:void 0),s]).then(([e])=>(!l&&r&&r(e),e)).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(Q.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(Error(`frag load aborted, context changed in FRAG_LOADING`)):u}doFragPartsLoad(e,t,n,r){return new Promise((a,o)=>{let s=[],c=n.details?.partList,l=t=>{this.fragmentLoader.loadPart(e,t,r).then(r=>{s[t.index]=r;let o=r.part;this.hls.trigger(Q.FRAG_LOADED,r);let u=xq(n.details,e.sn,t.index+1)||Sq(c,e.sn,t.index+1);if(u)l(u);else return a({frag:e,part:o,partsLoaded:s})}).catch(o)};l(t)})}handleFragLoadError(e){if(`data`in e){let t=e.data;t.frag&&t.details===Z.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===JH.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(Q.ERROR,t)}else this.hls.trigger(Q.ERROR,{type:JH.OTHER_ERROR,details:Z.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){let t=this.getCurrentContext(e);if(!t||this.state!==$.PARSING){!this.fragCurrent&&this.state!==$.STOPPED&&this.state!==$.ERROR&&(this.state=$.IDLE);return}let{frag:n,part:r,level:a}=t,o=self.performance.now();n.stats.parsing.end=o,r&&(r.stats.parsing.end=o);let s=this.getLevelDetails(),c=s&&n.sn>s.endSN||this.shouldLoadParts(s,n.end);c!==this.loadingParts&&(this.log(`LL-Part loading ${c?`ON`:`OFF`} after parsing segment ending @${n.end.toFixed(2)}`),this.loadingParts=c),this.updateLevelTiming(n,r,a,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){let n=e.partList[0];if(n.fragment.type===XH.SUBTITLE)return!1;if(t>=n.end+(e.fragmentHint?.duration||0)&&(this.hls.hasEnoughToStart?this.media?.currentTime||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return!0}}return!1}getCurrentContext(e){let{levels:t,fragCurrent:n}=this,{level:r,sn:a,part:o}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${a} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;let s=t[r],c=s.details,l=o>-1?xq(c,a,o):null,u=l?l.fragment:bq(c,a,n);return u?(n&&n!==u&&(u.stats=n.stats),{frag:u,part:l,level:s}):null}bufferFragmentData(e,t,n,r,a){if(this.state!==$.PARSING)return;let{data1:o,data2:s}=e,c=o;if(s&&(c=rW(o,s)),!c.length)return;let l=this.initPTS[t.cc],u=l?-l.baseTime/l.timescale:void 0,d={type:e.type,frag:t,part:n,chunkMeta:r,offset:u,parent:t.type,data:c};if(this.hls.trigger(Q.BUFFER_APPENDING,d),e.dropped&&e.independent&&!n){if(a)return;this.flushBufferGap(t)}}flushBufferGap(e){let t=this.media;if(!t)return;if(!oK.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}let n=t.currentTime,r=oK.bufferInfo(t,n,0),a=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,a*.25),s=Math.max(Math.min(e.start-o,r.end-o),n+o);e.start-s>o&&this.flushMainBuffer(s,e.start)}getFwdBufferInfo(e,t){var n;let r=this.getLoadPosition();if(!GH(r))return null;let a=this.lastCurrentTime>r||(n=this.media)!=null&&n.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,a)}getFwdBufferInfoAtPos(e,t,n,r){let a=oK.bufferInfo(e,t,r);if(a.len===0&&a.nextStart!==void 0){let o=this.fragmentTracker.getBufferedFrag(t,n);if(o&&(a.nextStart<=o.end||o.gap)){let n=Math.max(Math.min(a.nextStart,o.end)-t,r);return oK.bufferInfo(e,t,n)}}return a}getMaxBufferLength(e){let{config:t}=this,n;return n=e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}exceedsMaxBuffer(e,t,n){let r=e.nextStart;if(r&&n.start>r){let r=e.buffered;if(r){let a=e.len,o=e.bufferedIndex;for(let e=r.length-1;e>o;e--)r[e].start<n.start&&(a+=r[e].end-r[e].start);return a>=t}}return!1}reduceMaxBufferLength(e,t){let n=this.config,r=Math.max(Math.min(e-t,n.maxBufferLength),t),a=Math.max(e-t*3,n.maxMaxBufferLength/2,r);return a>=r?(n.maxMaxBufferLength=a,this.warn(`Reduce max buffer length to ${a}s`),!0):!1}getAppendedFrag(e,t=XH.MAIN){let n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return n&&`fragment`in n?n.fragment:n}getNextFragment(e,t){let n=t.fragments,r=n.length;if(!r)return null;let{config:a}=this,o=t.fragmentStart,s=a.lowLatencyMode&&!!t.partList,c=null;if(t.live){let n=a.initialLiveManifestSize;if(r<n)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${n})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o){s&&!this.loadingParts&&(this.log(`LL-Part loading ON for initial live fragment`),this.loadingParts=!0),c=this.getInitialLiveFragment(t);let n=this.config.startPosition,r=this.hls.startPosition,a=this.hls.liveSyncPosition,l=c?.start||0,u,d;r!==-1&&r>=o?(u=r,d=r===n?`config`:`next load start`):a===null?(u=e,d=`buffer pos`):(u=a,d=`live edge`),u<l&&(u=l,d=`live frag start`),u<o&&(u=o,d=`playlist start`),(this.startPosition!=u||this.nextLoadPosition!=u)&&(this.log(`Setting startPosition to ${u.toFixed(3)} ${r===-1?``:`(from ${n}) `}based on ${d}. live edge: ${a} live frag start: ${l.toFixed(3)} playlist start: ${o.toFixed(3)} buffer pos: ${e}`),this.startPosition=this.nextLoadPosition=u)}}else e<=o&&(c=n[0]);if(!c){let n=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,n,t)}let l=this.filterReplacedPrimary(c,t);if(!l&&c){let e=c.sn-t.startSN;l=this.filterReplacedPrimary(n[e+1]||null,t)}return this.mapToInitFragWhenRequired(l)}isLoopLoading(e,t){if(this.nextLoadPosition<=t)return!1;let n=this.fragmentTracker.getState(e);return n===LG.OK||n===LG.PARTIAL&&!!e.gap}getNextFragmentLoopLoading(e,t,n,r,a){let o=null;if(e.gap&&(o=this.getNextFragment(this.nextLoadPosition,t),o&&!o.gap&&n.nextStart)){let e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,r,0);if(e!==null&&n.len+e.len>=a){let e=o.sn;return this.loopSn!==e&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e}`),this.loopSn=e),null}}return this.loopSn=void 0,o}get primaryPrefetch(){if(Lq(this.config)){var e;if(!((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null)&&e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Lq(this.config)&&e.type!==XH.SUBTITLE){let n=this.hls.interstitialsManager,r=n?.bufferingItem;if(r){let n=r.event;if(n){if(n.appendInPlace||Math.abs(e.start-r.start)>1||r.start===0)return null}else if(e.end<=r.start&&t?.live===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}let a=n?.playerQueue;if(a)for(let t=a.length;t--;){let n=a[t].interstitial;if(n.appendInPlace&&e.start>=n.startTime&&e.end<=n.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,n){let r=-1,a=!1,o=!0;for(let s=0,c=e.length;s<c;s++){let c=e[s];if(o&&=!c.independent,r>-1&&n<c.start)break;let l=c.loaded;l?r=-1:(a||(c.independent||o)&&c.fragment===t)&&(c.fragment!==t&&this.warn(`Need buffer at ${n} but next unloaded part starts at ${c.start}`),r=s),a=l}return r}loadedEndOfParts(e,t){let n;for(let r=e.length;r--;){if(n=e[r],!n.loaded)return!1;if(t>n.start)return!0}return!1}getInitialLiveFragment(e){let t=e.fragments,n=this.fragPrevious,r=null;if(n){if(e.hasProgramDateTime&&(r=vG(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance),r&&this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`)),!r){let a=n.sn+1;if(a>=e.startSN&&a<=e.endSN){let o=t[a-e.startSN];n.cc===o.cc&&(r=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=CG(e,n.cc,n.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{let t=this.hls.liveSyncPosition;t!==null&&(r=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,n){let{config:r}=this,{fragPrevious:a}=this,{fragments:o,endSN:s}=n,{fragmentHint:c}=n,{maxFragLookUpTolerance:l}=r,u=n.partList,d=!!(this.loadingParts&&u!=null&&u.length&&c);d&&!this.bitrateTest&&u[u.length-1].fragment.sn===c.sn&&(o=o.concat(c),s=c.sn);let f;if(e<t){var p;let n=e<this.lastCurrentTime||e>t-l||(p=this.media)!=null&&p.paused||!this.startFragRequested?0:l;f=yG(a,o,e,n)}else f=o[o.length-1];if(f){let e=f.sn-n.startSN,t=this.fragmentTracker.getState(f);if((t===LG.OK||t===LG.PARTIAL&&f.gap)&&(a=f),a&&f.sn===a.sn&&(!d||u[0].fragment.sn>f.sn||!n.live)&&f.level===a.level){let t=o[e+1];f=f.sn<s&&this.fragmentTracker.getState(t)!==LG.OK?t:null}}return f}alignPlaylists(e,t,n){let r=e.fragments.length;if(!r)return this.warn(`No fragments in live playlist`),0;let a=e.fragmentStart,o=!t,s=e.alignedSliding&&GH(a);if(o||!s&&!a){Aq(n,e);let a=e.fragmentStart;return this.log(`Live playlist sliding: ${a.toFixed(2)} start-sn: ${t?t.startSN:`na`}->${e.startSN} fragments: ${r}`),a}return a}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;n<t&&(n=-1);let r=this.timelineOffset;if(n===-1){let a=this.startTimeOffset!==null,o=a?this.startTimeOffset:e.startTimeOffset;o!==null&&GH(o)?(n=t+o,o<0&&(n+=e.edge),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${o} found in ${a?`multivariant`:`media`} playlist`),this.startPosition=n):e.live?(n=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log(`setting startPosition to 0 by default`),this.startPosition=n=0),this.lastCurrentTime=n+r}this.nextLoadPosition=n+r}getLoadPosition(){var e;let{media:t}=this,n=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?n=t.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&OU(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?` part `+t.index:``} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==$.FRAG_LOADING_WAITING_RETRY)&&(this.state=$.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){let e=this.getCurrentContext(t.chunkMeta);e&&(t.frag=e.frag)}let n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){this.warn(`Frag load error must match current frag to retry ${n.url} > ${this.fragCurrent?.url}`);return}let r=t.details===Z.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(n,!0);let a=t.errorAction;if(!a){this.state=$.ERROR;return}let{action:o,flags:s,retryCount:c=0,retryConfig:l}=a,u=!!l,d=u&&o===NG.RetryRequest,f=u&&!a.resolved&&s===PG.MoveAllAlternatesMatchingHost,p=this.hls.latestLevelDetails?.live;if(!d&&f&&OU(n)&&!n.endList&&p&&!EG(t))this.resetFragmentErrors(e),this.treatAsGap(n),a.resolved=!0;else if((d||f)&&c<l.maxNumRetry){let r=MG(t.response?.code),o=OG(l,c);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+o,this.state=$.FRAG_LOADING_WAITING_RETRY,a.resolved=!0,r){this.log(`Waiting for connection (offline)`),this.retryDate=1/0,t.reason=`offline`;return}this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${c+1}/${l.maxNumRetry} in ${o}ms`)}else if(l)if(this.resetFragmentErrors(e),c<l.maxNumRetry)!r&&o!==NG.RemoveAlternatePermanently&&(a.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${c})`);return}else o===NG.SendAlternateToPenaltyBox?this.state=$.WAITING_LEVEL:this.state=$.ERROR;this.tickImmediate()}checkRetryDate(){let e=self.performance.now(),t=this.retryDate,n=t===1/0;(!t||e>=t||n&&!MG(0))&&(n&&this.log(`Connection restored (online)`),this.resetStartWhenNotLoaded(),this.state=$.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===$.PARSING||this.state===$.PARSED){let t=e.frag,n=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,n),a=r&&r.len>.5;a&&this.reduceMaxBufferLength(r.len,t?.duration||10);let o=!a;return o&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${n} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===XH.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==$.STOPPED&&(this.state=$.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;let r=oK.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,n),this.state===$.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log(`Reset loading state`),this.fragCurrent=null,this.fragPrevious=null,this.state!==$.STOPPED&&(this.state=$.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;let e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log(`resetting startPosition for live start`),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?`<removed>`:e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,n,r){let a=n.details;if(!a){this.warn(`level.details undefined`);return}if(!Object.keys(e.elementaryStreams).reduce((t,o)=>{let s=e.elementaryStreams[o];if(s){let c=s.endPTS-s.startPTS;if(c<=0)return this.warn(`Could not parse fragment ${e.sn} ${o} duration reliably (${c})`),t||!1;let l=r?0:dq(a,e,s.startPTS,s.endPTS,s.startDTS,s.endDTS,this);return this.hls.trigger(Q.LEVEL_PTS_UPDATED,{details:a,level:n,drift:l,type:o,frag:e,start:s.startPTS,end:s.endPTS}),!0}return t},!1)){let t=this.transmuxer?.error===null;if((n.fragmentError===0||t&&(n.fragmentError<2||e.endList))&&this.treatAsGap(e,n),t){let t=Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(t.message),this.hls.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=$.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?` part: `+t.index:``} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(Q.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===XH.MAIN?`level`:`track`}fragInfo(e,t=!0,n){return`${this.playlistLabel()} ${e.level} (${n?`part`:`frag`}:[${((t&&!n?e.startPTS:(n||e).start)??NaN).toFixed(3)}-${((t&&!n?e.endPTS:(n||e).end)??NaN).toFixed(3)}]${n&&e.type===`main`?`INDEPENDENT=`+(n.independent?`YES`:`NO`):``}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event===`demuxerWorker`&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&=(this.transmuxer.destroy(),null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){let t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}};function Lq(e){return!!e.interstitialsController&&e.enableInterstitialPlayback!==!1}var Rq=class{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){let{chunks:e,dataLength:t}=this,n;if(e.length)n=e.length===1?e[0]:zq(e,t);else return new Uint8Array;return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}};function zq(e,t){let n=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++){let a=e[t];n.set(a,r),r+=a.length}return n}var Bq={exports:{}},Vq;function Hq(){return Vq?Bq.exports:(Vq=1,(function(e){var t=Object.prototype.hasOwnProperty,n=`~`;function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,s){if(typeof r!=`function`)throw TypeError(`The listener must be a function`);var c=new a(r,o||e,s),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],c]:e._events[l].push(c):(e._events[l]=c,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new r:delete e._events[t]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],r,a;if(this._eventsCount===0)return e;for(a in r=this._events)t.call(r,a)&&e.push(n?a.slice(1):a);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},c.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var a=0,o=r.length,s=Array(o);a<o;a++)s[a]=r[a].fn;return s},c.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},c.prototype.emit=function(e,t,r,a,o,s){var c=n?n+e:e;if(!this._events[c])return!1;var l=this._events[c],u=arguments.length,d,f;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,a),!0;case 5:return l.fn.call(l.context,t,r,a,o),!0;case 6:return l.fn.call(l.context,t,r,a,o,s),!0}for(f=1,d=Array(u-1);f<u;f++)d[f-1]=arguments[f];l.fn.apply(l.context,d)}else{var p=l.length,m;for(f=0;f<p;f++)switch(l[f].once&&this.removeListener(e,l[f].fn,void 0,!0),u){case 1:l[f].fn.call(l[f].context);break;case 2:l[f].fn.call(l[f].context,t);break;case 3:l[f].fn.call(l[f].context,t,r);break;case 4:l[f].fn.call(l[f].context,t,r,a);break;default:if(!d)for(m=1,d=Array(u-1);m<u;m++)d[m-1]=arguments[m];l[f].fn.apply(l[f].context,d)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,r,a){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var c=this._events[o];if(c.fn)c.fn===t&&(!a||c.once)&&(!r||c.context===r)&&s(this,o);else{for(var l=0,u=[],d=c.length;l<d;l++)(c[l].fn!==t||a&&!c[l].once||r&&c[l].context!==r)&&u.push(c[l]);u.length?this._events[o]=u.length===1?u[0]:u:s(this,o)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,e.exports=c})(Bq),Bq.exports)}var Uq=bU(Hq()),Wq=`1.6.16`,Gq={};function Kq(){return typeof __HLS_WORKER_BUNDLE__==`function`}function qq(){let e=Gq[Wq];if(e)return e.clientCount++,e;let t=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:`text/javascript`}),n=self.URL.createObjectURL(t),r={worker:new self.Worker(n),objectURL:n,clientCount:1};return Gq[Wq]=r,r}function Jq(e){let t=Gq[e];if(t)return t.clientCount++,t;let n=new self.URL(e,self.location.href).href,r={worker:new self.Worker(n),scriptURL:n,clientCount:1};return Gq[e]=r,r}function Yq(e){let t=Gq[e||Wq];if(t&&t.clientCount--===1){let{worker:n,objectURL:r}=t;delete Gq[e||Wq],r&&self.URL.revokeObjectURL(r),n.terminate()}}function Xq(e,t){return t+10<=e.length&&e[t]===51&&e[t+1]===68&&e[t+2]===73&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Zq(e,t){return t+10<=e.length&&e[t]===73&&e[t+1]===68&&e[t+2]===51&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Qq(e,t){let n=0;return n=(e[t]&127)<<21,n|=(e[t+1]&127)<<14,n|=(e[t+2]&127)<<7,n|=e[t+3]&127,n}function $q(e,t){let n=t,r=0;for(;Zq(e,t);){r+=10;let n=Qq(e,t+6);r+=n,Xq(e,t+10)&&(r+=10),t+=r}if(r>0)return e.subarray(n,n+r)}function eJ(e,t,n,r){let a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],o=t[n+2],s=o>>2&15;if(s>12){let t=Error(`invalid ADTS sampling index:${s}`);e.emit(Q.ERROR,Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message});return}let c=(o>>6&3)+1,l=t[n+3]>>6&3|(o&1)<<2,u=`mp4a.40.`+c,d=a[s],f=s;(c===5||c===29)&&(f-=3);let p=[c<<3|(f&14)>>1,(f&1)<<7|l<<3];return pU.log(`manifest codec:${r}, parsed codec:${u}, channels:${l}, rate:${d} (ADTS object type:${c} sampling index:${s})`),{config:p,samplerate:d,channelCount:l,codec:u,parsedCodec:u,manifestCodec:r}}function tJ(e,t){return e[t]===255&&(e[t+1]&246)==240}function nJ(e,t){return e[t+1]&1?7:9}function rJ(e,t){return(e[t+3]&3)<<11|e[t+4]<<3|(e[t+5]&224)>>>5}function iJ(e,t){return t+5<e.length}function aJ(e,t){return t+1<e.length&&tJ(e,t)}function oJ(e,t){return iJ(e,t)&&tJ(e,t)&&rJ(e,t)<=e.length-t}function sJ(e,t){if(aJ(e,t)){let n=nJ(e,t);if(t+n>=e.length)return!1;let r=rJ(e,t);if(r<=n)return!1;let a=t+r;return a===e.length||aJ(e,a)}return!1}function cJ(e,t,n,r,a){if(!e.samplerate){let o=eJ(t,n,r,a);if(!o)return;eU(e,o)}}function lJ(e){return 1024*9e4/e}function uJ(e,t){let n=nJ(e,t);if(t+n<=e.length){let r=rJ(e,t)-n;if(r>0)return{headerLength:n,frameLength:r}}}function dJ(e,t,n,r,a){let o=r+a*lJ(e.samplerate),s=uJ(t,n),c;if(s){let{frameLength:r,headerLength:a}=s,l=a+r,u=Math.max(0,n+l-t.length);u?(c=new Uint8Array(l-a),c.set(t.subarray(n+a,t.length),0)):c=t.subarray(n+a,n+l);let d={unit:c,pts:o};return u||e.samples.push(d),{sample:d,length:l,missing:u}}let l=t.length-n;return c=new Uint8Array(l),c.set(t.subarray(n,t.length),0),{sample:{unit:c,pts:o},length:l,missing:-1}}function fJ(e,t){return Zq(e,t)&&Qq(e,t+6)+10<=e.length-t}function pJ(e){return e instanceof ArrayBuffer?e:e.byteOffset==0&&e.byteLength==e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function mJ(e,t=0,n=1/0){return hJ(e,t,n,Uint8Array)}function hJ(e,t,n,r){let a=gJ(e),o=1;`BYTES_PER_ELEMENT`in r&&(o=r.BYTES_PER_ELEMENT);let s=_J(e)?e.byteOffset:0,c=(s+e.byteLength)/o,l=(s+t)/o,u=Math.floor(Math.max(0,Math.min(l,c)));return new r(a,u,Math.floor(Math.min(u+Math.max(n,0),c))-u)}function gJ(e){return e instanceof ArrayBuffer?e:e.buffer}function _J(e){return e&&e.buffer instanceof ArrayBuffer&&e.byteLength!==void 0&&e.byteOffset!==void 0}function vJ(e){let t={key:e.type,description:``,data:``,mimeType:null,pictureType:null};if(e.size<2)return;if(e.data[0]!==3){console.log(`Ignore frame with unrecognized character encoding`);return}let n=e.data.subarray(1).indexOf(0);if(n===-1)return;let r=_U(mJ(e.data,1,n)),a=e.data[2+n],o=e.data.subarray(3+n).indexOf(0);if(o===-1)return;let s=_U(mJ(e.data,3+n,o)),c;return c=r===`-->`?_U(mJ(e.data,4+n+o)):pJ(e.data.subarray(4+n+o)),t.mimeType=r,t.pictureType=a,t.description=s,t.data=c,t}function yJ(e){if(e.size<2)return;let t=_U(e.data,!0),n=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:n.buffer}}function bJ(e){if(e.size<2)return;if(e.type===`TXXX`){let t=1,n=_U(e.data.subarray(t),!0);t+=n.length+1;let r=_U(e.data.subarray(t));return{key:e.type,info:n,data:r}}let t=_U(e.data.subarray(1));return{key:e.type,info:``,data:t}}function xJ(e){if(e.type===`WXXX`){if(e.size<2)return;let t=1,n=_U(e.data.subarray(t),!0);t+=n.length+1;let r=_U(e.data.subarray(t));return{key:e.type,info:n,data:r}}let t=_U(e.data);return{key:e.type,info:``,data:t}}function SJ(e){return e.type===`PRIV`?yJ(e):e.type[0]===`W`?xJ(e):e.type===`APIC`?vJ(e):bJ(e)}function CJ(e){let t=String.fromCharCode(e[0],e[1],e[2],e[3]),n=Qq(e,4);return{type:t,size:n,data:e.subarray(10,10+n)}}var wJ=10,TJ=10;function EJ(e){let t=0,n=[];for(;Zq(e,t);){let r=Qq(e,t+6);e[t+5]>>6&1&&(t+=wJ),t+=wJ;let a=t+r;for(;t+TJ<a;){let r=CJ(e.subarray(t)),a=SJ(r);a&&n.push(a),t+=r.size+wJ}Xq(e,t)&&(t+=wJ)}return n}function DJ(e){return e&&e.key===`PRIV`&&e.info===`com.apple.streaming.transportStreamTimestamp`}function OJ(e){if(e.data.byteLength===8){let t=new Uint8Array(e.data),n=t[3]&1,r=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return r/=45,n&&(r+=47721858.84),Math.round(r)}}function kJ(e){let t=EJ(e);for(let e=0;e<t.length;e++){let n=t[e];if(DJ(n))return OJ(n)}}var AJ=function(e){return e.audioId3=`org.id3`,e.dateRange=`com.apple.quicktime.HLS`,e.emsg=`https://aomedia.org/emsg/ID3`,e.misbklv=`urn:misb:KLV:bin:1910.1`,e}({});function jJ(e=``,t=9e4){return{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}var MJ=class{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,n,r){this._id3Track={type:`id3`,id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,n){}demux(e,t){this.cachedData&&=(e=rW(this.cachedData,e),null);let n=$q(e,0),r=n?n.length:0,a,o=this._audioTrack,s=this._id3Track,c=n?kJ(n):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&GH(c))&&(this.basePTS=NJ(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:AJ.audioId3,duration:1/0});r<l;){if(this.canParse(e,r)){let t=this.appendFrame(o,e,r);t?(this.frameIndex++,this.lastPTS=t.sample.pts,r+=t.length,a=r):r=l}else fJ(e,r)?(n=$q(e,r),s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:AJ.audioId3,duration:1/0}),r+=n.length,a=r):r++;if(r===l&&a!==l){let t=e.slice(a);this.cachedData?this.cachedData=rW(this.cachedData,t):this.cachedData=t}}return{audioTrack:o,videoTrack:jJ(),id3Track:s,textTrack:jJ()}}demuxSampleAes(e,t,n){return Promise.reject(Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){let t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:jJ(),id3Track:this._id3Track,textTrack:jJ()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}},NJ=(e,t,n)=>{if(GH(e))return e*90;let r=n?n.baseTime*9e4/n.timescale:0;return t*9e4+r},PJ=null,FJ=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],IJ=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],LJ=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],RJ=[0,1,1,4];function zJ(e,t,n,r,a){if(n+24>t.length)return;let o=BJ(t,n);if(o&&n+o.frameLength<=t.length){let s=r+a*(o.samplesPerFrame*9e4/o.sampleRate),c={unit:t.subarray(n,n+o.frameLength),pts:s,dts:s};return e.config=[],e.channelCount=o.channelCount,e.samplerate=o.sampleRate,e.samples.push(c),{sample:c,length:o.frameLength,missing:0}}}function BJ(e,t){let n=e[t+1]>>3&3,r=e[t+1]>>1&3,a=e[t+2]>>4&15,o=e[t+2]>>2&3;if(n!==1&&a!==0&&a!==15&&o!==3){let s=e[t+2]>>1&1,c=e[t+3]>>6,l=FJ[(n===3?3-r:r===3?3:4)*14+a-1]*1e3,u=IJ[(n===3?0:n===2?1:2)*3+o],d=c===3?1:2,f=LJ[n][r],p=RJ[r],m=f*8*p,h=Math.floor(f*l/u+s)*p;if(PJ===null){let e=(navigator.userAgent||``).match(/Chrome\/(\d+)/i);PJ=e?parseInt(e[1]):0}return PJ&&PJ<=87&&r===2&&l>=224e3&&c===0&&(e[t+3]=e[t+3]|128),{sampleRate:u,channelCount:d,frameLength:h,samplesPerFrame:m}}}function VJ(e,t){return e[t]===255&&(e[t+1]&224)==224&&(e[t+1]&6)!=0}function HJ(e,t){return t+1<e.length&&VJ(e,t)}function UJ(e,t){return VJ(e,t)&&4<=e.length-t}function WJ(e,t){if(t+1<e.length&&VJ(e,t)){let n=BJ(e,t),r=4;n!=null&&n.frameLength&&(r=n.frameLength);let a=t+r;return a===e.length||HJ(e,a)}return!1}var GJ=class extends MJ{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:`audio/adts`,type:`audio`,id:2,pid:-1,sequenceNumber:0,segmentCodec:`aac`,samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;let n=$q(e,0)?.length||0;if(WJ(e,n))return!1;for(let r=e.length;n<r;n++)if(sJ(e,n))return t.log(`ADTS sync word found !`),!0;return!1}canParse(e,t){return oJ(e,t)}appendFrame(e,t,n){cJ(e,this.observer,t,n,e.manifestCodec);let r=dJ(e,t,n,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}},KJ=(e,t)=>{let n=0,r=5;t+=r;let a=new Uint32Array(1),o=new Uint32Array(1),s=new Uint8Array(1);for(;r>0;){s[0]=e[t];let c=Math.min(r,8),l=8-c;o[0]=4278190080>>>24+l<<l,a[0]=(s[0]&o[0])>>l,n=n?n<<c|a[0]:a[0],t+=1,r-=c}return n},qJ=class extends MJ{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:`audio/ac-3`,type:`audio`,id:2,pid:-1,sequenceNumber:0,segmentCodec:`ac3`,samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){let r=JJ(e,t,n,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;let t=$q(e,0);if(!t)return!1;let n=t.length;return e[n]===11&&e[n+1]===119&&kJ(t)!==void 0&&KJ(e,n)<16}};function JJ(e,t,n,r,a){if(n+8>t.length||t[n]!==11||t[n+1]!==119)return-1;let o=t[n+4]>>6;if(o>=3)return-1;let s=[48e3,44100,32e3][o],c=t[n+4]&63,l=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+o]*2;if(n+l>t.length)return-1;let u=t[n+6]>>5,d=0;u===2?d+=2:(u&1&&u!==1&&(d+=2),u&4&&(d+=2));let f=(t[n+6]<<8|t[n+7])>>12-d&1,p=[2,1,2,3,3,4,4,5][u]+f,m=t[n+5]>>3,h=t[n+5]&7,g=new Uint8Array([o<<6|m<<1|h>>2,(h&3)<<6|u<<3|f<<2|c>>4,c<<4&224]),_=r+a*(1536/s*9e4),v=t.subarray(n,n+l);return e.config=g,e.channelCount=p,e.samplerate=s,e.samples.push({unit:v,pts:_}),l}var YJ=class extends MJ{resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:`audio/mpeg`,type:`audio`,id:2,pid:-1,sequenceNumber:0,segmentCodec:`mp3`,samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let t=$q(e,0),n=t?.length||0;if(t&&e[n]===11&&e[n+1]===119&&kJ(t)!==void 0&&KJ(e,n)<=16)return!1;for(let t=e.length;n<t;n++)if(WJ(e,n))return pU.log(`MPEG Audio sync word found !`),!0;return!1}canParse(e,t){return UJ(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return zJ(e,t,n,this.basePTS,this.frameIndex)}},XJ=/\/emsg[-/]ID3/i,ZJ=class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,n,r){let a=this.videoTrack=jJ(`video`,1),o=this.audioTrack=jJ(`audio`,1),s=this.txtTrack=jJ(`text`,1);if(this.id3Track=jJ(`id3`,1),this.timeOffset=0,!(e!=null&&e.byteLength))return;let c=WU(e);if(c.video){let{id:e,timescale:t,codec:n,supplemental:r}=c.video;a.id=e,a.timescale=s.timescale=t,a.codec=n,a.supplemental=r}if(c.audio){let{id:e,timescale:t,codec:n}=c.audio;o.id=e,o.timescale=t,o.codec=n}s.id=FU.text,a.sampleDuration=0,a.duration=o.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return VU(e)}demux(e,t){this.timeOffset=t;let n=e,r=this.videoTrack,a=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=rW(this.remainderData,e));let t=nW(n);this.remainderData=t.remainder,r.samples=t.valid||new Uint8Array}else r.samples=n;let o=this.extractID3Track(r,t);return a.samples=iW(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){let e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;let r=this.extractID3Track(t,this.timeOffset);return n.samples=iW(e,t),{videoTrack:t,audioTrack:jJ(),id3Track:r,textTrack:jJ()}}extractID3Track(e,t){let n=this.id3Track;if(e.samples.length){let r=HU(e.samples,[`emsg`]);r&&r.forEach(e=>{let r=lW(e);if(XJ.test(r.schemeIdUri)){let e=QJ(r,t),a=r.eventDuration===4294967295?1/0:r.eventDuration/r.timeScale;a<=.001&&(a=1/0);let o=r.payload;n.samples.push({data:o,len:o.byteLength,dts:e,pts:e,type:AJ.emsg,duration:a})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith(`urn:misb:KLV:bin:1910.1`)){let e=QJ(r,t);n.samples.push({data:r.payload,len:r.payload.byteLength,dts:e,pts:e,type:AJ.misbklv,duration:1/0})}})}return n}demuxSampleAes(e,t,n){return Promise.reject(Error(`The MP4 demuxer does not support SAMPLE-AES decryption`))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}};function QJ(e,t){return GH(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}var $J=class{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new YG(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,HG.cbc)}decryptAacSample(e,t,n){let r=e[t].unit;if(r.length<=16)return;let a=r.subarray(16,r.length-r.length%16),o=a.buffer.slice(a.byteOffset,a.byteOffset+a.length);this.decryptBuffer(o).then(a=>{let o=new Uint8Array(a);r.set(o,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)}).catch(n)}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){let t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t),r=0;for(let t=32;t<e.length-16;t+=160,r+=16)n.set(e.subarray(t,t+16),r);return n}getAvcDecryptedUnit(e,t){let n=new Uint8Array(t),r=0;for(let t=32;t<e.length-16;t+=160,r+=16)e.set(n.subarray(r,r+16),t);return e}decryptAvcSample(e,t,n,r,a){let o=cW(a.data),s=this.getAvcEncryptedData(o);this.decryptBuffer(s.buffer).then(s=>{a.data=this.getAvcDecryptedUnit(o,s),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,r)}).catch(r)}decryptAvcSamples(e,t,n,r){if(e instanceof Uint8Array)throw Error(`Cannot decrypt samples of type Uint8Array`);for(;;t++,n=0){if(t>=e.length){r();return}let a=e[t].units;for(;!(n>=a.length);n++){let o=a[n];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,n,r,o),!this.decrypter.isSync()))return}}}},eY=class{constructor(){this.VideoSample=null}createVideoSample(e,t,n){return{key:e,frame:!1,pts:t,dts:n,units:[],length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,r;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){let e=n.units;r=e[e.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){let n=t.samples,r=n.length;if(r){let t=n[r-1];e.pts=t.pts,e.dts=t.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,n){let r=t.byteLength,a=e.naluState||0,o=a,s=[],c=0,l,u,d,f=-1,p=0;for(a===-1&&(f=0,p=this.getNALuType(t,0),a=0,c=1);c<r;){if(l=t[c++],!a){a=+!l;continue}if(a===1){a=l?0:2;continue}if(!l)a=3;else if(l===1){if(u=c-a-1,f>=0){let e={data:t.subarray(f,u),type:p};s.push(e)}else{let n=this.getLastNalUnit(e.samples);n&&(o&&c<=4-o&&n.state&&(n.data=n.data.subarray(0,n.data.byteLength-o)),u>0&&(n.data=rW(n.data,t.subarray(0,u)),n.state=0))}c<r?(d=this.getNALuType(t,c),f=c,p=d,a=0):a=-1}else a=0}if(f>=0&&a>=0){let e={data:t.subarray(f,r),type:p,state:a};s.push(e)}if(s.length===0){let n=this.getLastNalUnit(e.samples);n&&(n.data=rW(n.data,t))}return e.naluState=a,s}},tY=class{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){let e=this.data,t=this.bytesAvailable,n=e.byteLength-t,r=new Uint8Array(4),a=Math.min(4,t);if(a===0)throw Error(`no bytes available`);r.set(e.subarray(n,n+a)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=a*8,this.bytesAvailable-=a}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e),n=this.word>>>32-t;if(e>32&&pU.error(`Cannot read more than 32 bits at a time`),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw Error(`no bits available`);return t=e-t,t>0&&this.bitsAvailable?n<<t|this.readBits(t):n}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){let e=this.skipLZ();return this.readBits(e+1)-1}readEG(){let e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}},nY=class extends eY{parsePES(e,t,n,r){let a=this.parseNALu(e,n.data,r),o=this.VideoSample,s,c=!1;n.data=null,o&&a.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),a.forEach(r=>{var a,l;switch(r.type){case 1:{let t=!1;s=!0;let a=r.data;if(c&&a.length>4){let e=this.readSliceType(a);(e===2||e===4||e===7||e===9)&&(t=!0)}if(t){var u;(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts),o.frame=!0,o.key=t;break}case 5:s=!0,(a=o)!=null&&a.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts),o.key=!0,o.frame=!0;break;case 6:s=!0,sW(r.data,1,n.pts,t.samples);break;case 7:{s=!0,c=!0;let t=r.data,n=this.readSPS(t);if(!e.sps||e.width!==n.width||e.height!==n.height||e.pixelRatio?.[0]!==n.pixelRatio[0]||e.pixelRatio?.[1]!==n.pixelRatio[1]){e.width=n.width,e.height=n.height,e.pixelRatio=n.pixelRatio,e.sps=[t];let r=t.subarray(1,4),a=`avc1.`;for(let e=0;e<3;e++){let t=r[e].toString(16);t.length<2&&(t=`0`+t),a+=t}e.codec=a}break}case 8:s=!0,e.pps=[r.data];break;case 9:s=!0,e.audFound=!0,(l=o)!=null&&l.frame&&(this.pushAccessUnit(o,e),o=null),o||=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts);break;case 12:s=!0;break;default:s=!1;break}o&&s&&o.units.push(r)}),r&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){let t=new tY(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let n=8,r=8,a;for(let o=0;o<e;o++)r!==0&&(a=t.readEG(),r=(n+a+256)%256),n=r===0?n:r}readSPS(e){let t=new tY(e),n=0,r=0,a=0,o=0,s,c,l,u=t.readUByte.bind(t),d=t.readBits.bind(t),f=t.readUEG.bind(t),p=t.readBoolean.bind(t),m=t.skipBits.bind(t),h=t.skipEG.bind(t),g=t.skipUEG.bind(t),_=this.skipScalingList.bind(this);u();let v=u();if(d(5),m(3),u(),g(),v===100||v===110||v===122||v===244||v===44||v===83||v===86||v===118||v===128){let e=f();if(e===3&&m(1),g(),g(),m(1),p())for(c=e===3?12:8,l=0;l<c;l++)p()&&_(l<6?16:64,t)}g();let y=f();if(y===0)f();else if(y===1)for(m(1),h(),h(),s=f(),l=0;l<s;l++)h();g(),m(1);let b=f(),x=f(),S=d(1);S===0&&m(1),m(1),p()&&(n=f(),r=f(),a=f(),o=f());let C=[1,1];if(p()&&p())switch(u()){case 1:C=[1,1];break;case 2:C=[12,11];break;case 3:C=[10,11];break;case 4:C=[16,11];break;case 5:C=[40,33];break;case 6:C=[24,11];break;case 7:C=[20,11];break;case 8:C=[32,11];break;case 9:C=[80,33];break;case 10:C=[18,11];break;case 11:C=[15,11];break;case 12:C=[64,33];break;case 13:C=[160,99];break;case 14:C=[4,3];break;case 15:C=[3,2];break;case 16:C=[2,1];break;case 255:C=[u()<<8|u(),u()<<8|u()];break}return{width:Math.ceil((b+1)*16-n*2-r*2),height:(2-S)*(x+1)*16-(S?2:4)*(a+o),pixelRatio:C}}},rY=class extends eY{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,n,r){let a=this.parseNALu(e,n.data,r),o=this.VideoSample,s,c=!1;n.data=null,o&&a.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),a.forEach(r=>{var a,l;switch(r.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:o||=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts),o.frame=!0,s=!0;break;case 16:case 17:case 18:case 21:if(s=!0,c){var u;(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts),o.key=!0,o.frame=!0;break;case 19:case 20:s=!0,(a=o)!=null&&a.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts),o.key=!0,o.frame=!0;break;case 39:s=!0,sW(r.data,2,n.pts,t.samples);break;case 32:s=!0,e.vps||(typeof e.params!=`object`&&(e.params={}),e.params=eU(e.params,this.readVPS(r.data)),this.initVPS=r.data),e.vps=[r.data];break;case 33:if(s=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],r.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){let t=this.readSPS(r.data);e.width=t.width,e.height=t.height,e.pixelRatio=t.pixelRatio,e.codec=t.codecString,e.sps=[],typeof e.params!=`object`&&(e.params={});for(let n in t.params)e.params[n]=t.params[n]}this.pushParameterSet(e.sps,r.data,e.vps),o||=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts),o.key=!0;break;case 34:if(s=!0,typeof e.params==`object`){if(!e.pps){e.pps=[];let t=this.readPPS(r.data);for(let n in t)e.params[n]=t[n]}this.pushParameterSet(e.pps,r.data,e.vps)}break;case 35:s=!0,e.audFound=!0,(l=o)!=null&&l.frame&&(this.pushAccessUnit(o,e),o=null),o||=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts);break;default:s=!1;break}o&&s&&o.units.push(r)}),r&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}pushParameterSet(e,t,n){(n&&n[0]===this.initVPS||!n&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){let t=new Uint8Array(e.byteLength),n=0;for(let r=0;r<e.byteLength;r++)r>=2&&e[r]===3&&e[r-1]===0&&e[r-2]===0||(t[n]=e[r],n++);return new Uint8Array(t.buffer,0,n)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&=null}readVPS(e){let t=new tY(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);let n=t.readBits(3),r=t.readBoolean();return{numTemporalLayers:n+1,temporalIdNested:r}}readSPS(e){let t=new tY(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);let n=t.readBits(3);t.readBoolean();let r=t.readBits(2),a=t.readBoolean(),o=t.readBits(5),s=t.readUByte(),c=t.readUByte(),l=t.readUByte(),u=t.readUByte(),d=t.readUByte(),f=t.readUByte(),p=t.readUByte(),m=t.readUByte(),h=t.readUByte(),g=t.readUByte(),_=t.readUByte(),v=[],y=[];for(let e=0;e<n;e++)v.push(t.readBoolean()),y.push(t.readBoolean());if(n>0)for(let e=n;e<8;e++)t.readBits(2);for(let e=0;e<n;e++)v[e]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),y[e]&&t.readUByte();t.readUEG();let b=t.readUEG();b==3&&t.skipBits(1);let x=t.readUEG(),S=t.readUEG(),C=t.readBoolean(),w=0,T=0,E=0,D=0;C&&(w+=t.readUEG(),T+=t.readUEG(),E+=t.readUEG(),D+=t.readUEG());let O=t.readUEG(),ee=t.readUEG(),te=t.readUEG(),ne=t.readBoolean();for(let e=ne?0:n;e<=n;e++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let e=0;e<4;e++)for(let n=0;n<(e===3?2:6);n++)if(!t.readBoolean())t.readUEG();else{let n=Math.min(64,1<<4+(e<<1));e>1&&t.readEG();for(let e=0;e<n;e++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());let re=t.readUEG(),ie=0;for(let e=0;e<re;e++){let n=!1;if(e!==0&&(n=t.readBoolean()),n){e===re&&t.readUEG(),t.readBoolean(),t.readUEG();let n=0;for(let e=0;e<=ie;e++){let e=t.readBoolean(),r=!1;e||(r=t.readBoolean()),(e||r)&&n++}ie=n}else{let e=t.readUEG(),n=t.readUEG();ie=e+n;for(let n=0;n<e;n++)t.readUEG(),t.readBoolean();for(let e=0;e<n;e++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){let e=t.readUEG();for(let n=0;n<e;n++){for(let e=0;e<te+4;e++)t.readBits(1);t.readBits(1)}}let ae=0,k=1,oe=1,A=!0,se=1,ce=0;t.readBoolean(),t.readBoolean();let le=!1;if(t.readBoolean()){if(t.readBoolean()){let e=t.readUByte();e>0&&e<16?(k=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][e-1],oe=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][e-1]):e===255&&(k=t.readBits(16),oe=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),le=t.readBoolean(),le&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(se=t.readBits(32),ce=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){let e=t.readBoolean(),r=t.readBoolean(),a=!1;(e||r)&&(a=t.readBoolean(),a&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),a&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let o=0;o<=n;o++){A=t.readBoolean();let n=A||t.readBoolean(),o=!1;n?t.readEG():o=t.readBoolean();let s=o?1:t.readUEG()+1;if(e)for(let e=0;e<s;e++)t.readUEG(),t.readUEG(),a&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(r)for(let e=0;e<s;e++)t.readUEG(),t.readUEG(),a&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),ae=t.readUEG())}let ue=x,de=S;if(C){let e=1,t=1;b===1?e=t=2:b==2&&(e=2),ue=x-e*T-e*w,de=S-t*D-t*E}let fe=r?[`A`,`B`,`C`][r]:``,pe=s<<24|c<<16|l<<8|u,me=0;for(let e=0;e<32;e++)me=(me|(pe>>e&1)<<31-e)>>>0;let he=me.toString(16);return o===1&&he===`2`&&(he=`6`),{codecString:`hvc1.${fe}${o}.${he}.${a?`H`:`L`}${_}.B0`,params:{general_tier_flag:a,general_profile_idc:o,general_profile_space:r,general_profile_compatibility_flags:[s,c,l,u],general_constraint_indicator_flags:[d,f,p,m,h,g],general_level_idc:_,bit_depth:O+8,bit_depth_luma_minus8:O,bit_depth_chroma_minus8:ee,min_spatial_segmentation_idc:ae,chroma_format_idc:b,frame_rate:{fixed:A,fps:ce/se}},width:ue,height:de,pixelRatio:[k,oe]}}readPPS(e){let t=new tY(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);let n=t.readBoolean(),r=t.readBoolean(),a=1;return r&&n?a=0:r?a=3:n&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}},iY=188,aY=class e{constructor(e,t,n,r){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.logger=r,this.videoParser=null}static probe(t,n){let r=e.syncOffset(t);return r>0&&n.warn(`MPEG2-TS detected but first sync word found @ offset ${r}`),r!==-1}static syncOffset(e){let t=e.length,n=Math.min(iY*5,t-iY)+1,r=0;for(;r<n;){let a=!1,o=-1,s=0;for(let c=r;c<t;c+=iY)if(e[c]===71&&(t-c===iY||e[c+iY]===71)){if(s++,o===-1&&(o=c,o!==0&&(n=Math.min(o+iY*99,e.length-iY)+1)),a||=oY(e,c)===0,a&&s>1&&(o===0&&s>2||c+iY>n))return o}else if(s)return-1;else break;r++}return-1}static createTrack(e,t){return{container:e===`video`||e===`audio`?`video/mp2t`:void 0,type:e,id:FU[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e===`audio`?t:void 0}}resetInitSegment(t,n,r,a){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack(`video`),this._videoTrack.duration=a,this._audioTrack=e.createTrack(`audio`,a),this._id3Track=e.createTrack(`id3`),this._txtTrack=e.createTrack(`text`),this._audioTrack.segmentCodec=`aac`,this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=n,this.videoCodec=r}resetTimeStamp(){}resetContiguity(){let{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(t,n,r=!1,a=!1){r||(this.sampleAes=null);let o,s=this._videoTrack,c=this._audioTrack,l=this._id3Track,u=this._txtTrack,d=s.pid,f=s.pesData,p=c.pid,m=l.pid,h=c.pesData,g=l.pesData,_=null,v=this.pmtParsed,y=this._pmtId,b=t.length;if(this.remainderData&&=(t=rW(this.remainderData,t),b=t.length,null),b<iY&&!a)return this.remainderData=t,{audioTrack:c,videoTrack:s,id3Track:l,textTrack:u};let x=Math.max(0,e.syncOffset(t));b-=(b-x)%iY,b<t.byteLength&&!a&&(this.remainderData=new Uint8Array(t.buffer,b,t.buffer.byteLength-b));let S=0;for(let e=x;e<b;e+=iY)if(t[e]===71){let n=!!(t[e+1]&64),a=oY(t,e),b=(t[e+3]&48)>>4,S;if(b>1){if(S=e+5+t[e+4],S===e+iY)continue}else S=e+4;switch(a){case d:n&&(f&&(o=dY(f,this.logger))&&(this.readyVideoParser(s.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(s,u,o,!1)),f={data:[],size:0}),f&&(f.data.push(t.subarray(S,e+iY)),f.size+=e+iY-S);break;case p:if(n){if(h&&(o=dY(h,this.logger)))switch(c.segmentCodec){case`aac`:this.parseAACPES(c,o);break;case`mp3`:this.parseMPEGPES(c,o);break;case`ac3`:this.parseAC3PES(c,o);break}h={data:[],size:0}}h&&(h.data.push(t.subarray(S,e+iY)),h.size+=e+iY-S);break;case m:n&&(g&&(o=dY(g,this.logger))&&this.parseID3PES(l,o),g={data:[],size:0}),g&&(g.data.push(t.subarray(S,e+iY)),g.size+=e+iY-S);break;case 0:n&&(S+=t[S]+1),y=this._pmtId=sY(t,S);break;case y:{n&&(S+=t[S]+1);let a=cY(t,S,this.typeSupported,r,this.observer,this.logger);d=a.videoPid,d>0&&(s.pid=d,s.segmentCodec=a.segmentVideoCodec),p=a.audioPid,p>0&&(c.pid=p,c.segmentCodec=a.segmentAudioCodec),m=a.id3Pid,m>0&&(l.pid=m),_!==null&&!v&&(this.logger.warn(`MPEG-TS PMT found at ${e} after unknown PID '${_}'. Backtracking to sync byte @${x} to parse all TS packets.`),_=null,e=x-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:_=a;break}}else S++;S>0&&lY(this.observer,Error(`Found ${S} TS packet/s that do not start with 0x47`),void 0,this.logger),s.pesData=f,c.pesData=h,l.pesData=g;let C={audioTrack:c,videoTrack:s,id3Track:l,textTrack:u};return a&&this.extractRemainingSamples(C),C}flush(){let{remainderData:e}=this;this.remainderData=null;let t;return t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){let{audioTrack:t,videoTrack:n,id3Track:r,textTrack:a}=e,o=n.pesData,s=t.pesData,c=r.pesData,l;if(o&&(l=dY(o,this.logger))?(this.readyVideoParser(n.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(n,a,l,!0),n.pesData=null)):n.pesData=o,s&&(l=dY(s,this.logger))){switch(t.segmentCodec){case`aac`:this.parseAACPES(t,l);break;case`mp3`:this.parseMPEGPES(t,l);break;case`ac3`:this.parseAC3PES(t,l);break}t.pesData=null}else s!=null&&s.size&&this.logger.log(`last AAC PES packet truncated,might overlap between fragments`),t.pesData=s;c&&(l=dY(c,this.logger))?(this.parseID3PES(r,l),r.pesData=null):r.pesData=c}demuxSampleAes(e,t,n){let r=this.demux(e,n,!0,!this.config.progressive),a=this.sampleAes=new $J(this.observer,this.config,t);return this.decrypt(r,a)}readyVideoParser(e){this.videoParser===null&&(e===`avc`?this.videoParser=new nY:e===`hevc`&&(this.videoParser=new rY))}decrypt(e,t){return new Promise(n=>{let{audioTrack:r,videoTrack:a}=e;r.samples&&r.segmentCodec===`aac`?t.decryptAacSamples(r.samples,0,()=>{a.samples?t.decryptAvcSamples(a.samples,0,0,()=>{n(e)}):n(e)}):a.samples&&t.decryptAvcSamples(a.samples,0,0,()=>{n(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let n=0,r=this.aacOverFlow,a=t.data;if(r){this.aacOverFlow=null;let t=r.missing,o=r.sample.unit.byteLength;if(t===-1)a=rW(r.sample.unit,a);else{let s=o-t;r.sample.unit.set(a.subarray(0,t),s),e.samples.push(r.sample),n=r.missing}}let o,s;for(o=n,s=a.length;o<s-1&&!aJ(a,o);o++);if(o!==n){let e,t=o<s-1;if(e=t?`AAC PES did not start with ADTS header,offset:${o}`:`No ADTS header found in AAC PES`,lY(this.observer,Error(e),t,this.logger),!t)return}cJ(e,this.observer,a,o,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(r){let t=lJ(e.samplerate);c=r.sample.pts+t}else{this.logger.warn(`[tsdemuxer]: AAC PES unknown PTS`);return}let l=0,u;for(;o<s;)if(u=dJ(e,a,o,c,l),o+=u.length,u.missing){this.aacOverFlow=u;break}else for(l++;o<s-1&&!aJ(a,o);o++);}parseMPEGPES(e,t){let n=t.data,r=n.length,a=0,o=0,s=t.pts;if(s===void 0){this.logger.warn(`[tsdemuxer]: MPEG PES unknown PTS`);return}for(;o<r;)if(HJ(n,o)){let t=zJ(e,n,o,s,a);if(t)o+=t.length,a++;else break}else o++}parseAC3PES(e,t){{let n=t.data,r=t.pts;if(r===void 0){this.logger.warn(`[tsdemuxer]: AC3 PES unknown PTS`);return}let a=n.length,o=0,s=0,c;for(;s<a&&(c=JJ(e,n,s,r,o++))>0;)s+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn(`[tsdemuxer]: ID3 PES unknown PTS`);return}let n=eU({},t,{type:this._videoTrack?AJ.emsg:AJ.audioId3,duration:1/0});e.samples.push(n)}};function oY(e,t){return((e[t+1]&31)<<8)+e[t+2]}function sY(e,t){return(e[t+10]&31)<<8|e[t+11]}function cY(e,t,n,r,a,o){let s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:`avc`,segmentAudioCodec:`aac`},c=(e[t+1]&15)<<8|e[t+2],l=t+3+c-4,u=(e[t+10]&15)<<8|e[t+11];for(t+=12+u;t<l;){let c=oY(e,t),l=(e[t+3]&15)<<8|e[t+4];switch(e[t]){case 207:if(!r){uY(`ADTS AAC`,o);break}case 15:s.audioPid===-1&&(s.audioPid=c);break;case 21:s.id3Pid===-1&&(s.id3Pid=c);break;case 219:if(!r){uY(`H.264`,o);break}case 27:s.videoPid===-1&&(s.videoPid=c);break;case 3:case 4:!n.mpeg&&!n.mp3?o.log(`MPEG audio found, not supported in this browser`):s.audioPid===-1&&(s.audioPid=c,s.segmentAudioCodec=`mp3`);break;case 193:if(!r){uY(`AC-3`,o);break}case 129:n.ac3?s.audioPid===-1&&(s.audioPid=c,s.segmentAudioCodec=`ac3`):o.log(`AC-3 audio found, not supported in this browser`);break;case 6:if(s.audioPid===-1&&l>0){let r=t+5,a=l;for(;a>2;){switch(e[r]){case 106:n.ac3===!0?(s.audioPid=c,s.segmentAudioCodec=`ac3`):o.log(`AC-3 audio found, not supported in this browser for now`);break}let t=e[r+1]+2;r+=t,a-=t}}break;case 194:case 135:return lY(a,Error(`Unsupported EC-3 in M2TS found`),void 0,o),s;case 36:s.videoPid===-1&&(s.videoPid=c,s.segmentVideoCodec=`hevc`,o.log(`HEVC in M2TS found`));break}t+=l+5}return s}function lY(e,t,n,r){r.warn(`parsing error: ${t.message}`),e.emit(Q.ERROR,Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.FRAG_PARSING_ERROR,fatal:!1,levelRetry:n,error:t,reason:t.message})}function uY(e,t){t.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function dY(e,t){let n=0,r,a,o,s,c,l=e.data;if(!e||e.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=rW(l[0],l[1]),l.splice(1,1);if(r=l[0],(r[0]<<16)+(r[1]<<8)+r[2]===1){if(a=(r[4]<<8)+r[5],a&&a>e.size-6)return null;let u=r[7];u&192&&(s=(r[9]&14)*536870912+(r[10]&255)*4194304+(r[11]&254)*16384+(r[12]&255)*128+(r[13]&254)/2,u&64?(c=(r[14]&14)*536870912+(r[15]&255)*4194304+(r[16]&254)*16384+(r[17]&255)*128+(r[18]&254)/2,s-c>60*9e4&&(t.warn(`${Math.round((s-c)/9e4)}s delta between PTS and DTS, align them`),s=c)):c=s),o=r[8];let d=o+9;if(e.size<=d)return null;e.size-=d;let f=new Uint8Array(e.size);for(let e=0,t=l.length;e<t;e++){r=l[e];let t=r.byteLength;if(d)if(d>t){d-=t;continue}else r=r.subarray(d),t-=d,d=0;f.set(r,n),n+=t}return a&&(a-=o+3),{data:f,pts:s,dts:c,len:a}}return null}var fY=class{static getSilentFrame(e,t){switch(e){case`mp4a.40.2`:if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2||t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}},pY=2**32-1,mY=class e{static init(){e.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let t;for(t in e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);e.HDLR_TYPES={video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])};let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);e.STTS=e.STSC=e.STCO=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);let r=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,r,o,r,a),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,n))}static box(e,...t){let n=8,r=t.length,a=r;for(;r--;)n+=t[r].byteLength;let o=new Uint8Array(n);for(o[0]=n>>24&255,o[1]=n>>16&255,o[2]=n>>8&255,o[3]=n&255,o.set(e,4),r=0,n=8;r<a;r++)o.set(t[r],n),n+=t[r].byteLength;return o}static hdlr(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}static mdat(t){return e.box(e.types.mdat,t)}static mdhd(t,n){n*=t;let r=Math.floor(n/(pY+1)),a=Math.floor(n%(pY+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,r>>24,r>>16&255,r>>8&255,r&255,a>>24,a>>16&255,a>>8&255,a&255,85,196,0,0]))}static mdia(t){return e.box(e.types.mdia,e.mdhd(t.timescale||0,t.duration||0),e.hdlr(t.type),e.minf(t))}static mfhd(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]))}static minf(t){return t.type===`audio`?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}static moof(t,n,r){return e.box(e.types.moof,e.mfhd(t),e.traf(r,n))}static moov(t){let n=t.length,r=[];for(;n--;)r[n]=e.trak(t[n]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale||0,t[0].duration||0)].concat(r,e.mvex(t)))}static mvex(t){let n=t.length,r=[];for(;n--;)r[n]=e.trex(t[n]);return e.box.apply(null,[e.types.mvex,...r])}static mvhd(t,n){n*=t;let r=Math.floor(n/(pY+1)),a=Math.floor(n%(pY+1)),o=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,r>>24,r>>16&255,r>>8&255,r&255,a>>24,a>>16&255,a>>8&255,a&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,o)}static sdtp(t){let n=t.samples||[],r=new Uint8Array(4+n.length),a,o;for(a=0;a<n.length;a++)o=n[a].flags,r[a+4]=o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy;return e.box(e.types.sdtp,r)}static stbl(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))}static avc1(t){let n=[],r=[],a,o,s;for(a=0;a<t.sps.length;a++)o=t.sps[a],s=o.byteLength,n.push(s>>>8&255),n.push(s&255),n=n.concat(Array.prototype.slice.call(o));for(a=0;a<t.pps.length;a++)o=t.pps[a],s=o.byteLength,r.push(s>>>8&255),r.push(s&255),r=r.concat(Array.prototype.slice.call(o));let c=e.box(e.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n,[t.pps.length],r))),l=t.width,u=t.height,d=t.pixelRatio[0],f=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,u>>8&255,u&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,f>>24,f>>16&255,f>>8&255,f&255])))}static esds(e){let t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){let t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(t){return e.box(e.types.mp4a,e.audioStsd(t),e.box(e.types.esds,e.esds(t)))}static mp3(t){return e.box(e.types[`.mp3`],e.audioStsd(t))}static ac3(t){return e.box(e.types[`ac-3`],e.audioStsd(t),e.box(e.types.dac3,t.config))}static stsd(t){let{segmentCodec:n}=t;if(t.type===`audio`){if(n===`aac`)return e.box(e.types.stsd,e.STSD,e.mp4a(t));if(n===`ac3`&&t.config)return e.box(e.types.stsd,e.STSD,e.ac3(t));if(n===`mp3`&&t.codec===`mp3`)return e.box(e.types.stsd,e.STSD,e.mp3(t))}else if(t.pps&&t.sps){if(n===`avc`)return e.box(e.types.stsd,e.STSD,e.avc1(t));if(n===`hevc`&&t.vps)return e.box(e.types.stsd,e.STSD,e.hvc1(t))}else throw Error(`video track missing pps or sps`);throw Error(`unsupported ${t.type} segment codec (${n}/${t.codec})`)}static tkhd(t){let n=t.id,r=(t.duration||0)*(t.timescale||0),a=t.width||0,o=t.height||0,s=Math.floor(r/(pY+1)),c=Math.floor(r%(pY+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,c>>24,c>>16&255,c>>8&255,c&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,a&255,0,0,o>>8&255,o&255,0,0]))}static traf(t,n){let r=e.sdtp(t),a=t.id,o=Math.floor(n/(pY+1)),s=Math.floor(n%(pY+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,s>>24,s>>16&255,s>>8&255,s&255])),e.trun(t,r.length+16+20+8+16+8+8),r)}static trak(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}static trex(t){let n=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(t,n){let r=t.samples||[],a=r.length,o=12+16*a,s=new Uint8Array(o),c,l,u,d,f,p;for(n+=8+o,s.set([+(t.type===`video`),0,15,1,a>>>24&255,a>>>16&255,a>>>8&255,a&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255],0),c=0;c<a;c++)l=r[c],u=l.duration,d=l.size,f=l.flags,p=l.cts,s.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,p>>>24&255,p>>>16&255,p>>>8&255,p&255],12+16*c);return e.box(e.types.trun,s)}static initSegment(t){e.types||e.init();let n=e.moov(t);return rW(e.FTYP,n)}static hvc1(t){let n=t.params,r=[t.vps,t.sps,t.pps],a=new Uint8Array([1,n.general_profile_space<<6|(n.general_tier_flag?32:0)|n.general_profile_idc,n.general_profile_compatibility_flags[0],n.general_profile_compatibility_flags[1],n.general_profile_compatibility_flags[2],n.general_profile_compatibility_flags[3],n.general_constraint_indicator_flags[0],n.general_constraint_indicator_flags[1],n.general_constraint_indicator_flags[2],n.general_constraint_indicator_flags[3],n.general_constraint_indicator_flags[4],n.general_constraint_indicator_flags[5],n.general_level_idc,240|n.min_spatial_segmentation_idc>>8,255&n.min_spatial_segmentation_idc,252|n.parallelismType,252|n.chroma_format_idc,248|n.bit_depth_luma_minus8,248|n.bit_depth_chroma_minus8,0,parseInt(n.frame_rate.fps),3|n.temporal_id_nested<<2|n.num_temporal_layers<<3|(n.frame_rate.fixed?64:0),r.length]),o=a.length;for(let e=0;e<r.length;e+=1){o+=3;for(let t=0;t<r[e].length;t+=1)o+=2+r[e][t].length}let s=new Uint8Array(o);s.set(a,0),o=a.length;let c=r.length-1;for(let e=0;e<r.length;e+=1){s.set(new Uint8Array([32+e|(e===c?128:0),0,r[e].length]),o),o+=3;for(let t=0;t<r[e].length;t+=1)s.set(new Uint8Array([r[e][t].length>>8,r[e][t].length&255]),o),o+=2,s.set(r[e][t],o),o+=r[e][t].length}let l=e.box(e.types.hvcC,s),u=t.width,d=t.height,f=t.pixelRatio[0],p=t.pixelRatio[1];return e.box(e.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,p>>24,p>>16&255,p>>8&255,p&255])))}};mY.types=void 0,mY.HDLR_TYPES=void 0,mY.STTS=void 0,mY.STSC=void 0,mY.STCO=void 0,mY.STSZ=void 0,mY.VMHD=void 0,mY.SMHD=void 0,mY.STSD=void 0,mY.FTYP=void 0,mY.DINF=void 0;var hY=9e4;function gY(e,t,n=1,r=!1){let a=e*t*n;return r?Math.round(a):a}function _Y(e,t,n=1,r=!1){return gY(e,t,1/n,r)}function vY(e,t=!1){return gY(e,1e3,1/hY,t)}function yY(e,t=1){return gY(e,hY,1/t)}function bY(e){let{baseTime:t,timescale:n,trackId:r}=e;return`${t/n} (${t}/${n}) trackId: ${r}`}var xY=10*1e3,SY=1024,CY=1152,wY=1536,TY=null,EY=null;function DY(e,t,n,r){return{duration:t,size:n,cts:r,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:+!e}}}var OY=class extends aU{constructor(e,t,n,r){if(super(`mp4-remuxer`,r),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.ISGenerated=!1,TY===null){let e=(navigator.userAgent||``).match(/Chrome\/(\d+)/i);TY=e?parseInt(e[1]):0}if(EY===null){let e=navigator.userAgent.match(/Safari\/(\d+)/i);EY=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){let t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&bY(t)} > ${e&&bY(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log(`reset next timestamp`),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log(`ISGenerated flag reset`),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1,n=e[0].pts,r=e.reduce((e,r)=>{let a=r.pts,o=a-e;return o<-4294967296&&(t=!0,a=kY(a,n),o=a-e),o>0?e:a},n);return t&&this.debug(`PTS rollover detected`),r}remux(e,t,n,r,a,o,s,c){let l,u,d,f,p,m,h=a,g=a,_=e.pid>-1,v=t.pid>-1,y=t.samples.length,b=e.samples.length>0,x=s&&y>0||y>1;if((!_||b)&&(!v||x)||this.ISGenerated||s){if(this.ISGenerated){let e=this.videoTrackConfig;(e&&(t.width!==e.width||t.height!==e.height||t.pixelRatio?.[0]!==e.pixelRatio?.[0]||t.pixelRatio?.[1]!==e.pixelRatio?.[1])||!e&&x||this.nextAudioTs===null&&b)&&this.resetInitSegment()}this.ISGenerated||(d=this.generateIS(e,t,a,o));let n=this.isVideoContiguous,r=-1,s;if(x&&(r=AY(t.samples),!n&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,r>0){this.warn(`Dropped ${r} out of ${y} video samples due to a missing keyframe`);let e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(r),t.dropped+=r,g+=(t.samples[0].pts-e)/t.inputTimeScale,s=g}else r===-1&&(this.warn(`No keyframe found out of ${y} video samples`),m=!1);if(this.ISGenerated){if(b&&x){let n=this.getVideoStartPts(t.samples),r=(kY(e.samples[0].pts,n)-n)/t.inputTimeScale;h+=Math.max(0,r),g+=Math.max(0,-r)}if(b){if(e.samplerate||(this.warn(`regenerate InitSegment as audio detected`),d=this.generateIS(e,t,a,o)),u=this.remuxAudio(e,h,this.isAudioContiguous,o,v||x||c===XH.AUDIO?g:void 0),x){let r=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.warn(`regenerate InitSegment as video detected`),d=this.generateIS(e,t,a,o)),l=this.remuxVideo(t,g,n,r)}}else x&&(l=this.remuxVideo(t,g,n,0));l&&(l.firstKeyFrame=r,l.independent=r!==-1,l.firstKeyFramePTS=s)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(p=jY(n,a,this._initPTS,this._initDTS)),r.samples.length&&(f=MY(r,a,this._initPTS))),{audio:u,video:l,initSegment:d,independent:m,text:f,id3:p}}computeInitPts(e,t,n,r){let a=Math.round(n*t),o=kY(e,a);if(o<a+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(a-o)/t} ${r}`);o<a+t;)o+=8589934592;return o-a}generateIS(e,t,n,r){let a=e.samples,o=t.samples,s=this.typeSupported,c={},l=this._initPTS,u=!l||r,d=`audio/mp4`,f,p,m,h=-1;if(u&&(f=p=1/0),e.config&&a.length){switch(e.timescale=e.samplerate,e.segmentCodec){case`mp3`:s.mpeg?(d=`audio/mpeg`,e.codec=``):s.mp3&&(e.codec=`mp3`);break;case`ac3`:e.codec=`ac-3`;break}c.audio={id:`audio`,container:d,codec:e.codec,initSegment:e.segmentCodec===`mp3`&&s.mpeg?new Uint8Array:mY.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(h=e.id,m=e.inputTimeScale,!l||m!==l.timescale?f=p=this.computeInitPts(a[0].pts,m,n,`audio`):u=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,c.video={id:`main`,container:`video/mp4`,codec:t.codec,initSegment:mY.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(h=t.id,m=t.inputTimeScale,!l||m!==l.timescale){let e=this.getVideoStartPts(o),t=kY(o[0].dts,e),r=this.computeInitPts(t,m,n,`video`),a=this.computeInitPts(e,m,n,`video`);p=Math.min(p,r),f=Math.min(f,a)}else u=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,u?(l&&this.warn(`Timestamps at playlist time: ${r?``:`~`}${n} ${f/m} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${f/m} (${f}/${m}) trackId: ${h}`),this._initPTS={baseTime:f,timescale:m,trackId:h},this._initDTS={baseTime:p,timescale:m,trackId:h}):f=m=void 0,{tracks:c,initPTS:f,timescale:m,trackId:h}}remuxVideo(e,t,n,r){let a=e.inputTimeScale,o=e.samples,s=[],c=o.length,l=this._initPTS,u=l.baseTime*a/l.timescale,d=this.nextVideoTs,f=8,p=this.videoSampleDuration,m,h,g=1/0,_=-1/0,v=!1;if(!n||d===null){let e=u+t*a,r=o[0].pts-kY(o[0].dts,o[0].pts);TY&&d!==null&&Math.abs(e-r-(d+u))<15e3?n=!0:d=e-r-u}let y=d+u;for(let e=0;e<c;e++){let t=o[e];t.pts=kY(t.pts,y),t.dts=kY(t.dts,y),t.dts<o[e>0?e-1:e].dts&&(v=!0)}v&&o.sort(function(e,t){let n=e.dts-t.dts,r=e.pts-t.pts;return n||r}),m=o[0].dts,h=o[o.length-1].dts;let b=h-m,x=b?Math.round(b/(c-1)):p||e.inputTimeScale/30;if(n){let n=m-y,r=n>x,a=n<-1;if((r||a)&&(r?this.warn(`${(e.segmentCodec||``).toUpperCase()}: ${vY(n,!0)} ms (${n}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||``).toUpperCase()}: ${vY(-n,!0)} ms (${n}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!a||y>=o[0].pts||TY)){m=y;let e=o[0].pts-n;if(r)o[0].dts=m,o[0].pts=e;else{let t=!0;for(let r=0;r<o.length&&!(o[r].dts>e&&t);r++){let e=o[r].pts;if(o[r].dts-=n,o[r].pts-=n,r<o.length-1){let n=o[r+1].pts;t=n<=o[r].pts==n<=e}}}this.log(`Video: Initial PTS/DTS adjusted: ${vY(e,!0)}/${vY(m,!0)}, delta: ${vY(n,!0)} ms`)}}m=Math.max(0,m);let S=0,C=0,w=m;for(let e=0;e<c;e++){let t=o[e],n=t.units,r=n.length,a=0;for(let e=0;e<r;e++)a+=n[e].data.length;C+=a,S+=r,t.length=a,t.dts<w?(t.dts=w,w+=x/4|0||1):w=t.dts,g=Math.min(t.pts,g),_=Math.max(t.pts,_)}h=o[c-1].dts;let T=C+4*S+8,E;try{E=new Uint8Array(T)}catch(e){this.observer.emit(Q.ERROR,Q.ERROR,{type:JH.MUX_ERROR,details:Z.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:T,reason:`fail allocating video mdat ${T}`});return}let D=new DataView(E.buffer);D.setUint32(0,T),E.set(mY.types.mdat,4);let O=!1,ee=1/0,te=1/0,ne=-1/0,re=-1/0;for(let e=0;e<c;e++){let t=o[e],n=t.units,l=0;for(let e=0,t=n.length;e<t;e++){let t=n[e],r=t.data,a=t.data.byteLength;D.setUint32(f,a),f+=4,E.set(r,f),f+=a,l+=4+a}let d;if(e<c-1)p=o[e+1].dts-t.dts,d=o[e+1].pts-t.pts;else{let n=this.config,s=e>0?t.dts-o[e-1].dts:x;if(d=e>0?t.pts-o[e-1].pts:x,n.stretchShortVideoTrack&&this.nextAudioTs!==null){let e=Math.floor(n.maxBufferHole*a),o=(r?g+r*a:this.nextAudioTs+u)-t.pts;o>e?(p=o-s,p<0?p=s:O=!0,this.log(`It is approximately ${o/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=s}else p=s}let m=Math.round(t.pts-t.dts);ee=Math.min(ee,p),ne=Math.max(ne,p),te=Math.min(te,d),re=Math.max(re,d),s.push(DY(t.key,p,l,m))}if(s.length){if(TY){if(TY<70){let e=s[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(EY&&re-te<ne-ee&&x/ne<.025&&s[0].cts===0){this.warn(`Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.`);let e=m;for(let t=0,n=s.length;t<n;t++){let r=e+s[t].duration,a=e+s[t].cts;if(t<n-1){let e=r+s[t+1].cts;s[t].duration=e-a}else s[t].duration=t?s[t-1].duration:x;s[t].cts=0,e=r}}}p=O||!p?x:p;let ie=h+p;this.nextVideoTs=d=ie-u,this.videoSampleDuration=p,this.isVideoContiguous=!0;let ae={data1:mY.moof(e.sequenceNumber++,m,eU(e,{samples:s})),data2:E,startPTS:(g-u)/a,endPTS:(_+p-u)/a,startDTS:(m-u)/a,endDTS:d/a,type:`video`,hasAudio:!1,hasVideo:!0,nb:s.length,dropped:e.dropped};return e.samples=[],e.dropped=0,ae}getSamplesPerFrame(e){switch(e.segmentCodec){case`mp3`:return CY;case`ac3`:return wY;default:return SY}}remuxAudio(e,t,n,r,a){let o=e.inputTimeScale,s=o/(e.samplerate?e.samplerate:o),c=this.getSamplesPerFrame(e),l=c*s,u=this._initPTS,d=e.segmentCodec===`mp3`&&this.typeSupported.mpeg,f=[],p=a!==void 0,m=e.samples,h=d?0:8,g=this.nextAudioTs||-1,_=u.baseTime*o/u.timescale,v=_+t*o;if(this.isAudioContiguous=n||=m.length&&g>0&&(r&&Math.abs(v-(g+_))<9e3||Math.abs(kY(m[0].pts,v)-(g+_))<20*l),m.forEach(function(e){e.pts=kY(e.pts,v)}),!n||g<0){let e=m.length;if(m=m.filter(e=>e.pts>=0),e!==m.length&&this.warn(`Removed ${m.length-e} of ${e} samples (initPTS ${_} / ${o})`),!m.length)return;g=a===0?0:r&&!p?Math.max(0,v-_):m[0].pts-_}if(e.segmentCodec===`aac`){let t=this.config.maxAudioFramesDrift;for(let n=0,r=g+_;n<m.length;n++){let a=m[n],s=a.pts,c=s-r,u=Math.abs(1e3*c/o);if(c<=-t*l&&p)n===0&&(this.warn(`Audio frame @ ${(s/o).toFixed(3)}s overlaps marker by ${Math.round(1e3*c/o)} ms.`),this.nextAudioTs=g=s-_,r=s);else if(c>=t*l&&u<xY&&p){let t=Math.round(c/l);for(r=s-t*l;r<0&&t&&l;)t--,r+=l;n===0&&(this.nextAudioTs=g=r-_),this.warn(`Injecting ${t} audio frames @ ${((r-_)/o).toFixed(3)}s due to ${Math.round(1e3*c/o)} ms gap.`);for(let o=0;o<t;o++){let t=fY.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);t||=(this.log(`Unable to get silent frame for given audio codec; duplicating last frame instead.`),a.unit.subarray()),m.splice(n,0,{unit:t,pts:r}),r+=l,n++}}a.pts=r,r+=l}}let y=null,b=null,x,S=0,C=m.length;for(;C--;)S+=m[C].unit.byteLength;for(let t=0,r=m.length;t<r;t++){let r=m[t],a=r.unit,o=r.pts;if(b!==null){let e=f[t-1];e.duration=Math.round((o-b)/s)}else if(n&&e.segmentCodec===`aac`&&(o=g+_),y=o,S>0){S+=h;try{x=new Uint8Array(S)}catch(e){this.observer.emit(Q.ERROR,Q.ERROR,{type:JH.MUX_ERROR,details:Z.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:S,reason:`fail allocating audio mdat ${S}`});return}d||(new DataView(x.buffer).setUint32(0,S),x.set(mY.types.mdat,4))}else return;x.set(a,h);let l=a.byteLength;h+=l,f.push(DY(!0,c,l,0)),b=o}let w=f.length;if(!w)return;let T=f[f.length-1];g=b-_,this.nextAudioTs=g+s*T.duration;let E=d?new Uint8Array:mY.moof(e.sequenceNumber++,y/s,eU({},e,{samples:f}));e.samples=[];let D=(y-_)/o,O=this.nextAudioTs/o,ee={data1:E,data2:x,startPTS:D,endPTS:O,startDTS:D,endDTS:O,type:`audio`,hasAudio:!0,hasVideo:!1,nb:w};return this.isAudioContiguous=!0,ee}};function kY(e,t){let n;if(t===null)return e;for(n=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=n;return e}function AY(e){for(let t=0;t<e.length;t++)if(e[t].key)return t;return-1}function jY(e,t,n,r){let a=e.samples.length;if(!a)return;let o=e.inputTimeScale;for(let s=0;s<a;s++){let a=e.samples[s];a.pts=kY(a.pts-n.baseTime*o/n.timescale,t*o)/o,a.dts=kY(a.dts-r.baseTime*o/r.timescale,t*o)/o}let s=e.samples;return e.samples=[],{samples:s}}function MY(e,t,n){let r=e.samples.length;if(!r)return;let a=e.inputTimeScale;for(let o=0;o<r;o++){let r=e.samples[o];r.pts=kY(r.pts-n.baseTime*a/n.timescale,t*a)/a}e.samples.sort((e,t)=>e.pts-t.pts);let o=e.samples;return e.samples=[],{samples:o}}var NY=class extends aU{constructor(e,t,n,r){super(`passthrough-remuxer`,r),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;let t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,n,r){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(e,r),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:n,videoCodec:r}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}let{audio:a,video:o}=this.initData=WU(e);if(t)ZU(e,t);else{let e=a||o;e!=null&&e.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${e.codec}")!`)}a&&(n=IY(a,EU.AUDIO,this)),o&&(r=IY(o,EU.VIDEO,this));let s={};a&&o?s.audiovideo={container:`video/mp4`,codec:n+`,`+r,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:`main`}:a?s.audio={container:`audio/mp4`,codec:n,encrypted:a.encrypted,initSegment:e,id:`audio`}:o?s.video={container:`video/mp4`,codec:r,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:`main`}:this.warn(`initSegment does not contain moov or trak boxes.`),this.initTracks=s}remux(e,t,n,r,a,o){var s,c;let{initPTS:l,lastEndTime:u}=this,d={audio:void 0,video:void 0,text:r,id3:n,initSegment:void 0};GH(u)||(u=this.lastEndTime=a||0);let f=t.samples;if(!f.length)return d;let p={initPTS:void 0,timescale:void 0,trackId:void 0},m=this.initData;if((s=m)!=null&&s.length||(this.generateInitSegment(f),m=this.initData),!((c=m)!=null&&c.length))return this.warn(`Failed to generate initSegment.`),d;this.emitInitSegment&&=(p.tracks=this.initTracks,!1);let h=tW(f,m,this),g=m.audio?h[m.audio.id]:null,_=m.video?h[m.video.id]:null,v=PY(_,1/0),y=PY(g,1/0),b=PY(_,0,!0),x=PY(g,0,!0),S=a,C=0,w=g&&(!_||!l&&y<v||l&&l.trackId===m.audio.id),T=w?g:_;if(T){let e=T.timescale,t=T.start-a*e,n=w?m.audio.id:m.video.id;S=T.start/e,C=w?x-y:b-v,(o||!l)&&(FY(l,S,a,C)||e!==l.timescale)&&(l&&this.warn(`Timestamps at playlist time: ${o?``:`~`}${a} ${t/e} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${a} offset: ${S-a} (${t}/${e}) trackId: ${n}`),l=null,p.initPTS=t,p.timescale=e,p.trackId=n)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${a}`);l?(p.initPTS=l.baseTime,p.timescale=l.timescale,p.trackId=l.trackId):((!p.timescale||p.trackId===void 0||p.initPTS===void 0)&&(this.warn(`Could not set initPTS`),p.initPTS=S,p.timescale=1,p.trackId=-1),this.initPTS=l={baseTime:p.initPTS,timescale:p.timescale,trackId:p.trackId});let E=S-l.baseTime/l.timescale,D=E+C;C>0?this.lastEndTime=D:(this.warn(`Duration parsed from mp4 should be greater than zero`),this.resetNextTimestamp());let O=!!m.audio,ee=!!m.video,te=``;O&&(te+=`audio`),ee&&(te+=`video`);let ne=(m.audio?m.audio.encrypted:!1)||(m.video?m.video.encrypted:!1),re={data1:f,startPTS:E,startDTS:E,endPTS:D,endDTS:D,type:te,hasAudio:O,hasVideo:ee,nb:1,dropped:0,encrypted:ne};d.audio=O&&!ee?re:void 0,d.video=ee?re:void 0;let ie=_?.sampleCount;if(ie){let e=_.keyFrameIndex,t=e!==-1;re.nb=ie,re.dropped=e===0||this.isVideoContiguous?0:t?e:ie,re.independent=t,re.firstKeyFrame=e,t&&_.keyFrameStart&&(re.firstKeyFramePTS=(_.keyFrameStart-l.baseTime)/l.timescale),this.isVideoContiguous||(d.independent=t),this.isVideoContiguous||=t,re.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${e}/${ie} dropped: ${re.dropped} start: ${re.firstKeyFramePTS||`NA`}`)}return d.initSegment=p,d.id3=jY(n,a,l,l),r.samples.length&&(d.text=MY(r,a,l)),d}};function PY(e,t,n=!1){return e?.start===void 0?t:(e.start+(n?e.duration:0))/e.timescale}function FY(e,t,n,r){if(e===null)return!0;let a=Math.max(r,1),o=t-e.baseTime/e.timescale;return Math.abs(o-n)>a}function IY(e,t,n){let r=e.codec;return r&&r.length>4?r:t===EU.AUDIO?r===`ec-3`||r===`ac-3`||r===`alac`?r:r===`fLaC`||r===`Opus`?TW(r,!1):(n.warn(`Unhandled audio codec "${r}" in mp4 MAP`),r||`mp4a`):(n.warn(`Unhandled video codec "${r}" in mp4 MAP`),r||`avc1`)}var LY;try{LY=self.performance.now.bind(self.performance)}catch{LY=Date.now}var RY=[{demux:ZJ,remux:NY},{demux:aY,remux:OY},{demux:GJ,remux:OY},{demux:YJ,remux:OY}];RY.splice(2,0,{demux:qJ,remux:OY});var zY=class{constructor(e,t,n,r,a,o){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=n,this.id=a,this.logger=o}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,r){let a=n.transmuxing;a.executeStart=LY();let o=new Uint8Array(e),{currentTransmuxState:s,transmuxConfig:c}=this;r&&(this.currentTransmuxState=r);let{contiguous:l,discontinuity:u,trackSwitch:d,accurateTimeOffset:f,timeOffset:p,initSegmentChange:m}=r||s,{audioCodec:h,videoCodec:g,defaultInitPts:_,duration:v,initSegmentData:y}=c,b=BY(o,t);if(b&&CK(b.method)){let e=this.getDecrypter(),t=wK(b.method);if(e.isSync()){let r=e.softwareDecrypt(o,b.key.buffer,b.iv.buffer,t);if(n.part>-1){let t=e.flush();r=t&&t.buffer}if(!r)return a.executeEnd=LY(),VY(n);o=new Uint8Array(r)}else return this.asyncResult=!0,this.decryptionPromise=e.webCryptoDecrypt(o,b.key.buffer,b.iv.buffer,t).then(e=>{let t=this.push(e,null,n);return this.decryptionPromise=null,t}),this.decryptionPromise}let x=this.needsProbing(u,d);if(x){let e=this.configureTransmuxer(o);if(e)return this.logger.warn(`[transmuxer] ${e.message}`),this.observer.emit(Q.ERROR,Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),a.executeEnd=LY(),VY(n)}(u||d||m||x)&&this.resetInitSegment(y,h,g,v,t),(u||m||x)&&this.resetInitialTimestamp(_),l||this.resetContiguity();let S=this.transmux(o,b,p,f,n);this.asyncResult=HY(S);let C=this.currentTransmuxState;return C.contiguous=!0,C.discontinuity=!1,C.trackSwitch=!1,a.executeEnd=LY(),S}flush(e){let t=e.transmuxing;t.executeStart=LY();let{decrypter:n,currentTransmuxState:r,decryptionPromise:a}=this;if(a)return this.asyncResult=!0,a.then(()=>this.flush(e));let o=[],{timeOffset:s}=r;if(n){let t=n.flush();t&&o.push(this.push(t.buffer,null,e))}let{demuxer:c,remuxer:l}=this;if(!c||!l){t.executeEnd=LY();let n=[VY(e)];return this.asyncResult?Promise.resolve(n):n}let u=c.flush(s);return HY(u)?(this.asyncResult=!0,u.then(t=>(this.flushRemux(o,t,e),o))):(this.flushRemux(o,u,e),this.asyncResult?Promise.resolve(o):o)}flushRemux(e,t,n){let{audioTrack:r,videoTrack:a,id3Track:o,textTrack:s}=t,{accurateTimeOffset:c,timeOffset:l}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${n.sn}${n.part>-1?` part: `+n.part:``} of ${this.id===XH.MAIN?`level`:`track`} ${n.level}`);let u=this.remuxer.remux(r,a,o,s,l,c,!0,this.id);e.push({remuxResult:u,chunkMeta:n}),n.transmuxing.executeEnd=LY()}resetInitialTimestamp(e){let{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){let{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,r,a){let{demuxer:o,remuxer:s}=this;!o||!s||(o.resetInitSegment(e,t,n,r),s.resetInitSegment(e,t,n,a))}destroy(){this.demuxer&&=(this.demuxer.destroy(),void 0),this.remuxer&&=(this.remuxer.destroy(),void 0)}transmux(e,t,n,r,a){let o;return o=t&&t.method===`SAMPLE-AES`?this.transmuxSampleAes(e,t,n,r,a):this.transmuxUnencrypted(e,n,r,a),o}transmuxUnencrypted(e,t,n,r){let{audioTrack:a,videoTrack:o,id3Track:s,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(a,o,s,c,t,n,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,n,r,a){return this.demuxer.demuxSampleAes(e,t,n).then(e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,n,r,!1,this.id),chunkMeta:a}))}configureTransmuxer(e){let{config:t,observer:n,typeSupported:r}=this,a;for(let t=0,n=RY.length;t<n;t++){var o;if((o=RY[t].demux)!=null&&o.probe(e,this.logger)){a=RY[t];break}}if(!a)return Error(`Failed to find demuxer by probing fragment data`);let s=this.demuxer,c=this.remuxer,l=a.remux,u=a.demux;(!c||!(c instanceof l))&&(this.remuxer=new l(n,t,r,this.logger)),(!s||!(s instanceof u))&&(this.demuxer=new u(n,t,r,this.logger),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||=this.decrypter=new YG(this.config),e}};function BY(e,t){let n=null;return e.byteLength>0&&t?.key!=null&&t.iv!==null&&t.method!=null&&(n=t),n}var VY=e=>({remuxResult:{},chunkMeta:e});function HY(e){return`then`in e&&e.then instanceof Function}var UY=class{constructor(e,t,n,r,a){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=n,this.duration=r,this.defaultInitPts=a||null}},WY=class{constructor(e,t,n,r,a,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=n,this.trackSwitch=r,this.timeOffset=a,this.initSegmentChange=o}},GY=0,KY=class{constructor(e,t,n,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=GY++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=e=>{let t=e.data,n=this.hls;if(!(!n||!(t!=null&&t.event)||t.instanceNo!==this.instanceNo))switch(t.event){case`init`:{let e=this.workerContext?.objectURL;e&&self.URL.revokeObjectURL(e);break}case`transmuxComplete`:this.handleTransmuxComplete(t.data);break;case`flush`:this.onFlush(t.data);break;case`workerLog`:n.logger[t.data.logType]&&n.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.part=this.part,t.data.id=this.id,n.trigger(t.event,t.data);break}},this.onWorkerError=e=>{if(!this.hls)return;let t=Error(`${e.message} (${e.filename}:${e.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(Q.ERROR,{type:JH.OTHER_ERROR,details:Z.INTERNAL_EXCEPTION,fatal:!1,event:`demuxerWorker`,error:t})};let a=e.config;this.hls=e,this.id=t,this.useWorker=!!a.enableWorker,this.onTransmuxComplete=n,this.onFlush=r;let o=(e,t)=>{t||={},t.frag=this.frag||void 0,e===Q.ERROR&&(t=t,t.parent=this.id,t.part=this.part,this.error=t.error),this.hls.trigger(e,t)};this.observer=new Uq,this.observer.on(Q.FRAG_DECRYPTED,o),this.observer.on(Q.ERROR,o);let s=jW(a.preferManagedMediaSource);if(this.useWorker&&typeof Worker<`u`){let n=this.hls.logger;if(a.workerPath||Kq()){try{a.workerPath?(n.log(`loading Web Worker ${a.workerPath} for "${t}"`),this.workerContext=Jq(a.workerPath)):(n.log(`injecting Web Worker for "${t}"`),this.workerContext=qq());let{worker:e}=this.workerContext;e.addEventListener(`message`,this.onWorkerMessage),e.addEventListener(`error`,this.onWorkerError),e.postMessage({instanceNo:this.instanceNo,cmd:`init`,typeSupported:s,id:t,config:nG(a)})}catch(r){n.warn(`Error setting up "${t}" Web Worker, fallback to inline`,r),this.terminateWorker(),this.error=null,this.transmuxer=new zY(this.observer,s,a,``,t,e.logger)}return}}this.transmuxer=new zY(this.observer,s,a,``,t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){let e=this.instanceNo;this.instanceNo=GY++;let t=this.hls.config,n=jW(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:`reset`,resetNo:e,typeSupported:n,id:this.id,config:nG(t)})}}terminateWorker(){if(this.workerContext){let{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener(`message`,this.onWorkerMessage),e.removeEventListener(`error`,this.onWorkerError),Yq(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{let e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}let e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,n,r,a,o,s,c,l,u){l.transmuxing.start=self.performance.now();let{instanceNo:d,transmuxer:f}=this,p=o?o.start:a.start,m=a.decryptdata,h=this.frag,g=!(h&&a.cc===h.cc),_=!(h&&l.level===h.level),v=h?l.sn-h.sn:-1,y=this.part?l.part-this.part.index:-1,b=v===0&&l.id>1&&l.id===h?.stats.chunkCount,x=!_&&(v===1||v===0&&(y===1||b&&y<=0)),S=self.performance.now();(_||v||a.stats.parsing.start===0)&&(a.stats.parsing.start=S),o&&(y||!x)&&(o.stats.parsing.start=S);let C=!(h&&a.initSegment?.url===h.initSegment?.url),w=new WY(g,x,c,_,p,C);if(!x||g||C){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${a.type} sn: ${l.sn}${l.part>-1?` part: `+l.part:``} ${this.id===XH.MAIN?`level`:`track`}: ${l.level} id: ${l.id}
124
- discontinuity: ${g}
125
- trackSwitch: ${_}
126
- contiguous: ${x}
127
- accurateTimeOffset: ${c}
128
- timeOffset: ${p}
129
- initSegmentChange: ${C}`);let e=new UY(n,r,t,s,u);this.configureTransmuxer(e)}if(this.frag=a,this.part=o,this.workerContext)this.workerContext.worker.postMessage({instanceNo:d,cmd:`demux`,data:e,decryptdata:m,chunkMeta:l,state:w},e instanceof ArrayBuffer?[e]:[]);else if(f){let t=f.push(e,m,l,w);HY(t)?t.then(e=>{this.handleTransmuxComplete(e)}).catch(e=>{this.transmuxerError(e,l,`transmuxer-interface push error`)}):this.handleTransmuxComplete(t)}}flush(e){e.transmuxing.start=self.performance.now();let{instanceNo:t,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:`flush`,chunkMeta:e});else if(n){let t=n.flush(e);HY(t)?t.then(t=>{this.handleFlushResult(t,e)}).catch(t=>{this.transmuxerError(t,e,`transmuxer-interface flush error`)}):this.handleFlushResult(t,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(e=>{this.handleTransmuxComplete(e)}),this.onFlush(t)}configureTransmuxer(e){let{instanceNo:t,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:`configure`,config:e}):n&&n.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}},qY=100,JY=class extends Iq{constructor(e,t,n){super(e,t,n,`audio-stream-controller`,XH.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(Q.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Q.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(Q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(Q.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(Q.BUFFER_RESET,this.onBufferReset,this),e.on(Q.BUFFER_CREATED,this.onBufferCreated,this),e.on(Q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(Q.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(Q.FRAG_LOADING,this.onFragLoading,this),e.on(Q.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){let{hls:e}=this;e&&(super.unregisterListeners(),e.off(Q.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Q.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(Q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(Q.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(Q.BUFFER_RESET,this.onBufferReset,this),e.off(Q.BUFFER_CREATED,this.onBufferCreated,this),e.off(Q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(Q.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(Q.FRAG_LOADING,this.onFragLoading,this),e.off(Q.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:n,initPTS:r,timescale:a,trackId:o}){if(n===XH.MAIN){let e=t.cc,n=this.fragCurrent;if(this.initPTS[e]={baseTime:r,timescale:a,trackId:o},this.log(`InitPTS for cc: ${e} found from main: ${r/a} (${r}/${a}) trackId: ${o}`),this.mainAnchor=t,this.state===$.WAITING_INIT_PTS){let n=this.waitingData;(!n&&!this.loadingParts||n&&n.frag.cc!==e)&&this.syncWithAnchor(t,n?.frag)}else !this.hls.hasEnoughToStart&&n&&n.cc!==e?(n.abortRequests(),this.syncWithAnchor(t,n)):this.state===$.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){let n=this.mainFragLoading?.frag||null;if(t&&n?.cc===t.cc)return;let r=(n||e).cc,a=CG(this.getLevelDetails(),r,this.getLoadPosition());a&&(this.log(`Syncing with main frag at ${a.start} cc ${a.cc}`),this.startFragRequested=!1,this.nextLoadPosition=a.start,this.resetLoadingState(),this.state===$.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=$.STOPPED;return}let n=this.lastCurrentTime;this.stopLoad(),this.setInterval(qY),n>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n,this.state=$.IDLE):this.state=$.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case $.IDLE:this.doTickIdle();break;case $.WAITING_TRACK:{let{levels:e,trackId:t}=this,n=e?.[t],r=n?.details;if(r&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(r))break;this.state=$.WAITING_INIT_PTS}break}case $.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break;case $.WAITING_INIT_PTS:{let e=this.waitingData;if(e){let{frag:t,part:n,cache:r,complete:a}=e,o=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=$.FRAG_LOADING;let e={frag:t,part:n,payload:r.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(e),a&&super._handleFragmentLoadComplete(e)}else o&&o.cc!==e.frag.cc&&this.syncWithAnchor(o,e.frag)}else this.state=$.IDLE}}this.onTickEnd()}resetLoadingState(){let e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){let{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){let{hls:e,levels:t,media:n,trackId:r}=this,a=e.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(t!=null&&t[r]))return;let o=t[r],s=o.details;if(!s||this.waitForLive(o)||this.waitForCdnTuneIn(s)){this.state=$.WAITING_TRACK,this.startFragRequested=!1;return}let c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=!1,this.afterBufferFlushed(c,EU.AUDIO,XH.AUDIO));let l=this.getFwdBufferInfo(c,XH.AUDIO);if(l===null)return;if(!this.switchingTrack&&this._streamEnded(l,s)){e.trigger(Q.BUFFER_EOS,{type:`audio`}),this.state=$.ENDED;return}let u=l.len,d=e.maxBufferLength,f=s.fragments,p=f[0].start,m=this.getLoadPosition(),h=this.flushing?m:l.end;if(this.switchingTrack&&n){let e=m;s.PTSKnown&&e<p&&(l.end>p||l.nextStart)&&(this.log(`Alt audio track ahead of main track, seek to start of alt audio track`),n.currentTime=p+.05)}if(u>=d&&!this.switchingTrack&&h<f[f.length-1].start)return;let g=this.getNextFragment(h,s);if(g&&this.isLoopLoading(g,h)&&(g=this.getNextFragmentLoopLoading(g,s,l,XH.MAIN,d)),!g){this.bufferFlushed=!0;return}if(this.exceedsMaxBuffer(l,d,g))return;let _=this.mainFragLoading?.frag||null;if(!this.audioOnly&&this.startFragRequested&&_&&OU(g)&&!g.endList&&(!s.live||!this.loadingParts&&h<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(_)===LG.OK&&(this.mainFragLoading=_=null),_&&OU(_))){if(g.start>_.end){let e=this.fragmentTracker.getFragAtPos(h,XH.MAIN);e&&e.end>_.end&&(_=e,this.mainFragLoading={frag:e,targetBufferTime:null})}if(g.start>_.end)return}this.loadFragment(g,o,h)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(e=>new ZW(e))}onAudioTrackSwitching(e,t){let n=!!t.url;this.trackId=t.id;let{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),n?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==$.STOPPED&&(this.setInterval(qY),this.state=$.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;let n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(Q.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(e,t){var n;let{levels:r}=this,{details:a,id:o,groupId:s,track:c}=t;if(!r){this.warn(`Audio tracks reset while loading track ${o} "${c.name}" of "${s}"`);return}let l=this.mainDetails;if(!l||a.endCC>l.endCC||l.expired){this.cachedTrackLoadedData=t,this.state!==$.STOPPED&&(this.state=$.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${o} "${c.name}" of "${s}" loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:``},duration:${a.totalduration}`);let u=r[o],d=0;if(a.live||(n=u.details)!=null&&n.live){if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;u.details&&(d=this.alignPlaylists(a,u.details,this.levelLastLoaded?.details)),a.alignedSliding||(jq(a,l),a.alignedSliding||Mq(a,l),d=a.fragmentStart)}u.details=a,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(l,d),this.hls.trigger(Q.AUDIO_TRACK_UPDATED,{details:a,id:o,groupId:t.groupId}),this.state===$.WAITING_TRACK&&!this.waitForCdnTuneIn(a)&&(this.state=$.IDLE),this.tick()}_handleFragmentLoadProgress(e){let t=e.frag,{part:n,payload:r}=e,{config:a,trackId:o,levels:s}=this;if(!s){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${t.sn} of level ${t.level} will not be buffered`);return}let c=s[o];if(!c){this.warn(`Audio track is undefined on fragment load progress`);return}let l=c.details;if(!l){this.warn(`Audio track details undefined on fragment load progress`),this.removeUnbufferedFrags(t.start);return}let u=a.defaultAudioCodec||c.audioCodec||`mp4a.40.2`,d=this.transmuxer;d||=this.transmuxer=new KY(this.hls,XH.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this));let f=this.initPTS[t.cc],p=t.initSegment?.data;if(f!==void 0){let e=n?n.index:-1,a=e!==-1,o=new rK(t.level,t.sn,t.stats.chunkCount,r.byteLength,e,a);d.push(r,p,u,``,t,n,l.totalduration,!1,o,f)}else{this.log(`Unknown video PTS for cc ${t.cc}, waiting for video PTS before demuxing audio frag ${t.sn} of [${l.startSN} ,${l.endSN}],track ${o}`);let{cache:e}=this.waitingData=this.waitingData||{frag:t,part:n,cache:new Rq,complete:!1};e.push(new Uint8Array(r)),this.state!==$.STOPPED&&(this.state=$.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;let n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===XH.MAIN&&OU(t.frag)&&(this.mainFragLoading=t,this.state===$.IDLE&&this.tick())}onFragBuffered(e,t){let{frag:n,part:r}=t;if(n.type!==XH.AUDIO){!this.audioOnly&&n.type===XH.MAIN&&!n.elementaryStreams.video&&!n.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${r?` p: `+r.index:``} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:`false`}`);return}if(OU(n)){this.fragPrevious=n;let e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(Q.AUDIO_TRACK_SWITCHED,nU({},e)))}this.fragBufferedComplete(n,r),this.media&&this.tick()}onError(e,t){if(t.fatal){this.state=$.ERROR;return}switch(t.details){case Z.FRAG_GAP:case Z.FRAG_PARSING_ERROR:case Z.FRAG_DECRYPT_ERROR:case Z.FRAG_LOAD_ERROR:case Z.FRAG_LOAD_TIMEOUT:case Z.KEY_LOAD_ERROR:case Z.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(XH.AUDIO,t);break;case Z.AUDIO_TRACK_LOAD_ERROR:case Z.AUDIO_TRACK_LOAD_TIMEOUT:case Z.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===$.WAITING_TRACK&&t.context?.type===YH.AUDIO_TRACK&&(this.state=$.IDLE);break;case Z.BUFFER_ADD_CODEC_ERROR:case Z.BUFFER_APPEND_ERROR:if(t.parent!==`audio`)return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case Z.BUFFER_FULL_ERROR:if(t.parent!==`audio`)return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,1/0,`audio`));break;case Z.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==EU.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==EU.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===$.ENDED&&(this.state=$.IDLE);let e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,XH.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;let n=`audio`,{hls:r}=this,{remuxResult:a,chunkMeta:o}=e,s=this.getCurrentContext(o);if(!s){this.resetWhenMissingContext(o);return}let{frag:c,part:l,level:u}=s,{details:d}=u,{audio:f,text:p,id3:m,initSegment:h}=a;if(this.fragContextChanged(c)||!d){this.fragmentTracker.removeFragment(c);return}if(this.state=$.PARSING,this.switchingTrack&&f&&this.completeAudioSwitch(this.switchingTrack),h!=null&&h.tracks){let e=c.initSegment||c;if(this.unhandledEncryptionError(h,c))return;this._bufferInitSegment(u,h.tracks,e,o),r.trigger(Q.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:n,tracks:h.tracks})}if(f){let{startPTS:e,endPTS:t,startDTS:n,endDTS:r}=f;l&&(l.elementaryStreams[EU.AUDIO]={startPTS:e,endPTS:t,startDTS:n,endDTS:r}),c.setElementaryStreamInfo(EU.AUDIO,e,t,n,r),this.bufferFragmentData(f,c,l,o)}if(m!=null&&(t=m.samples)!=null&&t.length){let e=eU({id:n,frag:c,details:d},m);r.trigger(Q.FRAG_PARSING_METADATA,e)}if(p){let e=eU({id:n,frag:c,details:d},p);r.trigger(Q.FRAG_PARSING_USERDATA,e)}}_bufferInitSegment(e,t,n,r){if(this.state!==$.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;let a=t.audio;a.id=XH.AUDIO;let o=e.audioCodec;this.log(`Init audio buffer, container:${a.container}, codecs[level/parsed]=[${o}/${a.codec}]`),o&&o.split(`,`).length===1&&(a.levelCodec=o),this.hls.trigger(Q.BUFFER_CODECS,t);let s=a.initSegment;if(s!=null&&s.byteLength){let e={type:`audio`,frag:n,part:null,chunkMeta:r,parent:n.type,data:s};this.hls.trigger(Q.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,n){let r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===LG.NOT_LOADED||r===LG.PARTIAL){var a;if(!OU(e))this._loadInitSegment(e,t);else if((a=t.details)!=null&&a.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=$.WAITING_INIT_PTS;let n=this.mainDetails;n&&n.fragmentStart!==t.details.fragmentStart&&Mq(t.details,n)}else super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){let{name:t,lang:n,assocLang:r,characteristics:a,audioCodec:o,channels:s}=this.bufferedTrack;lG({name:t,lang:n,assocLang:r,characteristics:a,audioCodec:o,channels:s},e,fG)||(hG(e.url,this.hls)?(this.log(`Switching audio track : flushing all audio`),super.flushMainBuffer(0,1/0,`audio`),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){let{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(Q.AUDIO_TRACK_SWITCHED,nU({},e))}},YY=class extends aU{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,n){let r=t?.renditionReports;if(r){let a=-1;for(let n=0;n<r.length;n++){let o=r[n],s;try{s=new self.URL(o.URI,t.url).href}catch(e){this.warn(`Could not construct new URL for Rendition Report: ${e}`),s=o.URI||``}if(s===e){a=n;break}else s===e.substring(0,s.length)&&(a=n)}if(a!==-1){let e=r[a],o=parseInt(e[`LAST-MSN`])||t.lastPartSn,s=parseInt(e[`LAST-PART`])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){let e=Math.min(t.age-t.partTarget,t.targetduration);s>=0&&e>t.partTarget&&(s+=1)}let c=n&&YW(n);return new XW(o,s>=0?s:void 0,c)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}return e}playlistLoaded(e,t,n){let{details:r,stats:a}=t,o=self.performance.now(),s=a.loading.first?Math.max(0,o-a.loading.first):0;r.advancedDateTime=Date.now()-s;let c=this.hls.config.timelineOffset;if(c!==r.appliedTimelineOffset){let e=Math.max(c||0,0);r.appliedTimelineOffset=e,r.fragments.forEach(t=>{t.setStart(t.playlistOffset+e)})}if(r.live||n!=null&&n.live){let c=`levelInfo`in t?t.levelInfo:t.track;if(r.reloaded(n),n&&r.fragments.length>0){fq(n,r,this);let e=r.playlistParsingError;if(e){this.warn(e);let n=this.hls;if(!n.config.ignorePlaylistParsingErrors){let{networkDetails:o}=t;n.trigger(Q.ERROR,{type:JH.NETWORK_ERROR,details:Z.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:e,reason:e.message,level:t.level||void 0,parent:r.fragments[0]?.type,networkDetails:o,stats:a});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=a.loading.start);let l=this.hls.mainForwardBufferInfo,u=l?l.end-l.len:0,d=yq(r,(r.edge-u)*1e3);if(r.requestScheduled+d<o?r.requestScheduled=o:r.requestScheduled+=d,this.log(`live playlist ${e} ${r.advanced?`REFRESHED `+r.lastPartSn+`-`+r.lastPartIndex:r.updated?`UPDATED`:`MISSED`}`),!this.canLoad||!r.live)return;let f,p,m;if(r.canBlockReload&&r.endSN&&r.advanced){let e=this.hls.config.lowLatencyMode,a=r.lastPartSn,s=r.endSN,l=r.lastPartIndex,u=l!==-1,d=a===s;u?d?(p=s+1,m=e?0:l):(p=a,m=e?l+1:r.maxPartIndex):p=s+1;let h=r.age,g=h+r.ageHeader,_=Math.min(g-r.partTarget,r.targetduration*1.5);if(_>0){if(g>r.targetduration*3)this.log(`Playlist last advanced ${h.toFixed(2)}s ago. Omitting segment and part directives.`),p=void 0,m=void 0;else if(n!=null&&n.tuneInGoal&&g-r.partTarget>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${_} with playlist age: ${r.age}`),_=0;else{let e=Math.floor(_/r.targetduration);if(p+=e,m!==void 0){let e=Math.round(_%r.targetduration/r.partTarget);m+=e}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${h.toFixed(2)}s goal: ${_} skip sn ${e} to part ${m}`)}r.tuneInGoal=_}if(f=this.getDeliveryDirectives(r,t.deliveryDirectives,p,m),e||!d){r.requestScheduled=o,this.loadingPlaylist(c,f);return}}else (r.canBlockReload||r.canSkipUntil)&&(f=this.getDeliveryDirectives(r,t.deliveryDirectives,p,m));f&&p!==void 0&&r.canBlockReload&&(r.requestScheduled=a.loading.first+Math.max(d-s*2,d/2)),this.scheduleLoading(c,f,r)}else this.clearTimer()}scheduleLoading(e,t,n){let r=n||e.details;if(!r){this.loadingPlaylist(e,t);return}let a=self.performance.now(),o=r.requestScheduled;if(a>=o){this.loadingPlaylist(e,t);return}let s=o-a;this.log(`reload live playlist ${e.name||e.bitrate+`bps`} in ${Math.round(s)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),s)}getDeliveryDirectives(e,t,n,r){let a=YW(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,r=t.part,a=JW.No),new XW(n,r,a)}checkRetry(e){let t=e.details,n=wG(e),r=e.errorAction,{action:a,retryCount:o=0,retryConfig:s}=r||{},c=!!r&&!!s&&(a===NG.RetryRequest||!r.resolved&&a===NG.SendAlternateToPenaltyBox);if(c){var l;if(o>=s.maxNumRetry)return!1;if(n&&(l=e.context)!=null&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${s.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{let e=OG(s,o);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),e),this.warn(`Retrying playlist loading ${o+1}/${s.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,r.resolved=!0}return c}};function XY(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!ZY(e[n].attrs,t[n].attrs))return!1;return!0}function ZY(e,t,n){let r=e[`STABLE-RENDITION-ID`];return r&&!n?r===t[`STABLE-RENDITION-ID`]:!(n||[`LANGUAGE`,`NAME`,`CHARACTERISTICS`,`AUTOSELECT`,`DEFAULT`,`FORCED`,`ASSOC-LANGUAGE`]).some(n=>e[n]!==t[n])}function QY(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||``).toLowerCase())}var $Y=class extends YY{constructor(e){super(e,`audio-track-controller`),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){let{hls:e}=this;e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Q.LEVEL_LOADING,this.onLevelLoading,this),e.on(Q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Q.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(Q.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Q.LEVEL_LOADING,this.onLevelLoading,this),e.off(Q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Q.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(Q.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){let{id:n,groupId:r,details:a}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==r){this.warn(`Audio track with id:${n} and group:${r} not found in active group ${o?.groupId}`);return}let s=o.details;o.details=t.details,this.log(`Audio track ${n} "${o.name}" lang:${o.lang} group:${r} loaded [${a.startSN}-${a.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,s)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let n=t.audioGroups||null,r=this.groupIds,a=this.currentTrack;if(!n||r?.length!==n?.length||n!=null&&n.some(e=>r?.indexOf(e)===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;let e=this.tracks.filter(e=>!n||n.indexOf(e.groupId)!==-1);if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!a&&!this.tracksInGroup.length)return;this.tracksInGroup=e;let t=this.hls.config.audioPreference;if(!a&&t){let n=cG(t,e,fG);if(n>-1)a=e[n];else{let e=cG(t,this.tracks);a=this.tracks[e]}}let r=this.findTrackId(a);r===-1&&a&&(r=this.findTrackId(null));let o={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${n?.join(`,`)}`),this.hls.trigger(Q.AUDIO_TRACKS_UPDATED,o);let s=this.trackId;if(r!==-1&&s===-1)this.setAudioTrack(r);else if(e.length&&s===-1){let t=Error(`No audio track selected for current audio group-ID(s): ${this.groupIds?.join(`,`)} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}}onError(e,t){t.fatal||!t.context||t.context.type===YH.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){let t=this.hls;if(t.config.audioPreference=e,e){let n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){let r=this.currentTrack;if(r&&lG(e,r,fG))return r;let a=cG(e,this.tracksInGroup,fG);if(a>-1){let e=this.tracksInGroup[a];return this.setAudioTrack(a),e}else if(r){let r=t.loadLevel;r===-1&&(r=t.firstAutoLevel);let a=pG(e,t.levels,n,r,fG);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){let t=cG(e,n);if(t>-1)return n[t]}}}return null}setAudioTrack(e){let t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;let n=this.currentTrack,r=t[e],a=r.details&&!r.details.live;if(e===this.trackId&&r===n&&a||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(Q.AUDIO_TRACK_SWITCHING,nU({},r)),a))return;let o=this.switchParams(r.url,n?.details,r.details);this.loadPlaylist(o)}findTrackId(e){let t=this.tracksInGroup;for(let n=0;n<t.length;n++){let r=t[n];if(!(this.selectDefaultTrack&&!r.default)&&(!e||lG(e,r,fG)))return n}if(e){let{name:n,lang:r,assocLang:a,characteristics:o,audioCodec:s,channels:c}=e;for(let e=0;e<t.length;e++){let l=t[e];if(lG({name:n,lang:r,assocLang:a,characteristics:o,audioCodec:s,channels:c},l,fG))return e}for(let n=0;n<t.length;n++){let r=t[n];if(ZY(e.attrs,r.attrs,[`LANGUAGE`,`ASSOC-LANGUAGE`,`CHARACTERISTICS`]))return n}for(let n=0;n<t.length;n++){let r=t[n];if(ZY(e.attrs,r.attrs,[`LANGUAGE`]))return n}}return-1}loadPlaylist(e){super.loadPlaylist();let t=this.currentTrack;this.shouldLoadPlaylist(t)&&hG(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let n=e.id,r=e.groupId,a=this.getUrlWithDirectives(e.url,t),o=e.details,s=o?.age;this.log(`Loading audio-track ${n} "${e.name}" lang:${e.lang} group:${r}${t?.msn===void 0?``:` at sn `+t.msn+` part `+t.part}${s&&o.live?` age `+s.toFixed(1)+(o.type&&` `+o.type||``):``} ${a}`),this.hls.trigger(Q.AUDIO_TRACK_LOADING,{url:a,id:n,groupId:r,deliveryDirectives:t||null,track:e})}},eX=class{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,n){if(this.queues===null||this.tracks===null)return;let r=this.queues[t];r.push(e),r.length===1&&!n&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{let n={label:`async-blocker`,execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){let n={label:`async-blocker-prepend`,execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(n)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{let t=e[0]?.label;(t===`async-blocker`||t===`async-blocker-prepend`)&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){this.queues!==null&&this.queues.audio[0]===e&&this.shiftAndExecuteNext(`audio`)}executeNext(e){if(this.queues===null||this.tracks===null)return;let t=this.queues[e];if(t.length){let n=t[0];try{n.execute()}catch(t){if(n.onError(t),this.queues===null||this.tracks===null)return;let r=this.tracks[e]?.buffer;r!=null&&r.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){return this.queues?.[e][0]||null}toString(){let{queues:e,tracks:t}=this;return e===null||t===null?`<destroyed>`:`
130
- ${this.list(`video`)}
131
- ${this.list(`audio`)}
132
- ${this.list(`audiovideo`)}}`}list(e){var t,n;return(t=this.queues)!=null&&t[e]||(n=this.tracks)!=null&&n[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:``}listSbInfo(e){let t=this.tracks?.[e],n=t?.buffer;return n?`SourceBuffer${n.updating?` updating`:``}${t.ended?` ended`:``}${t.ending?` ending`:``}`:`none`}listOps(e){return this.queues?.[e].map(e=>e.label).join(`, `)||``}},tX=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,nX=`HlsJsTrackRemovedError`,rX=class extends Error{constructor(e){super(e),this.name=nX}},iX=class extends aU{constructor(e,t){super(`buffer-controller`,e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=e=>{this.hls&&this.mediaSource?.readyState===`open`&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=e=>{let{media:t,mediaSource:n}=this;e&&this.log(`Media source opened`),!(!t||!n)&&(n.removeEventListener(`sourceopen`,this._onMediaSourceOpen),t.removeEventListener(`emptied`,this._onMediaEmptied),this.updateDuration(),this.hls.trigger(Q.MEDIA_ATTACHED,{media:t,mediaSource:n}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log(`Media source closed`)},this._onMediaSourceEnded=()=>{this.log(`Media source ended`)},this._onMediaEmptied=()=>{let{mediaSrc:e,_objectUrl:t}=this;e!==t&&this.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=hU(mU(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&=(this.operationQueue.destroy(),null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){let{hls:e}=this;e.on(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Q.BUFFER_RESET,this.onBufferReset,this),e.on(Q.BUFFER_APPENDING,this.onBufferAppending,this),e.on(Q.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Q.BUFFER_EOS,this.onBufferEos,this),e.on(Q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Q.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Q.FRAG_PARSED,this.onFragParsed,this),e.on(Q.FRAG_CHANGED,this.onFragChanged,this),e.on(Q.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Q.BUFFER_RESET,this.onBufferReset,this),e.off(Q.BUFFER_APPENDING,this.onBufferAppending,this),e.off(Q.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Q.BUFFER_EOS,this.onBufferEos,this),e.off(Q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Q.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Q.FRAG_PARSED,this.onFragParsed,this),e.off(Q.FRAG_CHANGED,this.onFragChanged,this),e.off(Q.ERROR,this.onError,this)}transferMedia(){let{media:e,mediaSource:t}=this;if(!e)return null;let n={};if(this.operationQueue){let e=this.isUpdating();e||this.operationQueue.removeBlockers();let t=this.isQueued();(e||t)&&this.warn(`Transfering MediaSource with${t?` operations in queue`:``}${e?` updating SourceBuffer(s)`:``} ${this.operationQueue}`),this.operationQueue.destroy()}let r=this.transferData;return!this.sourceBufferCount&&r&&r.mediaSource===t?eU(n,r.tracks):this.sourceBuffers.forEach(e=>{let[t]=e;t&&(n[t]=eU({},this.tracks[t]),this.removeBuffer(t)),e[0]=e[1]=null}),{media:e,mediaSource:t,tracks:n}}initTracks(){let e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var n;let r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsTotal=r,this.log(`${r} bufferCodec event(s) expected.`),(n=this.transferData)!=null&&n.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){let n=this.media=t.media;this.transferData=this.overrides=void 0;let r=mU(this.appendSource);if(r){let e=!!t.mediaSource;(e||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);let a=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(a),e)this._objectUrl=n.src,this.attachTransferred();else{let e=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{n.removeAttribute(`src`);let t=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||t&&a instanceof t,aX(n),oX(n,e),n.load()}catch{n.src=e}else n.src=e}n.addEventListener(`emptied`,this._onMediaEmptied)}}assignMediaSource(e){this.log(`${this.transferData?.mediaSource===e?`transferred`:`created`} media source: ${e.constructor?.name}`),e.addEventListener(`sourceopen`,this._onMediaSourceOpen),e.addEventListener(`sourceended`,this._onMediaSourceEnded),e.addEventListener(`sourceclose`,this._onMediaSourceClose),this.appendSource&&(e.addEventListener(`startstreaming`,this._onStartStreaming),e.addEventListener(`endstreaming`,this._onEndStreaming))}attachTransferred(){let e=this.media,t=this.transferData;if(!t||!e)return;let n=this.tracks,r=t.tracks,a=r?Object.keys(r):null,o=a?a.length:0,s=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&a&&o){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log(`attachTransferred: waiting for SourceBuffer track info`);return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
133
- required tracks: ${nG(n,(e,t)=>e===`initSegment`?void 0:t)};
134
- transfer tracks: ${nG(r,(e,t)=>e===`initSegment`?void 0:t)}}`),!gU(r,n)){t.mediaSource=null,t.tracks=void 0;let a=e.currentTime,o=this.details,s=Math.max(a,o?.fragments[0].start||0);if(s-a>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${a} -> ${s}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(n)}") start time: ${s} currentTime: ${a}`),this.onMediaDetaching(Q.MEDIA_DETACHING,{}),this.onMediaAttaching(Q.MEDIA_ATTACHING,t),e.currentTime=s;return}this.transferData=void 0,a.forEach(e=>{let t=e,n=r[t];if(n){let e=n.buffer;if(e){let r=this.fragmentTracker,a=n.id;if(r.hasFragments(a)||r.hasParts(a)){let n=oK.getBuffered(e);r.detectEvictedFragments(t,n,a,null,!0)}let o=sX(t),s=[t,e];this.sourceBuffers[o]=s,e.updating&&this.operationQueue&&this.operationQueue.prependBlocker(t),this.trackSourceBuffer(t,n)}}}),s(),this.bufferCreated()}else this.log(`attachTransferred: MediaSource w/o SourceBuffers`),s()}get mediaSourceOpenOrEnded(){let e=this.mediaSource?.readyState;return e===`open`||e===`ended`}onMediaDetaching(e,t){let n=!!t.transferMedia;this.transferData=this.overrides=void 0;let{media:r,mediaSource:a,_objectUrl:o}=this;if(a){if(this.log(`media source ${n?`transferring`:`detaching`}`),n)this.sourceBuffers.forEach(([e])=>{e&&this.removeBuffer(e)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){let e=a.readyState===`open`;try{let t=a.sourceBuffers;for(let n=t.length;n--;)e&&t[n].abort(),a.removeSourceBuffer(t[n]);e&&a.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}a.removeEventListener(`sourceopen`,this._onMediaSourceOpen),a.removeEventListener(`sourceended`,this._onMediaSourceEnded),a.removeEventListener(`sourceclose`,this._onMediaSourceClose),this.appendSource&&(a.removeEventListener(`startstreaming`,this._onStartStreaming),a.removeEventListener(`endstreaming`,this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener(`emptied`,this._onMediaEmptied),n||(o&&self.URL.revokeObjectURL(o),this.mediaSrc===o?(r.removeAttribute(`src`),this.appendSource&&aX(r),r.load()):this.warn(`media|source.src was changed by a third party - skip cleanup`)),this.media=null),this.hls.trigger(Q.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){let t=this.tracks[e]?.buffer;if(this.removeBuffer(e),t)try{var n;(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}catch(t){this.warn(`onBufferReset ${e}`,t)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[sX(e)]=[null,null];let t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new eX(this.tracks)}onBufferCodecs(e,t){let n=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);let a=`audiovideo`in t&&(n.audio||n.video)||n.audiovideo&&(`audio`in t||`video`in t),o=!a&&this.sourceBufferCount&&this.media&&r.some(e=>!n[e]);if(a||o){this.warn(`Unsupported transition between "${Object.keys(n)}" and "${r}" SourceBuffers`);return}r.forEach(e=>{var r;let{id:a,codec:o,levelCodec:s,container:c,metadata:l,supplemental:u}=t[e],d=n[e],f=(r=this.transferData)==null||(r=r.tracks)==null?void 0:r[e],p=f!=null&&f.buffer?f:d,m=p?.pendingCodec||p?.codec,h=p?.levelCodec;d||=n[e]={buffer:void 0,listeners:[],codec:o,supplemental:u,container:c,levelCodec:s,metadata:l,id:a};let g=DW(m,h),_=g?.replace(tX,`$1`),v=DW(o,s),y=v?.replace(tX,`$1`);v&&g&&_!==y&&(e.slice(0,5)===`audio`&&(v=TW(v,this.appendSource)),this.log(`switching codec ${m} to ${v}`),v!==(d.pendingCodec||d.codec)&&(d.pendingCodec=v),d.container=c,this.appendChangeType(e,c,v))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&t.audio?.id===`main`&&(this.log(`Main audio-only`),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{let n=this.tracks[t];return e[t]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e},{})}appendChangeType(e,t,n){let r=`${t};codecs=${n}`,a={label:`change-type=${r}`,execute:()=>{let a=this.tracks[e];if(a){let o=a.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),o.changeType(r),a.codec=n,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};this.append(a,e,this.isPending(this.tracks[e]))}blockAudio(e){let t=e.start,n=t+e.duration*.05;if(this.fragmentTracker.getAppendedFrag(t,XH.MAIN)?.gap===!0)return;let r={label:`block-audio`,execute:()=>{let e=this.tracks.video;(this.lastVideoAppendEnd>n||e!=null&&e.buffer&&oK.isBuffered(e.buffer,n)||this.fragmentTracker.getAppendedFrag(n,XH.MAIN)?.gap===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext(`audio`))},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn(`Error executing block-audio operation`,e)}};this.blockedAudioAppend={op:r,frag:e},this.append(r,`audio`,!0)}unblockAudio(){let{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){let{tracks:n}=this,{data:r,type:a,parent:o,frag:s,part:c,chunkMeta:l,offset:u}=t,d=l.buffering[a],{sn:f,cc:p}=s,m=self.performance.now();d.start=m;let h=s.stats.buffering,g=c?c.stats.buffering:null;h.start===0&&(h.start=m),g&&g.start===0&&(g.start=m);let _=n.audio,v=!1;a===`audio`&&_?.container===`audio/mpeg`&&(v=!this.lastMpegAudioChunk||l.id===1||this.lastMpegAudioChunk.sn!==l.sn,this.lastMpegAudioChunk=l);let y=n.video,b=y?.buffer;if(b&&f!==`initSegment`){let e=c||s,t=this.blockedAudioAppend;if(a===`audio`&&o!==`main`&&!this.blockedAudioAppend&&!(y.ending||y.ended)){let t=e.start+e.duration*.05,n=b.buffered,r=this.currentOp(`video`);(!n.length&&!r||!r&&!oK.isBuffered(b,t)&&this.lastVideoAppendEnd<t)&&this.blockAudio(e)}else if(a===`video`){let n=e.end;if(t){let e=t.frag.start;(n>e||n<this.lastVideoAppendEnd||oK.isBuffered(b,e))&&this.unblockAudio()}this.lastVideoAppendEnd=n}}let x=(c||s).start,S={label:`append-${a}`,execute:()=>{d.executeStart=self.performance.now();let e=this.tracks[a]?.buffer;e&&(v?this.updateTimestampOffset(e,x,.1,a,f,p):u!==void 0&&GH(u)&&this.updateTimestampOffset(e,u,1e-6,a,f,p)),this.appendExecutor(r,a)},onStart:()=>{},onComplete:()=>{let e=self.performance.now();d.executeEnd=d.end=e,h.first===0&&(h.first=e),g&&g.first===0&&(g.first=e);let t={};this.sourceBuffers.forEach(([e,n])=>{e&&(t[e]=oK.getBuffered(n))}),this.appendErrors[a]=0,a===`audio`||a===`video`?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(Q.BUFFER_APPENDED,{type:a,frag:s,part:c,chunkMeta:l,parent:s.type,timeRanges:t})},onError:e=>{let t={type:JH.MEDIA_ERROR,parent:s.type,details:Z.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:s,part:c,chunkMeta:l,error:e,err:e,fatal:!1},n=this.media?.error;if(e.code===DOMException.QUOTA_EXCEEDED_ERR||e.name==`QuotaExceededError`||`quota`in e)t.details=Z.BUFFER_FULL_ERROR;else if(e.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!n)t.errorAction=IG(!0);else if(e.name===nX&&this.sourceBufferCount===0)t.errorAction=IG(!0);else{let e=++this.appendErrors[a];this.warn(`Failed ${e}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer (${n||`no media error`})`),(e>=this.hls.config.appendErrorMaxRetry||n)&&(t.fatal=!0)}this.hls.trigger(Q.ERROR,t)}};this.log(`queuing "${a}" append sn: ${f}${c?` p: `+c.index:``} of ${s.type===XH.MAIN?`level`:`track`} ${s.level} cc: ${p}`),this.append(S,a,this.isPending(this.tracks[a]))}getFlushOp(e,t,n){return this.log(`queuing "${e}" remove ${t}-${n}`),{label:`remove`,execute:()=>{this.removeExecutor(e,t,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(Q.BUFFER_FLUSHED,{type:e})},onError:r=>{this.warn(`Failed to remove ${t}-${n} from "${e}" SourceBuffer`,r)}}}onBufferFlushing(e,t){let{type:n,startOffset:r,endOffset:a}=t;n?this.append(this.getFlushOp(n,r,a),n):this.sourceBuffers.forEach(([e])=>{e&&this.append(this.getFlushOp(e,r,a),e)})}onFragParsed(e,t){let{frag:n,part:r}=t,a=[],o=r?r.elementaryStreams:n.elementaryStreams;o[EU.AUDIOVIDEO]?a.push(`audiovideo`):(o[EU.AUDIO]&&a.push(`audio`),o[EU.VIDEO]&&a.push(`video`)),a.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(()=>{let e=self.performance.now();n.stats.buffering.end=e,r&&(r.stats.buffering.end=e);let t=r?r.stats:n.stats;this.hls.trigger(Q.FRAG_BUFFERED,{frag:n,part:r,stats:t,id:n.type})},a).catch(e=>{this.warn(`Fragment buffered callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){let t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){this.sourceBuffers.forEach(([e])=>{if(e){let n=this.tracks[e];(!t.type||t.type===e)&&(n.ending=!0,n.ended||(n.ended=!0,this.log(`${e} buffer reached EOS`)))}});let n=this.overrides?.endOfStream!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t;return e&&!((t=this.tracks[e])!=null&&t.ended)})?n?(this.log(`Queueing EOS`),this.blockUntilOpen(()=>{this.tracksEnded();let{mediaSource:e}=this;if(!e||e.readyState!==`open`){e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`);return}this.log(`Calling mediaSource.endOfStream()`),e.endOfStream(),this.hls.trigger(Q.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(Q.BUFFERED_TO_END,void 0)):t.type===`video`&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){let t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{let e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===Z.BUFFER_APPEND_ERROR&&t.frag){let e=t.errorAction?.nextAutoLevel;GH(e)&&e!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){let{hls:e,details:t,media:n}=this;if(!n||t===null||!this.sourceBufferCount)return;let r=e.config,a=n.currentTime,o=t.levelTargetDuration,s=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(GH(s)&&s>=0){let e=Math.max(s,o),t=Math.floor(a/o)*o-e;this.flushBackBuffer(a,o,t)}let c=r.frontBufferFlushThreshold;if(GH(c)&&c>0){let e=Math.max(r.maxBufferLength,c),t=Math.max(e,o),n=Math.floor(a/o)*o+t;this.flushFrontBuffer(a,o,n)}}flushBackBuffer(e,t,n){this.sourceBuffers.forEach(([e,t])=>{if(t){let a=oK.getBuffered(t);if(a.length>0&&n>a.start(0)){var r;this.hls.trigger(Q.BACK_BUFFER_REACHED,{bufferEnd:n});let t=this.tracks[e];if((r=this.details)!=null&&r.live)this.hls.trigger(Q.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(t!=null&&t.ended){this.log(`Cannot flush ${e} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(Q.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:e})}}})}flushFrontBuffer(e,t,n){this.sourceBuffers.forEach(([t,r])=>{if(r){let a=oK.getBuffered(r),o=a.length;if(o<2)return;let s=a.start(o-1),c=a.end(o-1);if(n>s||e>=s&&e<=c)return;this.hls.trigger(Q.BUFFER_FLUSHING,{startOffset:s,endOffset:1/0,type:t})}})}getDurationAndRange(){let{details:e,mediaSource:t}=this;if(!e||!this.media||t?.readyState!==`open`)return null;let n=e.edge;if(e.live&&this.hls.config.liveDurationInfinity){if(e.fragments.length&&t.setLiveSeekableRange){let t=Math.max(0,e.fragmentStart);return{duration:1/0,start:t,end:Math.max(t,n)}}return{duration:1/0}}let r=this.overrides?.duration;if(r)return GH(r)?{duration:r}:null;let a=this.media.duration;return n>(GH(t.duration)?t.duration:0)&&n>a||!GH(a)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:n}){let r=this.mediaSource;!this.media||!r||r.readyState!==`open`||(r.duration!==e&&(GH(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),t!==void 0&&n!==void 0&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${t}-${n}.`),r.setLiveSeekableRange(t,n)))}get tracksReady(){let e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){let{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${nG(n)}`),this.tracksReady){let e=this.transferData?.tracks;e&&Object.keys(e).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){let e={};this.sourceBuffers.forEach(([t,n])=>{if(t){let r=this.tracks[t];e[t]={buffer:n,container:r.container,codec:r.codec,supplemental:r.supplemental,levelCodec:r.levelCodec,id:r.id,metadata:r.metadata}}}),this.hls.trigger(Q.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([e])=>{this.executeNext(e)})}else{let e=Error(`could not create source buffer for media codec(s)`);this.hls.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){let{tracks:e,sourceBuffers:t,mediaSource:n}=this;if(!n)throw Error(`createSourceBuffers called when mediaSource was null`);for(let a in e){let o=a,s=e[o];if(this.isPending(s)){let e=this.getTrackCodec(s,o),a=`${s.container};codecs=${e}`;s.codec=e,this.log(`creating sourceBuffer(${a})${this.currentOp(o)?` Queued`:``} ${nG(s)}`);try{let e=n.addSourceBuffer(a),r=sX(o);t[r]=[o,e],s.buffer=e}catch(e){var r;this.error(`error while trying to add sourceBuffer: ${e.message}`),this.shiftAndExecuteNext(o),(r=this.operationQueue)==null||r.removeBlockers(),delete this.tracks[o],this.hls.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:o,mimeType:a,parent:s.id});return}this.trackSourceBuffer(o,s)}}this.bufferCreated()}getTrackCodec(e,t){let n=e.supplemental,r=e.codec;n&&(t===`video`||t===`audiovideo`)&&_W(n,`video`)&&(r=EW(r,n));let a=DW(r,e.levelCodec);return a?t.slice(0,5)===`audio`?TW(a,this.appendSource):a:``}trackSourceBuffer(e,t){let n=t.buffer;if(!n)return;let r=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:r,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,`updatestart`,this.onSBUpdateStart),this.addBufferListener(e,`updateend`,this.onSBUpdateEnd),this.addBufferListener(e,`error`,this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,`bufferedchange`,(e,t)=>{let n=t.removedRanges;n!=null&&n.length&&this.hls.trigger(Q.BUFFER_FLUSHED,{type:e})})}get mediaSrc(){var e,t;return(((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,`source`))||this.media)?.src}onSBUpdateStart(e){let t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){if(this.mediaSource?.readyState===`closed`){this.resetBuffer(e);return}let t=this.currentOp(e);t&&(t.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){let n=Error(`${e} SourceBuffer error. MediaSource readyState: ${this.mediaSource?.readyState}`);this.error(`${n}`,t),this.hls.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});let r=this.currentOp(e);r&&r.onError(n)}updateTimestampOffset(e,t,n,r,a,o){let s=t-e.timestampOffset;Math.abs(s)>=n&&(this.log(`Updating ${r} SourceBuffer timestampOffset to ${t} (sn: ${a} cc: ${o})`),e.timestampOffset=t)}removeExecutor(e,t,n){let{media:r,mediaSource:a}=this,o=this.tracks[e],s=o?.buffer;if(!r||!a||!s){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}let c=GH(r.duration)?r.duration:1/0,l=GH(a.duration)?a.duration:1/0,u=Math.max(0,t),d=Math.min(n,c,l);d>u&&(!o.ending||o.ended)?(o.ended=!1,this.log(`Removing [${u},${d}] from the ${e} SourceBuffer`),s.remove(u,d)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){let n=this.tracks[t],r=n?.buffer;if(!r)throw new rX(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,r.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(e=>{this.warn(`SourceBuffer blocked callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(e){this.warn(`Callback run without blocking ${this.operationQueue} ${e}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log(`Blocking operation requested, but no SourceBuffers exist`),Promise.resolve().then(e);let{operationQueue:n}=this,r=t.map(e=>this.appendBlocker(e));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(t=>{n===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(e=>{let t=this.tracks[e]?.buffer;!t||t.updating||this.shiftAndExecuteNext(e)})}append(e,t,n){this.operationQueue&&this.operationQueue.append(e,t,n)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+ +!!this.isPending(this.tracks[t]),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+ +!!t,0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,n){let r=this.tracks[e];if(!r)return;let a=r.buffer;if(!a)return;let o=n.bind(this,e);r.listeners.push({event:t,listener:o}),a.addEventListener(t,o)}removeBufferListeners(e){let t=this.tracks[e];if(!t)return;let n=t.buffer;n&&(t.listeners.forEach(e=>{n.removeEventListener(e.event,e.listener)}),t.listeners.length=0)}};function aX(e){let t=e.querySelectorAll(`source`);[].slice.call(t).forEach(t=>{e.removeChild(t)})}function oX(e,t){let n=self.document.createElement(`source`);n.type=`video/mp4`,n.src=t,e.appendChild(n)}function sX(e){return+(e===`audio`)}var cX=class e{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=1/0,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){let{hls:e}=this;e.on(Q.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Q.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Q.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){let{hls:e}=this;e.off(Q.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Q.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Q.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){let n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){let n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&GH(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}let e=this.hls.levels;if(e.length){let t=this.hls,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(t){let n=this.hls.levels;if(!n.length)return-1;let r=n.filter((e,n)=>this.isLevelAllowed(e)&&n<=t);return this.clientRect=null,e.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=1/0,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=1/0,this.timer&&=(self.clearInterval(this.timer),void 0)}getDimensions(){if(this.clientRect)return this.clientRect;let e=this.media,t={width:0,height:0};if(e){let n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;let r=(e,t)=>t?e.width!==t.width||e.height!==t.height:!0,a=e.length-1,o=Math.max(t,n);for(let t=0;t<e.length;t+=1){let n=e[t];if((n.width>=o||n.height>=o)&&r(n,e[t+1])){a=t;break}}return a}},lX={MANIFEST:`m`,AUDIO:`a`,VIDEO:`v`,MUXED:`av`,INIT:`i`,CAPTION:`c`,TIMED_TEXT:`tt`,KEY:`k`,OTHER:`o`},uX={HLS:`h`},dX=class e{constructor(t,n){Array.isArray(t)&&(t=t.map(t=>t instanceof e?t:new e(t))),this.value=t,this.params=n}},fX=`Dict`;function pX(e){return Array.isArray(e)?JSON.stringify(e):e instanceof Map?`Map{}`:e instanceof Set?`Set{}`:typeof e==`object`?JSON.stringify(e):String(e)}function mX(e,t,n,r){return Error(`failed to ${e} "${pX(t)}" as ${n}`,{cause:r})}function hX(e,t,n){return mX(`serialize`,e,t,n)}var gX=class{constructor(e){this.description=e}},_X=`Bare Item`,vX=`Boolean`;function yX(e){if(typeof e!=`boolean`)throw hX(e,vX);return e?`?1`:`?0`}function bX(e){return btoa(String.fromCharCode(...e))}var xX=`Byte Sequence`;function SX(e){if(ArrayBuffer.isView(e)===!1)throw hX(e,xX);return`:${bX(e)}:`}var CX=`Integer`;function wX(e){return e<-999999999999999||999999999999999<e}function TX(e){if(wX(e))throw hX(e,CX);return e.toString()}function EX(e){return`@${TX(e.getTime()/1e3)}`}function DX(e,t){if(e<0)return-DX(-e,t);let n=10**t;if(Math.abs(e*n%1-.5)<2**-52){let t=Math.floor(e*n);return(t%2==0?t:t+1)/n}else return Math.round(e*n)/n}var OX=`Decimal`;function kX(e){let t=DX(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw hX(e,OX);let n=t.toString();return n.includes(`.`)?n:`${n}.0`}var AX=`String`,jX=/[\x00-\x1f\x7f]+/;function MX(e){if(jX.test(e))throw hX(e,AX);return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function NX(e){return e.description||e.toString().slice(7,-1)}var PX=`Token`;function FX(e){let t=NX(e);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t)===!1)throw hX(t,PX);return t}function IX(e){switch(typeof e){case`number`:if(!GH(e))throw hX(e,_X);return Number.isInteger(e)?TX(e):kX(e);case`string`:return MX(e);case`symbol`:return FX(e);case`boolean`:return yX(e);case`object`:if(e instanceof Date)return EX(e);if(e instanceof Uint8Array)return SX(e);if(e instanceof gX)return FX(e);default:throw hX(e,_X)}}var LX=`Key`;function RX(e){if(/^[a-z*][a-z0-9\-_.*]*$/.test(e)===!1)throw hX(e,LX);return e}function zX(e){return e==null?``:Object.entries(e).map(([e,t])=>t===!0?`;${RX(e)}`:`;${RX(e)}=${IX(t)}`).join(``)}function BX(e){return e instanceof dX?`${IX(e.value)}${zX(e.params)}`:IX(e)}function VX(e){return`(${e.value.map(BX).join(` `)})${zX(e.params)}`}function HX(e,t={whitespace:!0}){if(typeof e!=`object`||!e)throw hX(e,fX);let n=e instanceof Map?e.entries():Object.entries(e),r=t?.whitespace?` `:``;return Array.from(n).map(([e,t])=>{t instanceof dX||(t=new dX(t));let n=RX(e);return t.value===!0?n+=zX(t.params):(n+=`=`,Array.isArray(t.value)?n+=VX(t):n+=BX(t)),n}).join(`,${r}`)}function UX(e,t){return HX(e,t)}var WX=`CMCD-Object`,GX=`CMCD-Request`,KX=`CMCD-Session`,qX=`CMCD-Status`,JX={br:WX,ab:WX,d:WX,ot:WX,tb:WX,tpb:WX,lb:WX,tab:WX,lab:WX,url:WX,pb:GX,bl:GX,tbl:GX,dl:GX,ltc:GX,mtp:GX,nor:GX,nrr:GX,rc:GX,sn:GX,sta:GX,su:GX,ttfb:GX,ttfbb:GX,ttlb:GX,cmsdd:GX,cmsds:GX,smrt:GX,df:GX,cs:GX,ts:GX,cid:KX,pr:KX,sf:KX,sid:KX,st:KX,v:KX,msd:KX,bs:qX,bsd:qX,cdn:qX,rtp:qX,bg:qX,pt:qX,ec:qX,e:qX},YX={REQUEST:GX};function XX(e){return Object.keys(e).reduce((t,n)=>{var r;return(r=e[n])==null||r.forEach(e=>t[e]=n),t},{})}function ZX(e,t){let n={};if(!e)return n;let r=Object.keys(e),a=t?XX(t):{};return r.reduce((t,n)=>{let r=JX[n]||a[n]||YX.REQUEST,o=t[r]??(t[r]={});return o[n]=e[n],t},n)}function QX(e){return[`ot`,`sf`,`st`,`e`,`sta`].includes(e)}function $X(e){return typeof e==`number`?GH(e):e!=null&&e!==``&&e!==!1}var eZ=`event`;function tZ(e,t){let n=new URL(e),r=new URL(t);if(n.origin!==r.origin)return e;let a=n.pathname.split(`/`).slice(1),o=r.pathname.split(`/`).slice(1,-1);for(;a[0]===o[0];)a.shift(),o.shift();for(;o.length;)o.shift(),a.unshift(`..`);return a.join(`/`)+n.search+n.hash}var nZ=e=>Math.round(e),rZ=(e,t)=>Array.isArray(e)?e.map(e=>rZ(e,t)):e instanceof dX&&typeof e.value==`string`?new dX(rZ(e.value,t),e.params):(t.baseUrl&&(e=tZ(e,t.baseUrl)),t.version===1?encodeURIComponent(e):e),iZ=e=>nZ(e/100)*100,aZ={br:nZ,d:nZ,bl:iZ,dl:iZ,mtp:iZ,nor:(e,t)=>{let n=e;return t.version>=2&&(e instanceof dX&&typeof e.value==`string`?n=new dX([e]):typeof e==`string`&&(n=[e])),rZ(n,t)},rtp:iZ,tb:nZ},oZ=`request`,sZ=`response`,cZ=`ab.bg.bl.br.bs.bsd.cdn.cid.cs.df.ec.lab.lb.ltc.msd.mtp.pb.pr.pt.sf.sid.sn.st.sta.tab.tb.tbl.tpb.ts.v`.split(`.`),lZ=[`e`],uZ=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function dZ(e){return uZ.test(e)}function fZ(e){return cZ.includes(e)||lZ.includes(e)||dZ(e)}var pZ=[`d`,`dl`,`nor`,`ot`,`rtp`,`su`];function mZ(e){return cZ.includes(e)||pZ.includes(e)||dZ(e)}var hZ=[`cmsdd`,`cmsds`,`rc`,`smrt`,`ttfb`,`ttfbb`,`ttlb`,`url`];function gZ(e){return cZ.includes(e)||pZ.includes(e)||hZ.includes(e)||dZ(e)}var _Z=[`bl`,`br`,`bs`,`cid`,`d`,`dl`,`mtp`,`nor`,`nrr`,`ot`,`pr`,`rtp`,`sf`,`sid`,`st`,`su`,`tb`,`v`];function vZ(e){return _Z.includes(e)||dZ(e)}var yZ={[sZ]:gZ,[eZ]:fZ,[oZ]:mZ};function bZ(e,t={}){let n={};if(typeof e!=`object`||!e)return n;let r=t.version||e.v||1,a=t.reportingMode||oZ,o=r===1?vZ:yZ[a],s=Object.keys(e).filter(o),c=t.filter;typeof c==`function`&&(s=s.filter(c));let l=a===sZ||a===eZ;l&&!s.includes(`ts`)&&s.push(`ts`),r>1&&!s.includes(`v`)&&s.push(`v`);let u=eU({},aZ,t.formatters),d={version:r,reportingMode:a,baseUrl:t.baseUrl};return s.sort().forEach(t=>{let a=e[t],o=u[t];if(typeof o==`function`&&(a=o(a,d)),t===`v`){if(r===1)return;a=r}t==`pr`&&a===1||(l&&t===`ts`&&!GH(a)&&(a=Date.now()),$X(a)&&(QX(t)&&typeof a==`string`&&(a=new gX(a)),n[t]=a))}),n}function xZ(e,t={}){let n={};if(!e)return n;let r=ZX(bZ(e,t),t?.customHeaderMap);return Object.entries(r).reduce((e,[t,n])=>{let r=UX(n,{whitespace:!1});return r&&(e[t]=r),e},n)}function SZ(e,t,n){return eU(e,xZ(t,n))}var CZ=`CMCD`;function wZ(e,t={}){return e?UX(bZ(e,t),{whitespace:!1}):``}function TZ(e,t={}){if(!e)return``;let n=wZ(e,t);return encodeURIComponent(n)}function EZ(e,t={}){return e?`${CZ}=${TZ(e,t)}`:``}var DZ=/CMCD=[^&#]+/;function OZ(e,t,n){let r=EZ(t,n);return r?DZ.test(e)?e.replace(DZ,r):`${e}${e.includes(`?`)?`&`:`?`}${r}`:e}var kZ=class{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||=!0,this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:lX.MANIFEST,su:!this.initialized})}catch(e){this.hls.logger.warn(`Could not generate manifest CMCD data.`,e)}},this.applyFragmentData=e=>{try{let{frag:t,part:n}=e,r=this.hls.levels[t.level],a=this.getObjectType(t),o={d:(n||t).duration*1e3,ot:a};(a===lX.VIDEO||a===lX.AUDIO||a==lX.MUXED)&&(o.br=r.bitrate/1e3,o.tb=this.getTopBandwidth(a)/1e3,o.bl=this.getBufferLength(a));let s=n?this.getNextPart(n):this.getNextFrag(t);s!=null&&s.url&&s.url!==t.url&&(o.nor=s.url),this.apply(e,o)}catch(e){this.hls.logger.warn(`Could not generate segment CMCD data.`,e)}},this.hls=e;let t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.sessionId,this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){let e=this.hls;e.on(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Q.MEDIA_DETACHED,this.onMediaDetached,this),e.on(Q.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){let e=this.hls;e.off(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Q.MEDIA_DETACHED,this.onMediaDetached,this),e.off(Q.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener(`waiting`,this.onWaiting),this.media.addEventListener(`playing`,this.onPlaying)}onMediaDetached(){this.media&&=(this.media.removeEventListener(`waiting`,this.onWaiting),this.media.removeEventListener(`playing`,this.onPlaying),null)}onBufferCreated(e,t){this.audioBuffer=t.tracks.audio?.buffer,this.videoBuffer=t.tracks.video?.buffer}createData(){return{v:1,sf:uX.HLS,sid:this.sid,cid:this.cid,pr:this.media?.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){eU(t,this.createData());let n=t.ot===lX.INIT||t.ot===lX.VIDEO||t.ot===lX.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su??=this.buffering;let{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((e,n)=>(r.includes(n)&&(e[n]=t[n]),e),{}));let a={baseUrl:e.url};this.useHeaders?(e.headers||={},SZ(e.headers,t,a)):e.url=OZ(e.url,t,a)}getNextFrag(e){let t=this.hls.levels[e.level]?.details;if(t){let n=e.sn-t.startSN;return t.fragments[n+1]}}getNextPart(e){var t;let{index:n,fragment:r}=e,a=(t=this.hls.levels[r.level])==null||(t=t.details)==null?void 0:t.partList;if(a){let{sn:e}=r;for(let t=a.length-1;t>=0;t--){let r=a[t];if(r.index===n&&r.fragment.sn===e)return a[t+1]}}}getObjectType(e){let{type:t}=e;if(t===`subtitle`)return lX.TIMED_TEXT;if(e.sn===`initSegment`)return lX.INIT;if(t===`audio`)return lX.AUDIO;if(t===`main`)return this.hls.audioTracks.length?lX.VIDEO:lX.MUXED}getTopBandwidth(e){let t=0,n,r=this.hls;if(e===lX.AUDIO)n=r.audioTracks;else{let e=r.maxAutoLevel,t=e>-1?e+1:r.levels.length;n=r.levels.slice(0,t)}return n.forEach(e=>{e.bitrate>t&&(t=e.bitrate)}),t>0?t:NaN}getBufferLength(e){let t=this.media,n=e===lX.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:oK.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){let{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new n(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,n,r){t(e),this.loader.load(e,n,r)}}}createFragmentLoader(){let{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new n(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,n,r){t(e),this.loader.load(e,n,r)}}}},AZ=3e5,jZ=class extends aU{constructor(e){super(`content-steering`,e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=`.`,this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){let e=this.hls;e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Q.ERROR,this.onError,this)}unregisterListeners(){let e=this.hls;e&&(e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Q.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){let e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&=(this.loader.destroy(),null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){let t=this.levels;t&&(this.levels=t.filter(t=>t!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=`.`,this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){let{contentSteering:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){let{errorAction:n}=t;if(n?.action===NG.SendAlternateToPenaltyBox&&n.flags===PG.MoveAllAlternatesMatchingHost){let e=this.levels,r=this._pathwayPriority,a=this.pathwayId;if(t.context){let{groupId:n,pathwayId:r,type:o}=t.context;n&&e?a=this.getPathwayForGroupId(n,o,a):r&&(a=r)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!r&&e&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),n.resolved=this.pathwayId!==a),t.details===Z.BUFFER_APPEND_ERROR&&!t.fatal?n.resolved=!0:n.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${e&&e.length} priorities: ${nG(r)} penalized: ${nG(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){let n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t,n=this.penalizedPathways,r=performance.now();Object.keys(n).forEach(e=>{r-n[e]>AZ&&delete n[e]});for(let r=0;r<e.length;r++){let a=e[r];if(a in n)continue;if(a===this.pathwayId)return;let o=this.hls.nextLoadLevel,s=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,Cq(t),this.hls.trigger(Q.LEVELS_UPDATED,{levels:t});let e=this.hls.levels[o];s&&e&&this.levels&&(e.attrs[`STABLE-VARIANT-ID`]!==s.attrs[`STABLE-VARIANT-ID`]&&e.bitrate!==s.bitrate&&this.log(`Unstable Pathways change from bitrate ${s.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,n){let r=this.getLevelsForPathway(n).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===YH.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===YH.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return n}clonePathways(e){let t=this.levels;if(!t)return;let n={},r={};e.forEach(e=>{let{ID:a,"BASE-ID":o,"URI-REPLACEMENT":s}=e;if(t.some(e=>e.pathwayId===a))return;let c=this.getLevelsForPathway(o).map(e=>{let t=new mK(e.attrs);t[`PATHWAY-ID`]=a;let o=t.AUDIO&&`${t.AUDIO}_clone_${a}`,c=t.SUBTITLES&&`${t.SUBTITLES}_clone_${a}`;o&&(n[t.AUDIO]=o,t.AUDIO=o),c&&(r[t.SUBTITLES]=c,t.SUBTITLES=c);let l=NZ(e.uri,t[`STABLE-VARIANT-ID`],`PER-VARIANT-URIS`,s),u=new ZW({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t<e.audioGroups.length;t++)u.addGroupId(`audio`,`${e.audioGroups[t]}_clone_${a}`);if(e.subtitleGroups)for(let t=1;t<e.subtitleGroups.length;t++)u.addGroupId(`text`,`${e.subtitleGroups[t]}_clone_${a}`);return u});t.push(...c),MZ(this.audioTracks,n,s,a),MZ(this.subtitleTracks,r,s,a)})}loadSteeringManifest(e){let t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!==`data:`){let e=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set(`_HLS_pathway`,this.pathwayId),r.searchParams.set(`_HLS_throughput`,``+e)}let a={responseType:`json`,url:r.href},o=t.steeringManifestLoadPolicy.default,s=o.errorRetry||o.timeoutRetry||{},c={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:s.maxNumRetry||0,retryDelay:s.retryDelayMs||0,maxRetryDelay:s.maxRetryDelayMs||0};this.log(`Requesting steering manifest: ${r}`),this.loader.load(a,c,{onSuccess:(e,t,n,a)=>{this.log(`Loaded steering manifest: "${r}"`);let o=e.data;if(o?.VERSION!==1){this.log(`Steering VERSION ${o.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=o.TTL;let{"RELOAD-URI":s,"PATHWAY-CLONES":c,"PATHWAY-PRIORITY":l}=o;if(s)try{this.uri=new self.URL(s,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${s}`);return}this.scheduleRefresh(this.uri||n.url),c&&this.clonePathways(c);let u={steeringManifest:o,url:r.toString()};this.hls.trigger(Q.STEERING_MANIFEST_LOADED,u),l&&this.updatePathwayPriority(l)},onError:(e,t,n,r)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),e.code===410){this.enabled=!1,this.log(`Steering manifest ${t.url} no longer available`);return}let a=this.timeToLoad*1e3;if(e.code===429){let e=this.loader;if(typeof e?.getResponseHeader==`function`){let t=e.getResponseHeader(`Retry-After`);t&&(a=parseFloat(t)*1e3)}this.log(`Steering manifest ${t.url} rate limited`);return}this.scheduleRefresh(this.uri||t.url,a)},onTimeout:(e,t,n)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}})}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{let t=this.hls?.media;if(t&&!t.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}};function MZ(e,t,n,r){e&&Object.keys(t).forEach(a=>{let o=e.filter(e=>e.groupId===a).map(e=>{let o=eU({},e);return o.details=void 0,o.attrs=new mK(o.attrs),o.url=o.attrs.URI=NZ(e.url,e.attrs[`STABLE-RENDITION-ID`],`PER-RENDITION-URIS`,n),o.groupId=o.attrs[`GROUP-ID`]=t[a],o.attrs[`PATHWAY-ID`]=r,o});e.push(...o)})}function NZ(e,t,n,r){let{HOST:a,PARAMS:o,[n]:s}=r,c;t&&(c=s?.[t],c&&(e=c));let l=new self.URL(e);return a&&!c&&(l.host=a),o&&Object.keys(o).sort().forEach(e=>{e&&l.searchParams.set(e,o[e])}),l.href}var PZ=class e extends aU{constructor(t){super(`eme`,t.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=e.CDMCleanupPromise?[e.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=e=>{let{initDataType:t,initData:n}=e,r=`"${e.type}" event: init data type: "${t}"`;if(this.debug(r),n!==null){if(!this.keyFormatPromise){let e=Object.keys(this.keySystemAccessPromises);e.length||(e=FK(this.config));let t=e.map(PK).filter(e=>!!e);this.keyFormatPromise=this.getKeyFormatPromise(t)}this.keyFormatPromise.then(a=>{let o=NK(a);if(t!==`sinf`||o!==jK.FAIRPLAY){this.log(`Ignoring "${e.type}" event with init data type: "${t}" for selected key-system ${o}`);return}let s;try{let e=IU(new Uint8Array(n)),t=eW(TK(JSON.parse(e).sinf));if(!t)throw Error(`'schm' box missing or not cbcs/cenc with schi > tenc`);s=new Uint8Array(t.subarray(8,24))}catch(e){this.warn(`${r} Failed to parse sinf: ${e}`);return}let c=vU(s),{keyIdToKeySessionPromise:l,mediaKeySessions:u}=this,d=l[c];for(let e=0;e<u.length;e++){let r=u[e],a=r.decryptdata;if(!a.keyId)continue;let o=vU(a.keyId);if(xK(s,a.keyId)||a.uri.replace(/-/g,``).indexOf(c)!==-1){if(d=l[o],!d)continue;if(a.pssh)break;delete l[o],a.pssh=new Uint8Array(n),a.keyId=s,d=l[c]=d.then(()=>this.generateRequestWithPreferredKeySession(r,t,n,`encrypted-event-key-match`)),d.catch(e=>this.handleError(e));break}}d||this.handleError(Error(`Key ID ${c} not encountered in playlist. Key-system sessions ${u.length}.`))}).catch(e=>this.handleError(e))}},this.onWaitingForKey=e=>{this.log(`"${e.type}" event`)},this.hls=t,this.config=t.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();let e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(Q.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Q.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Q.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(Q.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(Q.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Q.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Q.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(Q.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){let{drmSystems:t,widevineLicenseUrl:n}=this.config,r=t?.[e];if(r)return r.licenseUrl;if(e===jK.WIDEVINE&&n)return n}getLicenseServerUrlOrThrow(e){let t=this.getLicenseServerUrl(e);if(t===void 0)throw Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){let{drmSystems:t}=this.config,n=t?.[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){let t=this.hls.levels,n=(e,t,n)=>!!e&&n.indexOf(e)===t,r=t.map(e=>e.audioCodec).filter(n),a=t.map(e=>e.videoCodec).filter(n);return r.length+a.length===0&&a.push(`avc1.42e01e`),new Promise((t,n)=>{let o=e=>{let s=e.shift();this.getMediaKeysPromise(s,r,a).then(e=>t({keySystem:s,mediaKeys:e})).catch(t=>{e.length?o(e):t instanceof LZ?n(t):n(new LZ({type:JH.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})};o(e)})}requestMediaKeySystemAccess(e,t){let{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!=`function`){let e=`Configured requestMediaKeySystemAccess is not a function ${n}`;return IK===null&&self.location.protocol===`http:`&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(Error(e))}return n(e,t)}getMediaKeysPromise(e,t,n){let r=LK(e,t,n,this.config.drmSystemOptions||{}),a=this.keySystemAccessPromises[e],o=a?.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${nG(r)}`),o=this.requestMediaKeySystemAccess(e,r);let t=a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)}),o.then(n=>{this.log(`Access for key-system "${n.keySystem}" obtained`);let r=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);let a=t.mediaKeys=n.createMediaKeys().then(n=>(this.log(`Media-keys created for "${e}"`),t.hasMediaKeys=!0,r.then(t=>t?this.setMediaKeysServerCertificate(n,e,t):n)));return a.catch(t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)}),a})}return o.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${vU(e.keyId||[])} keyUri: ${e.uri}`);let r={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:n.createSession(),keyStatus:`status-pending`};return this.mediaKeySessions.push(r),r}renewKeySession(e){let t=e.decryptdata;if(t.pssh){let n=this.createMediaKeySessionContext(e),r=FZ(t);this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(n,`cenc`,t.pssh.buffer,`expired`)}else this.warn(`Could not renew expired session. Missing pssh initData.`);this.removeSession(e)}updateKeySession(e,t){let n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyId ${vU(e.decryptdata.keyId||[])}
135
- } (data length: ${t.byteLength})`),n.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>PK(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:e,mediaKeys:t})=>this.attemptSetMediaKeys(e,t))}selectKeySystem(e){return new Promise((t,n)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:e})=>{let r=PK(e);r?t(r):n(Error(`Unable to find format for key-system "${e}"`))}).catch(n)})}selectKeySystemFormat(e){let t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||=(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(`, `)}`),this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){let t=FK(this.config),n=e.map(NK).filter(e=>!!e&&t.indexOf(e)!==-1);return this.selectKeySystem(n)}getKeyStatus(e){let{mediaKeySessions:t}=this;for(let n=0;n<t.length;n++){let r=IZ(e,t[n]);if(r)return r}}loadKey(e){let t=e.keyInfo.decryptdata,n=FZ(t),r=this.bannedKeyIds[n];if(r||this.getKeyStatus(t)===`internal-error`){let n=RZ(r||`internal-error`,t);return this.handleError(n,e.frag),Promise.reject(n)}let a=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${a}`);let o=this.keyIdToKeySessionPromise[n];if(!o){let r=this.getKeySystemForKeyPromise(t).then(({keySystem:n,mediaKeys:r})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${a}`),this.attemptSetMediaKeys(n,r).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:n,mediaKeys:r,decryptdata:t}))))).then(e=>{let n=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(e,`cenc`,n,`playlist-key`)});return r.catch(t=>this.handleError(t,e.frag)),this.keyIdToKeySessionPromise[n]=r,r}return o.catch(n=>{if(n instanceof LZ){let r=nU({},n.data);this.getKeyStatus(t)===`internal-error`&&(r.decryptdata=t);let a=new LZ(r,n.message);this.handleError(a,e.frag)}}),o}throwIfDestroyed(e=`Invalid state`){if(!this.hls)throw Error(`invalid state`)}handleError(e,t){if(this.hls)if(e instanceof LZ){t&&(e.data.frag=t);let n=e.data.decryptdata;this.error(`${e.message}${n?` (${vU(n.keyId||[])})`:``}`),this.hls.trigger(Q.ERROR,e.data)}else this.error(e.message),this.hls.trigger(Q.ERROR,{type:JH.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){let t=FZ(e),n=this.keyIdToKeySessionPromise[t];if(!n){let t=NK(e.keyFormat),n=t?[t]:FK(this.config);return this.attemptKeySystemAccess(n)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=FK(this.config)),e.length===0)throw new LZ({type:JH.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${nG({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();let n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);let r=Promise.all(n).then(()=>this.media?this.media.setMediaKeys(t):new Promise((e,n)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return n(Error(`Attempted to set mediaKeys without media element attached`));this.mediaKeys=t,this.media.setMediaKeys(t).then(e).catch(n)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(e=>n.indexOf(e)===-1)})}generateRequestWithPreferredKeySession(e,t,n,r){var a;let o=(a=this.config.drmSystems)==null||(a=a[e.keySystem])==null?void 0:a.generateRequest;if(o)try{let r=o.call(this.hls,t,n,e);if(!r)throw Error(`Invalid response from configured generateRequest filter`);t=r.initDataType,n=r.initData?r.initData:null,e.decryptdata.pssh=n?new Uint8Array(n):null}catch(e){if(this.warn(e.message),this.hls&&this.hls.config.debug)throw e}if(n===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);let s=FZ(e.decryptdata),c=e.decryptdata.uri;this.log(`Generating key-session request for "${r}" keyId: ${s} URI: ${c} (init data type: ${t} length: ${n.byteLength})`);let l=new Uq,u=e._onmessage=t=>{let n=e.mediaKeysSession;if(!n){l.emit(`error`,Error(`invalid state`));return}let{messageType:r,message:a}=t;this.log(`"${r}" message event for session "${n.sessionId}" message size: ${a.byteLength}`),r===`license-request`||r===`license-renewal`?this.renewLicense(e,a).catch(e=>{l.eventNames().length?l.emit(`error`,e):this.handleError(e)}):r===`license-release`?e.keySystem===jK.FAIRPLAY&&this.updateKeySession(e,EK(`acknowledged`)).then(()=>this.removeSession(e)).catch(e=>this.handleError(e)):this.warn(`unhandled media key message type "${r}"`)},d=(e,t)=>{t.keyStatus=e;let n;e.startsWith(`usable`)?l.emit(`resolved`):e===`internal-error`||e===`output-restricted`||e===`output-downscaled`?n=RZ(e,t.decryptdata):e===`expired`?n=Error(`key expired (keyId: ${s})`):e===`released`?n=Error(`key released`):e===`status-pending`||this.warn(`unhandled key status change "${e}" (keyId: ${s})`),n&&(l.eventNames().length?l.emit(`error`,n):this.handleError(n))},f=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession){l.emit(`error`,Error(`invalid state`));return}let n=this.getKeyStatuses(e);if(!Object.keys(n).some(e=>n[e]!==`status-pending`))return;if(n[s]===`expired`){this.log(`Expired key ${nG(n)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let r=n[s];if(r)d(r,e);else{var a;let t=1e3;e.keyStatusTimeouts||={},(a=e.keyStatusTimeouts)[s]||(a[s]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;let n=this.getKeyStatus(e.decryptdata);if(n&&n!==`status-pending`)return this.log(`No status for keyId ${s} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${n} from other session.`),d(n,e);this.log(`key status for ${s} in key-session "${e.mediaKeysSession.sessionId}" timed out after ${t}ms`),r=`internal-error`,d(r,e)},t)),this.log(`No status for keyId ${s} (${nG(n)}).`)}};Nq(e.mediaKeysSession,`message`,u),Nq(e.mediaKeysSession,`keystatuseschange`,f);let p=new Promise((e,t)=>{l.on(`error`,t),l.on(`resolved`,e)});return e.mediaKeysSession.generateRequest(t,n).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${s} URI: ${c}`)}).catch(t=>{throw new LZ({type:JH.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_SESSION,error:t,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${t}`)}).then(()=>p).catch(t=>(l.removeAllListeners(),this.removeSession(e).then(()=>{throw t}))).then(()=>(l.removeAllListeners(),e))}getKeyStatuses(e){let t={};return e.mediaKeysSession.keyStatuses.forEach((n,r)=>{if(typeof r==`string`&&typeof n==`object`){let e=r;r=n,n=e}let a=`buffer`in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r);if(e.keySystem===jK.PLAYREADY&&a.length===16){let e=vU(a);t[e]=n,OK(a)}let o=vU(a);n===`internal-error`&&(this.bannedKeyIds[o]=n),this.log(`key status change "${n}" for keyStatuses keyId: ${o} key-session "${e.mediaKeysSession.sessionId}"`),t[o]=n}),t}fetchServerCertificate(e){let t=this.config,n=t.loader,r=new n(t),a=this.getServerCertificateUrl(e);return a?(this.log(`Fetching server certificate for "${e}"`),new Promise((n,o)=>{let s={responseType:`arraybuffer`,url:a},c=t.certLoadPolicy.default,l={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};r.load(s,l,{onSuccess:(e,t,r,a)=>{n(e.data)},onError:(t,n,r,c)=>{o(new LZ({type:JH.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:nU({url:s.url,data:void 0},t)},`"${e}" certificate request failed (${a}). Status: ${t.code} (${t.text})`))},onTimeout:(t,n,r)=>{o(new LZ({type:JH.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:s.url,data:void 0}},`"${e}" certificate request timed out (${a})`))},onAbort:(e,t,n)=>{o(Error(`aborted`))}})})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((r,a)=>{e.setServerCertificate(n).then(a=>{this.log(`setServerCertificate ${a?`success`:`not supported by CDM`} (${n.byteLength}) on "${t}"`),r(e)}).catch(e=>{a(new LZ({type:JH.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(t=>this.updateKeySession(e,new Uint8Array(t)).catch(t=>{throw new LZ({type:JH.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:t,fatal:!1},t.message)}))}unpackPlayReadyKeyMessage(e,t){let n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes(`PlayReadyKeyMessage`))return e.setRequestHeader(`Content-Type`,`text/xml; charset=utf-8`),t;let r=new DOMParser().parseFromString(n,`application/xml`),a=r.querySelectorAll(`HttpHeader`);if(a.length>0){let t;for(let n=0,r=a.length;n<r;n++){t=a[n];let r=t.querySelector(`name`)?.textContent,o=t.querySelector(`value`)?.textContent;r&&o&&e.setRequestHeader(r,o)}}let o=r.querySelector(`Challenge`)?.textContent;if(!o)throw Error(`Cannot find <Challenge> in key message`);return EK(atob(o))}setupLicenseXHR(e,t,n,r){let a=this.config.licenseXhrSetup;return a?Promise.resolve().then(()=>{if(!n.decryptdata)throw Error(`Key removed`);return a.call(this.hls,e,t,n,r)}).catch(o=>{if(!n.decryptdata)throw o;return e.open(`POST`,t,!0),a.call(this.hls,e,t,n,r)}).then(n=>(e.readyState||e.open(`POST`,t,!0),{xhr:e,licenseChallenge:n||r})):(e.open(`POST`,t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){let n=this.config.keyLoadPolicy.default;return new Promise((r,a)=>{let o=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${o}`);let s=new XMLHttpRequest;s.responseType=`arraybuffer`,s.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return a(Error(`invalid state`));if(s.readyState===4)if(s.status===200){this._requestLicenseFailureCount=0;let t=s.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);let n=this.config.licenseResponseCallback;if(n)try{t=n.call(this.hls,s,o,e)}catch(e){this.error(e)}r(t)}else{let c=n.errorRetry,l=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||s.status>=400&&s.status<500)a(new LZ({type:JH.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:s,response:{url:o,data:void 0,code:s.status,text:s.statusText}},`License Request XHR failed (${o}). Status: ${s.status} (${s.statusText})`));else{let n=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${n} attempts left`),this.requestLicense(e,t).then(r,a)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=s,this.setupLicenseXHR(s,o,e,t).then(({xhr:t,licenseChallenge:n})=>{e.keySystem==jK.PLAYREADY&&(n=this.unpackPlayReadyKeyMessage(t,n)),t.send(n)}).catch(a)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;let n=t.media;this.media=n,Nq(n,`encrypted`,this.onMediaEncrypted),Nq(n,`waitingforkey`,this.onWaitingForKey);let r=this.mediaResolved;r?r():this.mediaKeys=n.mediaKeys}onMediaDetached(){let e=this.media;e&&(Pq(e,`encrypted`,this.onMediaEncrypted),Pq(e,`waitingforkey`,this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var t;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};let n=this.mediaResolved;if(n&&n(),!this.mediaKeys&&!this.mediaKeySessions.length)return;let r=this.media,a=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,HK.clearKeyUriToKeyIdMap();let o=a.length;e.CDMCleanupPromise=Promise.all(a.map(e=>this.removeSession(e)).concat((r==null||(t=r.setMediaKeys(null))==null?void 0:t.catch(e=>{this.log(`Could not clear media keys: ${e}`),this.hls&&this.hls.trigger(Q.ERROR,{type:JH.OTHER_ERROR,details:Z.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:Error(`Could not clear media keys: ${e}`)})}))||Promise.resolve())).catch(e=>{this.log(`Could not close sessions and clear media keys: ${e}`),this.hls&&this.hls.trigger(Q.ERROR,{type:JH.OTHER_ERROR,details:Z.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:Error(`Could not close sessions and clear media keys: ${e}`)})}).then(()=>{o&&this.log(`finished closing key sessions and clearing media keys`)})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){let e=t.reduce((e,t)=>(e.indexOf(t.keyFormat)===-1&&e.push(t.keyFormat),e),[]);this.log(`Selecting key-system from session-keys ${e.join(`, `)}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){let{mediaKeysSession:t,licenseXhr:n,decryptdata:r}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${vU(r?.keyId||[])}`),e._onmessage&&=(t.removeEventListener(`message`,e._onmessage),void 0),e._onkeystatuseschange&&=(t.removeEventListener(`keystatuseschange`,e._onkeystatuseschange),void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;let a=this.mediaKeySessions.indexOf(e);a>-1&&this.mediaKeySessions.splice(a,1);let{keyStatusTimeouts:o}=e;o&&Object.keys(o).forEach(e=>self.clearTimeout(o[e]));let{drmSystemOptions:s}=this.config;return(zK(s)?new Promise((e,n)=>{self.setTimeout(()=>n(Error(`MediaKeySession.remove() timeout`)),8e3),t.remove().then(e).catch(n)}):Promise.resolve()).catch(e=>{this.log(`Could not remove session: ${e}`),this.hls&&this.hls.trigger(Q.ERROR,{type:JH.OTHER_ERROR,details:Z.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:Error(`Could not remove session: ${e}`)})}).then(()=>t.close()).catch(e=>{this.log(`Could not close session: ${e}`),this.hls&&this.hls.trigger(Q.ERROR,{type:JH.OTHER_ERROR,details:Z.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:Error(`Could not close session: ${e}`)})})}return Promise.resolve()}};PZ.CDMCleanupPromise=void 0;function FZ(e){if(!e)throw Error(`Could not read keyId of undefined decryptdata`);if(e.keyId===null)throw Error(`keyId is null`);return vU(e.keyId)}function IZ(e,t){if(e.keyId&&t.mediaKeysSession.keyStatuses.has(e.keyId))return t.mediaKeysSession.keyStatuses.get(e.keyId);if(e.matches(t.decryptdata))return t.keyStatus}var LZ=class extends Error{constructor(e,t){super(t),this.data=void 0,e.error||=Error(t),this.data=e,e.err=e.error}};function RZ(e,t){let n=e===`output-restricted`,r=n?Z.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:Z.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new LZ({type:JH.KEY_SYSTEM_ERROR,details:r,fatal:!1,decryptdata:t},n?`HDCP level output restricted`:`key status changed to "${e}"`)}var zZ=class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(Q.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(Q.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){let n=this.hls.config;if(n.capLevelOnFPSDrop){let e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&typeof e.getVideoPlaybackQuality==`function`&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,n){let r=performance.now();if(t){if(this.lastTime){let e=r-this.lastTime,a=n-this.lastDroppedFrames,o=t-this.lastDecodedFrames,s=1e3*a/e,c=this.hls;if(c.trigger(Q.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:n}),s>0&&a>c.config.fpsDroppedMonitoringThreshold*o){let e=c.currentLevel;c.logger.warn(`drop FPS ratio greater than max allowed value for currentLevel: `+e),e>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=e)&&(--e,c.trigger(Q.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:c.currentLevel}),c.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=n,this.lastDecodedFrames=t}}checkFPSInterval(){let e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){let t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}};function BZ(e,t){let n;try{n=new Event(`addtrack`)}catch{n=document.createEvent(`Event`),n.initEvent(`addtrack`,!1,!1)}n.track=e,t.dispatchEvent(n)}function VZ(e,t){let n=e.mode;if(n===`disabled`&&(e.mode=`hidden`),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw Error(`addCue is failed for: ${t}`)}catch(n){pU.debug(`[texttrack-utils]: ${n}`);try{let n=new self.TextTrackCue(t.startTime,t.endTime,t.text);n.id=t.id,e.addCue(n)}catch(e){pU.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}n===`disabled`&&(e.mode=n)}function HZ(e,t){let n=e.mode;if(n===`disabled`&&(e.mode=`hidden`),e.cues)for(let n=e.cues.length;n--;)t&&e.cues[n].removeEventListener(`enter`,t),e.removeCue(e.cues[n]);n===`disabled`&&(e.mode=n)}function UZ(e,t,n,r){let a=e.mode;if(a===`disabled`&&(e.mode=`hidden`),e.cues&&e.cues.length>0){let a=GZ(e.cues,t,n);for(let t=0;t<a.length;t++)(!r||r(a[t]))&&e.removeCue(a[t])}a===`disabled`&&(e.mode=a)}function WZ(e,t){if(t<=e[0].startTime)return 0;let n=e.length-1;if(t>e[n].endTime)return-1;let r=0,a=n,o;for(;r<=a;)if(o=Math.floor((a+r)/2),t<e[o].startTime)a=o-1;else if(t>e[o].startTime&&r<n)r=o+1;else return o;return e[r].startTime-t<t-e[a].startTime?r:a}function GZ(e,t,n){let r=[],a=WZ(e,t);if(a>-1)for(let o=a,s=e.length;o<s;o++){let a=e[o];if(a.startTime>=t&&a.endTime<=n)r.push(a);else if(a.startTime>n)return r}return r}function KZ(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];(r.kind===`subtitles`||r.kind===`captions`)&&r.label&&t.push(e[n])}return t}var qZ=class extends YY{constructor(e){super(e,`subtitle-track-controller`),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null,t=KZ(this.media.textTracks);for(let n=0;n<t.length;n++)if(t[n].mode===`hidden`)e=t[n];else if(t[n].mode===`showing`){e=t[n];break}let n=this.findTrackForTextTrack(e);this.subtitleTrack!==n&&this.setSubtitleTrack(n)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){let{hls:e}=this;e.on(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Q.LEVEL_LOADING,this.onLevelLoading,this),e.on(Q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Q.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Q.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Q.LEVEL_LOADING,this.onLevelLoading,this),e.off(Q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Q.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Q.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&`onchange`in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener(`change`,this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){let n=this.media;if(!n)return;let r=!!t.transferMedia;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener(`change`,this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,!r&&KZ(n.textTracks).forEach(e=>{HZ(e)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){let{id:n,groupId:r,details:a}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==r){this.warn(`Subtitle track with id:${n} and group:${r} not found in active group ${o?.groupId}`);return}let s=o.details;o.details=t.details,this.log(`Subtitle track ${n} "${o.name}" lang:${o.lang} group:${r} loaded [${a.startSN}-${a.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,s)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let n=t.subtitleGroups||null,r=this.groupIds,a=this.currentTrack;if(!n||r?.length!==n?.length||n!=null&&n.some(e=>r?.indexOf(e)===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;let e=this.tracks.filter(e=>!n||n.indexOf(e.groupId)!==-1);if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!a&&!this.tracksInGroup.length)return;this.tracksInGroup=e;let t=this.hls.config.subtitlePreference;if(!a&&t){this.selectDefaultTrack=!1;let n=cG(t,e);if(n>-1)a=e[n];else{let e=cG(t,this.tracks);a=this.tracks[e]}}let r=this.findTrackId(a);r===-1&&a&&(r=this.findTrackId(null));let o={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${n?.join(`,`)}" group-id`),this.hls.trigger(Q.SUBTITLE_TRACKS_UPDATED,o),r!==-1&&this.trackId===-1&&this.setSubtitleTrack(r)}}findTrackId(e){let t=this.tracksInGroup,n=this.selectDefaultTrack;for(let r=0;r<t.length;r++){let a=t[r];if(!(n&&!a.default||!n&&!e)&&(!e||lG(a,e)))return r}if(e){for(let n=0;n<t.length;n++){let r=t[n];if(ZY(e.attrs,r.attrs,[`LANGUAGE`,`ASSOC-LANGUAGE`,`CHARACTERISTICS`]))return n}for(let n=0;n<t.length;n++){let r=t[n];if(ZY(e.attrs,r.attrs,[`LANGUAGE`]))return n}}return-1}findTrackForTextTrack(e){if(e){let t=this.tracksInGroup;for(let n=0;n<t.length;n++){let r=t[n];if(QY(r,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===YH.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;let t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){let n=this.currentTrack;if(n&&lG(e,n))return n;let r=cG(e,this.tracksInGroup);if(r>-1){let e=this.tracksInGroup[r];return this.setSubtitleTrack(r),e}else if(n)return null;else{let n=cG(e,t);if(n>-1)return t[n]}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let n=e.id,r=e.groupId,a=this.getUrlWithDirectives(e.url,t),o=e.details,s=o?.age;this.log(`Loading subtitle ${n} "${e.name}" lang:${e.lang} group:${r}${t?.msn===void 0?``:` at sn `+t.msn+` part `+t.part}${s&&o.live?` age `+s.toFixed(1)+(o.type&&` `+o.type||``):``} ${a}`),this.hls.trigger(Q.SUBTITLE_TRACK_LOADING,{url:a,id:n,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){let{media:e}=this;if(!e)return;let t=KZ(e.textTracks),n=this.currentTrack,r;if(n&&(r=t.filter(e=>QY(n,e))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(e=>{e.mode!==`disabled`&&e!==r&&(e.mode=`disabled`)}),r){let e=this.subtitleDisplay?`showing`:`hidden`;r.mode!==e&&(r.mode=e)}}setSubtitleTrack(e){let t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!GH(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;let n=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(Q.SUBTITLE_TRACK_SWITCH,{id:e});return}let a=!!r.details&&!r.details.live;if(e===this.trackId&&r===n&&a)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:``));let{id:o,groupId:s=``,name:c,type:l,url:u}=r;this.hls.trigger(Q.SUBTITLE_TRACK_SWITCH,{id:o,groupId:s,name:c,type:l,url:u});let d=this.switchParams(r.url,n?.details,r.details);this.loadPlaylist(d)}};function JZ(){try{return crypto.randomUUID()}catch{try{let e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf(`/`)+1)}catch{let e=new Date().getTime();return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t==`x`?n:n&3|8).toString(16)})}}}function YZ(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0).toString()}var XZ=.025,ZZ=function(e){return e[e.Point=0]=`Point`,e[e.Range=1]=`Range`,e}({});function QZ(e,t,n){return`${e.identifier}-${n+1}-${YZ(t)}`}var $Z=class{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat(`X-RESUME-OFFSET`,this.resumeOffset),this.playoutLimit=e.attr.optionalFloat(`X-PLAYOUT-LIMIT`,this.playoutLimit),this.restrictions=e.attr.enumeratedStringList(`X-RESTRICT`,this.restrictions),this.snapOptions=e.attr.enumeratedStringList(`X-SNAP`,this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){if(e>0&&e>=this.assetList.length)return!0;let t=this.playoutLimit;return e<=0||isNaN(t)?!1:t===0?!0:(this.assetList[e]?.startOffset||0)>t}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){let e=this.dateRange.startTime;if(this.snapOptions.out){let t=this.dateRange.tagAnchor;if(t)return eQ(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;let e=this.dateRange.tagAnchor;if(e){let t=this.dateRange.startTime;return t-eQ(t,e)<.1}return!1}get resumptionOffset(){let e=this.resumeOffset,t=GH(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){let e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){let t=this.resumeAnchor;if(t)return eQ(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<XZ))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart===null?this.startTime:this._timelineStart}set timelineStart(e){this._timelineStart=e}get duration(){let e=this.playoutLimit,t;return t=this._duration===null?this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0:this._duration,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr[`X-TIMELINE-OCCUPIES`]===`RANGE`?ZZ.Range:ZZ.Point}get supplementsPrimary(){return this.dateRange.attr[`X-TIMELINE-STYLE`]===`PRIMARY`}get contentMayVary(){return this.dateRange.attr[`X-CONTENT-MAY-VARY`]!==`NO`}get assetUrl(){return this.dateRange.attr[`X-ASSET-URI`]}get assetListUrl(){return this.dateRange.attr[`X-ASSET-LIST`]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return rQ(this)}};function eQ(e,t){return e-t.start<t.duration/2&&!(Math.abs(e-(t.start+t.duration))<XZ)?t.start:t.start+t.duration}function tQ(e,t,n){let r=new self.URL(e,n);return r.protocol!==`data:`&&r.searchParams.set(`_HLS_primary_id`,t),r}function nQ(e,t){for(;(n=e.assetList[++t])!=null&&n.error;)var n;return t}function rQ(e){return`["${e.identifier}" ${e.cue.pre?`<pre>`:e.cue.post?`<post>`:``}${e.timelineStart.toFixed(2)}-${e.resumeTime.toFixed(2)}]`}function iQ(e){let t=e.timelineStart,n=e.duration||0;return`["${e.identifier}" ${t.toFixed(2)}-${(t+n).toFixed(2)}]`}var aQ=class{constructor(e,t,n,r){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(Q.PLAYOUT_LIMIT_REACHED,{})};let a=this.hls=new e(t);this.interstitial=n,this.assetItem=r;let o=()=>{this.hasDetails=!0};a.once(Q.LEVEL_LOADED,o),a.once(Q.AUDIO_TRACK_LOADED,o),a.once(Q.SUBTITLE_TRACK_LOADED,o),a.on(Q.MEDIA_ATTACHING,(e,{media:t})=>{this.removeMediaListeners(),this.mediaAttached=t,this.interstitial.playoutLimit&&(t.addEventListener(`timeupdate`,this.checkPlayout),this.appendInPlace&&a.on(Q.BUFFER_APPENDED,()=>{let e=this.bufferedEnd;this.reachedPlayout(e)&&(this._bufferedEosTime=e,a.trigger(Q.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){let e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=tQ(t,e.config.primarySessionId||``).href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;let n=Math.min(this._bufferedEosTime||1/0,this.duration),r=this.timelineOffset,a=oK.bufferInfo(e,r,0);return this.getAssetTime(a.end)>=n-.02}reachedPlayout(e){let t=this.interstitial.playoutLimit;return this.startOffset+e>=t}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){return this.hls?.media||null}get bufferedEnd(){let e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;let t=oK.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){let e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){let e=this.assetItem.duration;if(!e)return 0;let t=this.interstitial.playoutLimit;if(t){let n=t-this.startOffset;if(n>0&&n<e)return n}return e}get remaining(){let e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){return this.hls?.config.timelineOffset||0}set timelineOffset(e){let t=this.timelineOffset;if(e!==t){let n=e-t;if(Math.abs(n)>1/9e4&&this.hls){if(this.hasDetails)throw Error(`Cannot set timelineOffset after playlists are loaded`);this.hls.config.timelineOffset=e}}}getAssetTime(e){let t=this.timelineOffset,n=this.duration;return Math.min(Math.max(0,e-t),n)}removeMediaListeners(){let e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener(`timeupdate`,this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls?.transferMedia()||null}resetDetails(){let e=this.hls;if(e&&this.hasDetails){e.stopLoad();let t=e=>delete e.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,n){var r;(r=this.hls)==null||r.on(e,t)}once(e,t,n){var r;(r=this.hls)==null||r.once(e,t)}off(e,t,n){var r;(r=this.hls)==null||r.off(e,t)}toString(){return`HlsAssetPlayer: ${iQ(this.assetItem)} ${this.hls?.sessionId} ${this.appendInPlace?`append-in-place`:``}`}},oQ=.033,sQ=class extends aU{constructor(e,t){super(`interstitials-sched`,t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((n,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,n+1):n,0):0}get duration(){let e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let n=-1;e.nextEvent?n=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(n=this.findEventIndex(e.previousEvent.identifier)+1);let r=this.items;if(r)for(r[n]||(t===void 0&&(t=e.start),n=this.findItemIndexAtTime(t));n>=0&&(a=r[n])!=null&&a.event;){var a;n--}return n}findItemIndexAtTime(e,t){let n=this.items;if(n)for(let r=0;r<n.length;r++){let a=n[r];if(t&&t!==`primary`&&(a=a[t]),e===a.start||e>a.start&&e<a.end)return r}return-1}findJumpRestrictedIndex(e,t){let n=this.items;if(n)for(let r=e;r<=t&&n[r];r++){let e=n[r].event;if(e!=null&&e.restrictions.jump&&!e.appendInPlace)return r}return-1}findEventIndex(e){let t=this.items;if(t){for(let n=t.length;n--;)if(t[n].event?.identifier===e)return n}return-1}findAssetIndex(e,t){let n=e.assetList,r=n.length;if(r>1)for(let e=0;e<r;e++){let a=n[e];if(!a.error){let n=a.timelineStart;if(t===n||t>n&&(t<n+(a.duration||0)||e===r-1))return e}}return 0}get assetIdAtEnd(){var e;let t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){let e=t.assetList,n=e[e.length-1];if(n)return n.identifier}return null}parseInterstitialDateRanges(e,t){let n=e.main.details,{dateRanges:r}=n,a=this.events,o=this.parseDateRanges(r,{url:n.url},t),s=Object.keys(r),c=a?a.filter(e=>!s.includes(e.identifier)):[];o.length&&o.sort((e,t)=>{let n=e.cue.pre,r=e.cue.post,a=t.cue.pre,o=t.cue.post;if(n&&!a)return-1;if(a&&!n||r&&!o)return 1;if(o&&!r)return-1;if(!n&&!a&&!r&&!o){let n=e.startTime,r=t.startTime;if(n!==r)return n-r}return e.dateRange.tagOrder-t.dateRange.tagOrder}),this.events=o,c.forEach(e=>{this.removeEvent(e)}),this.updateSchedule(e,c)}updateSchedule(e,t=[],n=!1){let r=this.events||[];if(r.length||t.length||this.length<2){let a=this.items,o=this.parseSchedule(r,e);(n||t.length||a?.length!==o.length||o.some((e,t)=>Math.abs(e.playout.start-a[t].playout.start)>.005||Math.abs(e.playout.end-a[t].playout.end)>.005))&&(this.items=o,this.onScheduleUpdate(t,a))}}parseDateRanges(e,t,n){let r=[],a=Object.keys(e);for(let o=0;o<a.length;o++){let s=a[o],c=e[s];if(c.isInterstitial){let e=this.eventMap[s];e?e.setDateRange(c):(e=new $Z(c,t),this.eventMap[s]=e,n===!1&&(e.appendInPlace=n)),r.push(e)}}return r}parseSchedule(e,t){let n=[],r=t.main.details,a=r.live?1/0:r.edge,o=0;if(e=e.filter(e=>!e.error&&!(e.cue.once&&e.hasPlayed)),e.length){this.resolveOffsets(e,t);let r=0,s=0;if(e.forEach((t,c)=>{let l=t.cue.pre,u=t.cue.post,d=e[c-1]||null,f=t.appendInPlace,p=u?a:t.startOffset,m=t.duration,h=t.timelineOccupancy===ZZ.Range?m:0,g=t.resumptionOffset,_=d?.startTime===p,v=p+t.cumulativeDuration,y=f?v+m:p+g;if(l||!u&&p<=0){let e=s;s+=h,t.timelineStart=v;let r=o;o+=m,n.push({event:t,start:v,end:y,playout:{start:r,end:o},integrated:{start:e,end:s}})}else if(p<=a){if(!_){let a=p-r;if(a>oQ){let l=r,u=s;s+=a;let d=o;o+=a;let f={previousEvent:e[c-1]||null,nextEvent:t,start:l,end:l+a,playout:{start:d,end:o},integrated:{start:u,end:s}};n.push(f)}else a>0&&d&&(d.cumulativeDuration+=a,n[n.length-1].end=p)}u&&(y=v),t.timelineStart=v;let a=s;s+=h;let l=o;o+=m,n.push({event:t,start:v,end:y,playout:{start:l,end:o},integrated:{start:a,end:s}})}else return;let b=t.resumeTime;r=u||b>a?a:b}),r<a){let e=r,t=s,c=a-r;s+=c;let l=o;o+=c,n.push({previousEvent:n[n.length-1]?.event||null,nextEvent:null,start:r,end:e+c,playout:{start:l,end:o},integrated:{start:t,end:s}})}this.setDurations(a,o,s)}else n.push({previousEvent:null,nextEvent:null,start:0,end:a,playout:{start:0,end:a},integrated:{start:0,end:a}}),this.setDurations(a,a,a);return n}setDurations(e,t,n){this.durations={primary:e,playout:t,integrated:n}}resolveOffsets(e,t){let n=t.main.details,r=n.live?1/0:n.edge,a=0,o=-1;e.forEach((s,c)=>{let l=s.cue.pre,u=s.cue.post,d=l?0:u?r:s.startTime;this.updateAssetDurations(s),o===d?s.cumulativeDuration=a:(a=0,o=d),!u&&s.snapOptions.in&&(s.resumeAnchor=yG(null,n.fragments,s.startOffset+s.resumptionOffset,0,0)||void 0),s.appendInPlace&&!s.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(s,t)||(s.appendInPlace=!1)),!s.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<oQ&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${s}`));let f=GH(s.resumeOffset)?s.resumeOffset:s.duration;a+=f})}primaryCanResumeInPlaceAt(e,t){let n=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(n-r)>XZ?(this.log(`"${e.identifier}" resumption ${n} not aligned with estimated timeline end ${r}`),!1):!Object.keys(t).some(r=>{let a=t[r].details,o=a.edge;if(n>=o)return this.log(`"${e.identifier}" resumption ${n} past ${r} playlist end ${o}`),!1;let s=yG(null,a.fragments,n);if(!s)return this.log(`"${e.identifier}" resumption ${n} does not align with any fragments in ${r} playlist (${a.fragStart}-${a.fragmentEnd})`),!0;let c=r===`audio`?.175:0;return Math.abs(s.start-n)<XZ+c||Math.abs(s.end-n)<XZ+c?!1:(this.log(`"${e.identifier}" resumption ${n} not aligned with ${r} fragment bounds (${s.start}-${s.end} sn: ${s.sn} cc: ${s.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;let t=e.timelineStart,n=0,r=!1,a=!1;for(let o=0;o<e.assetList.length;o++){let s=e.assetList[o],c=t+n;s.startOffset=n,s.timelineStart=c,r||=s.duration===null,a||=!!s.error;let l=s.error?0:s.duration||0;n+=l}r&&!a?e.duration=Math.max(n,e.duration):e.duration=n}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}};function cQ(e){return`[${e.event?`"`+e.event.identifier+`"`:`primary`}: ${e.start.toFixed(2)}-${e.end.toFixed(2)}]`}var lQ=class{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){let n=e.assetListUrl,r;try{r=tQ(n,this.hls.sessionId,e.baseUrl)}catch(t){let r=this.assignAssetListError(e,Z.ASSET_LIST_LOAD_ERROR,t,n);this.hls.trigger(Q.ERROR,r);return}t&&r.protocol!==`data:`&&r.searchParams.set(`_HLS_start_offset`,``+t);let a=this.hls.config,o=a.loader,s=new o(a),c={responseType:`json`,url:r.href},l=a.interstitialAssetListLoadPolicy.default,u={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};return s.load(c,u,{onSuccess:(t,n,r,a)=>{let o=t.data,s=o?.ASSETS;if(!Array.isArray(s)){let t=this.assignAssetListError(e,Z.ASSET_LIST_PARSING_ERROR,Error(`Invalid interstitial asset list`),r.url,n,a);this.hls.trigger(Q.ERROR,t);return}e.assetListResponse=o,this.hls.trigger(Q.ASSET_LIST_LOADED,{event:e,assetListResponse:o,networkDetails:a})},onError:(t,n,r,a)=>{let o=this.assignAssetListError(e,Z.ASSET_LIST_LOAD_ERROR,Error(`Error loading X-ASSET-LIST: HTTP status ${t.code} ${t.text} (${n.url})`),n.url,a,r);this.hls.trigger(Q.ERROR,o)},onTimeout:(t,n,r)=>{let a=this.assignAssetListError(e,Z.ASSET_LIST_LOAD_TIMEOUT,Error(`Timeout loading X-ASSET-LIST (${n.url})`),n.url,t,r);this.hls.trigger(Q.ERROR,a)}}),this.hls.trigger(Q.ASSET_LIST_LOADING,{event:e}),s}assignAssetListError(e,t,n,r,a,o){return e.error=n,{type:JH.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:n,networkDetails:o,stats:a}}};function uQ(e){var t;e==null||(t=e.play())==null||t.catch(()=>{})}function dQ(e,t){return`[${e}] Advancing timeline position to ${t}`}var fQ=class extends aU{constructor(e,t){super(`interstitials`,e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{let e=this.currentTime;if(e===void 0||this.playbackDisabled||!this.schedule)return;let t=e-this.timelinePos;if(Math.abs(t)<1/7056e5)return;let n=t<=-.01;this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),this.timelinePos=e,this.bufferedPos=e;let r=this.playingItem;if(!r){this.checkBuffer();return}if(n&&this.schedule.resetErrorsInRange(e,e-t)&&this.updateSchedule(!0),this.checkBuffer(),n&&e<r.start||e>=r.end){var a;let t=this.findItemIndex(r),o=this.schedule.findItemIndexAtTime(e);if(o===-1&&(o=t+(n?-1:1),this.log(`seeked ${n?`back `:``}to position not covered by schedule ${e} (resolving from ${t} to ${o})`)),!this.isInterstitial(r)&&(a=this.media)!=null&&a.paused&&(this.shouldPlay=!1),!n&&o>t){let e=this.schedule.findJumpRestrictedIndex(t+1,o);if(e>t){this.setSchedulePosition(e);return}}this.setSchedulePosition(o);return}let o=this.playingAsset;if(!o){if(this.playingLastItem&&this.isInterstitial(r)){let t=r.event.assetList[0];t&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(e,t))}return}let s=o.timelineStart,c=o.duration||0;if(n&&e<s||e>=s+c){var l;(l=r.event)!=null&&l.appendInPlace&&(this.clearAssetPlayers(r.event,r),this.flushFrontBuffer(e)),this.setScheduleToAssetAtTime(e,o)}},this.onTimeupdate=()=>{let e=this.currentTime;if(e===void 0||this.playbackDisabled)return;if(this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),e>this.timelinePos)this.timelinePos=e,e>this.bufferedPos&&this.checkBuffer();else return;let t=this.playingItem;if(!t||this.playingLastItem)return;if(e>=t.end){this.timelinePos=t.end;let e=this.findItemIndex(t);this.setSchedulePosition(e+1)}let n=this.playingAsset;n&&e>=n.timelineStart+(n.duration||0)&&this.setScheduleToAssetAtTime(e,n)},this.onScheduleUpdate=(e,t)=>{let n=this.schedule;if(!n)return;let r=this.playingItem,a=n.events||[],o=n.items||[],s=n.durations,c=e.map(e=>e.identifier),l=!!(a.length||c.length);(l||t)&&this.log(`INTERSTITIALS_UPDATED (${a.length}): ${a}
136
- Schedule: ${o.map(e=>cQ(e))} pos: ${this.timelinePos}`),c.length&&this.log(`Removed events ${c}`);let u=null,d=null;r&&(u=this.updateItem(r,this.timelinePos),this.itemsMatch(r,u)?this.playingItem=u:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);let f=this.bufferingItem;if(f&&(d=this.updateItem(f,this.bufferedPos),this.itemsMatch(f,d)?this.bufferingItem=d:f.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(f.event,null))),e.forEach(e=>{e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,null)})}),this.playerQueue.forEach(e=>{if(e.interstitial.appendInPlace){let t=e.assetItem.timelineStart,n=e.timelineOffset-t;if(n)try{e.timelineOffset=t}catch(r){Math.abs(n)>XZ&&this.warn(`${r} ("${e.assetId}" ${e.timelineOffset}->${t})`)}}}),l||t){if(this.hls.trigger(Q.INTERSTITIALS_UPDATED,{events:a.slice(0),schedule:o.slice(0),durations:s,removedIds:c}),this.isInterstitial(r)&&c.includes(r.event.identifier)){this.warn(`Interstitial "${r.event.identifier}" removed while playing`),this.primaryFallback(r.event);return}r&&this.trimInPlace(u,r),f&&d!==u&&this.trimInPlace(d,f),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new lQ(e),this.schedule=new sQ(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){let e=this.hls;e&&(e.on(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(Q.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(Q.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(Q.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(Q.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(Q.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(Q.BUFFER_APPENDED,this.onBufferAppended,this),e.on(Q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(Q.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(Q.MEDIA_ENDED,this.onMediaEnded,this),e.on(Q.ERROR,this.onError,this),e.on(Q.DESTROYING,this.onDestroying,this))}unregisterListeners(){let e=this.hls;e&&(e.off(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(Q.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(Q.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(Q.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(Q.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(Q.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(Q.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Q.BUFFER_APPENDED,this.onBufferAppended,this),e.off(Q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(Q.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(Q.MEDIA_ENDED,this.onMediaEnded,this),e.off(Q.ERROR,this.onError,this),e.off(Q.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){let e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){Pq(e,`play`,this.onPlay),Pq(e,`pause`,this.onPause),Pq(e,`seeking`,this.onSeeking),Pq(e,`timeupdate`,this.onTimeupdate)}onMediaAttaching(e,t){let n=this.media=t.media;Nq(n,`seeking`,this.onSeeking),Nq(n,`timeupdate`,this.onTimeupdate),Nq(n,`play`,this.onPlay),Nq(n,`pause`,this.onPause)}onMediaAttached(e,t){let n=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,n===null)this.checkStart();else if(!r){this.clearScheduleState();let e=this.findItemIndex(n);this.setSchedulePosition(e)}}clearScheduleState(){this.log(`clear schedule state`),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){let n=!!t.transferMedia,r=this.media;if(this.media=null,!n&&(r&&this.removeMediaListeners(r),this.detachedData)){let e=this.getBufferingPlayer();e&&(this.log(`Removing schedule state for detachedData and ${e}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,e.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;let e=this,t=()=>e.bufferingItem||e.waitingItem,n=t=>t&&e.getAssetPlayer(t.identifier),r=(t,r,a,s,c)=>{if(t){let l=t[r].start,u=t.event;if(u){if(r===`playout`||u.timelineOccupancy!==ZZ.Point){let e=n(a);e?.interstitial===u&&(l+=e.assetItem.startOffset+e[c])}}else{let n=s===`bufferedPos`?o():e[s];l+=n-t.start}return l}return 0},a=(t,n)=>{var r;if(t!==0&&n!==`primary`&&(r=e.schedule)!=null&&r.length){let r=e.schedule.findItemIndexAtTime(t),a=e.schedule.items?.[r];if(a)return t+(a[n].start-a.start)}return t},o=()=>{let t=e.bufferedPos;return t===Number.MAX_VALUE?s(`primary`):Math.max(t,0)},s=t=>{var n;return(n=e.primaryDetails)!=null&&n.live?e.primaryDetails.edge:e.schedule?.durations[t]||0},c=(t,a)=>{var o;let s=e.effectivePlayingItem;if(s!=null&&(o=s.event)!=null&&o.restrictions.skip||!e.schedule)return;e.log(`seek to ${t} "${a}"`);let c=e.effectivePlayingItem,l=e.schedule.findItemIndexAtTime(t,a),u=e.schedule.items?.[l],d=e.getBufferingPlayer(),f=d?.interstitial?.appendInPlace,p=c&&e.itemsMatch(c,u);if(c&&(f||p)){let o=n(e.playingAsset),s=o?.media||e.primaryMedia;if(s){let n=a===`primary`?s.currentTime:r(c,a,e.playingAsset,`timelinePos`,`currentTime`),l=t-n,u=(f?n:s.currentTime)+l;if(u>=0&&(!o||f||u<=o.duration)){s.currentTime=u;return}}}if(u){let n=t;if(a!==`primary`){let e=t-u[a].start;n=u.start+e}let r=!e.isInterstitial(u);if((!e.isInterstitial(c)||c.event.appendInPlace)&&(r||u.event.appendInPlace)){let t=e.media||(f?d?.media:null);t&&(t.currentTime=n)}else if(c){let o=e.findItemIndex(c);if(l>o){let t=e.schedule.findJumpRestrictedIndex(o+1,l);if(t>o){e.setSchedulePosition(t);return}}let s=0;if(r)e.timelinePos=n,e.checkBuffer();else{let e=u.event.assetList,n=t-(u[a]||u).start;for(let t=e.length;t--;){let r=e[t];if(r.duration&&n>=r.startOffset&&n<r.startOffset+r.duration){s=t;break}}}e.setSchedulePosition(l,s)}}},l=()=>{let n=e.effectivePlayingItem;if(e.isInterstitial(n))return n;let r=t();return e.isInterstitial(r)?r:null},u={get bufferedEnd(){let n=t(),a=e.bufferingItem;return a&&a===n&&(r(a,`playout`,e.bufferingAsset,`bufferedPos`,`bufferedEnd`)-a.playout.start||e.bufferingAsset?.startOffset)||0},get currentTime(){let t=l(),n=e.effectivePlayingItem;return n&&n===t?r(n,`playout`,e.effectivePlayingAsset,`timelinePos`,`currentTime`)-n.playout.start:0},set currentTime(t){let n=l(),r=e.effectivePlayingItem;r&&r===n&&c(t+r.playout.start,`playout`)},get duration(){let e=l();return e?e.playout.end-e.playout.start:0},get assetPlayers(){let t=l()?.event.assetList;return t?t.map(t=>e.getAssetPlayer(t.identifier)):[]},get playingIndex(){let t=l()?.event;return t&&e.effectivePlayingAsset?t.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return l()}};return this.manager={get events(){var t;return((t=e.schedule)==null||(t=t.events)==null?void 0:t.slice(0))||[]},get schedule(){var t;return((t=e.schedule)==null||(t=t.items)==null?void 0:t.slice(0))||[]},get interstitialPlayer(){return l()?u:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){let n=t();return e.findItemIndex(n)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){let t=e.effectivePlayingItem;return e.findItemIndex(t)},primary:{get bufferedEnd(){return o()},get currentTime(){let t=e.timelinePos;return t>0?t:0},set currentTime(e){c(e,`primary`)},get duration(){return s(`primary`)},get seekableStart(){return e.primaryDetails?.fragmentStart||0}},integrated:{get bufferedEnd(){return r(t(),`integrated`,e.bufferingAsset,`bufferedPos`,`bufferedEnd`)},get currentTime(){return r(e.effectivePlayingItem,`integrated`,e.effectivePlayingAsset,`timelinePos`,`currentTime`)},set currentTime(e){c(e,`integrated`)},get duration(){return s(`integrated`)},get seekableStart(){return a(e.primaryDetails?.fragmentStart||0,`integrated`)}},skip:()=>{let t=e.effectivePlayingItem,n=t?.event;if(n&&!n.restrictions.skip){let r=e.findItemIndex(t);n.appendInPlace?c(t.playout.start+t.event.duration+.001,`playout`):e.advanceAfterAssetEnded(n,r,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){let e=this.playingItem,t=this.schedule?.items;return!this.playbackStarted||!e||!t?!1:this.findItemIndex(e)===t.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e;if(this.mediaSelection===null)return;let t=this.waitingItem||this.playingItem;if(this.isInterstitial(t)&&!t.event.appendInPlace)return;let n=this.media;!n&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(n=this.primaryMedia);let r=n?.currentTime;if(!(r===void 0||!GH(r)))return r}get primaryMedia(){return this.media||this.detachedData?.media||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){let n=this.getAssetPlayer(e);n&&this.transferMediaFromPlayer(n,t)}transferMediaFromPlayer(e,t){let n=e.interstitial.appendInPlace,r=e.media;if(n&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}let n=e.transferMedia();this.log(`transfer MediaSource from ${e} ${nG(n)}`),this.detachedData=n}else t&&r&&(this.shouldPlay||=!r.paused)}transferMediaTo(e,t){if(e.media===t)return;let n=null,r=this.hls,a=e!==r,o=a&&e.interstitial.appendInPlace,s=this.detachedData?.mediaSource,c;if(r.media)o&&(n=r.transferMedia(),this.detachedData=n),c=`Primary`;else if(s){let e=this.getBufferingPlayer();e?(n=e.transferMedia(),c=`${e}`):c=`detached MediaSource`}else c=`detached media`;if(!n){if(s)n=this.detachedData,this.log(`using detachedData: MediaSource ${nG(n)}`);else if(!this.detachedData||r.media===t){let e=this.playerQueue;e.length>1&&e.forEach(e=>{if(a&&e.interstitial.appendInPlace!==o){let t=e.interstitial;this.clearInterstitial(e.interstitial,null),t.appendInPlace=!1,t.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${t}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}let l=n&&`mediaSource`in n&&n.mediaSource?.readyState!==`closed`,u=l&&n?n:t;this.log(`${l?`transfering MediaSource`:`attaching media`} to ${a?e:`Primary`} from ${c} (media.currentTime: ${t.currentTime})`);let d=this.schedule;if(u===n&&d){let t=a&&e.assetId===d.assetIdAtEnd;u.overrides={duration:d.duration,endOfStream:!a||t,cueRemoval:!a}}e.attachMedia(u)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){let e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);let n=this.timelinePos,r=this.effectivePlayingItem;if(n===-1){let n=this.hls.startPosition;if(this.timelinePos=n,t.length===0)this.setSchedulePosition(0);else if(t[0].cue.pre){this.log(dQ(`checkStart (preroll)`,n));let r=e.findEventIndex(t[0].identifier);this.setSchedulePosition(r)}else if(n>=0||!this.primaryLive){this.log(dQ(`checkStart`,n));let t=this.timelinePos=n>0?n:0,r=e.findItemIndexAtTime(t);this.setSchedulePosition(r)}else this.hls.liveSyncPosition===0?this.setSchedulePosition(0):this.log(`[checkStart] waiting for live start`)}else if(r&&!this.playingItem){this.log(dQ(`checkStart (playing item)`,r.start));let t=e.findItemIndex(r);this.setSchedulePosition(t)}}advanceAssetBuffering(e,t){let n=e.event,r=nQ(n,n.findAssetIndex(t));if(!n.isAssetPastPlayoutLimit(r))this.bufferedToEvent(e,r);else if(this.schedule){let t=this.schedule.items?.[this.findItemIndex(e)+1];t&&this.bufferedToItem(t)}}advanceAfterAssetEnded(e,t,n){let r=nQ(e,n);if(!e.isAssetPastPlayoutLimit(r)){if(e.appendInPlace){let t=e.assetList[r];t&&this.advanceInPlace(t.timelineStart)}this.setSchedulePosition(t,r)}else if(this.schedule){let n=this.schedule.items;if(n){let r=t+1;if(r>=n.length){this.setSchedulePosition(-1);return}let a=e.resumeTime;this.timelinePos<a&&(this.log(dQ(`advanceAfterAssetEnded`,a)),this.timelinePos=a,e.appendInPlace&&this.advanceInPlace(a),this.checkBuffer(this.bufferedPos<a)),this.setSchedulePosition(r)}}}setScheduleToAssetAtTime(e,t){let n=this.schedule;if(!n)return;let r=t.parentIdentifier,a=n.getEvent(r);if(a){let t=n.findEventIndex(r),o=n.findAssetIndex(a,e);this.advanceAfterAssetEnded(a,t,o-1)}}setSchedulePosition(e,t){let n=this.schedule?.items;if(!n||this.playbackDisabled)return;let r=e>=0?n[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${r&&cQ(r)}) pos: ${this.timelinePos}`);let a=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(a)){let c=a.event,l=this.playingAsset,u=l?.identifier,d=u?this.getAssetPlayer(u):null;if(d&&u&&(!this.eventItemsMatch(a,r)||t!==void 0&&u!==c.assetList[t].identifier)){var s;let t=c.findAssetIndex(l);if(this.log(`INTERSTITIAL_ASSET_ENDED ${t+1}/${c.assetList.length} ${iQ(l)}`),this.endedAsset=l,this.playingAsset=null,this.hls.trigger(Q.INTERSTITIAL_ASSET_ENDED,{asset:l,assetListIndex:t,event:c,schedule:n.slice(0),scheduleIndex:e,player:d}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(c,this.findItemIndex(this.playingItem),t);return}this.retreiveMediaSource(u,r),d.media&&!((s=this.detachedData)!=null&&s.mediaSource)&&d.detachMedia()}if(!this.eventItemsMatch(a,r)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${c} ${cQ(a)}`),c.hasPlayed=!0,this.hls.trigger(Q.INTERSTITIAL_ENDED,{event:c,schedule:n.slice(0),scheduleIndex:e}),c.cue.once)){this.updateSchedule();let e=this.schedule?.items;if(r&&e){let n=this.findItemIndex(r);this.advanceSchedule(n,e,t,a,o)}return}}this.advanceSchedule(e,n,t,a,o)}advanceSchedule(e,t,n,r,a){let o=this.schedule;if(!o)return;let s=t[e]||null,c=this.primaryMedia,l=this.playerQueue;if(l.length&&l.forEach(t=>{let n=t.interstitial,r=o.findEventIndex(n.identifier);(r<e||r>e+1)&&this.clearInterstitial(n,s)}),this.isInterstitial(s)){this.timelinePos=Math.min(Math.max(this.timelinePos,s.start),s.end);let a=s.event;if(n===void 0){n=o.findAssetIndex(a,this.timelinePos);let t=nQ(a,n-1);if(a.isAssetPastPlayoutLimit(t)||a.appendInPlace&&this.timelinePos===s.end){this.advanceAfterAssetEnded(a,e,n);return}n=t}let l=this.waitingItem;this.assetsBuffered(s,c)||this.setBufferingItem(s);let u=this.preloadAssets(a,n);if(this.eventItemsMatch(s,l||r)||(this.waitingItem=s,this.log(`INTERSTITIAL_STARTED ${cQ(s)} ${a.appendInPlace?`append in place`:``}`),this.hls.trigger(Q.INTERSTITIAL_STARTED,{event:a,schedule:t.slice(0),scheduleIndex:e})),!a.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${a}`);return}if(a.assetListLoader&&=(a.assetListLoader.destroy(),void 0),!c){this.log(`Waiting for attachMedia to start Interstitial ${a}`);return}this.waitingItem=this.endedItem=null,this.playingItem=s;let d=a.assetList[n];if(!d){this.advanceAfterAssetEnded(a,e,n||0);return}if(u||=this.getAssetPlayer(d.identifier),u===null||u.destroyed){let e=a.assetList.length;this.warn(`asset ${n+1}/${e} player destroyed ${a}`),u=this.createAssetPlayer(a,d,n),u.loadSource()}if(!this.eventItemsMatch(s,this.bufferingItem)&&a.appendInPlace&&this.isAssetBuffered(d))return;this.startAssetPlayer(u,n,t,e,c),this.shouldPlay&&uQ(u.media)}else s?(this.resumePrimary(s,e,r),this.shouldPlay&&uQ(this.hls.media)):a&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(o.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){return this.mediaSelection?.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,n){var r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${cQ(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let n=this.timelinePos;(n<e.start||n>=e.end)&&(n=this.getPrimaryResumption(e,t),this.log(dQ(`resumePrimary`,n)),this.timelinePos=n),this.attachPrimary(n,e)}if(!n)return;let a=this.schedule?.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${cQ(e)}`),this.hls.trigger(Q.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){let n=e.start;if(this.primaryLive){let e=this.primaryDetails;if(t===0)return this.hls.startPosition;if(e&&(n<e.fragmentStart||n>e.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(e){let t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:oK.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,n){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;let r=this.primaryMedia;if(!r)return;let a=this.hls;a.media?this.checkBuffer():(this.transferMediaTo(a,r),n&&this.startLoadingPrimaryAt(e,n)),n||(this.log(dQ(`attachPrimary`,e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,n))}startLoadingPrimaryAt(e,t){let n=this.hls;!n.loadingEnabled||!n.media||Math.abs((n.mainForwardBufferInfo?.start||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(Q.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(Q.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;let n=this.hls.levels[t.level];if(!n.details)return;let r=nU(nU({},this.mediaSelection||this.altSelection),{},{main:n});this.mediaSelection=r,this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){let n=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=nU(nU({},this.altSelection),{},{audio:n});return}let a=nU(nU({},r),{},{audio:n});this.mediaSelection=a}onSubtitleTrackUpdated(e,t){let n=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=nU(nU({},this.altSelection),{},{subtitles:n});return}let a=nU(nU({},r),{},{subtitles:n});this.mediaSelection=a}onAudioTrackSwitching(e,t){let n=sG(t);this.playerQueue.forEach(({hls:e})=>e&&(e.setAudioOption(t)||e.setAudioOption(n)))}onSubtitleTrackSwitch(e,t){let n=sG(t);this.playerQueue.forEach(({hls:e})=>e&&(e.setSubtitleOption(t)||t.id!==-1&&e.setSubtitleOption(n)))}onBufferCodecs(e,t){let n=t.tracks;n&&(this.requiredTracks=n)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){let n=this.playingItem;if(n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)){let e=this.timelinePos;this.bufferedPos=e,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;let t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let e=0;e<t.length;e++){let n=t[e];if(n.cue.post){let e=this.schedule.findEventIndex(n.identifier),t=this.schedule.items?.[e];this.isInterstitial(t)&&this.eventItemsMatch(t,this.bufferingItem)&&this.bufferedToItem(t,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){let t=this.playingItem;if(!this.playingLastItem&&t){let e=this.findItemIndex(t);this.setSchedulePosition(e+1)}else this.shouldPlay=!1}updateItem(e,t){let n=this.schedule?.items;return e&&n&&n[this.findItemIndex(e,t)]||null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((t,n)=>{e.event.isAssetPastPlayoutLimit(n)&&this.clearAssetPlayer(t.identifier,null)});let n=e.end+.25,r=oK.bufferInfo(this.primaryMedia,n,0);(r.end>n||(r.nextStart||0)>n)&&(this.log(`trim buffered interstitial ${cQ(e)} (was ${cQ(t)})`),this.attachPrimary(n,null,!0),this.flushFrontBuffer(n))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){return!!t&&(e===t||e.event.identifier===t.event?.identifier)}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;let n=this.mediaSelection;n&&((t=this.schedule)==null||t.updateSchedule(n,[],e))}checkBuffer(e){let t=this.schedule?.items;if(!t)return;let n=oK.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||=n.len<1,this.updateBufferedPos(n.end,t,e)}updateBufferedPos(e,t,n){let r=this.schedule,a=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(t.length===1&&this.itemsMatch(t[0],a)){this.bufferedPos=e;return}let o=this.playingItem,s=this.findItemIndex(o),c=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var l;let n=this.findItemIndex(a),r=Math.min(n+1,t.length-1),o=t[r];if((c===-1&&a&&e>=a.end||(l=o.event)!=null&&l.appendInPlace&&e+.01>=o.start)&&(c=r),this.isInterstitial(a)){let e=a.event;if(r-s>1&&e.appendInPlace===!1||e.assetList.length===0&&e.assetListLoader)return}if(this.bufferedPos=e,c>n&&c>s)this.bufferedToItem(o);else{let t=this.primaryDetails;this.primaryLive&&t&&e>t.edge-t.targetduration&&o.start<t.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(o)&&this.preloadAssets(o.event,0)}}else n&&o&&!this.itemsMatch(o,a)&&(c===s?this.bufferedToItem(o):c===s+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(e=>{let n=this.getAssetPlayer(e.identifier);return!(n!=null&&n.bufferedInPlaceToEnd(t))})}setBufferingItem(e){let t=this.bufferingItem,n=this.schedule;if(!this.itemsMatch(e,t)&&n){let{items:r,events:a}=n;if(!r||!a)return t;let o=this.isInterstitial(e),s=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));let c=s?s.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${cQ(e)}`+(t?` (${c.toFixed(2)} remaining)`:``)),!this.playbackDisabled)if(o){let t=n.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((e,n)=>{let r=this.getAssetPlayer(e.identifier);r&&(n===t&&r.loadSource(),r.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(e=>e.pauseBuffering());this.hls.trigger(Q.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:a.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){let n=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(n!==null){this.bufferingAsset=null;let t=this.detachedData;t&&t.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e)}}}preloadPrimary(e){let t=this.findItemIndex(e),n=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(n)}bufferedToEvent(e,t){let n=e.event,r=n.assetList.length===0&&!n.assetListLoader,a=n.cue.once;if(r||!a){let e=this.preloadAssets(n,t);if(e!=null&&e.interstitial.appendInPlace){let t=this.primaryMedia;t&&this.bufferAssetPlayer(e,t)}}}preloadAssets(e,t){let n=e.assetUrl,r=e.assetList.length,a=r===0&&!e.assetListLoader,o=e.cue.once;if(a){let a=e.timelineStart;if(e.appendInPlace){var s;let t=this.playingItem;!this.isInterstitial(t)&&(t==null||(s=t.nextEvent)==null?void 0:s.identifier)===e.identifier&&this.flushFrontBuffer(a+.25)}let o,c=0;if(!this.playingItem&&this.primaryLive&&(c=this.hls.startPosition,c===-1&&(c=this.hls.liveSyncPosition||0)),c&&!(e.cue.pre||e.cue.post)){let e=c-a;e>0&&(o=Math.round(e*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${n?1:r} ${e}${o?` live-start: ${c} start-offset: ${o}`:``}`),n)return this.createAsset(e,0,0,a,e.duration,n);let l=this.assetListLoader.loadAssetList(e,o);l&&(e.assetListLoader=l)}else if(!o&&r){for(let n=t;n<r;n++){let t=e.assetList[n],r=this.getAssetPlayerQueueIndex(t.identifier);(r===-1||this.playerQueue[r].destroyed)&&!t.error&&this.createAssetPlayer(e,t,n)}let n=e.assetList[t];if(n){let e=this.getAssetPlayer(n.identifier);return e&&e.loadSource(),e}}return null}flushFrontBuffer(e){let t=this.requiredTracks;t&&(this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(t=>{this.hls.trigger(Q.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:t})}))}getAssetPlayerQueueIndex(e){let t=this.playerQueue;for(let n=0;n<t.length;n++)if(e===t[n].assetId)return n;return-1}getAssetPlayer(e){let t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){let{playerQueue:e,primaryMedia:t}=this;if(t){for(let n=0;n<e.length;n++)if(e[n].media===t)return e[n]}return null}createAsset(e,t,n,r,a,o){let s={parentIdentifier:e.identifier,identifier:QZ(e,o,t),duration:a,startOffset:n,timelineStart:r,uri:o};return this.createAssetPlayer(e,s,t)}createAssetPlayer(e,t,n){let r=this.hls,a=r.userConfig,o=a.videoPreference,s=r.loadLevelObj||r.levels[r.currentLevel];(o||s)&&(o=eU({},o),s.videoCodec&&(o.videoCodec=s.videoCodec),s.videoRange&&(o.allowedVideoRanges=[s.videoRange]));let c=r.audioTracks[r.audioTrack],l=r.subtitleTracks[r.subtitleTrack],u=0;if(this.primaryLive||e.appendInPlace){let e=this.timelinePos-t.timelineStart;if(e>1){let n=t.duration;n&&e<n&&(u=e)}}let d=t.identifier,f=nU(nU({},a),{},{maxMaxBufferLength:Math.min(180,r.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:d,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:o,audioPreference:c||a.audioPreference,subtitlePreference:l||a.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(f.timelineOffset=t.timelineStart));let p=f.cmcd;p!=null&&p.sessionId&&p.contentId&&(f.cmcd=eU({},p,{contentId:YZ(t.uri)})),this.getAssetPlayer(d)&&this.warn(`Duplicate date range identifier ${e} and asset ${d}`);let m=new aQ(this.HlsPlayerClass,f,e,t);this.playerQueue.push(m),e.assetList[n]=t;let h=!0,g=r=>{if(r.live){let t=Error(`Interstitials MUST be VOD assets ${e}`),r={fatal:!0,type:JH.OTHER_ERROR,details:Z.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},a=this.schedule?.findEventIndex(e.identifier)||-1;this.handleAssetItemError(r,e,a,n,t.message);return}let a=r.edge-r.fragmentStart,o=t.duration;(h||o===null||a>o)&&(h=!1,this.log(`Interstitial asset "${d}" duration change ${o} > ${a}`),t.duration=a,this.updateSchedule())};m.on(Q.LEVEL_UPDATED,(e,{details:t})=>g(t)),m.on(Q.LEVEL_PTS_UPDATED,(e,{details:t})=>g(t)),m.on(Q.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());let _=(e,t)=>{let n=this.getAssetPlayer(d);if(n&&t.tracks){n.off(Q.BUFFER_CODECS,_),n.tracks=t.tracks;let e=this.primaryMedia;this.bufferingAsset===n.assetItem&&e&&!n.media&&this.bufferAssetPlayer(n,e)}};m.on(Q.BUFFER_CODECS,_),m.on(Q.BUFFERED_TO_END,()=>{let n=this.getAssetPlayer(d);if(this.log(`buffered to end of asset ${n}`),!n||!this.schedule)return;let r=this.schedule.findEventIndex(e.identifier),a=this.schedule.items?.[r];this.isInterstitial(a)&&this.advanceAssetBuffering(a,t)});let v=t=>()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;this.shouldPlay=!0;let n=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,n,t)};return m.once(Q.MEDIA_ENDED,v(n)),m.once(Q.PLAYOUT_LIMIT_REACHED,v(1/0)),m.on(Q.ERROR,(t,r)=>{if(!this.schedule)return;let a=this.getAssetPlayer(d);if(r.details===Z.BUFFER_STALLED_ERROR){if(a!=null&&a.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(r,e,this.schedule.findEventIndex(e.identifier),n,`Asset player error ${r.error} ${e}`)}),m.on(Q.DESTROYING,()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;let t=Error(`Asset player destroyed unexpectedly ${d}`),r={fatal:!0,type:JH.OTHER_ERROR,details:Z.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};this.handleAssetItemError(r,e,this.schedule.findEventIndex(e.identifier),n,t.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${iQ(t)}`),this.hls.trigger(Q.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:n,event:e,player:m}),m}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,t)})}resetAssetPlayer(e){let t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);let n=this.playerQueue[t];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(e,t){let n=this.getAssetPlayerQueueIndex(e);if(n!==-1){let e=this.playerQueue[n];this.log(`clear ${e} toSegment: ${t&&cQ(t)}`),this.transferMediaFromPlayer(e,t),this.playerQueue.splice(n,1),e.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,n,r,a){let{interstitial:o,assetItem:s,assetId:c}=e,l=o.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=s,(!u||u.identifier!==c)&&(u&&(this.clearAssetPlayer(u.identifier,n[r]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${l} ${iQ(s)}`),this.hls.trigger(Q.INTERSTITIAL_ASSET_STARTED,{asset:s,assetListIndex:t,event:o,schedule:n.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,a)}bufferAssetPlayer(e,t){if(!this.schedule)return;let{interstitial:n,assetItem:r}=e,a=this.schedule.findEventIndex(n.identifier),o=this.schedule.items?.[a];if(!o)return;e.loadSource(),this.setBufferingItem(o),this.bufferingAsset=r;let s=this.getBufferingPlayer();if(s===e)return;let c=n.appendInPlace;if(c&&s?.interstitial.appendInPlace===!1)return;let l=s?.tracks||this.detachedData?.tracks||this.requiredTracks;if(c&&r!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(l&&!gU(l,e.tracks)){let t=Error(`Asset ${iQ(r)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(l)}')`),o={fatal:!0,type:JH.OTHER_ERROR,details:Z.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},s=n.findAssetIndex(r);this.handleAssetItemError(o,n,a,s,t.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){let t=this.schedule,n=this.primaryMedia;if(!t||!n)return;let r=n.currentTime,a=t.findAssetIndex(e,r),o=e.assetList[a];if(o){let s=this.getAssetPlayer(o.identifier);if(s){let c=s.currentTime||r-o.timelineStart,l=s.duration-c;if(this.warn(`Stalled at ${c} of ${c+l} in ${s} ${e} (media.currentTime: ${r})`),c&&(l/n.playbackRate<.5||s.bufferedInPlaceToEnd(n))&&s.hls){let n=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,n,a)}}}}advanceInPlace(e){let t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,n,r,a){if(e.details===Z.BUFFER_STALLED_ERROR)return;let o=t.assetList[r]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${o&&iQ(o)} ${e.error}`),!this.schedule)return;let s=o?.identifier||``,c=this.getAssetPlayerQueueIndex(s),l=this.playerQueue[c]||null,u=this.schedule.items,d=eU({},e,{fatal:!1,errorAction:IG(!0),asset:o,assetListIndex:r,event:t,schedule:u,scheduleIndex:n,player:l});if(this.hls.trigger(Q.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;let f=this.playingAsset,p=this.bufferingAsset,m=Error(a);if(o&&(this.clearAssetPlayer(s,null),o.error=m),!t.assetList.some(e=>!e.error))t.error=m;else for(let e=r;e<t.assetList.length;e++)this.resetAssetPlayer(t.assetList[e].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):f&&f.identifier===s?this.advanceAfterAssetEnded(t,n,r):p&&p.identifier===s&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,p)}primaryFallback(e){let t=e.timelineStart,n=this.effectivePlayingItem,r=this.timelinePos;if(n){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${r} playing: ${cQ(n)} error: ${e.error}`),r===-1&&(r=this.hls.startPosition);let a=this.updateItem(n,r);this.itemsMatch(n,a)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(r===-1){this.checkStart();return}if(!this.schedule)return;let a=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(a)}onAssetListLoaded(e,t){var n;let r=t.event,a=r.identifier,o=t.assetListResponse.ASSETS;if(!((n=this.schedule)!=null&&n.hasEvent(a)))return;let s=r.timelineStart,c=r.duration,l=0;o.forEach((e,t)=>{let n=parseFloat(e.DURATION);this.createAsset(r,t,l,s+l,n,e.URI),l+=n}),r.duration=l,this.log(`Loaded asset-list with duration: ${l} (was: ${c}) ${r}`);let u=this.waitingItem?.event.identifier===a;this.updateSchedule();let d=this.bufferingItem?.event;if(u){let e=this.schedule.findEventIndex(a),t=this.schedule.items?.[e];if(t){if(!this.playingItem&&this.timelinePos>t.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==e){r.error=Error(`Interstitial ${o.length?`no longer within playback range`:`asset-list is empty`} ${this.timelinePos} ${r}`),this.log(r.error.message),this.updateSchedule(!0),this.primaryFallback(r);return}this.setBufferingItem(t)}this.setSchedulePosition(e)}else if(d?.identifier===a){let e=r.assetList[0];if(e){let t=this.getAssetPlayer(e.identifier);if(d.appendInPlace){let e=this.primaryMedia;t&&e&&this.bufferAssetPlayer(t,e)}else t&&t.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case Z.ASSET_LIST_PARSING_ERROR:case Z.ASSET_LIST_LOAD_ERROR:case Z.ASSET_LIST_LOAD_TIMEOUT:{let e=t.interstitial;e&&(this.updateSchedule(!0),this.primaryFallback(e));break}case Z.BUFFER_STALLED_ERROR:{let e=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(e)&&e.event.appendInPlace){this.handleInPlaceStall(e.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}},pQ=500,mQ=class extends Iq{constructor(e,t,n){super(e,t,n,`subtitle-stream-controller`,XH.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(Q.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Q.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Q.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(Q.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Q.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(Q.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();let{hls:e}=this;e.off(Q.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Q.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Q.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(Q.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Q.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(Q.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=$.IDLE,this.setInterval(pQ),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){let{frag:n,success:r}=t;if(this.fragContextChanged(n)||(OU(n)&&(this.fragPrevious=n),this.state=$.IDLE),!r)return;let a=this.tracksBuffered[this.currentTrackId];if(!a)return;let o,s=n.start;for(let e=0;e<a.length;e++)if(s>=a[e].start&&s<=a[e].end){o=a[e];break}let c=n.start+n.duration;o?o.end=c:(o={start:s,end:c},a.push(o)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null),this.media&&this.tick()}onBufferFlushing(e,t){let{startOffset:n,endOffset:r}=t;if(n===0&&r!==1/0){let e=r-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach(t=>{for(let n=0;n<t.length;){if(t[n].end<=e){t.shift();continue}else if(t[n].start<e)t[n].start=e;else break;n++}}),this.fragmentTracker.removeFragmentsInRange(n,e,XH.SUBTITLE)}}onError(e,t){let n=t.frag;n?.type===XH.SUBTITLE&&(t.details===Z.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==$.STOPPED&&(this.state=$.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&XY(this.levels,t)){this.levels=t.map(e=>new ZW(e));return}this.tracksBuffered=[],this.levels=t.map(e=>{let t=new ZW(e);return this.tracksBuffered[t.id]=[],t}),this.fragmentTracker.removeFragmentsInRange(0,1/0,XH.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}let r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.state!==$.STOPPED&&this.setInterval(pQ)}onSubtitleTrackLoaded(e,t){var n;let{currentTrackId:r,levels:a}=this,{details:o,id:s}=t;if(!a){this.warn(`Subtitle tracks were reset while loading level ${s}`);return}let c=a[s];if(s>=a.length||!c)return;this.log(`Subtitle track ${s} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:``},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(o.live||(n=c.details)!=null&&n.live){if(o.deltaUpdateFailed)return;let e=this.mainDetails;if(!e){this.startFragRequested=!1;return}let t=e.fragments[0];c.details?(l=this.alignPlaylists(o,c.details,this.levelLastLoaded?.details),l===0&&t&&(l=t.start,vq(o,l))):o.hasProgramDateTime&&e.hasProgramDateTime?(Mq(o,e),l=o.fragmentStart):t&&(l=t.start,vq(o,l)),e&&!this.startFragRequested&&this.setStartPosition(e,l)}c.details=o,this.levelLastLoaded=c,s===r&&(this.hls.trigger(Q.SUBTITLE_TRACK_UPDATED,{details:o,id:s,groupId:t.groupId}),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===$.IDLE&&(yG(null,o.fragments,this.media.currentTime,0)||(this.warn(`Subtitle playlist not aligned with playback`),c.details=void 0)))}_handleFragmentLoadComplete(e){let{frag:t,payload:n}=e,r=t.decryptdata,a=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&r!=null&&r.key&&r.iv&&CK(r.method)){let e=performance.now();this.decrypter.decrypt(new Uint8Array(n),r.key.buffer,r.iv.buffer,wK(r.method)).catch(e=>{throw a.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e}).then(n=>{let r=performance.now();a.trigger(Q.FRAG_DECRYPTED,{frag:t,payload:n,stats:{tstart:e,tdecrypt:r}})}).catch(e=>{this.warn(`${e.name}: ${e.message}`),this.state=$.IDLE})}}doTick(){if(!this.media){this.state=$.IDLE;return}if(this.state===$.IDLE){let{currentTrackId:e,levels:t}=this,n=t?.[e];if(!n||!t.length||!n.details||this.waitForLive(n))return;let{config:r}=this,a=this.getLoadPosition(),{end:o,len:s}=oK.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],a,r.maxBufferHole),c=n.details;if(s>this.hls.maxBufferLength+c.levelTargetDuration)return;let l=c.fragments,u=l.length,d=c.edge,f=null,p=this.fragPrevious;if(o<d){let e=r.maxFragLookUpTolerance,t=o>d-e?0:e;f=yG(p,l,Math.max(l[0].start,o),t),!f&&p&&p.start<l[0].start&&(f=l[0])}else f=l[u-1];if(f=this.filterReplacedPrimary(f,n.details),!f)return;let m=l[f.sn-c.startSN-1];if(m&&m.cc===f.cc&&this.fragmentTracker.getState(m)===LG.NOT_LOADED&&(f=m),this.fragmentTracker.getState(f)===LG.NOT_LOADED){let e=this.mapToInitFragWhenRequired(f);e&&this.loadFragment(e,n,o)}}}loadFragment(e,t,n){OU(e)?super.loadFragment(e,t,n):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new hQ(this.tracksBuffered[this.currentTrackId]||[])}},hQ=class{constructor(e){this.buffered=void 0;let t=(t,n,r)=>{if(n>>>=0,n>r-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${r})`);return e[n][t]};this.buffered={get length(){return e.length},end(n){return t(`end`,n,e.length)},start(n){return t(`start`,n,e.length)}}}},gQ={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},_Q=e=>String.fromCharCode(gQ[e]||e),vQ=15,yQ=100,bQ={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},xQ={17:2,18:4,21:6,22:8,23:10,19:13,20:15},SQ={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},CQ={25:2,26:4,29:6,30:8,31:10,27:13,28:15},wQ=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`,`black`,`transparent`],TQ=class{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){let n=typeof t==`function`?t():t;pU.log(`${this.time} [${e}] ${n}`)}}},EQ=function(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t},DQ=class{constructor(){this.foreground=`white`,this.underline=!1,this.italics=!1,this.background=`black`,this.flash=!1}reset(){this.foreground=`white`,this.underline=!1,this.italics=!1,this.background=`black`,this.flash=!1}setStyles(e){let t=[`foreground`,`underline`,`italics`,`background`,`flash`];for(let n=0;n<t.length;n++){let r=t[n];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground===`white`&&!this.underline&&!this.italics&&this.background===`black`&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return`color=`+this.foreground+`, underline=`+this.underline+`, italics=`+this.italics+`, background=`+this.background+`, flash=`+this.flash}},OQ=class{constructor(){this.uchar=` `,this.penState=new DQ}reset(){this.uchar=` `,this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===` `&&this.penState.isDefault()}},kQ=class{constructor(e){this.chars=[],this.pos=0,this.currPenState=new DQ,this.cueStartTime=null,this.logger=void 0;for(let e=0;e<yQ;e++)this.chars.push(new OQ);this.logger=e}equals(e){for(let t=0;t<yQ;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<yQ;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<yQ;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,`Negative cursor position `+this.pos),this.pos=0):this.pos>yQ&&(this.logger.log(3,`Too large cursor position `+this.pos),this.pos=yQ)}moveCursor(e){let t=this.pos+e;if(e>1)for(let e=this.pos+1;e<t+1;e++)this.chars[e].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(` `,this.currPenState)}insertChar(e){e>=144&&this.backSpace();let t=_Q(e);if(this.pos>=yQ){this.logger.log(0,()=>`Cannot insert `+e.toString(16)+` (`+t+`) at position `+this.pos+`. Skipping it!`);return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<yQ;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){let e=[],t=!0;for(let n=0;n<yQ;n++){let r=this.chars[n].uchar;r!==` `&&(t=!1),e.push(r)}return t?``:e.join(``)}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}},AQ=class{constructor(e){this.rows=[],this.currRow=vQ-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<vQ;t++)this.rows.push(new kQ(e));this.logger=e}reset(){for(let e=0;e<vQ;e++)this.rows[e].clear();this.currRow=vQ-1}equals(e){let t=!0;for(let n=0;n<vQ;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<vQ;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<vQ;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,`setCursor: `+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>`pacData = `+nG(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let e=0;e<vQ;e++)this.rows[e].clear();let e=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){let r=n.rows[e].cueStartTime,a=this.logger.time;if(r!==null&&a!==null&&r<a)for(let r=0;r<this.nrRollUpRows;r++)this.rows[t-this.nrRollUpRows+r+1].copy(n.rows[e+r])}}this.currRow=t;let n=this.rows[this.currRow];if(e.indent!==null){let t=e.indent,r=Math.max(t-1,0);n.setCursor(e.indent),e.color=n.chars[r].penState.foreground}let r={foreground:e.color,underline:e.underline,italics:e.italics,background:`black`,flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>`bkgData = `+nG(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,`roll_up but nrRollUpRows not set yet`);return}this.logger.log(1,()=>this.getDisplayText());let e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,`Rolling up`)}getDisplayText(e){e||=!1;let t=[],n=``,r=-1;for(let n=0;n<vQ;n++){let a=this.rows[n].getTextString();a&&(r=n+1,e?t.push(`Row `+r+`: '`+a+`'`):t.push(a.trim()))}return t.length>0&&(n=e?`[`+t.join(` | `)+`]`:t.join(`
137
- `)),n}getTextAndFormat(){return this.rows}},jQ=class{constructor(e,t,n){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new AQ(n),this.nonDisplayedMemory=new AQ(n),this.lastOutputScreen=new AQ(n),this.currRollUpRow=this.displayedMemory.rows[vQ-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[vQ-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>`MODE=`+e),this.mode===`MODE_POP-ON`?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!==`MODE_ROLL-UP`&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);let t=this.writeScreen===this.displayedMemory?`DISP`:`NON_DISP`;this.logger.log(2,()=>t+`: `+this.writeScreen.getDisplayText(!0)),(this.mode===`MODE_PAINT-ON`||this.mode===`MODE_ROLL-UP`)&&(this.logger.log(1,()=>`DISPLAYED: `+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,`RCL - Resume Caption Loading`),this.setMode(`MODE_POP-ON`)}ccBS(){this.logger.log(2,`BS - BackSpace`),this.mode!==`MODE_TEXT`&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,`DER- Delete to End of Row`),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,`RU(`+e+`) - Roll Up`),this.writeScreen=this.displayedMemory,this.setMode(`MODE_ROLL-UP`),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,`FON - Flash On`),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,`RDC - Resume Direct Captioning`),this.setMode(`MODE_PAINT-ON`)}ccTR(){this.logger.log(2,`TR`),this.setMode(`MODE_TEXT`)}ccRTD(){this.logger.log(2,`RTD`),this.setMode(`MODE_TEXT`)}ccEDM(){this.logger.log(2,`EDM - Erase Displayed Memory`),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,`CR - Carriage Return`),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,`ENM - Erase Non-displayed Memory`),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,`EOC - End Of Caption`),this.mode===`MODE_POP-ON`){let e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>`DISP: `+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,`TO(`+e+`) - Tab Offset`),this.writeScreen.moveCursor(e)}ccMIDROW(e){let t={flash:!1};t.underline=e%2==1,t.italics=e>=46,t.italics?t.foreground=`white`:t.foreground=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`][Math.floor(e/2)-16],this.logger.log(2,`MIDROW: `+nG(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){let t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}},MQ=class{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=FQ(),this.logger=void 0;let r=this.logger=new TQ;this.channels=[null,new jQ(e,t,r),new jQ(e+1,n,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let e=0;e<t.length;e+=2){let n=t[e]&127,r=t[e+1]&127,a=!1,o=null;if(n===0&&r===0)continue;this.logger.log(3,()=>`[`+EQ([t[e],t[e+1]])+`] -> (`+EQ([n,r])+`)`);let s=this.cmdHistory;if(n>=16&&n<=31){if(PQ(n,r,s)){NQ(null,null,s),this.logger.log(3,()=>`Repeated command (`+EQ([n,r])+`) is dropped`);continue}NQ(n,r,this.cmdHistory),a=this.parseCmd(n,r),a||=this.parseMidrow(n,r),a||=this.parsePAC(n,r),a||=this.parseBackgroundAttributes(n,r)}else NQ(null,null,s);if(!a&&(o=this.parseChars(n,r),o)){let e=this.currentChannel;e&&e>0?this.channels[e].insertChars(o):this.logger.log(2,`No channel found yet. TEXT-MODE?`)}!a&&!o&&this.logger.log(2,()=>`Couldn't parse cleaned data `+EQ([n,r])+` orig: `+EQ([t[e],t[e+1]]))}}parseCmd(e,t){if(!((e===20||e===28||e===21||e===29)&&t>=32&&t<=47||(e===23||e===31)&&t>=33&&t<=35))return!1;let n=e===20||e===21||e===23?1:2,r=this.channels[n];return e===20||e===21||e===28||e===29?t===32?r.ccRCL():t===33?r.ccBS():t===34?r.ccAOF():t===35?r.ccAON():t===36?r.ccDER():t===37?r.ccRU(2):t===38?r.ccRU(3):t===39?r.ccRU(4):t===40?r.ccFON():t===41?r.ccRDC():t===42?r.ccTR():t===43?r.ccRTD():t===44?r.ccEDM():t===45?r.ccCR():t===46?r.ccENM():t===47&&r.ccEOC():r.ccTO(t-32),this.currentChannel=n,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(n=e===17?1:2,n!==this.currentChannel)return this.logger.log(0,`Mismatch channel in midrow parsing`),!1;let r=this.channels[n];return r?(r.ccMIDROW(t),this.logger.log(3,()=>`MIDROW (`+EQ([e,t])+`)`),!0):!1}return!1}parsePAC(e,t){let n;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(e===16||e===24)&&t>=64&&t<=95))return!1;let r=e<=23?1:2;n=t>=64&&t<=95?r===1?bQ[e]:SQ[e]:r===1?xQ[e]:CQ[e];let a=this.channels[r];return a?(a.setPAC(this.interpretPAC(n,t)),this.currentChannel=r,!0):!1}interpretPAC(e,t){let n,r={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-64,r.underline=(n&1)==1,n<=13?r.color=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`,`white`][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color=`white`):r.indent=Math.floor((n-16)/2)*4,r}parseChars(e,t){let n,r=null,a=null;if(e>=25?(n=2,a=e-8):(n=1,a=e),a>=17&&a<=19){let e;e=a===17?t+80:a===18?t+112:t+144,this.logger.log(2,()=>`Special char '`+_Q(e)+`' in channel `+n),r=[e]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,()=>`Char codes = `+EQ(r).join(`,`)),r}parseBackgroundAttributes(e,t){if(!((e===16||e===24)&&t>=32&&t<=47||(e===23||e===31)&&t>=45&&t<=47))return!1;let n,r={};e===16||e===24?(n=Math.floor((t-32)/2),r.background=wQ[n],t%2==1&&(r.background+=`_semi`)):t===45?r.background=`transparent`:(r.foreground=`black`,t===47&&(r.underline=!0));let a=e<=23?1:2;return this.channels[a].setBkgData(r),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){let t=this.channels[e];t&&t.reset()}NQ(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){let n=this.channels[t];n&&n.cueSplitAtTime(e)}}};function NQ(e,t,n){n.a=e,n.b=t}function PQ(e,t,n){return n.a===e&&n.b===t}function FQ(){return{a:null,b:null}}var IQ=(function(){if(AK!=null&&AK.VTTCue)return self.VTTCue;let e=[``,`lr`,`rl`],t=[`start`,`middle`,`end`,`left`,`right`];function n(e,t){if(typeof t!=`string`||!Array.isArray(e))return!1;let n=t.toLowerCase();return~e.indexOf(n)?n:!1}function r(t){return n(e,t)}function a(e){return n(t,e)}function o(e,...t){let n=1;for(;n<arguments.length;n++){let t=arguments[n];for(let n in t)e[n]=t[n]}return e}function s(e,t,n){let s=this,c={enumerable:!0};s.hasBeenReset=!1;let l=``,u=!1,d=e,f=t,p=n,m=null,h=``,g=!0,_=`auto`,v=`start`,y=50,b=`middle`,x=50,S=`middle`;Object.defineProperty(s,"id",o({},c,{get:function(){return l},set:function(e){l=``+e}})),Object.defineProperty(s,"pauseOnExit",o({},c,{get:function(){return u},set:function(e){u=!!e}})),Object.defineProperty(s,"startTime",o({},c,{get:function(){return d},set:function(e){if(typeof e!=`number`)throw TypeError(`Start time must be set to a number.`);d=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"endTime",o({},c,{get:function(){return f},set:function(e){if(typeof e!=`number`)throw TypeError(`End time must be set to a number.`);f=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"text",o({},c,{get:function(){return p},set:function(e){p=``+e,this.hasBeenReset=!0}})),Object.defineProperty(s,"region",o({},c,{get:function(){return m},set:function(e){m=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"vertical",o({},c,{get:function(){return h},set:function(e){let t=r(e);if(t===!1)throw SyntaxError(`An invalid or illegal string was specified.`);h=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"snapToLines",o({},c,{get:function(){return g},set:function(e){g=!!e,this.hasBeenReset=!0}})),Object.defineProperty(s,"line",o({},c,{get:function(){return _},set:function(e){if(typeof e!=`number`&&e!==`auto`)throw SyntaxError(`An invalid number or illegal string was specified.`);_=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"lineAlign",o({},c,{get:function(){return v},set:function(e){let t=a(e);if(!t)throw SyntaxError(`An invalid or illegal string was specified.`);v=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"position",o({},c,{get:function(){return y},set:function(e){if(e<0||e>100)throw Error(`Position must be between 0 and 100.`);y=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"positionAlign",o({},c,{get:function(){return b},set:function(e){let t=a(e);if(!t)throw SyntaxError(`An invalid or illegal string was specified.`);b=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"size",o({},c,{get:function(){return x},set:function(e){if(e<0||e>100)throw Error(`Size must be between 0 and 100.`);x=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"align",o({},c,{get:function(){return S},set:function(e){let t=a(e);if(!t)throw SyntaxError(`An invalid or illegal string was specified.`);S=t,this.hasBeenReset=!0}})),s.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s})(),LQ=class{decode(e,t){if(!e)return``;if(typeof e!=`string`)throw Error(`Error - expected string data.`);return decodeURIComponent(encodeURIComponent(e))}};function RQ(e){function t(e,t,n,r){return(e|0)*3600+(t|0)*60+(n|0)+parseFloat(r||0)}let n=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?t(n[2],n[3],0,n[4]):t(n[1],n[2],n[3],n[4]):null}var zQ=class{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==``&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let r=0;r<n.length;++r)if(t===n[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){let n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}};function BQ(e,t,n,r){let a=r?e.split(r):[e];for(let e in a){if(typeof a[e]!=`string`)continue;let r=a[e].split(n);if(r.length!==2)continue;let o=r[0],s=r[1];t(o,s)}}var VQ=new IQ(0,0,``),HQ=VQ.align===`middle`?`middle`:`center`;function UQ(e,t,n){let r=e;function a(){let t=RQ(e);if(t===null)throw Error(`Malformed timestamp: `+r);return e=e.replace(/^[^\sa-zA-Z-]+/,``),t}function o(e,t){let r=new zQ;BQ(e,function(e,t){let a;switch(e){case`region`:for(let a=n.length-1;a>=0;a--)if(n[a].id===t){r.set(e,n[a].region);break}break;case`vertical`:r.alt(e,t,[`rl`,`lr`]);break;case`line`:a=t.split(`,`),r.integer(e,a[0]),r.percent(e,a[0])&&r.set(`snapToLines`,!1),r.alt(e,a[0],[`auto`]),a.length===2&&r.alt(`lineAlign`,a[1],[`start`,HQ,`end`]);break;case`position`:a=t.split(`,`),r.percent(e,a[0]),a.length===2&&r.alt(`positionAlign`,a[1],[`start`,HQ,`end`,`line-left`,`line-right`,`auto`]);break;case`size`:r.percent(e,t);break;case`align`:r.alt(e,t,[`start`,HQ,`end`,`left`,`right`]);break}},/:/,/\s/),t.region=r.get(`region`,null),t.vertical=r.get(`vertical`,``);let a=r.get(`line`,`auto`);a===`auto`&&VQ.line===-1&&(a=-1),t.line=a,t.lineAlign=r.get(`lineAlign`,`start`),t.snapToLines=r.get(`snapToLines`,!0),t.size=r.get(`size`,100),t.align=r.get(`align`,HQ);let o=r.get(`position`,`auto`);o===`auto`&&VQ.position===50&&(o=t.align===`start`||t.align===`left`?0:t.align===`end`||t.align===`right`?100:50),t.position=o}function s(){e=e.replace(/^\s+/,``)}if(s(),t.startTime=a(),s(),e.slice(0,3)!==`-->`)throw Error(`Malformed time stamp (time stamps must be separated by '-->'): `+r);e=e.slice(3),s(),t.endTime=a(),s(),o(e,t)}function WQ(e){return e.replace(/<br(?: \/)?>/gi,`
138
- `)}var GQ=class{constructor(){this.state=`INITIAL`,this.buffer=``,this.decoder=new LQ,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){let t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function n(){let e=t.buffer,n=0;for(e=WQ(e);n<e.length&&e[n]!==`\r`&&e[n]!==`
139
- `;)++n;let r=e.slice(0,n);return e[n]===`\r`&&++n,e[n]===`
140
- `&&++n,t.buffer=e.slice(n),r}function r(e){BQ(e,function(e,t){},/:/)}try{let e=``;if(t.state===`INITIAL`){if(!/\r\n|\n/.test(t.buffer))return this;e=n();let r=e.match(/^()?WEBVTT([ \t].*)?$/);if(!(r!=null&&r[0]))throw Error(`Malformed WebVTT signature.`);t.state=`HEADER`}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:e=n(),t.state){case`HEADER`:/:/.test(e)?r(e):e||(t.state=`ID`);continue;case`NOTE`:e||(t.state=`ID`);continue;case`ID`:if(/^NOTE($|[ \t])/.test(e)){t.state=`NOTE`;break}if(!e)continue;if(t.cue=new IQ(0,0,``),t.state=`CUE`,e.indexOf(`-->`)===-1){t.cue.id=e;continue}case`CUE`:if(!t.cue){t.state=`BADCUE`;continue}try{UQ(e,t.cue,t.regionList)}catch{t.cue=null,t.state=`BADCUE`;continue}t.state=`CUETEXT`;continue;case`CUETEXT`:{let n=e.indexOf(`-->`)!==-1;if(!e||n&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state=`ID`;continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
141
- `),t.cue.text+=e}continue;case`BADCUE`:e||(t.state=`ID`)}}}catch{t.state===`CUETEXT`&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state===`INITIAL`?`BADWEBVTT`:`BADCUE`}return this}flush(){let e=this;try{if((e.cue||e.state===`HEADER`)&&(e.buffer+=`
142
-
143
- `,e.parse()),e.state===`INITIAL`||e.state===`BADWEBVTT`)throw Error(`Malformed WebVTT signature.`)}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}},KQ=/\r\n|\n\r|\n|\r/g,qQ=function(e,t,n=0){return e.slice(n,n+t.length)===t},JQ=function(e){let t=parseInt(e.slice(-3)),n=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),a=e.length>9?parseInt(e.substring(0,e.indexOf(`:`))):0;if(!GH(t)||!GH(n)||!GH(r)||!GH(a))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*r,t+=3600*1e3*a,t};function YQ(e,t,n){return YZ(e.toString())+YZ(t.toString())+YZ(n)}var XQ=function(e,t,n){let r=e[t],a=e[r.prevCC];if(!a||!a.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(o=a)!=null&&o.new;){var o;e.ccOffset+=r.start-a.start,r.new=!1,r=a,a=e[r.prevCC]}e.presentationOffset=n};function ZQ(e,t,n,r,a,o,s){let c=new GQ,l=_U(new Uint8Array(e)).trim().replace(KQ,`
144
- `).split(`
145
- `),u=[],d=t?yY(t.baseTime,t.timescale):0,f=`00:00.000`,p=0,m=0,h,g=!0;c.oncue=function(e){let o=n[r],s=n.ccOffset,c=(p-d)/9e4;if(o!=null&&o.new&&(m===void 0?XQ(n,r,c):s=n.ccOffset=o.start),c){if(!t){h=Error(`Missing initPTS for VTT MPEGTS`);return}s=c-n.presentationOffset}let l=e.endTime-e.startTime,f=kY((e.startTime+s-m)*9e4,a*9e4)/9e4;e.startTime=Math.max(f,0),e.endTime=Math.max(f+l,0);let g=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(g)),e.id||=YQ(e.startTime,e.endTime,g),e.endTime>0&&u.push(e)},c.onparsingerror=function(e){h=e},c.onflush=function(){if(h){s(h);return}o(u)},l.forEach(e=>{if(g)if(qQ(e,`X-TIMESTAMP-MAP=`)){g=!1,e.slice(16).split(`,`).forEach(e=>{qQ(e,`LOCAL:`)?f=e.slice(6):qQ(e,`MPEGTS:`)&&(p=parseInt(e.slice(7)))});try{m=JQ(f)/1e3}catch(e){h=e}return}else e===``&&(g=!1);c.parse(e+`
146
- `)}),c.flush()}var QQ=`stpp.ttml.im1t`,$Q=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,e$=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,t$={left:`start`,center:`center`,right:`end`,start:`start`,end:`end`};function n$(e,t,n,r){let a=HU(new Uint8Array(e),[`mdat`]);if(a.length===0){r(Error(`Could not parse IMSC1 mdat`));return}let o=a.map(e=>_U(e)),s=_Y(t.baseTime,1,t.timescale);try{o.forEach(e=>n(r$(e,s)))}catch(e){r(e)}}function r$(e,t){let n=new DOMParser().parseFromString(e,`text/xml`).getElementsByTagName(`tt`)[0];if(!n)throw Error(`Invalid ttml`);let r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(r).reduce((e,t)=>(e[t]=n.getAttribute(`ttp:${t}`)||r[t],e),{}),o=n.getAttribute(`xml:space`)!==`preserve`,s=a$(i$(n,`styling`,`style`)),c=a$(i$(n,`layout`,`region`)),l=i$(n,`body`,`[begin]`);return[].map.call(l,e=>{let n=o$(e,o);if(!n||!e.hasAttribute(`begin`))return null;let r=u$(e.getAttribute(`begin`),a),l=u$(e.getAttribute(`dur`),a),u=u$(e.getAttribute(`end`),a);if(r===null)throw l$(e);if(u===null){if(l===null)throw l$(e);u=r+l}let d=new IQ(r-t,u-t,n);d.id=YQ(d.startTime,d.endTime,d.text);let f=c[e.getAttribute(`region`)],p=s[e.getAttribute(`style`)],m=s$(f,p,s),{textAlign:h}=m;if(h){let e=t$[h];e&&(d.lineAlign=e),d.align=h}return eU(d,m),d}).filter(e=>e!==null)}function i$(e,t,n){let r=e.getElementsByTagName(t)[0];return r?[].slice.call(r.querySelectorAll(n)):[]}function a$(e){return e.reduce((e,t)=>{let n=t.getAttribute(`xml:id`);return n&&(e[n]=t),e},{})}function o$(e,t){return[].slice.call(e.childNodes).reduce((e,n,r)=>{var a;return n.nodeName===`br`&&r?e+`
147
- `:(a=n.childNodes)!=null&&a.length?o$(n,t):t?e+n.textContent.trim().replace(/\s+/g,` `):e+n.textContent},``)}function s$(e,t,n){let r=`http://www.w3.org/ns/ttml#styling`,a=null,o=[`displayAlign`,`textAlign`,`color`,`backgroundColor`,`fontSize`,`fontFamily`],s=e!=null&&e.hasAttribute(`style`)?e.getAttribute(`style`):null;return s&&n.hasOwnProperty(s)&&(a=n[s]),o.reduce((n,o)=>{let s=c$(t,r,o)||c$(e,r,o)||c$(a,r,o);return s&&(n[o]=s),n},{})}function c$(e,t,n){return e&&e.hasAttributeNS(t,n)?e.getAttributeNS(t,n):null}function l$(e){return Error(`Could not parse ttml timestamp ${e}`)}function u$(e,t){if(!e)return null;let n=RQ(e);return n===null&&($Q.test(e)?n=d$(e,t):e$.test(e)&&(n=f$(e,t))),n}function d$(e,t){let n=$Q.exec(e),r=(n[4]|0)+(n[5]|0)/t.subFrameRate;return(n[1]|0)*3600+(n[2]|0)*60+(n[3]|0)+r/t.frameRate}function f$(e,t){let n=e$.exec(e),r=Number(n[1]);switch(n[2]){case`h`:return r*3600;case`m`:return r*60;case`ms`:return r*1e3;case`f`:return r/t.frameRate;case`t`:return r/t.tickRate}return r}var p$=class{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}},m$=class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v$(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Q.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Q.FRAG_LOADING,this.onFragLoading,this),e.on(Q.FRAG_LOADED,this.onFragLoaded,this),e.on(Q.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(Q.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(Q.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(Q.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(Q.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){let{hls:e}=this;e.off(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Q.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Q.FRAG_LOADING,this.onFragLoading,this),e.off(Q.FRAG_LOADED,this.onFragLoaded,this),e.off(Q.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(Q.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(Q.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(Q.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(Q.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){let e=new p$(this,`textTrack1`),t=new p$(this,`textTrack2`),n=new p$(this,`textTrack3`),r=new p$(this,`textTrack4`);this.cea608Parser1=new MQ(1,e,t),this.cea608Parser2=new MQ(3,n,r)}addCues(e,t,n,r,a){let o=!1;for(let e=a.length;e--;){let r=a[e],s=_$(r[0],r[1],t,n);if(s>=0&&(r[0]=Math.min(r[0],t),r[1]=Math.max(r[1],n),o=!0,s/(n-t)>.5))return}if(o||a.push([t,n]),this.config.renderTextTracksNatively){let a=this.captionsTracks[e];this.Cues.newCue(a,t,n,r)}else{let a=this.Cues.newCue(null,t,n,r);this.hls.trigger(Q.CUES_PARSED,{type:`captions`,cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:r,timescale:a,trackId:o}){let{unparsedVttFrags:s}=this;n===XH.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:a,trackId:o}),s.length&&(this.unparsedVttFrags=[],s.forEach(e=>{this.initPTS[e.frag.cc]?this.onFragLoaded(Q.FRAG_LOADED,e):this.hls.trigger(Q.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e.frag,error:Error(`Subtitle discontinuity domain does not match main`)})}))}getExistingTrack(e,t){let{media:n}=this;if(n)for(let r=0;r<n.textTracks.length;r++){let a=n.textTracks[r];if(g$(a,{name:e,lang:t,characteristics:`transcribes-spoken-dialog,describes-music-and-sound`}))return a}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;let{captionsProperties:t,captionsTracks:n,media:r}=this,{label:a,languageCode:o}=t[e],s=this.getExistingTrack(a,o);if(s)n[e]=s,HZ(n[e]),BZ(n[e],r);else{let t=this.createTextTrack(`captions`,a,o);t&&(t[e]=!0,n[e]=t)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;let t=this.captionsProperties[e];if(!t)return;let n={_id:e,label:t.label,kind:`captions`,default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(Q.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,n){let r=this.media;if(r)return r.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){let n=!!t.transferMedia;if(this.media=null,n)return;let{captionsTracks:r}=this;Object.keys(r).forEach(e=>{HZ(r[e]),delete r[e]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v$(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){let{media:e}=this;if(!e)return;let t=e.textTracks;if(t)for(let e=0;e<t.length;e++)HZ(t[e])}onSubtitleTracksUpdated(e,t){let n=t.subtitleTracks||[],r=n.some(e=>e.textCodec===QQ);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(XY(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){let e=this.media,t=e?KZ(e.textTracks):null;if(this.tracks.forEach((e,n)=>{let r;if(t){let n=null;for(let r=0;r<t.length;r++)if(t[r]&&g$(t[r],e)){n=t[r],t[r]=null;break}n&&(r=n)}if(r)HZ(r);else{let t=h$(e);r=this.createTextTrack(t,e.name,e.lang),r&&(r.mode=`disabled`)}r&&this.textTracks.push(r)}),t!=null&&t.length){let e=t.filter(e=>e!==null).map(e=>e.label);e.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${e.join(`, `)}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){let e=this.tracks.map(e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}));this.hls.trigger(Q.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(e=>{let t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;let n=`textTrack${t[1]}`,r=this.captionsProperties[n];r&&(r.label=e.name,e.lang&&(r.languageCode=e.lang),r.media=e)})}closedCaptionsForLevel(e){return this.hls.levels[e.level]?.attrs[`CLOSED-CAPTIONS`]}onFragLoading(e,t){if(this.enabled&&t.frag.type===XH.MAIN){let{cea608Parser1:e,cea608Parser2:n,lastSn:r}=this,{cc:a,sn:o}=t.frag,s=t.part?.index??-1;e&&n&&(o!==r+1||o===r&&s!==this.lastPartIndex+1||a!==this.lastCc)&&(e.reset(),n.reset()),this.lastCc=a,this.lastSn=o,this.lastPartIndex=s}}onFragLoaded(e,t){let{frag:n,payload:r}=t;if(n.type===XH.SUBTITLE)if(r.byteLength){let e=n.decryptdata,a=`stats`in t;if(e==null||!e.encrypted||a){let e=this.tracks[n.level],a=this.vttCCs;a[n.cc]||(a[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),e&&e.textCodec===QQ?this._parseIMSC1(n,r):this._parseVTTs(t)}}else this.hls.trigger(Q.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:Error(`Empty subtitle payload`)})}_parseIMSC1(e,t){let n=this.hls;n$(t,this.initPTS[e.cc],t=>{this._appendCues(t,e.level),n.trigger(Q.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},t=>{n.logger.log(`Failed to parse IMSC1: ${t}`),n.trigger(Q.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})})}_parseVTTs(e){var t;let{frag:n,payload:r}=e,{initPTS:a,unparsedVttFrags:o}=this,s=a.length-1;if(!a[n.cc]&&s===-1){o.push(e);return}let c=this.hls;ZQ((t=n.initSegment)!=null&&t.data?rW(n.initSegment.data,new Uint8Array(r)).buffer:r,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,e=>{this._appendCues(e,n.level),c.trigger(Q.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},t=>{let a=t.message===`Missing initPTS for VTT MPEGTS`;a?o.push(e):this._fallbackToIMSC1(n,r),c.logger.log(`Failed to parse VTT cue: ${t}`),!(a&&s>n.cc)&&c.trigger(Q.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:t})})}_fallbackToIMSC1(e,t){let n=this.tracks[e.level];n.textCodec||n$(t,this.initPTS[e.cc],()=>{n.textCodec=QQ,this._parseIMSC1(e,t)},()=>{n.textCodec=`wvtt`})}_appendCues(e,t){let n=this.hls;if(this.config.renderTextTracksNatively){let n=this.textTracks[t];if(!n||n.mode===`disabled`)return;e.forEach(e=>VZ(n,e))}else{let r=this.tracks[t];if(!r)return;let a=r.default?`default`:`subtitles`+t;n.trigger(Q.CUES_PARSED,{type:`subtitles`,cues:e,track:a})}}onFragDecrypted(e,t){let{frag:n}=t;n.type===XH.SUBTITLE&&this.onFragLoaded(Q.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;let{frag:n,samples:r}=t;if(!(n.type===XH.MAIN&&this.closedCaptionsForLevel(n)===`NONE`))for(let e=0;e<r.length;e++){let t=r[e].bytes;if(t){this.cea608Parser1||this.initCea608Parsers();let n=this.extractCea608Data(t);this.cea608Parser1.addData(r[e].pts,n[0]),this.cea608Parser2.addData(r[e].pts,n[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:r,type:a}){let{media:o}=this;if(!(!o||o.currentTime<n)){if(!a||a===`video`){let{captionsTracks:e}=this;Object.keys(e).forEach(r=>UZ(e[r],t,n))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){let{textTracks:e}=this;Object.keys(e).forEach(n=>UZ(e[n],t,r))}}}extractCea608Data(e){let t=[[],[]],n=e[0]&31,r=2;for(let a=0;a<n;a++){let n=e[r++],a=127&e[r++],o=127&e[r++];if(!(a===0&&o===0)&&4&n){let e=3&n;(e===0||e===1)&&(t[e].push(a),t[e].push(o))}}return t}};function h$(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?`captions`:`subtitles`}function g$(e,t){return!!e&&e.kind===h$(t)&&QY(t,e)}function _$(e,t,n,r){return Math.min(t,r)-Math.max(e,n)}function v$(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}var y$=/\s/,b$={newCue(e,t,n,r){let a=[],o,s,c,l,u,d=self.VTTCue||self.TextTrackCue;for(let p=0;p<r.rows.length;p++)if(o=r.rows[p],c=!0,l=0,u=``,!o.isEmpty()){var f;for(let e=0;e<o.chars.length;e++)y$.test(o.chars[e].uchar)&&c?l++:(u+=o.chars[e].uchar,c=!1);o.cueStartTime=t,t===n&&(n+=1e-4),l>=16?l--:l++;let r=WQ(u.trim()),m=YQ(t,n,r);e!=null&&(f=e.cues)!=null&&f.getCueById(m)||(s=new d(t,n,r),s.id=m,s.line=p+1,s.align=`left`,s.position=10+Math.min(80,Math.floor(l*8/32)*10),a.push(s))}return e&&a.length&&(a.sort((e,t)=>e.line===`auto`||t.line===`auto`?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),a.forEach(t=>VZ(e,t))),a}};function x$(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}var S$=/(\d+)-(\d+)\/(\d+)/,C$=class{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||D$,this.controller=new self.AbortController,this.stats=new TU}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,n){let r=this.stats;if(r.loading.start)throw Error(`Loader can only be used once.`);r.loading.start=self.performance.now();let a=w$(e,this.controller.signal),o=e.responseType===`arraybuffer`,s=o?`byteLength`:`length`,{maxTimeToFirstByteMs:c,maxLoadTimeMs:l}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,a),self.clearTimeout(this.requestTimeout),t.timeout=c&&GH(c)?c:l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(HY(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(n=>{this.response=this.loader=n;let a=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},l-(a-r.loading.start)),!n.ok){let{status:e,statusText:t}=n;throw new O$(t||`fetch, bad network response`,e,n)}r.loading.first=a,r.total=E$(n.headers)||r.total;let s=this.callbacks?.onProgress;return s&&GH(t.highWaterMark)?this.loadProgressively(n,r,e,t.highWaterMark,s):o?n.arrayBuffer():e.responseType===`json`?n.json():n.text()}).then(n=>{var a;let o=this.response;if(!o)throw Error(`loader destroyed`);self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);let c=n[s];c&&(r.loaded=r.total=c);let l={url:o.url,data:n,code:o.status},u=this.callbacks?.onProgress;u&&!GH(t.highWaterMark)&&u(r,e,n,o),(a=this.callbacks)==null||a.onSuccess(l,r,e,o)}).catch(t=>{var n;if(self.clearTimeout(this.requestTimeout),r.aborted)return;let a=t&&t.code||0,o=t?t.message:null;(n=this.callbacks)==null||n.onError({code:a,text:o},e,t?t.details:null,r)})}getCacheAge(){let e=null;if(this.response){let t=this.response.headers.get(`age`);e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,n,r=0,a){let o=new Rq,s=e.body.getReader(),c=()=>s.read().then(s=>{if(s.done)return o.dataLength&&a(t,n,o.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));let l=s.value,u=l.length;return t.loaded+=u,u<r||o.dataLength?(o.push(l),o.dataLength>=r&&a(t,n,o.flush().buffer,e)):a(t,n,l.buffer,e),c()}).catch(()=>Promise.reject());return c()}};function w$(e,t){let n={method:`GET`,mode:`cors`,credentials:`same-origin`,signal:t,headers:new self.Headers(eU({},e.headers))};return e.rangeEnd&&n.headers.set(`Range`,`bytes=`+e.rangeStart+`-`+String(e.rangeEnd-1)),n}function T$(e){let t=S$.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}function E$(e){let t=e.get(`Content-Range`);if(t){let e=T$(t);if(GH(e))return e}let n=e.get(`Content-Length`);if(n)return parseInt(n)}function D$(e,t){return new self.Request(e.url,t)}var O$=class extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}},k$=/^age:\s*[\d.]+\s*$/im,A$=class{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new TU,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){let e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,n){if(this.stats.loading.start)throw Error(`Loader can only be used once.`);this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=n,this.loadInternal()}loadInternal(){let{config:e,context:t}=this;if(!e||!t)return;let n=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;let a=this.xhrSetup;a?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return a(n,t.url)}).catch(e=>{if(!(this.loader!==n||this.stats.aborted))return n.open(`GET`,t.url,!0),a(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(e=>{var a;(a=this.callbacks)==null||a.onError({code:n.status,text:e.message},t,n,r)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open(`GET`,t.url,!0);let r=t.headers,{maxTimeToFirstByteMs:a,maxLoadTimeMs:o}=n.loadPolicy;if(r)for(let t in r)e.setRequestHeader(t,r[t]);t.rangeEnd&&e.setRequestHeader(`Range`,`bytes=`+t.rangeStart+`-`+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),n.timeout=a&&GH(a)?a:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){let{context:e,loader:t,stats:n}=this;if(!e||!t)return;let r=t.readyState,a=this.config;if(!n.aborted&&r>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),a.timeout!==a.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),a.timeout=a.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;let r=t.status,c=t.responseType===`text`?t.responseText:null;if(r>=200&&r<300){let a=c??t.response;if(a!=null){var o;n.loading.end=Math.max(self.performance.now(),n.loading.first),n.loaded=n.total=t.responseType===`arraybuffer`?a.byteLength:a.length,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first);let s=this.callbacks?.onProgress;s&&s(n,e,a,t);let c={url:t.responseURL,data:a,code:r};(o=this.callbacks)==null||o.onSuccess(c,n,e,t);return}}let l=a.loadPolicy.errorRetry,u=n.retry;if(AG(l,u,!1,{url:e.url,data:void 0,code:r}))this.retry(l);else{var s;pU.error(`${r} while loading ${e.url}`),(s=this.callbacks)==null||s.onError({code:r,text:t.statusText},e,t,n)}}}loadtimeout(){if(!this.config)return;let e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(AG(e,t,!0))this.retry(e);else{pU.warn(`timeout while loading ${this.context?.url}`);let e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){let{context:t,stats:n}=this;this.retryDelay=OG(e,n.retry),n.retry++,pU.warn(`${status?`HTTP Status `+status:`Timeout`} while loading ${t?.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){let t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&k$.test(this.loader.getAllResponseHeaders())){let t=this.loader.getResponseHeader(`age`);e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&RegExp(`^${e}:\\s*[\\d.]+\\s*$`,`im`).test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}},j$=nU(nU({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:1/0,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:`edge`,liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:A$,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:gG,bufferController:iX,capLevelController:cX,errorController:FG,fpsController:zZ,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:IK,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:`linear`},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:`linear`}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},M$()),{},{subtitleStreamController:mQ,subtitleTrackController:qZ,timelineController:m$,audioStreamController:JY,audioTrackController:$Y,emeController:PZ,cmcdController:kZ,contentSteeringController:jZ,interstitialsController:fQ});function M$(){return{cueHandler:b$,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:`English`,captionsTextTrack1LanguageCode:`en`,captionsTextTrack2Label:`Spanish`,captionsTextTrack2LanguageCode:`es`,captionsTextTrack3Label:`Unknown CC`,captionsTextTrack3LanguageCode:``,captionsTextTrack4Label:`Unknown CC`,captionsTextTrack4LanguageCode:``,renderTextTracksNatively:!0}}function N$(e,t,n){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw Error(`Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration`);if(t.liveMaxLatencyDurationCount!==void 0&&(t.liveSyncDurationCount===void 0||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw Error(`Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"`);if(t.liveMaxLatencyDuration!==void 0&&(t.liveSyncDuration===void 0||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw Error(`Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"`);let r=P$(e),a=[`manifest`,`level`,`frag`],o=[`TimeOut`,`MaxRetry`,`RetryDelay`,`MaxRetryTimeout`];return a.forEach(e=>{let a=`${e===`level`?`playlist`:e}LoadPolicy`,s=t[a]===void 0,c=[];o.forEach(n=>{let o=`${e}Loading${n}`,l=t[o];if(l!==void 0&&s){c.push(o);let e=r[a].default;switch(t[a]={default:e},n){case`TimeOut`:e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case`MaxRetry`:e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case`RetryDelay`:e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case`MaxRetryTimeout`:e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l;break}}}),c.length&&n.warn(`hls.js config: "${c.join(`", "`)}" setting(s) are deprecated, use "${a}": ${nG(t[a])}`)}),nU(nU({},r),t)}function P$(e){return e&&typeof e==`object`?Array.isArray(e)?e.map(P$):Object.keys(e).reduce((t,n)=>(t[n]=P$(e[n]),t),{}):e}function F$(e,t){let n=e.loader;n!==C$&&n!==A$?(t.log(`[config]: Custom loader detected, cannot enable progressive streaming`),e.progressive=!1):x$()&&(e.loader=C$,e.progressive=!0,e.enableSoftwareAES=!0,t.log(`[config]: Progressive streaming enabled, using FetchLoader`))}var I$=2,L$=.1,R$=.05,z$=100,B$=class extends nK{constructor(e,t){super(`gap-controller`,e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var e;(e=this.media)!=null&&e.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{this.hls&&(this.ended=this.media?.currentTime||1,this.hls.trigger(Q.MEDIA_ENDED,{stalled:!1}))},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){let{hls:e}=this;e&&(e.on(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Q.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Q.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(z$),this.mediaSource=t.mediaSource;let n=this.media=t.media;Nq(n,`playing`,this.onMediaPlaying),Nq(n,`waiting`,this.onMediaWaiting),Nq(n,`ended`,this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();let{media:n}=this;n&&(Pq(n,`playing`,this.onMediaPlaying),Pq(n,`waiting`,this.onMediaWaiting),Pq(n,`ended`,this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;let t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){let n=this.hls?.config;if(!n)return;let r=this.media;if(!r)return;let{seeking:a}=r,o=this.seeking&&!a,s=!this.seeking&&a,c=r.paused&&!a||r.ended||r.playbackRate===0;if(this.seeking=a,e!==t){t&&(this.ended=0),this.moved=!0,a||(this.nudgeRetry=0,n.nudgeOnVideoHole&&!c&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(s||o){o&&this.stallResolved(e);return}if(c){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&r.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(Q.MEDIA_ENDED,{stalled:!1}));return}if(!oK.getBuffered(r).length){this.nudgeRetry=0;return}let l=oK.bufferInfo(r,e,0),u=l.nextStart||0,d=this.fragmentTracker;if(a&&d&&this.hls){let t=V$(this.hls.inFlightFragments,e),n=l.len>I$,r=!u||t||u-e>I$&&!d.getPartialFragment(e);if(n||r)return;this.moved=!1}let f=this.hls?.latestLevelDetails;if(!this.moved&&this.stalled!==null&&d){if(!(l.len>0)&&!u)return;let t=Math.max(u,l.start||0)-e,n=f!=null&&f.live?f.targetduration*2:I$,a=U$(e,d);if(t>0&&(t<=n||a)){r.paused||this._trySkipBufferHole(a);return}}let p=n.detectStallWithCurrentTimeMs,m=self.performance.now(),h=this.waiting,g=this.stalled;if(g===null)if(h>0&&m-h<p)g=this.stalled=h;else{this.stalled=m;return}let _=m-g;if(!a&&(_>=p||h)&&this.hls){if(this.mediaSource?.readyState===`ended`&&!(f!=null&&f.live)&&Math.abs(e-(f?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(Q.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(l),!this.media||!this.hls)return}let v=oK.bufferInfo(r,e,n.maxBufferHole);this._tryFixBufferStall(v,_,e)}stallResolved(e){let t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){let n=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(Q.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var n;let r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(n=this.buffered.audio)!=null&&n.length&&r&&r.length>1&&e>r.end(0)){let n=oK.bufferedInfo(oK.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){let n=oK.timeRangesToArray(r),a=oK.bufferedInfo(n,t,0).bufferedIndex;if(a>-1&&a<n.length-1){let t=oK.bufferedInfo(n,e,0).bufferedIndex,r=n[a].end,o=n[a+1].start;if((t===-1||t>a)&&o-r<1&&e-r<2){let n=Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${r} -> ${o} buffered index: ${t}`);this.warn(n.message),this.media.currentTime+=1e-6;let a=U$(e,this.fragmentTracker);a&&`fragment`in a?a=a.fragment:a||=void 0;let s=oK.bufferInfo(this.media,e,0);this.hls.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:n,reason:n.message,frag:a,buffer:s.len,bufferInfo:s})}}}}}_tryFixBufferStall(e,t,n){let{fragmentTracker:r,media:a}=this,o=this.hls?.config;if(!a||!r||!o)return;let s=this.hls?.latestLevelDetails,c=U$(n,r);if((c||s!=null&&s.live&&n<s.fragmentStart)&&(this._trySkipBufferHole(c)||!this.media))return;let l=e.buffered,u=this.adjacentTraversal(e,n);(l&&l.length>1&&e.len>o.maxBufferHole||e.nextStart&&(e.nextStart-n<o.maxBufferHole||u))&&(t>o.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn(`Trying to nudge playhead over buffer-hole`),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){let n=this.fragmentTracker,r=e.nextStart;if(n&&r){let e=n.getFragAtPos(t,XH.MAIN),a=n.getFragAtPos(r,XH.MAIN);if(e&&a)return a.sn-e.sn<2}return!1}_reportStall(e){let{hls:t,media:n,stallReported:r,stalled:a}=this;if(!r&&a!==null&&n&&t){this.stallReported=!0;let r=Error(`Playback stalling at @${n.currentTime} due to low buffer (${nG(e)})`);this.warn(r.message),t.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:a}})}}_trySkipBufferHole(e){let{fragmentTracker:t,media:n}=this,r=this.hls?.config;if(!n||!t||!r)return 0;let a=n.currentTime,o=oK.bufferInfo(n,a,0),s=a<o.start?o.start:o.nextStart;if(s&&this.hls){let l=o.len<=r.maxBufferHole,u=o.len>0&&o.len<1&&n.readyState<3,d=s-a;if(d>0&&(l||u)){if(d>r.maxBufferHole){let n=!1;if(a===0){let e=t.getAppendedFrag(0,XH.MAIN);e&&s<e.end&&(n=!0)}if(!n&&e){var c;if(!((c=this.hls.loadLevelObj)!=null&&c.details)||V$(this.hls.inFlightFragments,s))return 0;let n=!1,r=e.end;for(;r<s;){let e=U$(r,t);if(e)r+=e.duration;else{n=!0;break}}if(n)return 0}}let l=Math.max(s+R$,a+L$);if(this.warn(`skipping hole, adjusting currentTime from ${a} to ${l}`),this.moved=!0,n.currentTime=l,!(e!=null&&e.gap)){let t=Error(`fragment loaded with buffer holes, seeking from ${a} to ${l}`),n={type:JH.MEDIA_ERROR,details:Z.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:t,reason:t.message,buffer:o.len,bufferInfo:o};e&&(`fragment`in e?n.part=e:n.frag=e),this.hls.trigger(Q.ERROR,n)}return l}}return 0}_tryNudgeBuffer(e){let{hls:t,media:n,nudgeRetry:r}=this,a=t?.config;if(!n||!a)return 0;let o=n.currentTime;if(this.nudgeRetry++,r<a.nudgeMaxRetry){let s=o+(r+1)*a.nudgeOffset,c=Error(`Nudging 'currentTime' from ${o} to ${s}`);this.warn(c.message),n.currentTime=s,t.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{let n=Error(`Playhead still not moving while enough data buffered @${o} after ${a.nudgeMaxRetry} nudges`);this.error(n.message),t.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.BUFFER_STALLED_ERROR,error:n,fatal:!0,buffer:e.len,bufferInfo:e})}}};function V$(e,t){let n=H$(e.main);if(n&&n.start<=t)return n;let r=H$(e.audio);return r&&r.start<=t?r:null}function H$(e){if(!e)return null;switch(e.state){case $.IDLE:case $.STOPPED:case $.ENDED:case $.ERROR:return null}return e.frag}function U$(e,t){return t.getAppendedFrag(e,XH.MAIN)||t.getPartialFragment(e)}var W$=.25;function G$(){if(!(typeof self>`u`))return self.VTTCue||self.TextTrackCue}function K$(e,t,n,r,a){let o=new e(t,n,``);try{o.value=r,a&&(o.type=a)}catch{o=new e(t,n,nG(a?nU({type:a},r):r))}return o}var q$=(()=>{let e=G$();try{e&&new e(0,1/0,``)}catch{return Number.MAX_VALUE}return 1/0})(),J$=class{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(Q.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){let{hls:e}=this;e&&(e.on(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(Q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Q.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Q.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){let{hls:e}=this;e&&(e.off(Q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(Q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Q.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Q.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){this.media=t.media,t.overrides?.cueRemoval===!1&&(this.removeCues=!1)}onMediaAttached(){let e=this.hls?.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&=(this.removeCues&&HZ(this.id3Track,this.onEventCueEnter),null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){let t=this.getID3Track(e.textTracks);return t.mode=`hidden`,t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){let n=e[t];if(n.kind===`metadata`&&n.label===`id3`)return BZ(n,this.media),n}return this.media.addTextTrack(`metadata`,`id3`)}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;let{enableEmsgMetadataCues:n,enableID3MetadataCues:r}=this.hls.config;if(!n&&!r)return;let{samples:a}=t;this.id3Track||=this.createTrack(this.media);let o=G$();if(o)for(let e=0;e<a.length;e++){let t=a[e].type;if(t===AJ.emsg&&!n||!r)continue;let s=EJ(a[e].data),c=a[e].pts,l=c+a[e].duration;l>q$&&(l=q$),l-c<=0&&(l=c+W$);for(let e=0;e<s.length;e++){let n=s[e];if(!DJ(n)){this.updateId3CueEnds(c,t);let e=K$(o,c,l,n,t);e&&this.id3Track.addCue(e)}}}}updateId3CueEnds(e,t){let n=this.id3Track?.cues;if(n)for(let r=n.length;r--;){let a=n[r];a.type===t&&a.startTime<e&&a.endTime===q$&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:r}){let{id3Track:a,hls:o}=this;if(!o)return;let{config:{enableEmsgMetadataCues:s,enableID3MetadataCues:c}}=o;if(a&&(s||c)){let e;e=r===`audio`?e=>e.type===AJ.audioId3&&c:r===`video`?e=>e.type===AJ.emsg&&s:e=>e.type===AJ.audioId3&&c||e.type===AJ.emsg&&s,UZ(a,t,n,e)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;let{assetPlayerId:n,timelineOffset:r,enableDateRangeMetadataCues:a,interstitialsController:o}=this.hls.config;if(!a)return;let s=G$();if(n&&r&&!o){let{fragmentStart:t,fragmentEnd:r}=e,a=this.assetCue;a?(a.startTime=t,a.endTime=r):s&&(a=this.assetCue=K$(s,t,r,{assetPlayerId:this.hls.config.assetPlayerId},`hlsjs.interstitial.asset`),a&&(a.id=n,this.id3Track||=this.createTrack(this.media),this.id3Track.addCue(a),a.addEventListener(`enter`,this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;let{id3Track:c}=this,{dateRanges:l}=e,u=Object.keys(l),d=this.dateRangeCuesAppended;if(c&&t){var f;if((f=c.cues)!=null&&f.length){let e=Object.keys(d).filter(e=>!u.includes(e));for(let t=e.length;t--;){let n=e[t],r=d[n]?.cues;delete d[n],r&&Object.keys(r).forEach(e=>{let t=r[e];if(t){t.removeEventListener(`enter`,this.onEventCueEnter);try{c.removeCue(t)}catch{}}})}}else d=this.dateRangeCuesAppended={}}let p=e.fragments[e.fragments.length-1];if(!(u.length===0||!GH(p?.programDateTime))){this.id3Track||=this.createTrack(this.media);for(let e=0;e<u.length;e++){let t=u[e],n=l[t],r=n.startTime,a=d[t],c=a?.cues||{},f=a?.durationKnown||!1,p=q$,{duration:m,endDate:h}=n;if(h&&m!==null)p=r+m,f=!0;else if(n.endOnNext&&!f){let e=u.reduce((e,t)=>{if(t!==n.id){let r=l[t];if(r.class===n.class&&r.startDate>n.startDate&&(!e||n.startDate<e.startDate))return r}return e},null);e&&(p=e.startTime,f=!0)}let g=Object.keys(n.attr);for(let e=0;e<g.length;e++){let l=g[e];if(!gK(l))continue;let u=c[l];if(u)f&&!(a!=null&&a.durationKnown)?u.endTime=p:Math.abs(u.startTime-r)>.01&&(u.startTime=r,u.endTime=p);else if(s){let e=n.attr[l];_K(l)&&(e=yU(e));let a=K$(s,r,p,{key:l,data:e},AJ.dateRange);a&&(a.id=t,this.id3Track.addCue(a),c[l]=a,o&&(l===`X-ASSET-LIST`||l===`X-ASSET-URL`)&&a.addEventListener(`enter`,this.onEventCueEnter))}}d[t]={cues:c,dateRange:n,durationKnown:f}}}}},Y$=class{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{let{media:e}=this,t=this.levelDetails;if(!e||!t)return;this.currentTime=e.currentTime;let n=this.computeLatency();if(n===null)return;this._latency=n;let{lowLatencyMode:r,maxLiveSyncPlaybackRate:a}=this.config;if(!r||a===1||!t.live)return;let o=this.targetLatency;if(o===null)return;let s=n-o;if(s<Math.min(this.maxLatency,o+t.targetduration)&&s>.05&&this.forwardBufferLength>1){let t=Math.min(2,Math.max(1,a)),n=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20,r=Math.min(t,Math.max(1,n));this.changeMediaPlaybackRate(e,r)}else e.playbackRate!==1&&e.playbackRate!==0&&this.changeMediaPlaybackRate(e,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){return this.hls?.latestLevelDetails||null}get latency(){return this._latency||0}get maxLatency(){let{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;let t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){let e=this.levelDetails;if(e===null||this.hls===null)return null;let{holdBack:t,partHoldBack:n,targetduration:r}=e,{liveSyncDuration:a,liveSyncDurationCount:o,lowLatencyMode:s}=this.config,c=this.hls.userConfig,l=s&&n||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||l===0)&&(l=a===void 0?o*r:a);let u=r;return l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){let e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;let n=this.levelDetails;if(n===null)return null;let r=n.edge,a=e-t-this.edgeStalled,o=r-n.totalduration,s=r-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(o,a),s)}get drift(){let e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){let e=this.levelDetails;if(e===null)return 0;let t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){let{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;let n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){let{hls:e}=this;e&&(e.on(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Q.ERROR,this.onError,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(Q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Q.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener(`timeupdate`,this.onTimeupdate)}onMediaDetaching(){this.media&&=(this.media.removeEventListener(`timeupdate`,this.onTimeupdate),null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener(`timeupdate`,this.onTimeupdate)}onError(e,t){var n;t.details===Z.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(n=this.levelDetails)!=null&&n.live&&this.hls.logger.warn(`[latency-controller]: Stall detected, adjusting target latency`))}changeMediaPlaybackRate(e,t){var n;e.playbackRate!==t&&((n=this.hls)==null||n.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${this.targetLatency?.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){let e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){let e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}},X$=class extends YY{constructor(e,t){super(e,`level-controller`),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){let{hls:e}=this;e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Q.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Q.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Q.ERROR,this.onError,this)}_unregisterListeners(){let{hls:e}=this;e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Q.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Q.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Q.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(e=>{e.loadError=0,e.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){let n=this.hls.config.preferManagedMediaSource,r=[],a={},o={},s=!1,c=!1,l=!1;t.levels.forEach(e=>{let t=e.attrs,{audioCodec:u,videoCodec:d}=e;u&&(e.audioCodec=u=TW(u,n)||void 0),d&&=e.videoCodec=kW(d);let{width:f,height:p,unknownCodecs:m}=e,h=m?.length||0;if(s||=!!(f&&p),c||=!!d,l||=!!u,h||u&&!this.isAudioSupported(u)||d&&!this.isVideoSupported(d)){this.log(`Some or all CODECS not supported "${t.CODECS}"`);return}let{CODECS:g,"FRAME-RATE":_,"HDCP-LEVEL":v,"PATHWAY-ID":y,RESOLUTION:b,"VIDEO-RANGE":x}=t,S=`${`${y||`.`}-`}${e.bitrate}-${b}-${_}-${g}-${x}-${v}`;if(!a[S]){let t=this.createLevel(e);a[S]=t,o[S]=1,r.push(t)}else if(a[S].uri!==e.url&&!e.attrs[`PATHWAY-ID`]){let t=o[S]+=1;e.attrs[`PATHWAY-ID`]=Array(t+1).join(`.`);let n=this.createLevel(e);a[S]=n,r.push(n)}else a[S].addGroupId(`audio`,t.AUDIO),a[S].addGroupId(`text`,t.SUBTITLES)}),this.filterAndSortMediaOptions(r,t,s,c,l)}createLevel(e){let t=new ZW(e),n=e.supplemental;if(n!=null&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){let e=Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(e.message),t.supportedResult=IW(e,[])}return t}isAudioSupported(e){return _W(e,`audio`,this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return _W(e,`video`,this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,n,r,a){let o=[],s=[],c=e,l=t.stats?.parsing||{};if((n||r)&&a&&(c=c.filter(({videoCodec:e,videoRange:t,width:n,height:r})=>(!!e||!!(n&&r))&&qW(t))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let e=`no level with compatible codecs found in manifest`,n=e;t.levels.length&&(n=`one or more CODECS in variant not supported: ${nG(t.levels.map(e=>e.attrs.CODECS).filter((e,t,n)=>n.indexOf(e)===t))}`,this.warn(n),e+=` (${n})`);let r=Error(e);this.hls.trigger(Q.ERROR,{type:JH.MEDIA_ERROR,details:Z.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:r,reason:n})}}),l.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(e=>!e.audioCodec||this.isAudioSupported(e.audioCodec)),Z$(o)),t.subtitles&&(s=t.subtitles,Z$(s));let u=c.slice(0);c.sort((e,t)=>{if(e.attrs[`HDCP-LEVEL`]!==t.attrs[`HDCP-LEVEL`])return(e.attrs[`HDCP-LEVEL`]||``)>(t.attrs[`HDCP-LEVEL`]||``)?1:-1;if(n&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return KW.indexOf(e.videoRange)-KW.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){let n=bW(e.videoCodec),r=bW(t.videoCodec);if(n!==r)return r-n}if(e.uri===t.uri&&e.codecSet!==t.codecSet){let n=xW(e.codecSet),r=xW(t.codecSet);if(n!==r)return r-n}return e.averageBitrate===t.averageBitrate?0:e.averageBitrate-t.averageBitrate});let d=u[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==u.length)){for(let e=0;e<u.length;e++)if(u[e].pathwayId===c[0].pathwayId){d=u[e];break}}this._levels=c;for(let e=0;e<c.length;e++)if(c[e]===d){this._firstLevel=e;let t=d.bitrate,n=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${t}`),this.hls.userConfig?.abrEwmaDefaultEstimate===void 0){let e=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);e>n&&n===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}let f=a&&!r,p=this.hls.config,m=!!(p.audioStreamController&&p.audioTrackController),h={levels:c,audioTracks:o,subtitleTracks:s,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:a,video:r,altAudio:m&&!f&&o.some(e=>!!e.url)};l.end=performance.now(),this.hls.trigger(Q.MANIFEST_PARSED,h)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){let t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){let n=Error(`invalid level idx`),r=e<0;if(this.hls.trigger(Q.ERROR,{type:JH.OTHER_ERROR,details:Z.LEVEL_SWITCH_ERROR,level:e,fatal:r,error:n,reason:n.message}),r)return;e=Math.min(e,t.length-1)}let n=this.currentLevelIndex,r=this.currentLevel,a=r?r.attrs[`PATHWAY-ID`]:void 0,o=t[e],s=o.attrs[`PATHWAY-ID`];if(this.currentLevelIndex=e,this.currentLevel=o,n===e&&r&&a===s)return;this.log(`Switching to level ${e} (${o.height?o.height+`p `:``}${o.videoRange?o.videoRange+` `:``}${o.codecSet?o.codecSet+` `:``}@${o.bitrate})${s?` with Pathway `+s:``} from level ${n}${a?` with Pathway `+a:``}`);let c={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(Q.LEVEL_SWITCHING,c);let l=o.details;if(!l||l.live){let e=this.switchParams(o.uri,r?.details,l);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){let e=this.hls.config.startLevel;return e===void 0?this.hls.firstAutoLevel:e}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){let t=this.steering.pathways(),n=e.filter(e=>t.indexOf(e)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=n}}onError(e,t){t.fatal||!t.context||t.context.type===YH.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===XH.MAIN){let e=t.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return;let n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var n;let{level:r,details:a}=t,o=t.levelInfo;if(!o){var s;this.warn(`Invalid level index ${r}`),(s=t.deliveryDirectives)!=null&&s.skip&&(a.deltaUpdateFailed=!0);return}if(o===this.currentLevel||t.withoutMultiVariant){o.fragmentError===0&&(o.loadError=0);let e=o.details;e===t.details&&e.advanced&&(e=void 0),this.playlistLoaded(r,t,e)}else (n=t.deliveryDirectives)!=null&&n.skip&&(a.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let n=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,a=e.attrs[`PATHWAY-ID`],o=e.details,s=o?.age;this.log(`Loading level index ${r}${t?.msn===void 0?``:` at sn `+t.msn+` part `+t.part}${a?` Pathway `+a:``}${s&&o.live?` age `+s.toFixed(1)+(o.type&&` `+o.type||``):``} ${n}`),this.hls.trigger(Q.LEVEL_LOADING,{url:n,level:r,levelInfo:e,pathwayId:e.attrs[`PATHWAY-ID`],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex===-1?this.hls.nextAutoLevel:this.manualLevelIndex}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;let n=this._levels.filter((t,n)=>n===e?(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(e=>e.level=-1)),!1):!0);Cq(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);let r=n.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&=Math.min(this._startLevel,r),this.hls.trigger(Q.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){let{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(Q.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}};function Z$(e){let t={};e.forEach(e=>{let n=e.groupId||``;e.id=t[n]=t[n]||0,t[n]++})}function Q$(){return self.SourceBuffer||self.WebKitSourceBuffer}function $$(){if(!mU())return!1;let e=Q$();return!e||e.prototype&&typeof e.prototype.appendBuffer==`function`&&typeof e.prototype.remove==`function`}function e1(){if(!$$())return!1;let e=mU();return typeof e?.isTypeSupported==`function`&&([`avc1.42E01E,mp4a.40.2`,`av01.0.01M.08`,`vp09.00.50.08`].some(t=>e.isTypeSupported(yW(t,`video`)))||[`mp4a.40.2`,`fLaC`].some(t=>e.isTypeSupported(yW(t,`audio`))))}function t1(){var e;let t=Q$();return typeof(t==null||(e=t.prototype)==null?void 0:e.changeType)==`function`}var n1=100,r1=class extends Iq{constructor(e,t,n){super(e,t,n,`stream-controller`,XH.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{let e=this.media,t=e?e.currentTime:null;if(t===null||!GH(t)||(this.log(`Media seeked to ${t.toFixed(3)}`),!this.getBufferedFrag(t)))return;let n=this.getFwdBufferInfoAtPos(e,t,XH.MAIN,0);if(n===null||n.len===0){this.warn(`Main forward buffer length at ${t} on "seeked" event ${n?n.len:`empty`})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Q.LEVEL_LOADING,this.onLevelLoading,this),e.on(Q.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Q.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(Q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(Q.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(Q.BUFFER_CREATED,this.onBufferCreated,this),e.on(Q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(Q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Q.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();let{hls:e}=this;e.off(Q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Q.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Q.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(Q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(Q.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(Q.BUFFER_CREATED,this.onBufferCreated,this),e.off(Q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(Q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Q.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){let{lastCurrentTime:n,hls:r}=this;if(this.stopLoad(),this.setInterval(n1),this.level=-1,!this.startFragRequested){let e=r.startLevel;e===-1&&(r.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=r.firstAutoLevel),r.nextLoadLevel=e,this.level=r.loadLevel,this._hasEnoughToStart=!!t}n>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n),this.state=$.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=$.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case $.WAITING_LEVEL:{let{levels:e,level:t}=this,n=e?.[t],r=n?.details;if(r&&(!r.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(r))break;this.state=$.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=$.IDLE;break}break}case $.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===$.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){let{hls:e,levelLastLoaded:t,levels:n,media:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;let a=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[a]))return;let o=n[a],s=this.getMainFwdBufferInfo();if(s===null)return;let c=this.getLevelDetails();if(c&&this._streamEnded(s,c)){let e={};this.altAudio===2&&(e.type=`video`),this.hls.trigger(Q.BUFFER_EOS,e),this.state=$.ENDED;return}if(!this.buffering)return;e.loadLevel!==a&&e.manualLevel===-1&&this.log(`Adapting to level ${a} from level ${this.level}`),this.level=e.nextLoadLevel=a;let l=o.details;if(!l||this.state===$.WAITING_LEVEL||this.waitForLive(o)){this.level=a,this.state=$.WAITING_LEVEL,this.startFragRequested=!1;return}let u=s.len,d=this.getMaxBufferLength(o.maxBitrate);if(u>=d)return;this.backtrackFragment&&this.backtrackFragment.start>s.end&&(this.backtrackFragment=null);let f=this.backtrackFragment?this.backtrackFragment.start:s.end,p=this.getNextFragment(f,l);if(this.couldBacktrack&&!this.fragPrevious&&p&&OU(p)&&this.fragmentTracker.getState(p)!==LG.OK){let e=(this.backtrackFragment??p).sn-l.startSN,t=l.fragments[e-1];t&&p.cc===t.cc&&(p=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&s.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,f)){if(!p.gap){let e=this.audioOnly&&!this.altAudio?EU.AUDIO:EU.VIDEO,t=(e===EU.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,XH.MAIN)}p=this.getNextFragmentLoopLoading(p,l,s,XH.MAIN,d)}p&&(this.exceedsMaxBuffer(s,d,p)||(p.initSegment&&!p.initSegment.data&&!this.bitrateTest&&(p=p.initSegment),this.loadFragment(p,o,f)))}loadFragment(e,t,n){let r=this.fragmentTracker.getState(e);r===LG.NOT_LOADED||r===LG.PARTIAL?OU(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,n):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,XH.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,1/0),this.altAudio!==0&&(this.getLevelDetails()?.fragmentStart||0)>this.lastCurrentTime&&super.flushMainBuffer(0,1/0,`audio`)}nextLevelSwitch(){let{levels:e,media:t}=this;if(t!=null&&t.readyState){let n,r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);let a=this.getLevelDetails();if(a!=null&&a.live){let e=this.getMainFwdBufferInfo();if(!e||e.len<a.targetduration*2)return}if(!t.paused&&e){let t=e[this.hls.nextLoadLevel],r=this.fragLastKbps;n=r&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*r)+1:0}else n=0;let o=this.getBufferedFrag(t.currentTime+n);if(o){let e=this.followingBufferedFrag(o);if(e){this.abortCurrentFrag();let t=e.maxStartPTS?e.maxStartPTS:e.start,n=e.duration,r=Math.max(o.end,t+Math.min(Math.max(n-this.config.maxFragLookUpTolerance,n*(this.couldBacktrack?.5:.125)),n*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(r,1/0)}}}}abortCurrentFrag(){let e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case $.KEY_LOADING:case $.FRAG_LOADING:case $.FRAG_LOADING_WAITING_RETRY:case $.PARSING:case $.PARSED:this.state=$.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?`video`:null)}onMediaAttached(e,t){super.onMediaAttached(e,t);let n=t.media;Nq(n,`playing`,this.onMediaPlaying),Nq(n,`seeked`,this.onMediaSeeked)}onMediaDetaching(e,t){let{media:n}=this;n&&(Pq(n,`playing`,this.onMediaPlaying),Pq(n,`seeked`,this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log(`Trigger BUFFER_RESET`),this.hls.trigger(Q.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let n=!1,r=!1;for(let e=0;e<t.levels.length;e++){let a=t.levels[e].audioCodec;a&&(n||=a.indexOf(`mp4a.40.2`)!==-1,r||=a.indexOf(`mp4a.40.5`)!==-1)}this.audioCodecSwitch=n&&r&&!t1(),this.audioCodecSwitch&&this.log(`Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC`),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){let{levels:n}=this;if(!n||this.state!==$.IDLE)return;let r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=$.WAITING_LEVEL)}onLevelLoaded(e,t){var n;let{levels:r,startFragRequested:a}=this,o=t.level,s=t.details,c=s.totalduration;if(!r){this.warn(`Levels were reset while loading level ${o}`);return}this.log(`Level ${o} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:``}, cc [${s.startCC}, ${s.endCC}] duration:${c}`);let l=t.levelInfo,u=this.fragCurrent;u&&(this.state===$.FRAG_LOADING||this.state===$.FRAG_LOADING_WAITING_RETRY)&&u.level!==t.level&&u.loader&&this.abortCurrentFrag();let d=0;if(s.live||(n=l.details)!=null&&n.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;d=this.alignPlaylists(s,l.details,this.levelLastLoaded?.details)}if(l.details=s,this.levelLastLoaded=l,a||this.setStartPosition(s,d),this.hls.trigger(Q.LEVEL_UPDATED,{details:s,level:o}),this.state===$.WAITING_LEVEL){if(this.waitForCdnTuneIn(s))return;this.state=$.IDLE}a&&s.live&&this.synchronizeToLiveEdge(s),this.tick()}synchronizeToLiveEdge(e){let{config:t,media:n}=this;if(!n)return;let r=this.hls.liveSyncPosition,a=this.getLoadPosition(),o=e.fragmentStart,s=e.edge,c=a>=o-t.maxFragLookUpTolerance&&a<=s;if(r!==null&&n.duration>r&&(a<r||!c)){let o=t.liveMaxLatencyDuration===void 0?t.liveMaxLatencyDurationCount*e.targetduration:t.liveMaxLatencyDuration;if((!c&&n.readyState<4||a<s-o)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),n.readyState))if(this.warn(`Playback: ${a.toFixed(3)} is located too far from the end of live sliding playlist: ${s}, reset currentTime to : ${r.toFixed(3)}`),this.config.liveSyncMode===`buffered`){var l;let e=oK.bufferInfo(n,r,0);if(!((l=e.buffered)!=null&&l.length)){n.currentTime=r;return}if(e.start<=a){n.currentTime=r;return}let{nextStart:t}=oK.bufferedInfo(e.buffered,a,0);t&&(n.currentTime=t)}else n.currentTime=r}}_handleFragmentLoadProgress(e){let t=e.frag,{part:n,payload:r}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${t.sn} of level ${t.level} will not be buffered`);return}let o=a[t.level];if(!o){this.warn(`Level ${t.level} not found on progress`);return}let s=o.details;if(!s){this.warn(`Dropping fragment ${t.sn} of level ${t.level} after level details were reset`),this.fragmentTracker.removeFragment(t);return}let c=o.videoCodec,l=s.PTSKnown||!s.live,u=t.initSegment?.data,d=this._getAudioCodec(o),f=this.transmuxer=this.transmuxer||new KY(this.hls,XH.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=n?n.index:-1,m=p!==-1,h=new rK(t.level,t.sn,t.stats.chunkCount,r.byteLength,p,m),g=this.initPTS[t.cc];f.push(r,u,d,c,t,n,s.totalduration,l,h,g)}onAudioTrackSwitching(e,t){let n=this.hls,r=this.altAudio!==0;if(hG(t.url,n))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log(`Switching on main audio, use media.buffered to schedule main fragment loading`),this.mediaBuffer=this.media;let e=this.fragCurrent;e&&(this.log(`Switching to main audio track, cancel main fragment load`),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.altAudio=0,this.fragmentTracker.removeAllFragments(),n.once(Q.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(Q.AUDIO_TRACK_SWITCHED,t)}),n.trigger(Q.BUFFER_FLUSHING,{startOffset:0,endOffset:1/0,type:null});return}n.trigger(Q.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){let n=hG(t.url,this.hls);if(n){let e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log(`Switching on alternate audio, use video.buffered to schedule main fragment loading`),this.mediaBuffer=e)}this.altAudio=n?2:0,this.tick()}onBufferCreated(e,t){let n=t.tracks,r,a,o=!1;for(let e in n){let t=n[e];if(t.id===`main`){if(a=e,r=t,e===`video`){let t=n[e];t&&(this.videoBuffer=t.buffer)}}else o=!0}o&&r?(this.log(`Alternate track found, use ${a}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){let{frag:n,part:r}=t,a=n.type===XH.MAIN;if(a){if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${r?` p: `+r.index:``} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===$.PARSED&&(this.state=$.IDLE);return}let e=r?r.stats:n.stats;this.fragLastKbps=Math.round(8*e.total/(e.buffering.end-e.loading.first)),OU(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,r)}let o=this.media;o&&(!this._hasEnoughToStart&&oK.getBuffered(o).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),a&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){if(t.fatal){this.state=$.ERROR;return}switch(t.details){case Z.FRAG_GAP:case Z.FRAG_PARSING_ERROR:case Z.FRAG_DECRYPT_ERROR:case Z.FRAG_LOAD_ERROR:case Z.FRAG_LOAD_TIMEOUT:case Z.KEY_LOAD_ERROR:case Z.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(XH.MAIN,t);break;case Z.LEVEL_LOAD_ERROR:case Z.LEVEL_LOAD_TIMEOUT:case Z.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===$.WAITING_LEVEL&&t.context?.type===YH.LEVEL&&(this.state=$.IDLE);break;case Z.BUFFER_ADD_CODEC_ERROR:case Z.BUFFER_APPEND_ERROR:if(t.parent!==`main`)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case Z.BUFFER_FULL_ERROR:if(t.parent!==`main`)return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,1/0));break;case Z.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=$.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==EU.AUDIO||!this.altAudio){let e=(t===EU.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;e&&(this.afterBufferFlushed(e,t,XH.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){let{media:e}=this;if(!e)return;let t=e.currentTime,n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}let r=this.timelineOffset;r&&n&&(n+=r);let a=this.getLevelDetails(),o=oK.getBuffered(e),s=o.length?o.start(0):0,c=s-n,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<l||this.loadingParts&&c<2*(a?.partTarget||0)))&&(this.log(`adjusting start position by ${c} to match buffer start`),n+=c,this.startPosition=n),t<n&&(this.log(`seek to target start position ${n} from current time ${t} buffer start ${s}`),e.currentTime=n)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log(`Swapping audio codec`),t=t.indexOf(`mp4a.40.5`)===-1?`mp4a.40.5`:`mp4a.40.2`),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(e=>{let{hls:n}=this,r=e?.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=$.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;let a=r.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),n.trigger(Q.FRAG_LOADED,e),r.bitrateTest=!1}).catch(t=>{this.state===$.STOPPED||this.state===$.ERROR||(this.warn(t),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){let t=this.playlistType,{hls:n}=this,{remuxResult:r,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}let{frag:s,part:c,level:l}=o,{video:u,text:d,id3:f,initSegment:p}=r,{details:m}=l,h=this.altAudio?void 0:r.audio;if(this.fragContextChanged(s)){this.fragmentTracker.removeFragment(s);return}if(this.state=$.PARSING,p){let e=p.tracks;if(e){let r=s.initSegment||s;if(this.unhandledEncryptionError(p,s))return;this._bufferInitSegment(l,e,r,a),n.trigger(Q.FRAG_PARSING_INIT_SEGMENT,{frag:r,id:t,tracks:e})}let r=p.initPTS,o=p.timescale,c=this.initPTS[s.cc];if(GH(r)&&(!c||c.baseTime!==r||c.timescale!==o)){let e=p.trackId;this.initPTS[s.cc]={baseTime:r,timescale:o,trackId:e},n.trigger(Q.INIT_PTS_FOUND,{frag:s,id:t,initPTS:r,timescale:o,trackId:e})}}if(u&&m){h&&u.type===`audiovideo`&&this.logMuxedErr(s);let e=m.fragments[s.sn-1-m.startSN],t=s.sn===m.startSN,n=!e||s.cc>e.cc;if(r.independent!==!1){let{startPTS:e,endPTS:r,startDTS:o,endDTS:l}=u;if(c)c.elementaryStreams[u.type]={startPTS:e,endPTS:r,startDTS:o,endDTS:l};else if(u.firstKeyFrame&&u.independent&&a.id===1&&!n&&(this.couldBacktrack=!0),u.dropped&&u.independent){let a=this.getMainFwdBufferInfo(),o=(a?a.end:this.getLoadPosition())+this.config.maxBufferHole,c=u.firstKeyFramePTS?u.firstKeyFramePTS:e;if(!t&&o<c-this.config.maxBufferHole&&!n){this.backtrack(s);return}else n&&(s.gap=!0);s.setElementaryStreamInfo(u.type,s.start,r,s.start,l,!0)}else t&&e-(m.appliedTimelineOffset||0)>I$&&(s.gap=!0);s.setElementaryStreamInfo(u.type,e,r,o,l),this.backtrackFragment&&=s,this.bufferFragmentData(u,s,c,a,t||n)}else if(t||n)s.gap=!0;else{this.backtrack(s);return}}if(h){let{startPTS:e,endPTS:t,startDTS:n,endDTS:r}=h;c&&(c.elementaryStreams[EU.AUDIO]={startPTS:e,endPTS:t,startDTS:n,endDTS:r}),s.setElementaryStreamInfo(EU.AUDIO,e,t,n,r),this.bufferFragmentData(h,s,c,a)}if(m&&f!=null&&f.samples.length){let e={id:t,frag:s,details:m,samples:f.samples};n.trigger(Q.FRAG_PARSING_METADATA,e)}if(m&&d){let e={id:t,frag:s,details:m,samples:d.samples};n.trigger(Q.FRAG_PARSING_USERDATA,e)}}logMuxedErr(e){this.warn(`${OU(e)?`Media`:`Init`} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,n,r){if(this.state!==$.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(n));let{audio:a,video:o,audiovideo:s}=t;if(a){let n=e.audioCodec,r=DW(a.codec,n);r===`mp4a`&&(r=`mp4a.40.5`);let o=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){r&&=r.indexOf(`mp4a.40.5`)===-1?`mp4a.40.5`:`mp4a.40.2`;let e=a.metadata;e&&`channelCount`in e&&(e.channelCount||1)!==1&&o.indexOf(`firefox`)===-1&&(r=`mp4a.40.5`)}r&&r.indexOf(`mp4a.40.5`)!==-1&&o.indexOf(`android`)!==-1&&a.container!==`audio/mpeg`&&(r=`mp4a.40.2`,this.log(`Android: force audio codec to ${r}`)),n&&n!==r&&this.log(`Swapping manifest audio codec "${n}" for "${r}"`),a.levelCodec=r,a.id=XH.MAIN,this.log(`Init audio buffer, container:${a.container}, codecs[selected/level/parsed]=[${r||``}/${n||``}/${a.codec}]`),delete t.audiovideo}if(o){o.levelCodec=e.videoCodec,o.id=XH.MAIN;let n=o.codec;if(n?.length===4)switch(n){case`hvc1`:case`hev1`:o.codec=`hvc1.1.6.L120.90`;break;case`av01`:o.codec=`av01.0.04M.08`;break;case`avc1`:o.codec=`avc1.42e01e`;break}this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||``}/${n}]${o.codec===n?``:` parsed-corrected=`+o.codec}${o.supplemental?` supplemental=`+o.supplemental:``}`),delete t.audiovideo}s&&(this.log(`Init audiovideo buffer, container:${s.container}, codecs[level/parsed]=[${e.codecs}/${s.codec}]`),delete t.video,delete t.audio);let c=Object.keys(t);if(c.length){if(this.hls.trigger(Q.BUFFER_CODECS,t),!this.hls)return;c.forEach(e=>{let a=t[e].initSegment;a!=null&&a.byteLength&&this.hls.trigger(Q.BUFFER_APPENDING,{type:e,data:a,frag:n,part:null,chunkMeta:r,parent:n.type})})}this.tickImmediate()}getMainFwdBufferInfo(){let e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,XH.MAIN)}get maxBufferLength(){let{levels:e,level:t}=this,n=e?.[t];return n?this.getMaxBufferLength(n.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=$.IDLE}checkFragmentChanged(){let e=this.media,t=null;if(e&&e.readyState>1&&e.seeking===!1){let n=e.currentTime;if(oK.isBuffered(e,n)?t=this.getAppendedFrag(n):oK.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;let e=this.fragPlaying,n=t.level;(!e||t.sn!==e.sn||e.level!==n)&&(this.fragPlaying=t,this.hls.trigger(Q.FRAG_CHANGED,{frag:t}),(!e||e.level!==n)&&this.hls.trigger(Q.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){let e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){if(this.fragPlaying)return this.fragPlaying;let e=this.media?.currentTime||this.lastCurrentTime;return GH(e)?this.getAppendedFrag(e):null}get currentProgramDateTime(){let e=this.media?.currentTime||this.lastCurrentTime;if(GH(e)){let t=this.getLevelDetails(),n=this.currentFrag||(t?yG(null,t.fragments,e):null);if(n){let t=n.programDateTime;if(t!==null){let r=t+(e-n.start)*1e3;return new Date(r)}}}return null}get currentLevel(){let e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){let e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}},i1=class extends aU{constructor(e,t){super(`key-loader`,t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(let t in this.keyIdToKeyInfo){let n=this.keyIdToKeyInfo[t].loader;if(n){if(e&&e!==n.context?.frag.type)return;n.abort()}}}detach(){for(let e in this.keyIdToKeyInfo){let t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(let e in this.keyIdToKeyInfo){let t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=Z.KEY_LOAD_ERROR,n,r,a){return new tK({type:JH.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:a,error:n,networkDetails:r})}loadClear(e,t,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,a=t.length;r<a;r++){let o=t[r];if(e.cc<=o.cc&&(!OU(e)||!OU(o)||e.sn<o.sn)||!n&&r==a-1)return this.emeController.selectKeySystemFormat(o).then(e=>{if(!this.emeController)return;o.setKeyFormat(e);let t=NK(e);if(t)return this.emeController.getKeySystemAccess([t])})}if(this.config.requireKeySystemAccessOnStart){let e=FK(this.config);if(e.length)return this.emeController.getKeySystemAccess(e)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var n,r;t&&e.setKeyFormat(t);let a=e.decryptdata;if(!a){let n=Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,Z.KEY_LOAD_ERROR,n))}let o=a.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,Z.KEY_LOAD_ERROR,Error(`Invalid key URI: "${o}"`)));let s=a1(a),c=this.keyIdToKeyInfo[s];if((n=c)!=null&&n.decryptdata.key)return a.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if(this.emeController&&(r=c)!=null&&r.keyLoadPromise)switch(this.emeController.getKeyStatus(c.decryptdata)){case`usable`:case`usable-in-future`:return c.keyLoadPromise.then(t=>{let{keyInfo:n}=t;return a.key=n.decryptdata.key,{frag:e,keyInfo:n}})}switch(this.log(`${this.keyIdToKeyInfo[s]?`Rel`:`L`}oading${a.keyId?` keyId: `+vU(a.keyId):``} URI: ${a.uri} from ${e.type} ${e.level}`),c=this.keyIdToKeyInfo[s]={decryptdata:a,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},a.method){case`SAMPLE-AES`:case`SAMPLE-AES-CENC`:case`SAMPLE-AES-CTR`:return a.keyFormat===`identity`?this.loadKeyHTTP(c,e):this.loadKeyEME(c,e);case`AES-128`:case`AES-256`:case`AES-256-CTR`:return this.loadKeyHTTP(c,e);default:return Promise.reject(this.createKeyLoadError(e,Z.KEY_LOAD_ERROR,Error(`Key supplied with unsupported METHOD: "${a.method}"`)))}}loadKeyEME(e,t){let n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r;if(!e.decryptdata.keyId&&(r=t.initSegment)!=null&&r.data){let n=QU(t.initSegment.data);if(n.length){let t=n[0];t.some(e=>e!==0)?(this.log(`Using keyId found in init segment ${vU(t)}`),HK.setKeyIdForUri(e.decryptdata.uri,t)):(t=HK.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${vU(t)}`)),e.decryptdata.keyId=t}}return!e.decryptdata.keyId&&!OU(t)?Promise.resolve(n):(e.keyLoadPromise=this.emeController.loadKey(n).then(t=>(e.mediaKeySessionContext=t,n))).catch(n=>{throw e.keyLoadPromise=null,`data`in n&&(n.data.frag=t),n})}return Promise.resolve(n)}loadKeyHTTP(e,t){let n=this.config,r=n.loader,a=new r(n);return t.keyLoader=e.loader=a,e.keyLoadPromise=new Promise((r,o)=>{let s={keyInfo:e,frag:t,responseType:`arraybuffer`,url:e.decryptdata.uri},c=n.keyLoadPolicy.default,l={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};a.load(s,l,{onSuccess:(e,t,n,a)=>{let{frag:s,keyInfo:c}=n,l=a1(c.decryptdata);if(!s.decryptdata||c!==this.keyIdToKeyInfo[l])return o(this.createKeyLoadError(s,Z.KEY_LOAD_ERROR,Error(`after key load, decryptdata unset or changed`),a));c.decryptdata.key=s.decryptdata.key=new Uint8Array(e.data),s.keyLoader=null,c.loader=null,r({frag:s,keyInfo:c})},onError:(e,n,r,a)=>{this.resetLoader(n),o(this.createKeyLoadError(t,Z.KEY_LOAD_ERROR,Error(`HTTP Error ${e.code} loading key ${e.text}`),r,nU({url:s.url,data:void 0},e)))},onTimeout:(e,n,r)=>{this.resetLoader(n),o(this.createKeyLoadError(t,Z.KEY_LOAD_TIMEOUT,Error(`key loading timed out`),r))},onAbort:(e,n,r)=>{this.resetLoader(n),o(this.createKeyLoadError(t,Z.INTERNAL_ABORTED,Error(`key loading aborted`),r))}})})}resetLoader(e){let{frag:t,keyInfo:n,url:r}=e,a=n.loader;t.keyLoader===a&&(t.keyLoader=null,n.loader=null);let o=a1(n.decryptdata)||r;delete this.keyIdToKeyInfo[o],a&&a.destroy()}};function a1(e){if(e.keyFormat!==MK.FAIRPLAY){let t=e.keyId;if(t)return vU(t)}return e.uri}function o1(e){let{type:t}=e;switch(t){case YH.AUDIO_TRACK:return XH.AUDIO;case YH.SUBTITLE_TRACK:return XH.SUBTITLE;default:return XH.MAIN}}function s1(e,t){let n=e.url;return(n===void 0||n.indexOf(`data:`)===0)&&(n=t.url),n}var c1=class{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){let{hls:e}=this;e.on(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Q.LEVEL_LOADING,this.onLevelLoading,this),e.on(Q.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(Q.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(Q.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){let{hls:e}=this;e.off(Q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Q.LEVEL_LOADING,this.onLevelLoading,this),e.off(Q.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(Q.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(Q.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){let t=this.hls.config,n=t.pLoader,r=t.loader,a=new(n||r)(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(let e in this.loaders){let t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){let{url:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:`text`,type:YH.MANIFEST,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){let{id:n,level:r,pathwayId:a,url:o,deliveryDirectives:s,levelInfo:c}=t;this.load({id:n,level:r,pathwayId:a,responseType:`text`,type:YH.LEVEL,url:o,deliveryDirectives:s,levelOrTrack:c})}onAudioTrackLoading(e,t){let{id:n,groupId:r,url:a,deliveryDirectives:o,track:s}=t;this.load({id:n,groupId:r,level:null,responseType:`text`,type:YH.AUDIO_TRACK,url:a,deliveryDirectives:o,levelOrTrack:s})}onSubtitleTrackLoading(e,t){let{id:n,groupId:r,url:a,deliveryDirectives:o,track:s}=t;this.load({id:n,groupId:r,level:null,responseType:`text`,type:YH.SUBTITLE_TRACK,url:a,deliveryDirectives:o,levelOrTrack:s})}onLevelsUpdated(e,t){let n=this.loaders[YH.LEVEL];if(n){let e=n.context;e&&!t.levels.some(t=>t===e.levelOrTrack)&&(n.abort(),delete this.loaders[YH.LEVEL])}}load(e){let t=this.hls.config,n=this.getInternalLoader(e);if(n){let t=this.hls.logger,r=n.context;if(r&&r.levelOrTrack===e.levelOrTrack&&(r.url===e.url||r.deliveryDirectives&&!e.deliveryDirectives)){r.url===e.url?t.log(`[playlist-loader]: ignore ${e.url} ongoing request`):t.log(`[playlist-loader]: ignore ${e.url} in favor of ${r.url}`);return}t.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let r;if(r=e.type===YH.MANIFEST?t.manifestLoadPolicy.default:eU({},t.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),GH(e.deliveryDirectives?.part)){let t;if(e.type===YH.LEVEL&&e.level!==null?t=this.hls.levels[e.level].details:e.type===YH.AUDIO_TRACK&&e.id!==null?t=this.hls.audioTracks[e.id].details:e.type===YH.SUBTITLE_TRACK&&e.id!==null&&(t=this.hls.subtitleTracks[e.id].details),t){let e=t.partTarget,n=t.targetduration;if(e&&n){let t=Math.max(e*3,n*.8)*1e3;r=eU({},r,{maxTimeToFirstByteMs:Math.min(t,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,r.maxTimeToFirstByteMs)})}}}let a=r.errorRetry||r.timeoutRetry||{},o={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0};n.load(e,o,{onSuccess:(e,t,n,r)=>{let a=this.getInternalLoader(n);this.resetInternalLoader(n.type);let o=e.data;t.parsing.start=performance.now(),ZK.isMediaPlaylist(o)||n.type!==YH.MANIFEST?this.handleTrackOrLevelPlaylist(e,t,n,r||null,a):this.handleMasterPlaylist(e,t,n,r)},onError:(e,t,n,r)=>{this.handleNetworkError(t,n,!1,e,r)},onTimeout:(e,t,n)=>{this.handleNetworkError(t,n,!0,void 0,e)}})}checkAutostartLoad(){if(!this.hls)return;let{config:{autoStartLoad:e,startPosition:t},forceStartLoad:n}=this.hls;(e||n)&&(this.hls.logger.log(`${e?`auto`:`force`} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,n,r){let a=this.hls,o=e.data,s=s1(e,n),c=ZK.parseMasterPlaylist(o,s);if(c.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,n,c.playlistParsingError,r,t);return}let{contentSteering:l,levels:u,sessionData:d,sessionKeys:f,startTimeOffset:p,variableList:m}=c;this.variableList=m,u.forEach(e=>{let{unknownCodecs:t}=e;if(t){let{preferManagedMediaSource:n}=this.hls.config,{audioCodec:r,videoCodec:a}=e;for(let o=t.length;o--;){let s=t[o];_W(s,`audio`,n)?(e.audioCodec=r=r?`${r},${s}`:s,hW.audio[r.substring(0,4)]=2,t.splice(o,1)):_W(s,`video`,n)&&(e.videoCodec=a=a?`${a},${s}`:s,hW.video[a.substring(0,4)]=2,t.splice(o,1))}}});let{AUDIO:h=[],SUBTITLES:g,"CLOSED-CAPTIONS":_}=ZK.parseMasterPlaylistMedia(o,s,c);h.length&&!h.some(e=>!e.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(this.hls.logger.log(`[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one`),h.unshift({type:`main`,name:`main`,groupId:`main`,default:!1,autoselect:!1,forced:!1,id:-1,attrs:new mK({}),bitrate:0,url:``})),a.trigger(Q.MANIFEST_LOADED,{levels:u,audioTracks:h,subtitles:g,captions:_,contentSteering:l,url:s,stats:t,networkDetails:r,sessionData:d,sessionKeys:f,startTimeOffset:p,variableList:m})}handleTrackOrLevelPlaylist(e,t,n,r,a){let o=this.hls,{id:s,level:c,type:l}=n,u=s1(e,n),d=GH(c)?c:GH(s)?s:0,f=o1(n),p=ZK.parseLevelPlaylist(e.data,u,d,f,0,this.variableList);if(l===YH.MANIFEST){let e={attrs:new mK({}),bitrate:0,details:p,name:``,url:u};p.requestScheduled=t.loading.start+yq(p,0),o.trigger(Q.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:u,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=p,this.handlePlaylistLoaded(p,e,t,n,r,a)}handleManifestParsingError(e,t,n,r,a){this.hls.trigger(Q.ERROR,{type:JH.NETWORK_ERROR,details:Z.MANIFEST_PARSING_ERROR,fatal:t.type===YH.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:r,stats:a})}handleNetworkError(e,t,n=!1,r,a){let o=`A network ${n?`timeout`:`error`+(r?` (status `+r.code+`)`:``)} occurred while loading ${e.type}`;e.type===YH.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===YH.AUDIO_TRACK||e.type===YH.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);let s=Error(o);this.hls.logger.warn(`[playlist-loader]: ${o}`);let c=Z.UNKNOWN,l=!1,u=this.getInternalLoader(e);switch(e.type){case YH.MANIFEST:c=n?Z.MANIFEST_LOAD_TIMEOUT:Z.MANIFEST_LOAD_ERROR,l=!0;break;case YH.LEVEL:c=n?Z.LEVEL_LOAD_TIMEOUT:Z.LEVEL_LOAD_ERROR,l=!1;break;case YH.AUDIO_TRACK:c=n?Z.AUDIO_TRACK_LOAD_TIMEOUT:Z.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case YH.SUBTITLE_TRACK:c=n?Z.SUBTITLE_TRACK_LOAD_TIMEOUT:Z.SUBTITLE_LOAD_ERROR,l=!1;break}u&&this.resetInternalLoader(e.type);let d={type:JH.NETWORK_ERROR,details:c,fatal:l,url:e.url,loader:u,context:e,error:s,networkDetails:t,stats:a};r&&(d.response=nU({url:t?.url||e.url,data:void 0},r)),this.hls.trigger(Q.ERROR,d)}handlePlaylistLoaded(e,t,n,r,a,o){let s=this.hls,{type:c,level:l,levelOrTrack:u,id:d,groupId:f,deliveryDirectives:p}=r,m=s1(t,r),h=o1(r),g=typeof r.level==`number`&&h===XH.MAIN?l:void 0,_=e.playlistParsingError;if(_){if(this.hls.logger.warn(`${_} ${e.url}`),!s.config.ignorePlaylistParsingErrors){s.trigger(Q.ERROR,{type:JH.NETWORK_ERROR,details:Z.LEVEL_PARSING_ERROR,fatal:!1,url:m,error:_,reason:_.message,response:t,context:r,level:g,parent:h,networkDetails:a,stats:n});return}e.playlistParsingError=null}if(!e.fragments.length){let o=e.playlistParsingError=Error(`No Segments found in Playlist`);s.trigger(Q.ERROR,{type:JH.NETWORK_ERROR,details:Z.LEVEL_EMPTY_ERROR,fatal:!1,url:m,error:o,reason:o.message,response:t,context:r,level:g,parent:h,networkDetails:a,stats:n});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case YH.MANIFEST:case YH.LEVEL:if(g){if(!u)g=0;else if(u!==s.levels[g]){let e=s.levels.indexOf(u);e>-1&&(g=e)}}s.trigger(Q.LEVEL_LOADED,{details:e,levelInfo:u||s.levels[0],level:g||0,id:d||0,stats:n,networkDetails:a,deliveryDirectives:p,withoutMultiVariant:c===YH.MANIFEST});break;case YH.AUDIO_TRACK:s.trigger(Q.AUDIO_TRACK_LOADED,{details:e,track:u,id:d||0,groupId:f||``,stats:n,networkDetails:a,deliveryDirectives:p});break;case YH.SUBTITLE_TRACK:s.trigger(Q.SUBTITLE_TRACK_LOADED,{details:e,track:u,id:d||0,groupId:f||``,stats:n,networkDetails:a,deliveryDirectives:p});break}}},l1=class e{static get version(){return Wq}static isMSESupported(){return $$()}static isSupported(){return e1()}static getMediaSource(){return mU()}static get Events(){return Q}static get MetadataSchema(){return AJ}static get ErrorTypes(){return JH}static get ErrorDetails(){return Z}static get DefaultConfig(){return e.defaultConfig?e.defaultConfig:j$}static set DefaultConfig(t){e.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Uq,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;let n=this.logger=fU(t.debug||!1,`Hls instance`,t.assetPlayerId),r=this.config=N$(e.DefaultConfig,t,n);this.userConfig=t,r.progressive&&F$(r,n);let{abrController:a,bufferController:o,capLevelController:s,errorController:c,fpsController:l}=r,u=new c(this),d=this.abrController=new a(this),f=new RG(this),p=r.interstitialsController,m=p?this.interstitialsController=new p(this,e):null,h=this.bufferController=new o(this,f),g=this.capLevelController=new s(this),_=new l(this),v=new c1(this),y=r.contentSteeringController,b=y?new y(this):null,x=this.levelController=new X$(this,b),S=new J$(this),C=new i1(this.config,this.logger),w=this.streamController=new r1(this,f,C),T=this.gapController=new B$(this,f);g.setStreamController(w),_.setStreamController(w);let E=[v,x,w];m&&E.splice(1,0,m),b&&E.splice(1,0,b),this.networkControllers=E;let D=[d,h,T,g,_,S,f];this.audioTrackController=this.createController(r.audioTrackController,E);let O=r.audioStreamController;O&&E.push(this.audioStreamController=new O(this,f,C)),this.subtitleTrackController=this.createController(r.subtitleTrackController,E);let ee=r.subtitleStreamController;ee&&E.push(this.subtititleStreamController=new ee(this,f,C)),this.createController(r.timelineController,D),C.emeController=this.emeController=this.createController(r.emeController,D),this.cmcdController=this.createController(r.cmcdController,D),this.latencyController=this.createController(Y$,D),this.coreComponents=D,E.push(u);let te=u.onErrorOut;typeof te==`function`&&this.on(Q.ERROR,te,u),this.on(Q.MANIFEST_LOADED,v.onManifestLoaded,v)}createController(e,t){if(e){let n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,r){this._emitter.off(e,t,n,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(this.logger.error(`An internal error happened while handling event `+e+`. Error message: "`+t.message+`". Here is a stacktrace:`,t),!this.triggeringException){this.triggeringException=!0;let n=e===Q.ERROR;this.trigger(Q.ERROR,{type:JH.OTHER_ERROR,details:Z.INTERNAL_EXCEPTION,fatal:n,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log(`destroy`),this.trigger(Q.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>e.destroy()),this.coreComponents.length=0;let e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||`media`in e&&!e.media){let t=Error(`attachMedia failed: invalid argument (${e})`);this.trigger(Q.ERROR,{type:JH.OTHER_ERROR,details:Z.ATTACH_MEDIA_ERROR,fatal:!0,error:t});return}this.logger.log(`attachMedia`),this._media&&(this.logger.warn(`media must be detached before attaching`),this.detachMedia());let t=`media`in e,n=t?e.media:e,r=t?e:{media:n};this._media=n,this.trigger(Q.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log(`detachMedia`),this.trigger(Q.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;let e=this.bufferController.transferMedia();return this.trigger(Q.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();let t=this.media,n=this._url,r=this._url=wU.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&n&&(n!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(Q.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?`, <skip seek to start>`:``)})`),this.started=!0,this.resumeBuffering();for(let n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(e,t),!(!this.started||!this.networkControllers));n++);}stopLoad(){this.logger.log(`stopLoad`),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log(`resume buffering`),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log(`pause buffering`),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){let e={[XH.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[XH.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[XH.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log(`swapAudioCodec`),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log(`recoverMediaError`);let e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||=this._sessionId=JZ(),e}get levels(){return this.levelController.levels||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){let e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){let t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){let{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){GW(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){let{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;let n=e.length;for(let r=0;r<n;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){let{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this,r;if(r=t===-1&&e!=null&&e.length?e.length-1:t,n)for(let t=r;t--;){let r=e[t].attrs[`HDCP-LEVEL`];if(r&&r<=n)return t}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){return this.audioTrackController?.setAudioOption(e)||null}setSubtitleOption(e){return this.subtitleTrackController?.setSubtitleOption(e)||null}get allAudioTracks(){let e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){let e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){let e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){let t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){let e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){let e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){let e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){let t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){let e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){let t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){return this.interstitialsController?.interstitialsManager||null}getMediaDecodingInfo(e,t=this.allAudioTracks){return RW(e,aG(t),navigator.mediaCapabilities)}};l1.defaultConfig=void 0,U({id:R(),stableId:L(),addonId:L(),type:L(),name:L(),online:z(),disabled:z(),parentDeviceId:R().nullable(),role:L().nullable().optional(),features:H(L()).optional(),isCamera:z().optional(),sourceInfo:Zb.optional()}),Jv.AddonStarted,Jv.AddonInstalled,Jv.AddonRestarted,Jv.AddonUpdated,Jv.AddonStopped,Jv.AddonUninstalled,Jv.AddonCrashed,Jv.AddonError,Jv.DetectionPhaseTransition,Jv.DetectionResult,Jv.DetectionEvent,Jv.DetectionCameraNative,Jv.ProviderMotion,Jv.MotionOnMotionChanged,Jv.MotionAnalysis,Jv.MotionZonesRaw,Jv.ProviderDetection,Jv.PipelineAudioInferenceResult,Jv.AgentOnline,Jv.AgentOffline,Jv.DeviceRegistered,Jv.DeviceUnregistered,Jv.DeviceStateChanged,Jv.EventEmitted;var u1=Object.freeze([...new Set(Object.values(Jv))].toSorted()),d1=Object.freeze([Jv.PipelineCameraMetricsSnapshot,Jv.PipelineRunnerLoadSnapshot,Jv.PipelineEngineMetricsSnapshot,Jv.PipelineInferenceResult,Jv.PipelineTrace,Jv.PipelineProgress,Jv.StreamBrokerMetricsSnapshot,Jv.MetricsNodeResourcesSnapshot,Jv.MetricsNodeProcessesSnapshot,Jv.ClusterTopologySnapshot,Jv.MotionAnalysis,Jv.MotionZonesRaw,Jv.DetectionResult,Jv.PipelineAudioInferenceResult,Jv.PlatformProbePhase,Jv.BenchmarkProgress,Jv.ModelDownloadProgress]),f1=new Set(d1);Object.freeze(u1.filter(e=>!f1.has(e))),Object.freeze([...new Set(aM.filter(e=>e.scope===`device`).map(e=>e.name))].toSorted()),_F(`camstack:zone-editing`,null);var p1=500,m1=800;function h1(e,t,n){try{let r=e.live;if(!r)return null;let a=r.onEvent;return!a||typeof a.subscribe!=`function`?null:a.subscribe({category:t},{onData:n})}catch{return null}}function g1(e,t){return e?.id===t}function _1(e,t){let[n,r]=(0,S.useState)(null),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(`watching`),d=(0,S.useRef)(void 0),f=(0,S.useRef)(void 0),p=(0,S.useRef)(void 0);return(0,S.useEffect)(()=>{if(t===null)return;let n=h1(e,`detection.motion-analysis`,e=>{let n=e;if(!g1(n?.source,t))return;let a=n.data;!a?.regions||a.regions.length===0||(r({zones:a.regions.map(e=>({...e.bbox,intensity:e.intensity})),frameWidth:a.frameWidth,frameHeight:a.frameHeight}),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>r(null),p1))});return()=>{n?.unsubscribe(),d.current&&clearTimeout(d.current)}},[e,t]),(0,S.useEffect)(()=>{if(t===null)return;let n=h1(e,`detection.motion-zones-raw`,e=>{let n=e;if(!g1(n?.source,t))return;let r=n.data;r?.zones&&(o({boxes:r.zones.map(e=>({bbox:e.bbox,changeScore:e.changeScore})),frameWidth:r.frameSize?.width??0,frameHeight:r.frameSize?.height??0,motionScore:r.zones.length>0?r.zones.reduce((e,t)=>e+t.changeScore,0)/r.zones.length:0}),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>o(null),p1))});return()=>{n?.unsubscribe(),f.current&&clearTimeout(f.current)}},[e,t]),(0,S.useEffect)(()=>{if(t===null)return;let n=h1(e,`detection.result`,e=>{let n=e;if(!g1(n?.source,t))return;let r=n.data?.frame;r?.detections?.length&&(c({detections:r.detections,frameWidth:r.width,frameHeight:r.height}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>c(null),m1))});return()=>{n?.unsubscribe(),p.current&&clearTimeout(p.current)}},[e,t]),(0,S.useEffect)(()=>{if(t===null)return;let n=h1(e,`detection.phase-transition`,e=>{let n=e;g1(n?.source,t)&&n.data?.to&&u(n.data.to)});return()=>{n?.unsubscribe()}},[e,t]),{motion:n,motionRaw:a,detection:s,phase:l}}function v1(e,t,n=5e3){let[r,a]=(0,S.useState)([]);(0,S.useEffect)(()=>{if(t===null)return;let r=!1,o=()=>{e.webrtcSession.listStreams.query({deviceId:t}).then(e=>{r||a(e)}).catch(()=>{})};o();let s=setInterval(o,n);return()=>{r=!0,clearInterval(s)}},[e,t,n]);let[o,s]=(0,S.useState)(null);(0,S.useEffect)(()=>{if(t===null)return;let n=!1;return e.pipelineOrchestrator&&e.pipelineOrchestrator.getCameraMetrics.query({deviceId:t}).then(e=>{n||!e||s({phase:e.phase,detectionFps:e.actualFps,avgInferenceMs:e.avgInferenceTimeMs,droppedFrames:e.droppedFrames})}).catch(()=>{}),()=>{n=!0}},[e,t]),CB(`pipeline.camera-metrics-snapshot`,e=>{if(t===null)return;let n=e.data;n.deviceId!==t||!n.metrics||s({phase:n.metrics.phase,detectionFps:n.metrics.actualFps,avgInferenceMs:n.metrics.avgInferenceTimeMs,droppedFrames:n.metrics.droppedFrames})});let{streams:c,hasWebrtc:l}=(0,S.useMemo)(()=>t===null||r.length===0?{streams:[],hasWebrtc:!1}:{streams:r.map(e=>({id:e.id,label:e.label,target:e.target,status:e.status,inputFps:e.inputFps,decodeFps:e.decodeFps,bitrateKbps:e.bitrateKbps})),hasWebrtc:!0},[t,r]),u=(0,S.useCallback)(async()=>{if(e.turnProvider)try{return(await e.turnProvider.getTurnServers.query()).map(e=>({urls:typeof e.urls==`string`?e.urls:[...e.urls],...e.username===void 0?{}:{username:e.username},...e.credential===void 0?{}:{credential:e.credential}}))}catch{return}},[e]),d=(0,S.useCallback)(async(n,r)=>{if(t===null)throw Error(`No device selected`);let a=await e.webrtcSession.createSession.mutate({deviceId:t,target:n,hints:r}),o=await u();return{sessionId:a.sessionId,sdpOffer:a.sdpOffer,...o?{iceServers:o}:{}}},[e,t,u]),f=(0,S.useCallback)(async(n,r,a)=>{if(t===null)throw Error(`No device selected`);return e.webrtcSession.handleOffer.mutate({deviceId:t,target:n,sdpOffer:r,...a===void 0?{}:{sessionId:a}})},[e,t]),p=(0,S.useCallback)(async(n,r)=>{if(t===null)throw Error(`No device selected`);await e.webrtcSession.handleAnswer.mutate({deviceId:t,sessionId:n,sdpAnswer:r})},[e,t]);return{streams:c,hasWebrtc:l,pipelineMetrics:o,createSession:d,handleOffer:f,getIceServers:u,addIceCandidate:(0,S.useCallback)(async(n,r)=>{t!==null&&await e.webrtcSession.addIceCandidate.mutate({deviceId:t,sessionId:n,candidate:r.candidate??``,sdpMid:r.sdpMid??null,sdpMLineIndex:r.sdpMLineIndex??null}).catch(()=>{})},[e,t]),getIceCandidates:(0,S.useCallback)(async n=>t===null?{candidates:[],done:!0}:e.webrtcSession.getIceCandidates.query({deviceId:t,sessionId:n}),[e,t]),sendAnswer:p,closeSession:(0,S.useCallback)(async n=>{t!==null&&await e.webrtcSession.closeSession.mutate({deviceId:t,sessionId:n}).catch(()=>{})},[e,t]),getSessionState:(0,S.useCallback)(async n=>{if(t===null)return{pendingRenegotiation:null};try{return await e.webrtcSession.getSessionState.query({deviceId:t,sessionId:n})}catch{return{pendingRenegotiation:null}}},[e,t])}}var y1=G([`auto`,`high`,`medium`,`low`]),b1=av([K(`auto`),R().int().min(1)]),x1=U({enabled:z(),motion:z(),audio:G([`off`,`sensor`,`level`]),audioDb:R(),audioHoldSec:R(),detection:z(),detectionHoldSec:R(),detectionClasses:H(L()).optional(),appearance:U({motionColor:L(),audioColor:L(),detectionColor:L(),thickness:R()}).optional()}),S1=U({serverUrl:L().min(1),token:L().min(1),devices:H(R().int().nonnegative()).min(1),layout:b1,quality:y1,showName:z(),showBadges:z(),muted:z(),paused:z(),highlight:x1.optional(),activeOnly:z().optional(),audioOnIds:H(R().int().nonnegative()).optional(),pausedIds:H(R().int().nonnegative()).optional(),snapshots:W(L(),L()).optional(),ptzIds:H(R().int().nonnegative()).optional()});function C1(e){if(e==null)return{ok:!1,error:`config is required`};let t=S1.safeParse(e);return t.success?{ok:!0,config:t.data}:{ok:!1,error:t.error.issues.map(e=>`${e.path.join(`.`)||`(root)`}: ${e.message}`).join(`; `)}}var w1=1e4;function T1(){try{return window.parent!==window}catch{return!0}}function E1(e){let t=window.ReactNativeWebView;if(t){t.postMessage(JSON.stringify(e));return}T1()&&window.parent.postMessage(e,`*`)}function D1(e){let t=t=>{let n=t.data;if(typeof n!=`object`||!n)return;let r=n;r.type!==`embed-command`||typeof r.command!=`object`||r.command===null||e(r.command)};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)}function O1(e,t,n){let r=t();return r==null?T1()?new Promise(t=>{let r,a=e=>{let o=e.data;if(typeof o!=`object`||!o)return;let s=o;s.type===`embed-config`&&(clearTimeout(r),window.removeEventListener(`message`,a),t(n(s.config)))};window.addEventListener(`message`,a),r=setTimeout(()=>{window.removeEventListener(`message`,a),t({ok:!1,error:`config handshake timed out`})},w1),window.parent.postMessage({type:`embed-ready`,mode:e},`*`)}):Promise.resolve({ok:!1,error:`config global for mode "${e}" is not set`}):Promise.resolve(n(r))}function k1(e,t,n){let[r,a]=(0,S.useState)(null),o=(0,S.useRef)(t);o.current=t;let s=(0,S.useRef)(n);return s.current=n,(0,S.useEffect)(()=>{let t=!0;return O1(e,()=>o.current(),e=>s.current(e)).then(e=>{t&&a(e)}),()=>{t=!1}},[e]),r}var A1=16/9;function j1(e,t,n,r){if(e<=0||t<=0||n<=0)return{cols:0,rows:0,cellW:0,cellH:0};if(typeof r==`number`&&r>=1){let a=Math.floor(r),o=Math.ceil(e/a),s=Math.min(t/a,n/o*A1);return{cols:a,rows:o,cellW:s,cellH:s/A1}}let a={cols:1,rows:e,cellW:0,cellH:0},o=-1;for(let r=1;r<=e;r++){let s=Math.ceil(e/r),c=Math.min(t/r,n/s*A1),l=c/A1,u=c*l;u>o&&(o=u,a={cols:r,rows:s,cellW:c,cellH:l})}return a}function M1(){let[e,t]=(0,S.useState)(null),[n,r]=(0,S.useState)(`idle`),a=(0,S.useRef)(null),o=(0,S.useRef)(null),s=(0,S.useRef)(null),c=(0,S.useRef)(0),l=(0,S.useRef)(null),u=TB(),d=EB(),f=DB(),p=(0,S.useRef)({start:u.mutateAsync,answer:d.mutateAsync,stop:f.mutateAsync});p.current={start:u.mutateAsync,answer:d.mutateAsync,stop:f.mutateAsync};let m=(0,S.useCallback)(()=>{if(a.current){try{a.current.close()}catch{}a.current=null}if(o.current){for(let e of o.current.getTracks())try{e.stop()}catch{}o.current=null}},[]),h=(0,S.useCallback)(async()=>{let e=s.current;if(s.current=null,m(),e)try{await p.current.stop({deviceId:e.deviceId,sessionId:e.sessionId})}catch{}},[m]),g=(0,S.useCallback)(async e=>{if(l.current===e){c.current+=1,l.current=null,t(null),r(`idle`),await h();return}c.current+=1;let n=c.current;l.current=e,t(e),r(`starting`);let u;try{u=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1})}catch{n===c.current&&(l.current=null,t(null),r(`error`));return}if(n!==c.current){for(let e of u.getTracks())e.stop();return}if(await h(),n!==c.current){for(let e of u.getTracks())e.stop();return}let d=null;try{o.current=u;let f=await p.current.start({deviceId:e});if(n!==c.current){try{await p.current.stop({deviceId:e,sessionId:f.sessionId})}catch{}m();return}s.current={deviceId:e,sessionId:f.sessionId},d=new RTCPeerConnection,a.current=d,d.oniceconnectionstatechange=()=>{if(n!==c.current||!d)return;let e=d.iceConnectionState;e===`connected`||e===`completed`?r(`talking`):(e===`failed`||e===`closed`||e===`disconnected`)&&(l.current=null,t(null),r(`idle`),h())};for(let e of u.getAudioTracks())d.addTrack(e,u);await d.setRemoteDescription({type:`offer`,sdp:f.sdpOffer});let g=await d.createAnswer();if(await d.setLocalDescription(g),n!==c.current)return;await p.current.answer({deviceId:e,sessionId:f.sessionId,sdpAnswer:d.localDescription?.sdp??g.sdp??``})}catch{if(d)try{d.close()}catch{}m();let e=s.current;if(s.current=null,e)try{await p.current.stop({deviceId:e.deviceId,sessionId:e.sessionId})}catch{}n===c.current&&(l.current=null,t(null),r(`error`))}},[h,m]),_=(0,S.useCallback)(e=>{if(e===null){c.current+=1,l.current=null,t(null),r(`idle`),h();return}l.current!==e&&g(e)},[h,g]);return(0,S.useEffect)(()=>()=>{c.current+=1,h()},[h]),{activeMicId:e,micState:n,toggleMic:e=>{g(e)},setActiveMic:_}}var N1=6e3,P1=500;function F1(e,t){let n=(0,S.useRef)(new Map),[,r]=(0,S.useState)(0),a=t?.motion??!1,o=t?.audio??`off`,s=t?.audioDb??-30,c=t?.audioHoldSec??3,l=t?.detection??!1,u=t?.detectionHoldSec??3,d=t?.detectionClasses??[],f=(e,t)=>{n.current.set(e,Date.now()+t),r(e=>e+1)};CB(Jv.MotionOnMotionChanged,e=>{if(!a)return;let t=e.data;t&&t.detected&&f(t.deviceId,N1)}),CB(Jv.PipelineAudioInferenceResult,e=>{if(o===`off`)return;let t=e.data;t&&(o===`sensor`?t.frame.detections.length>0:(t.frame.level?.dbfs??-1/0)>=s)&&f(t.deviceId,c*1e3)}),CB(Jv.DetectionResult,e=>{if(!l)return;let t=e.data;t&&t.frame.detections.some(e=>d.length===0||d.includes(e.macroClass))&&f(t.frame.deviceId,u*1e3)}),(0,S.useEffect)(()=>{let e=setInterval(()=>r(e=>e+1),P1);return()=>clearInterval(e)},[]);let p=Date.now(),m=new Set;for(let t of e){let e=n.current.get(t);e!==void 0&&p<e&&m.add(t)}return m}function I1(e){return{type:`tileOpen`,deviceId:e}}function L1(e){return{type:`audioToggle`,deviceId:e}}function R1(e){return{type:`pauseToggle`,deviceId:e}}function z1(e){return{type:`ptzOpen`,deviceId:e}}function B1(e,t){return t===void 0?{type:`state`,state:e}:{type:`state`,state:e,message:t}}function V1(e){return{type:`layout`,tiles:e}}function H1(e){E1(e)}var U1=4,W1=8,G1=300;function K1(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function q1({children:e,onTap:t}){let n=(0,S.useRef)(null),r=(0,S.useRef)(null),a=(0,S.useRef)(new Map),o=(0,S.useRef)(1),s=(0,S.useRef)(0),c=(0,S.useRef)(0),l=(0,S.useRef)(null),u=(0,S.useRef)(null),d=(0,S.useRef)(0),f=()=>{let e=r.current;e&&(e.style.transform=`translate(${s.current}px, ${c.current}px) scale(${o.current})`)},p=()=>{let e=n.current?.getBoundingClientRect();if(!e)return;let t=(o.current-1)*e.width/2,r=(o.current-1)*e.height/2;s.current=Math.max(-t,Math.min(t,s.current)),c.current=Math.max(-r,Math.min(r,c.current))},m=()=>{o.current=1,s.current=0,c.current=0,f()},h=e=>{try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}if(a.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),a.current.size===2){let e=[...a.current.values()],t=e[0],n=e[1];t&&n&&(l.current={dist:K1(t,n),scale:o.current,cx:(t.x+n.x)/2,cy:(t.y+n.y)/2,tx:s.current,ty:c.current}),u.current=null}else a.current.size===1&&(u.current={x:e.clientX,y:e.clientY,tx:s.current,ty:c.current,moved:!1})},g=e=>{if(!a.current.has(e.pointerId))return;if(a.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),a.current.size>=2&&l.current){let e=[...a.current.values()],t=e[0],n=e[1];if(!t||!n)return;let r=K1(t,n);l.current.dist>0&&(o.current=Math.max(1,Math.min(U1,l.current.scale*(r/l.current.dist))));let u=(t.x+n.x)/2,d=(t.y+n.y)/2;s.current=l.current.tx+(u-l.current.cx),c.current=l.current.ty+(d-l.current.cy),p(),f();return}let t=u.current;if(a.current.size===1&&t){let n=e.clientX-t.x,r=e.clientY-t.y;(Math.abs(n)>W1||Math.abs(r)>W1)&&(t.moved=!0),o.current>1&&(s.current=t.tx+n,c.current=t.ty+r,p(),f())}},_=e=>{let n=a.current.size===1,r=u.current;if(a.current.delete(e.pointerId),a.current.size<2&&(l.current=null),a.current.size===0&&(u.current=null,n&&r&&!r.moved)){let e=Date.now();e-d.current<G1?(d.current=0,m()):(d.current=e,t())}};return(0,C.jsx)(`div`,{ref:n,style:{position:`absolute`,inset:0,overflow:`hidden`,touchAction:`none`},onPointerDown:h,onPointerMove:g,onPointerUp:_,onPointerCancel:_,children:(0,C.jsx)(`div`,{ref:r,style:{width:`100%`,height:`100%`,transformOrigin:`center center`,willChange:`transform`},children:e})})}var J1=500;function Y1(e,t,n){let{motion:r,detection:a}=_1(e.trpcClient,t),o=(0,S.useRef)(0),s=(0,S.useRef)(0),[,c]=(0,S.useState)(0),l=n?.audio??`off`,u=n?.audioDb??-30,d=n?.audioHoldSec??3,f=n?.detectionHoldSec??3,p=n?.detectionClasses??[],m=p.join(`,`);if(CB(Jv.PipelineAudioInferenceResult,e=>{let n=e.data;!n||n.deviceId!==t||l===`off`||(l===`sensor`?n.frame.detections.length>0:(n.frame.level?.dbfs??-1/0)>=u)&&(o.current=Date.now()+d*1e3,c(e=>e+1))}),(0,S.useEffect)(()=>{a&&a.detections.some(e=>p.length===0||p.includes(e.macroClass))&&(s.current=Date.now()+f*1e3,c(e=>e+1))},[a,f,m]),(0,S.useEffect)(()=>{let e=setInterval(()=>c(e=>e+1),J1);return()=>clearInterval(e)},[]),!n?.enabled)return null;let h=Date.now();return n.detection&&h<s.current?`detection`:l!==`off`&&h<o.current?`audio`:n.motion&&r!==null?`motion`:null}var X1={motion:`#DC2626`,audio:`#3B82F6`,detection:`#22C55E`},Z1=3500;function Q1(e){return e===`auto`?{kind:`adaptive`}:{kind:`profile`,profile:e===`medium`?`mid`:e}}function $1({system:e,deviceId:t,name:n,online:r,quality:a,muted:o,paused:s,showName:c,audioActive:l,micActive:u,onTogglePause:d,onToggleAudio:f,onToggleMic:p,onOpen:m,ptzSupported:h,onPtz:g,highlight:_,reconnectSignal:v,posterUrl:y}){let{handleOffer:b,getIceServers:x,addIceCandidate:w,getIceCandidates:T,closeSession:E,getSessionState:D}=v1(e.trpcClient,t),O=Y1(e,t,_),[ee,te]=(0,S.useState)(void 0);(0,S.useEffect)(()=>{if(y||s)return;let n=!1;return e.trpcClient.snapshot.getSnapshot.query({deviceId:t}).then(e=>{!n&&e?.base64&&te(`data:${e.contentType??`image/jpeg`};base64,${e.base64}`)}).catch(()=>{}),()=>{n=!0}},[y,s,e,t]);let ne=y??ee,re=(0,S.useMemo)(()=>Q1(a),[a]),ie=`grid:${t}:${a}`,ae=(0,S.useMemo)(()=>(e,t)=>b(re,e,t),[b,re]),k=(0,S.useMemo)(()=>(e,t,n)=>b(n,t,e),[b]),[oe,A]=(0,S.useState)(!1),se=(0,S.useRef)(null),ce=()=>{se.current&&clearTimeout(se.current),se.current=setTimeout(()=>A(!1),Z1)},le=()=>{A(!0),ce()},ue=()=>{A(e=>{let t=!e;return t&&ce(),t})},de=e=>{e.stopPropagation(),le()};return(0,S.useEffect)(()=>()=>{se.current&&clearTimeout(se.current)},[]),(0,C.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,background:`#000`},children:[(0,C.jsx)(q1,{onTap:ue,children:s?(0,C.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fafaf9`},children:(0,C.jsx)(n0,{size:28})}):(0,C.jsx)(HH,{serverUrl:e.serverUrl,streamKey:ie,autoPlay:!0,muted:o,showControls:!1,className:`w-full h-full`,handleOffer:ae,reoffer:k,getSessionState:D,getIceServers:x,addIceCandidate:w,getIceCandidates:T,closeSession:E,reconnectSignal:v,posterUrl:ne},ie)}),O&&(()=>{let e=_?.appearance,t=O===`motion`?e?.motionColor??X1.motion:O===`audio`?e?.audioColor??X1.audio:e?.detectionColor??X1.detection;return(0,C.jsx)(`div`,{style:{position:`absolute`,inset:0,border:`${e?.thickness??3}px solid ${t}`,boxShadow:`inset 0 0 12px ${t}`,pointerEvents:`none`}})})(),(c||oe)&&(0,C.jsxs)(`div`,{style:{position:`absolute`,left:0,right:0,top:0,display:`flex`,alignItems:`center`,gap:6,padding:`4px 8px`,background:`rgba(0,0,0,0.6)`,color:`#fafaf9`,fontSize:12,fontWeight:600,fontFamily:`system-ui, sans-serif`,pointerEvents:`none`,opacity:c||oe?1:0,transition:`opacity 150ms ease`},children:[(0,C.jsx)(`span`,{style:{width:8,height:8,borderRadius:4,background:r?`#34d399`:`#71717a`}}),(0,C.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n})]}),(0,C.jsxs)(`div`,{style:{position:`absolute`,inset:0,opacity:+!!oe,transition:`opacity 150ms ease`,pointerEvents:`none`},children:[(0,C.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`},children:(0,C.jsx)(e0,{label:s?`Play`:`Pause`,big:!0,enabled:oe,onClick:e=>{de(e),d(t)},children:s?(0,C.jsx)(n0,{size:22}):(0,C.jsx)(r0,{size:22})})}),(0,C.jsxs)(`div`,{style:{position:`absolute`,left:8,bottom:8,display:`flex`,gap:8,pointerEvents:`none`},children:[(0,C.jsx)(e0,{label:l?`Mute`:`Listen`,active:l,enabled:oe,onClick:e=>{de(e),f(t)},children:l?(0,C.jsx)(i0,{size:18}):(0,C.jsx)(a0,{size:18})}),(0,C.jsx)(e0,{label:u?`Stop talk`:`Talk`,active:u,enabled:oe,onClick:e=>{de(e),p(t)},children:(0,C.jsx)(o0,{size:18,muted:!u})}),h&&g?(0,C.jsx)(e0,{label:`PTZ`,enabled:oe,onClick:e=>{de(e),g(t)},children:(0,C.jsx)(c0,{size:18})}):null]}),(0,C.jsx)(`div`,{style:{position:`absolute`,right:8,bottom:8,pointerEvents:`none`},children:(0,C.jsx)(e0,{label:`Open`,enabled:oe,onClick:e=>{de(e),m(t)},children:(0,C.jsx)(s0,{size:18})})})]})]})}function e0({children:e,label:t,onClick:n,big:r=!1,active:a=!1,enabled:o=!0}){let s=r?52:40;return(0,C.jsx)(`button`,{type:`button`,"aria-label":t,onClick:n,style:{width:s,height:s,borderRadius:s/2,border:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:a?`rgba(59,130,246,0.85)`:`rgba(0,0,0,0.55)`,color:`#fafaf9`,cursor:`pointer`,padding:0,WebkitTapHighlightColor:`transparent`,pointerEvents:o?`auto`:`none`},children:e})}var t0={fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`};function n0({size:e}){return(0,C.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,children:(0,C.jsx)(`polygon`,{points:`6 4 20 12 6 20 6 4`,fill:`currentColor`})})}function r0({size:e}){return(0,C.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,children:[(0,C.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,fill:`currentColor`}),(0,C.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,fill:`currentColor`})]})}function i0({size:e}){return(0,C.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,...t0,children:[(0,C.jsx)(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),(0,C.jsx)(`path`,{d:`M19.07 4.93a10 10 0 010 14.14M15.54 8.46a5 5 0 010 7.07`})]})}function a0({size:e}){return(0,C.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,...t0,children:[(0,C.jsx)(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),(0,C.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,C.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]})}function o0({size:e,muted:t}){return(0,C.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,...t0,children:[(0,C.jsx)(`path`,{d:`M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z`}),(0,C.jsx)(`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2M12 19v4`}),t&&(0,C.jsx)(`line`,{x1:`3`,y1:`3`,x2:`21`,y2:`21`})]})}function s0({size:e}){return(0,C.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,...t0,children:(0,C.jsx)(`path`,{d:`M15 3h6v6M21 3l-9 9M21 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5`})})}function c0({size:e}){return(0,C.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,...t0,children:[(0,C.jsx)(`path`,{d:`M12 2v20M2 12h20`}),(0,C.jsx)(`path`,{d:`M12 2l-3 3M12 2l3 3M12 22l-3-3M12 22l3-3M2 12l3-3M2 12l3 3M22 12l-3-3M22 12l-3 3`})]})}function l0({message:e}){return(0,S.useEffect)(()=>H1(B1(`error`,e)),[e]),(0,C.jsxs)(`div`,{style:{position:`fixed`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#000`,color:`#f87171`,fontFamily:`system-ui, sans-serif`,fontSize:13,padding:16,textAlign:`center`},children:[`Grid embed config error: `,e]})}function u0({system:e,config:t}){let[n,r]=(0,S.useState)(()=>new Set(t.audioOnIds??[])),a=M1(),o=(0,S.useRef)(a.setActiveMic);o.current=a.setActiveMic;let[s,c]=(0,S.useState)(()=>new Set(t.pausedIds??[])),[l,u]=(0,S.useState)(t.highlight),[d,f]=(0,S.useState)(t.activeOnly??!1),p=F1(t.devices,l),m=(0,S.useMemo)(()=>d?t.devices.filter(e=>p.has(e)):t.devices,[d,t.devices,p]),[h,g]=(0,S.useState)(t.quality),[_,v]=(0,S.useState)(t.layout),[y,b]=(0,S.useState)(t.showName),[x,w]=(0,S.useState)(0),[T,E]=(0,S.useState)(()=>t.snapshots??{}),D=(0,S.useMemo)(()=>new Set(t.ptzIds??[]),[t.ptzIds]),[O,ee]=(0,S.useState)({w:window.innerWidth,h:window.innerHeight}),[te,ne]=(0,S.useState)({});(0,S.useEffect)(()=>{let t=!1;return e.trpcClient.deviceManager.listAll.query({}).then(e=>{if(t)return;let n={};for(let t of e)n[t.id]={name:t.name??`Camera ${t.id}`,online:t.online??!1};ne(n)}).catch(()=>{}),()=>{t=!0}},[e]),(0,S.useEffect)(()=>(window.__camstackGrid={setAudioOn:e=>r(new Set(e)),setMutedAll:e=>{e&&r(new Set)},setActiveMic:e=>o.current(e),setHighlight:e=>u(e),setActiveOnly:e=>f(e),setPaused:e=>c(new Set(e)),setQuality:e=>g(e),setLayout:e=>v(e),setShowName:b,setShowBadges:()=>{},setSnapshots:e=>E(e),fit:(e,t)=>ee({w:e,h:t}),reconnect:()=>w(e=>e+1)},H1(B1(`ready`)),()=>{window.__camstackGrid&&delete window.__camstackGrid}),[]),(0,S.useEffect)(()=>D1(e=>{let t=window.__camstackGrid;if(t)switch(e.kind){case`setAudioOn`:t.setAudioOn(e.value);break;case`setMutedAll`:t.setMutedAll(e.value);break;case`setActiveMic`:t.setActiveMic(e.value);break;case`setHighlight`:t.setHighlight(e.value);break;case`setActiveOnly`:t.setActiveOnly(e.value);break;case`setPaused`:t.setPaused(e.value);break;case`setQuality`:t.setQuality(e.value);break;case`setLayout`:t.setLayout(e.value);break;case`setShowName`:t.setShowName(e.value);break;case`setShowBadges`:t.setShowBadges(e.value);break;case`setSnapshots`:t.setSnapshots(e.value);break;case`fit`:t.fit(e.w,e.h);break;case`reconnect`:t.reconnect();break;default:break}}),[]);let re=(0,S.useMemo)(()=>j1(m.length,O.w,O.h,_),[m.length,O.w,O.h,_]),ie=(0,S.useRef)(null);return(0,S.useEffect)(()=>{let e=ie.current;if(!e)return;let t=[];e.querySelectorAll(`[data-device-id]`).forEach(e=>{let n=Number(e.dataset.deviceId),r=e.getBoundingClientRect();t.push({deviceId:n,rect:{x:r.x,y:r.y,w:r.width,h:r.height}})}),t.length&&H1(V1(t))},[re,m]),(0,C.jsxs)(`div`,{ref:ie,style:{position:`fixed`,inset:0,background:`#000`,display:`flex`,flexWrap:`wrap`,alignItems:`center`,justifyContent:`center`},children:[d&&m.length===0&&(0,C.jsx)(`div`,{style:{color:`#a1a1aa`,fontFamily:`system-ui, sans-serif`,fontSize:14,padding:24,textAlign:`center`},children:`No active cameras`}),m.map(t=>(0,C.jsx)(`div`,{"data-device-id":t,style:{width:re.cellW,height:re.cellH},children:(0,C.jsx)($1,{system:e,deviceId:t,name:te[t]?.name??`Camera ${t}`,online:te[t]?.online??!1,quality:h,muted:!n.has(t),paused:s.has(t),showName:y,audioActive:n.has(t),micActive:a.activeMicId===t,onTogglePause:e=>H1(R1(e)),onToggleAudio:e=>H1(L1(e)),onToggleMic:a.toggleMic,onOpen:e=>H1(I1(e)),ptzSupported:D.has(t),onPtz:e=>H1(z1(e)),highlight:l,reconnectSignal:x,posterUrl:T[String(t)]})},t))]})}function d0(){let e=k1(`grid`,()=>window.__CAMSTACK_GRID__,C1),t=(0,S.useMemo)(()=>e===null||!e.ok?null:{system:xN({serverUrl:e.config.serverUrl,token:e.config.token}),queryClient:new st({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}})},[e]);return(0,S.useEffect)(()=>{if(t)return()=>t.system.close()},[t]),e===null?null:e.ok?t?(0,C.jsx)(xB,{system:t.system,children:(0,C.jsx)(ut,{client:t.queryClient,children:(0,C.jsx)(X.Provider,{client:t.system.trpcClient,queryClient:t.queryClient,children:(0,C.jsx)(u0,{system:t.system,config:e.config})})})}):(0,C.jsx)(l0,{message:`Failed to initialise the grid embed`}):(0,C.jsx)(l0,{message:e.error})}function f0(e){switch(e.kind){case`seekTo`:return{t:`seek`,epoch:e.epochMs};case`scrubEnd`:return{t:`scrubCommit`,epoch:e.epochMs};case`play`:return{t:`setRate`,rate:1};case`pause`:return{t:`setRate`,rate:0};case`goLive`:return{t:`goLive`};case`playRecorded`:return{t:`playRecorded`,deviceId:e.deviceId,epoch:e.epochMs,profile:e.profile};case`scrubStart`:case`scrubTo`:return null}}var p0=class{capacity;dispose;map=new Map;constructor(e,t){this.capacity=e,this.dispose=t}has(e){return this.map.has(e)}get(e){if(!this.map.has(e))return;let t=this.map.get(e);return this.map.delete(e),t!==void 0&&this.map.set(e,t),t}set(e,t){if(this.map.has(e)){let t=this.map.get(e);this.map.delete(e),t!==void 0&&this.dispose?.(t)}for(this.map.set(e,t);this.map.size>this.capacity;){let e=this.map.keys().next().value;if(e===void 0)break;let t=this.map.get(e);this.map.delete(e),t!==void 0&&this.dispose?.(t)}}clear(){this.map.forEach(e=>this.dispose?.(e)),this.map.clear()}};function m0(e){try{return new URL(e).toString()}catch{let t=typeof window<`u`&&window.location?.origin?window.location.origin:`http://localhost`;return new URL(e,t).toString()}}function h0(e,t){return new URL(t,e).toString()}function g0(e){let t=(e.split(`/`).pop()??``).match(/^(\d+)-(\d+)(?:-\d+)?\.m4s$/);return t?{startMs:Number(t[1]),durMs:Number(t[2])}:null}function _0(e,t){let n=e.split(`
148
- `).map(e=>e.trim());for(let e of n)if(/low\.m3u8/i.test(e))return h0(t,e);let r=null;for(let e=0;e<n.length;e++){let a=n[e],o=n[e+1];a&&a.startsWith(`#EXT-X-STREAM-INF`)&&o&&!o.startsWith(`#`)&&(r=h0(t,o))}return r}async function v0(e,t){let n=await fetch(e,t?{headers:t}:void 0);if(!n.ok)throw Error(`playlist fetch ${n.status} for ${e}`);return n.text()}async function y0(e,t){let n=m0(e),r=_0(await v0(n,t),n);if(!r)return[];let a=await v0(r,t),o=[];for(let e of a.split(`
149
- `).map(e=>e.trim())){if(!e||e.startsWith(`#`))continue;let t=h0(r,e),n=g0(t);n&&o.push({uri:t,startMs:n.startMs,durMs:n.durMs})}return o.sort((e,t)=>e.startMs-t.startMs),o}function b0(e,t){let n=e.length;if(n===0)return 0;let r=0,a=n-1,o=-1;for(;r<=a;){let n=r+a>>1,s=e[n];if(!s)break;s.startMs<=t?(o=n,r=n+1):a=n-1}if(o===-1)return 0;let s=e[o];if(s&&t<s.startMs+s.durMs)return o;let c=e[o+1];return s&&c?Math.abs(s.startMs-t)<=Math.abs(c.startMs-t)?o:o+1:o}function x0(e,t){return e.length===0?null:e[b0(e,t)]??null}function S0(e,t,n,r){if(e.length===0||r<=0)return[];let a=b0(e,t),o=[];if(n===`forward`)for(let t=a+1;t<=a+r&&t<e.length;t++){let n=e[t];n&&o.push(n)}else for(let t=a-1;t>=a-r&&t>=0;t--){let n=e[t];n&&o.push(n)}return o}var C0=class{deps;generation=0;inflight=null;lastEpoch=0;lastSegStart=null;bytes;frames;prefetchCount;prefetching=new Map;constructor(e){this.deps=e,this.bytes=new p0(e.byteCacheSize??24),this.frames=new p0(e.frameCacheSize??16,e=>e.close()),this.prefetchCount=e.prefetchCount??3}clearFrames(){this.frames.clear()}dispose(){this.inflight?.abort();for(let e of this.prefetching.values())e.abort();this.prefetching.clear(),this.frames.clear(),this.bytes.clear()}async scrubTo(e){let t=e>=this.lastEpoch?`forward`:`backward`;this.lastEpoch=e;let n=++this.generation;this.inflight?.abort();let r=new AbortController;this.inflight=r;let a=performance.now(),o=await this.deps.ensureIndex(e),s=x0(o,e);if(!s)return;let c=this.frames.get(s.startMs);if(c){n===this.generation&&(this.deps.draw(c),this.deps.onTiming?.({epochMs:e,cached:!0,fetchMs:0,decodeMs:0,totalMs:performance.now()-a}),this.maybePrefetch(o,e,t,s.startMs));return}try{let c=performance.now(),l=await this.getBytes(s.uri,r.signal),u=performance.now()-c,d=performance.now(),f=await this.deps.decode(l),p=performance.now()-d;if(n!==this.generation){f.close();return}this.frames.set(s.startMs,f),this.deps.draw(f),this.deps.onTiming?.({epochMs:e,cached:!1,fetchMs:u,decodeMs:p,totalMs:performance.now()-a}),this.maybePrefetch(o,e,t,s.startMs)}catch(e){if(r.signal.aborted)return;throw e}}async getBytes(e,t){let n=this.bytes.get(e);if(n)return n;let r=await this.deps.fetchBytes(e,t);return this.bytes.set(e,r),r}maybePrefetch(e,t,n,r){let a=this.lastSegStart;this.lastSegStart=r,!(a===null||r===a)&&this.schedulePrefetch(e,t,n)}schedulePrefetch(e,t,n){let r=S0(e,t,n,this.prefetchCount);for(let e of r){if(this.bytes.has(e.uri)||this.prefetching.has(e.uri))continue;let t=new AbortController;this.prefetching.set(e.uri,t),this.deps.fetchBytes(e.uri,t.signal).then(t=>{this.bytes.set(e.uri,t),this.prefetching.delete(e.uri)}).catch(()=>{this.prefetching.delete(e.uri)})}}},w0=u(s((e=>{var t=(function(){var e=new Date,n=4,r=3,a=2,o=1,s=n;return{setLogLevel:function(e){s=e==this.debug?o:e==this.info?a:e==this.warn?r:(this.error,n)},debug:function(n,r){console.debug===void 0&&(console.debug=console.log),o>=s&&console.debug(`[`+t.getDurationString(new Date-e,1e3)+`]`,`[`+n+`]`,r)},log:function(e,t){this.debug(e.msg)},info:function(n,r){a>=s&&console.info(`[`+t.getDurationString(new Date-e,1e3)+`]`,`[`+n+`]`,r)},warn:function(n,a){r>=s&&console.warn(`[`+t.getDurationString(new Date-e,1e3)+`]`,`[`+n+`]`,a)},error:function(r,a){n>=s&&console.error(`[`+t.getDurationString(new Date-e,1e3)+`]`,`[`+r+`]`,a)}}})();t.getDurationString=function(e,t){var n;function r(e,t){for(var n=(``+e).split(`.`);n[0].length<t;)n[0]=`0`+n[0];return n.join(`.`)}e<0?(n=!0,e=-e):n=!1;var a=e/(t||1),o=Math.floor(a/3600);a-=o*3600;var s=Math.floor(a/60);a-=s*60;var c=a*1e3;return a=Math.floor(a),c-=a*1e3,c=Math.floor(c),(n?`-`:``)+o+`:`+r(s,2)+`:`+r(a,2)+`.`+r(c,3)},t.printRanges=function(e){var n=e.length;if(n>0){for(var r=``,a=0;a<n;a++)a>0&&(r+=`,`),r+=`[`+t.getDurationString(e.start(a))+`,`+t.getDurationString(e.end(a))+`]`;return r}else return`(empty)`},e!==void 0&&(e.Log=t);var n=function(e){if(e instanceof ArrayBuffer)this.buffer=e,this.dataview=new DataView(e);else throw`Needs an array buffer`;this.position=0};n.prototype.getPosition=function(){return this.position},n.prototype.getEndPosition=function(){return this.buffer.byteLength},n.prototype.getLength=function(){return this.buffer.byteLength},n.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},n.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},n.prototype.readAnyInt=function(e,t){var n=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:n=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:n=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw`No method for reading signed 24 bits values`;n=this.dataview.getUint8(this.position)<<16,n|=this.dataview.getUint8(this.position+1)<<8,n|=this.dataview.getUint8(this.position+2);break;case 4:n=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw`No method for reading signed 64 bits values`;n=this.dataview.getUint32(this.position)<<32,n|=this.dataview.getUint32(this.position+4);break;default:throw`readInt method not implemented for size: `+e}return this.position+=e,n}else throw`Not enough bytes in buffer`},n.prototype.readUint8=function(){return this.readAnyInt(1,!1)},n.prototype.readUint16=function(){return this.readAnyInt(2,!1)},n.prototype.readUint24=function(){return this.readAnyInt(3,!1)},n.prototype.readUint32=function(){return this.readAnyInt(4,!1)},n.prototype.readUint64=function(){return this.readAnyInt(8,!1)},n.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t=``,n=0;n<e;n++)t+=String.fromCharCode(this.readUint8());return t}else throw`Not enough bytes in buffer`},n.prototype.readCString=function(){for(var e=[];;){var t=this.readUint8();if(t!==0)e.push(t);else break}return String.fromCharCode.apply(null,e)},n.prototype.readInt8=function(){return this.readAnyInt(1,!0)},n.prototype.readInt16=function(){return this.readAnyInt(2,!0)},n.prototype.readInt32=function(){return this.readAnyInt(4,!0)},n.prototype.readInt64=function(){return this.readAnyInt(8,!1)},n.prototype.readUint8Array=function(e){for(var t=new Uint8Array(e),n=0;n<e;n++)t[n]=this.readUint8();return t},n.prototype.readInt16Array=function(e){for(var t=new Int16Array(e),n=0;n<e;n++)t[n]=this.readInt16();return t},n.prototype.readUint16Array=function(e){for(var t=new Int16Array(e),n=0;n<e;n++)t[n]=this.readUint16();return t},n.prototype.readUint32Array=function(e){for(var t=new Uint32Array(e),n=0;n<e;n++)t[n]=this.readUint32();return t},n.prototype.readInt32Array=function(e){for(var t=new Int32Array(e),n=0;n<e;n++)t[n]=this.readInt32();return t},e!==void 0&&(e.MP4BoxStream=n);var r=function(e,t,n){this._byteOffset=t||0,e instanceof ArrayBuffer?this.buffer=e:typeof e==`object`?(this.dataView=e,t&&(this._byteOffset+=t)):this.buffer=new ArrayBuffer(e||0),this.position=0,this.endianness=n??r.LITTLE_ENDIAN};r.prototype={},r.prototype.getPosition=function(){return this.position},r.prototype._realloc=function(e){if(this._dynamicSize){var t=this._byteOffset+this.position+e,n=this._buffer.byteLength;if(t<=n){t>this._byteLength&&(this._byteLength=t);return}for(n<1&&(n=1);t>n;)n*=2;var r=new ArrayBuffer(n),a=new Uint8Array(this._buffer);new Uint8Array(r,0,a.length).set(a),this.buffer=r,this._byteLength=t}},r.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),n=new Uint8Array(this._buffer,0,t.length);t.set(n),this.buffer=e}},r.BIG_ENDIAN=!1,r.LITTLE_ENDIAN=!0,r.prototype._byteLength=0,Object.defineProperty(r.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(r.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(r.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(r.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),r.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},r.prototype.isEof=function(){return this.position>=this._byteLength},r.prototype.mapUint8Array=function(e){this._realloc(e*1);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=e*1,t},r.prototype.readInt32Array=function(e,t){e??=this.byteLength-this.position/4;var n=new Int32Array(e);return r.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),r.arrayToNative(n,t??this.endianness),this.position+=n.byteLength,n},r.prototype.readInt16Array=function(e,t){e??=this.byteLength-this.position/2;var n=new Int16Array(e);return r.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),r.arrayToNative(n,t??this.endianness),this.position+=n.byteLength,n},r.prototype.readInt8Array=function(e){e??=this.byteLength-this.position;var t=new Int8Array(e);return r.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},r.prototype.readUint32Array=function(e,t){e??=this.byteLength-this.position/4;var n=new Uint32Array(e);return r.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),r.arrayToNative(n,t??this.endianness),this.position+=n.byteLength,n},r.prototype.readUint16Array=function(e,t){e??=this.byteLength-this.position/2;var n=new Uint16Array(e);return r.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),r.arrayToNative(n,t??this.endianness),this.position+=n.byteLength,n},r.prototype.readUint8Array=function(e){e??=this.byteLength-this.position;var t=new Uint8Array(e);return r.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},r.prototype.readFloat64Array=function(e,t){e??=this.byteLength-this.position/8;var n=new Float64Array(e);return r.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),r.arrayToNative(n,t??this.endianness),this.position+=n.byteLength,n},r.prototype.readFloat32Array=function(e,t){e??=this.byteLength-this.position/4;var n=new Float32Array(e);return r.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),r.arrayToNative(n,t??this.endianness),this.position+=n.byteLength,n},r.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,e??this.endianness);return this.position+=4,t},r.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,e??this.endianness);return this.position+=2,t},r.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},r.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,e??this.endianness);return this.position+=4,t},r.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,e??this.endianness);return this.position+=2,t},r.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},r.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,e??this.endianness);return this.position+=4,t},r.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,e??this.endianness);return this.position+=8,t},r.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,r.memcpy=function(e,t,n,r,a){var o=new Uint8Array(e,t,a),s=new Uint8Array(n,r,a);o.set(s)},r.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},r.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},r.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=0;n<e.byteLength;n+=e.BYTES_PER_ELEMENT)for(var r=n+e.BYTES_PER_ELEMENT-1,a=n;r>a;r--,a++){var o=t[a];t[a]=t[r],t[r]=o}return e},r.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return String.fromCharCode.apply(null,t)},r.prototype.readString=function(e,t){return t==null||t==`ASCII`?String.fromCharCodeUint8.apply(null,[this.mapUint8Array(e??this.byteLength-this.position)]):new TextDecoder(t).decode(this.mapUint8Array(e))},r.prototype.readCString=function(e){var t=this.byteLength-this.position,n=new Uint8Array(this._buffer,this._byteOffset+this.position),r=t;e!=null&&(r=Math.min(e,t));for(var a=0;a<r&&n[a]!==0;a++);var o=String.fromCharCodeUint8.apply(null,[this.mapUint8Array(a)]);return e==null?a!=t&&(this.position+=1):this.position+=r-a,o};var a=2**32;r.prototype.readInt64=function(){return this.readInt32()*a+this.readUint32()},r.prototype.readUint64=function(){return this.readUint32()*a+this.readUint32()},r.prototype.readInt64=function(){return this.readUint32()*a+this.readUint32()},r.prototype.readUint24=function(){return(this.readUint8()<<16)+(this.readUint8()<<8)+this.readUint8()},e!==void 0&&(e.DataStream=r),r.prototype.save=function(e){var t=new Blob([this.buffer]);if(window.URL&&URL.createObjectURL){var n=window.URL.createObjectURL(t),r=document.createElement(`a`);document.body.appendChild(r),r.setAttribute(`href`,n),r.setAttribute(`download`,e),r.setAttribute(`target`,`_self`),r.click(),window.URL.revokeObjectURL(n)}else throw`DataStream.save: Can't create object URL.`},r.prototype._dynamicSize=!0,Object.defineProperty(r.prototype,"dynamicSize",{get:function(){return this._dynamicSize},set:function(e){e||this._trimAlloc(),this._dynamicSize=e}}),r.prototype.shift=function(e){var t=new ArrayBuffer(this._byteLength-e),n=new Uint8Array(t),r=new Uint8Array(this._buffer,e,n.length);n.set(r),this.buffer=t,this.position-=e},r.prototype.writeInt32Array=function(e,t){if(this._realloc(e.length*4),e instanceof Int32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt32Array(e.length,t);else for(var n=0;n<e.length;n++)this.writeInt32(e[n],t)},r.prototype.writeInt16Array=function(e,t){if(this._realloc(e.length*2),e instanceof Int16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt16Array(e.length,t);else for(var n=0;n<e.length;n++)this.writeInt16(e[n],t)},r.prototype.writeInt8Array=function(e){if(this._realloc(e.length*1),e instanceof Int8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt8Array(e.length);else for(var t=0;t<e.length;t++)this.writeInt8(e[t])},r.prototype.writeUint32Array=function(e,t){if(this._realloc(e.length*4),e instanceof Uint32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint32Array(e.length,t);else for(var n=0;n<e.length;n++)this.writeUint32(e[n],t)},r.prototype.writeUint16Array=function(e,t){if(this._realloc(e.length*2),e instanceof Uint16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint16Array(e.length,t);else for(var n=0;n<e.length;n++)this.writeUint16(e[n],t)},r.prototype.writeUint8Array=function(e){if(this._realloc(e.length*1),e instanceof Uint8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint8Array(e.length);else for(var t=0;t<e.length;t++)this.writeUint8(e[t])},r.prototype.writeFloat64Array=function(e,t){if(this._realloc(e.length*8),e instanceof Float64Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat64Array(e.length,t);else for(var n=0;n<e.length;n++)this.writeFloat64(e[n],t)},r.prototype.writeFloat32Array=function(e,t){if(this._realloc(e.length*4),e instanceof Float32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat32Array(e.length,t);else for(var n=0;n<e.length;n++)this.writeFloat32(e[n],t)},r.prototype.writeInt32=function(e,t){this._realloc(4),this._dataView.setInt32(this.position,e,t??this.endianness),this.position+=4},r.prototype.writeInt16=function(e,t){this._realloc(2),this._dataView.setInt16(this.position,e,t??this.endianness),this.position+=2},r.prototype.writeInt8=function(e){this._realloc(1),this._dataView.setInt8(this.position,e),this.position+=1},r.prototype.writeUint32=function(e,t){this._realloc(4),this._dataView.setUint32(this.position,e,t??this.endianness),this.position+=4},r.prototype.writeUint16=function(e,t){this._realloc(2),this._dataView.setUint16(this.position,e,t??this.endianness),this.position+=2},r.prototype.writeUint8=function(e){this._realloc(1),this._dataView.setUint8(this.position,e),this.position+=1},r.prototype.writeFloat32=function(e,t){this._realloc(4),this._dataView.setFloat32(this.position,e,t??this.endianness),this.position+=4},r.prototype.writeFloat64=function(e,t){this._realloc(8),this._dataView.setFloat64(this.position,e,t??this.endianness),this.position+=8},r.prototype.writeUCS2String=function(e,t,n){n??=e.length;for(var r=0;r<e.length&&r<n;r++)this.writeUint16(e.charCodeAt(r),t);for(;r<n;r++)this.writeUint16(0)},r.prototype.writeString=function(e,t,n){var r=0;if(t==null||t==`ASCII`)if(n!=null){var a=Math.min(e.length,n);for(r=0;r<a;r++)this.writeUint8(e.charCodeAt(r));for(;r<n;r++)this.writeUint8(0)}else for(r=0;r<e.length;r++)this.writeUint8(e.charCodeAt(r));else this.writeUint8Array(new TextEncoder(t).encode(e.substring(0,n)))},r.prototype.writeCString=function(e,t){var n=0;if(t!=null){var r=Math.min(e.length,t);for(n=0;n<r;n++)this.writeUint8(e.charCodeAt(n));for(;n<t;n++)this.writeUint8(0)}else{for(n=0;n<e.length;n++)this.writeUint8(e.charCodeAt(n));this.writeUint8(0)}},r.prototype.writeStruct=function(e,t){for(var n=0;n<e.length;n+=2){var r=e[n+1];this.writeType(r,t[e[n]],t)}},r.prototype.writeType=function(e,t,n){var a;if(typeof e==`function`)return e(this,t);if(typeof e==`object`&&!(e instanceof Array))return e.set(this,t,n);var o=null,s=`ASCII`,c=this.position;switch(typeof e==`string`&&/:/.test(e)&&(a=e.split(`:`),e=a[0],o=parseInt(a[1])),typeof e==`string`&&/,/.test(e)&&(a=e.split(`,`),e=a[0],s=parseInt(a[1])),e){case`uint8`:this.writeUint8(t);break;case`int8`:this.writeInt8(t);break;case`uint16`:this.writeUint16(t,this.endianness);break;case`int16`:this.writeInt16(t,this.endianness);break;case`uint32`:this.writeUint32(t,this.endianness);break;case`int32`:this.writeInt32(t,this.endianness);break;case`float32`:this.writeFloat32(t,this.endianness);break;case`float64`:this.writeFloat64(t,this.endianness);break;case`uint16be`:this.writeUint16(t,r.BIG_ENDIAN);break;case`int16be`:this.writeInt16(t,r.BIG_ENDIAN);break;case`uint32be`:this.writeUint32(t,r.BIG_ENDIAN);break;case`int32be`:this.writeInt32(t,r.BIG_ENDIAN);break;case`float32be`:this.writeFloat32(t,r.BIG_ENDIAN);break;case`float64be`:this.writeFloat64(t,r.BIG_ENDIAN);break;case`uint16le`:this.writeUint16(t,r.LITTLE_ENDIAN);break;case`int16le`:this.writeInt16(t,r.LITTLE_ENDIAN);break;case`uint32le`:this.writeUint32(t,r.LITTLE_ENDIAN);break;case`int32le`:this.writeInt32(t,r.LITTLE_ENDIAN);break;case`float32le`:this.writeFloat32(t,r.LITTLE_ENDIAN);break;case`float64le`:this.writeFloat64(t,r.LITTLE_ENDIAN);break;case`cstring`:this.writeCString(t,o);break;case`string`:this.writeString(t,s,o);break;case`u16string`:this.writeUCS2String(t,this.endianness,o);break;case`u16stringle`:this.writeUCS2String(t,r.LITTLE_ENDIAN,o);break;case`u16stringbe`:this.writeUCS2String(t,r.BIG_ENDIAN,o);break;default:if(e.length==3){for(var l=e[1],u=0;u<t.length;u++)this.writeType(l,t[u]);break}else{this.writeStruct(e,t);break}}o!=null&&(this.position=c,this._realloc(o),this.position=c+o)},r.prototype.writeUint64=function(e){var t=Math.floor(e/a);this.writeUint32(t),this.writeUint32(e&4294967295)},r.prototype.writeUint24=function(e){this.writeUint8((e&16711680)>>16),this.writeUint8((e&65280)>>8),this.writeUint8(e&255)},r.prototype.adjustUint32=function(e,t){var n=this.position;this.seek(e),this.writeUint32(t),this.seek(n)},r.prototype.mapInt32Array=function(e,t){this._realloc(e*4);var n=new Int32Array(this._buffer,this.byteOffset+this.position,e);return r.arrayToNative(n,t??this.endianness),this.position+=e*4,n},r.prototype.mapInt16Array=function(e,t){this._realloc(e*2);var n=new Int16Array(this._buffer,this.byteOffset+this.position,e);return r.arrayToNative(n,t??this.endianness),this.position+=e*2,n},r.prototype.mapInt8Array=function(e){this._realloc(e*1);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=e*1,t},r.prototype.mapUint32Array=function(e,t){this._realloc(e*4);var n=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return r.arrayToNative(n,t??this.endianness),this.position+=e*4,n},r.prototype.mapUint16Array=function(e,t){this._realloc(e*2);var n=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return r.arrayToNative(n,t??this.endianness),this.position+=e*2,n},r.prototype.mapFloat64Array=function(e,t){this._realloc(e*8);var n=new Float64Array(this._buffer,this.byteOffset+this.position,e);return r.arrayToNative(n,t??this.endianness),this.position+=e*8,n},r.prototype.mapFloat32Array=function(e,t){this._realloc(e*4);var n=new Float32Array(this._buffer,this.byteOffset+this.position,e);return r.arrayToNative(n,t??this.endianness),this.position+=e*4,n};var o=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};o.prototype=new r(new ArrayBuffer,0,r.BIG_ENDIAN),o.prototype.initialized=function(){var e;return this.bufferIndex>-1?!0:this.buffers.length>0?(e=this.buffers[0],e.fileStart===0?(this.buffer=e,this.bufferIndex=0,t.debug(`MultiBufferStream`,`Stream ready for parsing`),!0):(t.warn(`MultiBufferStream`,`The first buffer should have a fileStart of 0`),this.logBufferLevel(),!1)):(t.warn(`MultiBufferStream`,`No buffer to start parsing from`),this.logBufferLevel(),!1)},ArrayBuffer.concat=function(e,n){t.debug(`ArrayBuffer`,`Trying to create a new buffer of size: `+(e.byteLength+n.byteLength));var r=new Uint8Array(e.byteLength+n.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(n),e.byteLength),r.buffer},o.prototype.reduceBuffer=function(e,t,n){var r=new Uint8Array(n);return r.set(new Uint8Array(e,t,n)),r.buffer.fileStart=e.fileStart+t,r.buffer.usedBytes=0,r.buffer},o.prototype.insertBuffer=function(e){for(var n=!0,r=0;r<this.buffers.length;r++){var a=this.buffers[r];if(e.fileStart<=a.fileStart){if(e.fileStart===a.fileStart)if(e.byteLength>a.byteLength){this.buffers.splice(r,1),r--;continue}else t.warn(`MultiBufferStream`,`Buffer (fileStart: `+e.fileStart+` - Length: `+e.byteLength+`) already appended, ignoring`);else e.fileStart+e.byteLength<=a.fileStart||(e=this.reduceBuffer(e,0,a.fileStart-e.fileStart)),t.debug(`MultiBufferStream`,`Appending new buffer (fileStart: `+e.fileStart+` - Length: `+e.byteLength+`)`),this.buffers.splice(r,0,e),r===0&&(this.buffer=e);n=!1;break}else if(e.fileStart<a.fileStart+a.byteLength){var o=a.fileStart+a.byteLength-e.fileStart,s=e.byteLength-o;if(s>0)e=this.reduceBuffer(e,o,s);else{n=!1;break}}}n&&(t.debug(`MultiBufferStream`,`Appending new buffer (fileStart: `+e.fileStart+` - Length: `+e.byteLength+`)`),this.buffers.push(e),r===0&&(this.buffer=e))},o.prototype.logBufferLevel=function(e){var n,r,a,o,s=[],c,l=``;for(a=0,o=0,n=0;n<this.buffers.length;n++)r=this.buffers[n],n===0?(c={},s.push(c),c.start=r.fileStart,c.end=r.fileStart+r.byteLength,l+=`[`+c.start+`-`):c.end===r.fileStart?c.end=r.fileStart+r.byteLength:(c={},c.start=r.fileStart,l+=s[s.length-1].end-1+`], [`+c.start+`-`,c.end=r.fileStart+r.byteLength,s.push(c)),a+=r.usedBytes,o+=r.byteLength;s.length>0&&(l+=c.end-1+`]`);var u=e?t.info:t.debug;this.buffers.length===0?u(`MultiBufferStream`,`No more buffer in memory`):u(`MultiBufferStream`,``+this.buffers.length+` stored buffer(s) (`+a+`/`+o+` bytes), continuous ranges: `+l)},o.prototype.cleanBuffers=function(){var e,n;for(e=0;e<this.buffers.length;e++)n=this.buffers[e],n.usedBytes===n.byteLength&&(t.debug(`MultiBufferStream`,`Removing buffer #`+e),this.buffers.splice(e,1),e--)},o.prototype.mergeNextBuffer=function(){var e;if(this.bufferIndex+1<this.buffers.length)if(e=this.buffers[this.bufferIndex+1],e.fileStart===this.buffer.fileStart+this.buffer.byteLength){var n=this.buffer.byteLength,r=this.buffer.usedBytes,a=this.buffer.fileStart;return this.buffers[this.bufferIndex]=ArrayBuffer.concat(this.buffer,e),this.buffer=this.buffers[this.bufferIndex],this.buffers.splice(this.bufferIndex+1,1),this.buffer.usedBytes=r,this.buffer.fileStart=a,t.debug(`ISOFile`,`Concatenating buffer for box parsing (length: `+n+`->`+this.buffer.byteLength+`)`),!0}else return!1;else return!1},o.prototype.findPosition=function(e,n,r){var a,o=null,s=-1;for(a=e===!0?0:this.bufferIndex;a<this.buffers.length&&(o=this.buffers[a],o.fileStart<=n);)s=a,r&&(o.fileStart+o.byteLength<=n?o.usedBytes=o.byteLength:o.usedBytes=n-o.fileStart,this.logBufferLevel()),a++;return s===-1?-1:(o=this.buffers[s],o.fileStart+o.byteLength>=n?(t.debug(`MultiBufferStream`,`Found position in existing buffer #`+s),s):-1)},o.prototype.findEndContiguousBuf=function(e){var t,n,r,a=e===void 0?this.bufferIndex:e;if(n=this.buffers[a],this.buffers.length>a+1)for(t=a+1;t<this.buffers.length&&(r=this.buffers[t],r.fileStart===n.fileStart+n.byteLength);t++)n=r;return n.fileStart+n.byteLength},o.prototype.getEndFilePositionAfter=function(e){var t=this.findPosition(!0,e,!1);return t===-1?e:this.findEndContiguousBuf(t)},o.prototype.addUsedBytes=function(e){this.buffer.usedBytes+=e,this.logBufferLevel()},o.prototype.setAllUsedBytes=function(){this.buffer.usedBytes=this.buffer.byteLength,this.logBufferLevel()},o.prototype.seek=function(e,n,r){var a=this.findPosition(n,e,r);return a===-1?(t.debug(`MultiBufferStream`,`Position `+e+` not found in buffered data`),!1):(this.buffer=this.buffers[a],this.bufferIndex=a,this.position=e-this.buffer.fileStart,t.debug(`MultiBufferStream`,`Repositioning parser at buffer position: `+this.position),!0)},o.prototype.getPosition=function(){if(this.bufferIndex===-1||this.buffers[this.bufferIndex]===null)throw`Error accessing position in the MultiBufferStream`;return this.buffers[this.bufferIndex].fileStart+this.position},o.prototype.getLength=function(){return this.byteLength},o.prototype.getEndPosition=function(){if(this.bufferIndex===-1||this.buffers[this.bufferIndex]===null)throw`Error accessing position in the MultiBufferStream`;return this.buffers[this.bufferIndex].fileStart+this.byteLength},e!==void 0&&(e.MultiBufferStream=o);var s=function(){var e=3,n=4,r=5,a=6,o=[];o[e]=`ES_Descriptor`,o[n]=`DecoderConfigDescriptor`,o[r]=`DecoderSpecificInfo`,o[a]=`SLConfigDescriptor`,this.getDescriptorName=function(e){return o[e]};var s=this,c={};return this.parseOneDescriptor=function(e){var n=0,r=0,a=e.readUint8(),s,l;for(n++,l=e.readUint8(),n++;l&128;)r=(r<<7)+(l&127),l=e.readUint8(),n++;return r=(r<<7)+(l&127),t.debug(`MPEG4DescriptorParser`,`Found `+(o[a]||`Descriptor `+a)+`, size `+r+` at position `+e.getPosition()),s=o[a]?new c[o[a]](r):new c.Descriptor(r),s.parse(e),s},c.Descriptor=function(e,t){this.tag=e,this.size=t,this.descs=[]},c.Descriptor.prototype.parse=function(e){this.data=e.readUint8Array(this.size)},c.Descriptor.prototype.findDescriptor=function(e){for(var t=0;t<this.descs.length;t++)if(this.descs[t].tag==e)return this.descs[t];return null},c.Descriptor.prototype.parseRemainingDescriptors=function(e){for(var t=e.position;e.position<t+this.size;){var n=s.parseOneDescriptor(e);this.descs.push(n)}},c.ES_Descriptor=function(t){c.Descriptor.call(this,e,t)},c.ES_Descriptor.prototype=new c.Descriptor,c.ES_Descriptor.prototype.parse=function(e){if(this.ES_ID=e.readUint16(),this.flags=e.readUint8(),this.size-=3,this.flags&128?(this.dependsOn_ES_ID=e.readUint16(),this.size-=2):this.dependsOn_ES_ID=0,this.flags&64){var t=e.readUint8();this.URL=e.readString(t),this.size-=t+1}else this.URL=``;this.flags&32?(this.OCR_ES_ID=e.readUint16(),this.size-=2):this.OCR_ES_ID=0,this.parseRemainingDescriptors(e)},c.ES_Descriptor.prototype.getOTI=function(e){var t=this.findDescriptor(n);return t?t.oti:0},c.ES_Descriptor.prototype.getAudioConfig=function(e){var t=this.findDescriptor(n);if(!t)return null;var a=t.findDescriptor(r);if(a&&a.data){var o=(a.data[0]&248)>>3;return o===31&&a.data.length>=2&&(o=32+((a.data[0]&7)<<3)+((a.data[1]&224)>>5)),o}else return null},c.DecoderConfigDescriptor=function(e){c.Descriptor.call(this,n,e)},c.DecoderConfigDescriptor.prototype=new c.Descriptor,c.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=(this.streamType>>1&1)!=0,this.streamType>>>=2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},c.DecoderSpecificInfo=function(e){c.Descriptor.call(this,r,e)},c.DecoderSpecificInfo.prototype=new c.Descriptor,c.SLConfigDescriptor=function(e){c.Descriptor.call(this,a,e)},c.SLConfigDescriptor.prototype=new c.Descriptor,this};e!==void 0&&(e.MPEG4DescriptorParser=s);var c={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:[{type:`mdat`,name:`MediaDataBox`},{type:`idat`,name:`ItemDataBox`},{type:`free`,name:`FreeSpaceBox`},{type:`skip`,name:`FreeSpaceBox`},{type:`meco`,name:`AdditionalMetadataContainerBox`},{type:`strk`,name:`SubTrackBox`}],FULL_BOXES:[{type:`hmhd`,name:`HintMediaHeaderBox`},{type:`nmhd`,name:`NullMediaHeaderBox`},{type:`iods`,name:`ObjectDescriptorBox`},{type:`xml `,name:`XMLBox`},{type:`bxml`,name:`BinaryXMLBox`},{type:`ipro`,name:`ItemProtectionBox`},{type:`mere`,name:`MetaboxRelationBox`}],CONTAINER_BOXES:[[{type:`moov`,name:`CompressedMovieBox`},[`trak`,`pssh`]],[{type:`trak`,name:`TrackBox`}],[{type:`edts`,name:`EditBox`}],[{type:`mdia`,name:`MediaBox`}],[{type:`minf`,name:`MediaInformationBox`}],[{type:`dinf`,name:`DataInformationBox`}],[{type:`stbl`,name:`SampleTableBox`},[`sgpd`,`sbgp`]],[{type:`mvex`,name:`MovieExtendsBox`},[`trex`]],[{type:`moof`,name:`CompressedMovieFragmentBox`},[`traf`]],[{type:`traf`,name:`TrackFragmentBox`},[`trun`,`sgpd`,`sbgp`]],[{type:`vttc`,name:`VTTCueBox`}],[{type:`tref`,name:`TrackReferenceBox`}],[{type:`iref`,name:`ItemReferenceBox`}],[{type:`mfra`,name:`MovieFragmentRandomAccessBox`},[`tfra`]],[{type:`meco`,name:`AdditionalMetadataContainerBox`}],[{type:`hnti`,name:`trackhintinformation`}],[{type:`hinf`,name:`hintstatisticsbox`}],[{type:`strk`,name:`SubTrackBox`}],[{type:`strd`,name:`SubTrackDefinitionBox`}],[{type:`sinf`,name:`ProtectionSchemeInfoBox`}],[{type:`rinf`,name:`RestrictedSchemeInfoBox`}],[{type:`schi`,name:`SchemeInformationBox`}],[{type:`trgr`,name:`TrackGroupBox`}],[{type:`udta`,name:`UserDataBox`},[`kind`]],[{type:`iprp`,name:`ItemPropertiesBox`},[`ipma`]],[{type:`ipco`,name:`ItemPropertyContainerBox`}],[{type:`grpl`,name:`GroupsListBox`}],[{type:`j2kH`,name:`J2KHeaderInfoBox`}],[{type:`etyp`,name:`ExtendedTypeBox`},[`tyco`]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){c.FullBox.prototype=new c.Box,c.ContainerBox.prototype=new c.Box,c.SampleEntry.prototype=new c.Box,c.TrackGroupTypeBox.prototype=new c.FullBox,c.BASIC_BOXES.forEach(function(e){c.createBoxCtor(e.type,e.name)}),c.FULL_BOXES.forEach(function(e){c.createFullBoxCtor(e.type,e.name)}),c.CONTAINER_BOXES.forEach(function(e){c.createContainerBoxCtor(e[0].type,e[0].name,null,e[1])})},Box:function(e,t,n,r){this.type=e,this.box_name=n,this.size=t,this.uuid=r},FullBox:function(e,t,n,r){c.Box.call(this,e,t,n,r),this.flags=0,this.version=0},ContainerBox:function(e,t,n,r){c.Box.call(this,e,t,n,r),this.boxes=[]},SampleEntry:function(e,t,n,r){c.ContainerBox.call(this,e,t),this.hdr_size=n,this.start=r},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){c.FullBox.call(this,e,t)},createBoxCtor:function(e,t,n){c.boxCodes.push(e),c[e+`Box`]=function(n){c.Box.call(this,e,n,t)},c[e+`Box`].prototype=new c.Box,n&&(c[e+`Box`].prototype.parse=n)},createFullBoxCtor:function(e,t,n){c[e+`Box`]=function(n){c.FullBox.call(this,e,n,t)},c[e+`Box`].prototype=new c.FullBox,c[e+`Box`].prototype.parse=function(e){this.parseFullHeader(e),n&&n.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,n=0;n<t;n++)this[e[n]+`s`]=[]}},createContainerBoxCtor:function(e,t,n,r){c[e+`Box`]=function(n){c.ContainerBox.call(this,e,n,t),c.addSubBoxArrays.call(this,r)},c[e+`Box`].prototype=new c.ContainerBox,n&&(c[e+`Box`].prototype.parse=n)},createMediaSampleEntryCtor:function(e,t,n){c.sampleEntryCodes[e]=[],c[e+`SampleEntry`]=function(e,t){c.SampleEntry.call(this,e,t),c.addSubBoxArrays.call(this,n)},c[e+`SampleEntry`].prototype=new c.SampleEntry,t&&(c[e+`SampleEntry`].prototype.parse=t)},createSampleEntryCtor:function(e,t,n,r){c.sampleEntryCodes[e].push(t),c[t+`SampleEntry`]=function(n){c[e+`SampleEntry`].call(this,t,n),c.addSubBoxArrays.call(this,r)},c[t+`SampleEntry`].prototype=new c[e+`SampleEntry`],n&&(c[t+`SampleEntry`].prototype.parse=n)},createEncryptedSampleEntryCtor:function(e,t,n){c.createSampleEntryCtor.call(this,e,t,n,[`sinf`])},createSampleGroupCtor:function(e,t){c[e+`SampleGroupEntry`]=function(t){c.SampleGroupEntry.call(this,e,t)},c[e+`SampleGroupEntry`].prototype=new c.SampleGroupEntry,t&&(c[e+`SampleGroupEntry`].prototype.parse=t)},createTrackGroupCtor:function(e,t){c[e+`TrackGroupTypeBox`]=function(t){c.TrackGroupTypeBox.call(this,e,t)},c[e+`TrackGroupTypeBox`].prototype=new c.TrackGroupTypeBox,t&&(c[e+`TrackGroupTypeBox`].prototype.parse=t)},createUUIDBox:function(e,t,n,r,a){c.UUIDs.push(e),c.UUIDBoxes[e]=function(a){n?c.FullBox.call(this,`uuid`,a,t,e):r?c.ContainerBox.call(this,`uuid`,a,t,e):c.Box.call(this,`uuid`,a,t,e)},c.UUIDBoxes[e].prototype=n?new c.FullBox:r?new c.ContainerBox:new c.Box,a&&(n?c.UUIDBoxes[e].prototype.parse=function(e){this.parseFullHeader(e),a&&a.call(this,e)}:c.UUIDBoxes[e].prototype.parse=a)}};c.initialize(),c.TKHD_FLAG_ENABLED=1,c.TKHD_FLAG_IN_MOVIE=2,c.TKHD_FLAG_IN_PREVIEW=4,c.TFHD_FLAG_BASE_DATA_OFFSET=1,c.TFHD_FLAG_SAMPLE_DESC=2,c.TFHD_FLAG_SAMPLE_DUR=8,c.TFHD_FLAG_SAMPLE_SIZE=16,c.TFHD_FLAG_SAMPLE_FLAGS=32,c.TFHD_FLAG_DUR_EMPTY=65536,c.TFHD_FLAG_DEFAULT_BASE_IS_MOOF=131072,c.TRUN_FLAGS_DATA_OFFSET=1,c.TRUN_FLAGS_FIRST_FLAG=4,c.TRUN_FLAGS_DURATION=256,c.TRUN_FLAGS_SIZE=512,c.TRUN_FLAGS_FLAGS=1024,c.TRUN_FLAGS_CTS_OFFSET=2048,c.Box.prototype.add=function(e){return this.addBox(new c[e+`Box`])},c.Box.prototype.addBox=function(e){return this.boxes.push(e),this[e.type+`s`]?this[e.type+`s`].push(e):this[e.type]=e,e},c.Box.prototype.set=function(e,t){return this[e]=t,this},c.Box.prototype.addEntry=function(e,t){var n=t||`entries`;return this[n]||(this[n]=[]),this[n].push(e),this},e!==void 0&&(e.BoxParser=c),c.parseUUID=function(e){return c.parseHex16(e)},c.parseHex16=function(e){for(var t=``,n=0;n<16;n++){var r=e.readUint8().toString(16);t+=r.length===1?`0`+r:r}return t},c.parseOneBox=function(e,n,r){var a,o=e.getPosition(),s=0,l,u;if(e.getEndPosition()-o<8)return t.debug(`BoxParser`,`Not enough data in stream to parse the type and size of the box`),{code:c.ERR_NOT_ENOUGH_DATA};if(r&&r<8)return t.debug(`BoxParser`,`Not enough bytes left in the parent box to parse a new box`),{code:c.ERR_NOT_ENOUGH_DATA};var d=e.readUint32(),f=e.readString(4),p=f;if(t.debug(`BoxParser`,`Found box of type '`+f+`' and size `+d+` at position `+o),s=8,f==`uuid`){if(e.getEndPosition()-e.getPosition()<16||r-s<16)return e.seek(o),t.debug(`BoxParser`,`Not enough bytes left in the parent box to parse a UUID box`),{code:c.ERR_NOT_ENOUGH_DATA};u=c.parseUUID(e),s+=16,p=u}if(d==1){if(e.getEndPosition()-e.getPosition()<8||r&&r-s<8)return e.seek(o),t.warn(`BoxParser`,`Not enough data in stream to parse the extended size of the "`+f+`" box`),{code:c.ERR_NOT_ENOUGH_DATA};d=e.readUint64(),s+=8}else if(d===0){if(r)d=r;else if(f!==`mdat`)return t.error(`BoxParser`,`Unlimited box size not supported for type: '`+f+`'`),a=new c.Box(f,d),{code:c.OK,box:a,size:a.size}}return d!==0&&d<s?(t.error(`BoxParser`,`Box of type `+f+` has an invalid size `+d+` (too small to be a box)`),{code:c.ERR_NOT_ENOUGH_DATA,type:f,size:d,hdr_size:s,start:o}):d!==0&&r&&d>r?(t.error(`BoxParser`,`Box of type '`+f+`' has a size `+d+` greater than its container size `+r),{code:c.ERR_NOT_ENOUGH_DATA,type:f,size:d,hdr_size:s,start:o}):d!==0&&o+d>e.getEndPosition()?(e.seek(o),t.info(`BoxParser`,`Not enough data in stream to parse the entire '`+f+`' box`),{code:c.ERR_NOT_ENOUGH_DATA,type:f,size:d,hdr_size:s,start:o}):n?{code:c.OK,type:f,size:d,hdr_size:s,start:o}:(c[f+`Box`]?a=new c[f+`Box`](d):f===`uuid`?c.UUIDBoxes[u]?a=new c.UUIDBoxes[u](d):(t.warn(`BoxParser`,`Unknown uuid type: '`+u+`'`),a=new c.Box(f,d),a.uuid=u,a.has_unparsed_data=!0):(t.warn(`BoxParser`,`Unknown box type: '`+f+`'`),a=new c.Box(f,d),a.has_unparsed_data=!0),a.hdr_size=s,a.start=o,a.write===c.Box.prototype.write&&a.type!==`mdat`&&(t.info(`BoxParser`,`'`+p+`' box writing not yet implemented, keeping unparsed data in memory for later write`),a.parseDataAndRewind(e)),a.parse(e),l=e.getPosition()-(a.start+a.size),l<0?(t.warn(`BoxParser`,`Parsing of box '`+p+`' did not read the entire indicated box data size (missing `+-l+` bytes), seeking forward`),e.seek(a.start+a.size)):l>0&&(t.error(`BoxParser`,`Parsing of box '`+p+`' read `+l+` more bytes than the indicated box data size, seeking backwards`),a.size!==0&&e.seek(a.start+a.size)),{code:c.OK,box:a,size:a.size})},c.Box.prototype.parse=function(e){this.type==`mdat`?this.size===0?e.seek(e.getEndPosition()):e.seek(this.start+this.size):this.data=e.readUint8Array(this.size-this.hdr_size)},c.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},c.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},c.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},c.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},c.ContainerBox.prototype.parse=function(e){for(var n,r;e.getPosition()<this.start+this.size;)if(n=c.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),n.code===c.OK)if(r=n.box,this.boxes.push(r),this.subBoxNames&&this.subBoxNames.indexOf(r.type)!=-1)this[this.subBoxNames[this.subBoxNames.indexOf(r.type)]+`s`].push(r);else{var a=r.type===`uuid`?r.uuid:r.type;this[a]?t.warn(`Box of type `+a+` already stored in field of this type`):this[a]=r}else return},c.Box.prototype.parseLanguage=function(e){this.language=e.readUint16();var t=[];t[0]=this.language>>10&31,t[1]=this.language>>5&31,t[2]=this.language&31,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},c.SAMPLE_ENTRY_TYPE_VISUAL=`Visual`,c.SAMPLE_ENTRY_TYPE_AUDIO=`Audio`,c.SAMPLE_ENTRY_TYPE_HINT=`Hint`,c.SAMPLE_ENTRY_TYPE_METADATA=`Metadata`,c.SAMPLE_ENTRY_TYPE_SUBTITLE=`Subtitle`,c.SAMPLE_ENTRY_TYPE_SYSTEM=`System`,c.SAMPLE_ENTRY_TYPE_TEXT=`Text`,c.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},c.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},c.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},c.SampleEntry.prototype.parseFooter=function(e){c.ContainerBox.prototype.parse.call(this,e)},c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_HINT),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SYSTEM),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_TEXT),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)}),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)}),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`avc1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`avc2`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`avc3`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`avc4`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`av01`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`dav1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`hvc1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`hev1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`hvt1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`lhe1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`dvh1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`dvhe`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`vvc1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`vvi1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`vvs1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`vvcN`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`vp08`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`vp09`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`avs3`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`j2ki`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`mjp2`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`mjpg`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`uncv`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,`mp4a`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,`ac-3`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,`ac-4`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,`ec-3`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,`Opus`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,`mha1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,`mha2`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,`mhm1`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,`mhm2`),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,`fLaC`),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,`encv`),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,`enca`),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE,`encu`),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SYSTEM,`encs`),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_TEXT,`enct`),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA,`encm`),c.createBoxCtor(`a1lx`,`AV1LayeredImageIndexingProperty`,function(e){var t=((e.readUint8()&1)+1)*16;this.layer_size=[];for(var n=0;n<3;n++)t==16?this.layer_size[n]=e.readUint16():this.layer_size[n]=e.readUint32()}),c.createBoxCtor(`a1op`,`OperatingPointSelectorProperty`,function(e){this.op_index=e.readUint8()}),c.createFullBoxCtor(`auxC`,`AuxiliaryTypeProperty`,function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)}),c.createBoxCtor(`av1C`,`AV1CodecConfigurationBox`,function(e){var n=e.readUint8();if((n>>7&1)!=1){t.error(`av1C marker problem`);return}if(this.version=n&127,this.version!==1){t.error(`av1C version `+this.version+` not supported`);return}if(n=e.readUint8(),this.seq_profile=n>>5&7,this.seq_level_idx_0=n&31,n=e.readUint8(),this.seq_tier_0=n>>7&1,this.high_bitdepth=n>>6&1,this.twelve_bit=n>>5&1,this.monochrome=n>>4&1,this.chroma_subsampling_x=n>>3&1,this.chroma_subsampling_y=n>>2&1,this.chroma_sample_position=n&3,n=e.readUint8(),this.reserved_1=n>>5&7,this.reserved_1!==0){t.error(`av1C reserved_1 parsing problem`);return}if(this.initial_presentation_delay_present=n>>4&1,this.initial_presentation_delay_present===1)this.initial_presentation_delay_minus_one=n&15;else if(this.reserved_2=n&15,this.reserved_2!==0){t.error(`av1C reserved_2 parsing problem`);return}var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)});function l(e){var t=`<table class='inner-table'>`;t+=`<thead><tr><th>length</th><th>nalu_data</th></tr></thead>`,t+=`<tbody>`;for(var n=0;n<e.length;n++){var r=e[n];t+=`<tr>`,t+=`<td>`+r.length+`</td>`,t+=`<td>`,t+=r.nalu.reduce(function(e,t){return e+t.toString(16).padStart(2,`0`)},`0x`),t+=`</td></tr>`}return t+=`</tbody></table>`,t}c.createBoxCtor(`avcC`,`AVCConfigurationBox`,function(e){var t,n;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=e.readUint8()&3,this.nb_SPS_nalus=e.readUint8()&31,n=this.size-this.hdr_size-6,this.SPS=[],this.SPS.toString=function(){return l(this)},t=0;t<this.nb_SPS_nalus;t++)this.SPS[t]={},this.SPS[t].length=e.readUint16(),this.SPS[t].nalu=e.readUint8Array(this.SPS[t].length),n-=2+this.SPS[t].length;for(this.nb_PPS_nalus=e.readUint8(),n--,this.PPS=[],this.PPS.toString=function(){return l(this)},t=0;t<this.nb_PPS_nalus;t++)this.PPS[t]={},this.PPS[t].length=e.readUint16(),this.PPS[t].nalu=e.readUint8Array(this.PPS[t].length),n-=2+this.PPS[t].length;n>0&&(this.ext=e.readUint8Array(n))}),c.createBoxCtor(`btrt`,`BitRateBox`,function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()}),c.createFullBoxCtor(`ccst`,`CodingConstraintsBox`,function(e){var t=e.readUint8();this.all_ref_pics_intra=(t&128)==128,this.intra_pred_used=(t&64)==64,this.max_ref_per_pic=(t&63)>>2,e.readUint24()}),c.createBoxCtor(`cdef`,`ComponentDefinitionBox`,function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t<this.channel_count;t++)this.channel_indexes.push(e.readUint16()),this.channel_types.push(e.readUint16()),this.channel_associations.push(e.readUint16())}),c.createBoxCtor(`clap`,`CleanApertureBox`,function(e){this.cleanApertureWidthN=e.readUint32(),this.cleanApertureWidthD=e.readUint32(),this.cleanApertureHeightN=e.readUint32(),this.cleanApertureHeightD=e.readUint32(),this.horizOffN=e.readUint32(),this.horizOffD=e.readUint32(),this.vertOffN=e.readUint32(),this.vertOffD=e.readUint32()}),c.createBoxCtor(`clli`,`ContentLightLevelBox`,function(e){this.max_content_light_level=e.readUint16(),this.max_pic_average_light_level=e.readUint16()}),c.createFullBoxCtor(`cmex`,`CameraExtrinsicMatrixProperty`,function(e){this.flags&1&&(this.pos_x=e.readInt32()),this.flags&2&&(this.pos_y=e.readInt32()),this.flags&4&&(this.pos_z=e.readInt32()),this.flags&8&&(this.version==0?this.flags&16?(this.quat_x=e.readInt32(),this.quat_y=e.readInt32(),this.quat_z=e.readInt32()):(this.quat_x=e.readInt16(),this.quat_y=e.readInt16(),this.quat_z=e.readInt16()):this.version),this.flags&32&&(this.id=e.readUint32())}),c.createFullBoxCtor(`cmin`,`CameraIntrinsicMatrixProperty`,function(e){this.focal_length_x=e.readInt32(),this.principal_point_x=e.readInt32(),this.principal_point_y=e.readInt32(),this.flags&1&&(this.focal_length_y=e.readInt32(),this.skew_factor=e.readInt32())}),c.createBoxCtor(`cmpd`,`ComponentDefinitionBox`,function(e){for(this.component_count=e.readUint32(),this.component_types=[],this.component_type_urls=[],i=0;i<this.component_count;i++){var t=e.readUint16();this.component_types.push(t),t>=32768&&this.component_type_urls.push(e.readCString())}}),c.createFullBoxCtor(`co64`,`ChunkLargeOffsetBox`,function(e){var t=e.readUint32(),n;if(this.chunk_offsets=[],this.version===0)for(n=0;n<t;n++)this.chunk_offsets.push(e.readUint64())}),c.createFullBoxCtor(`CoLL`,`ContentLightLevelBox`,function(e){this.maxCLL=e.readUint16(),this.maxFALL=e.readUint16()}),c.createBoxCtor(`colr`,`ColourInformationBox`,function(e){if(this.colour_type=e.readString(4),this.colour_type===`nclx`){this.colour_primaries=e.readUint16(),this.transfer_characteristics=e.readUint16(),this.matrix_coefficients=e.readUint16();var t=e.readUint8();this.full_range_flag=t>>7}else (this.colour_type===`rICC`||this.colour_type===`prof`)&&(this.ICC_profile=e.readUint8Array(this.size-4))}),c.createFullBoxCtor(`cprt`,`CopyrightBox`,function(e){this.parseLanguage(e),this.notice=e.readCString()}),c.createFullBoxCtor(`cslg`,`CompositionToDecodeBox`,function(e){this.version===0&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())}),c.createFullBoxCtor(`ctts`,`CompositionOffsetBox`,function(e){var n=e.readUint32(),r;if(this.sample_counts=[],this.sample_offsets=[],this.version===0)for(r=0;r<n;r++){this.sample_counts.push(e.readUint32());var a=e.readInt32();a<0&&t.warn(`BoxParser`,`ctts box uses negative values without using version 1`),this.sample_offsets.push(a)}else if(this.version==1)for(r=0;r<n;r++)this.sample_counts.push(e.readUint32()),this.sample_offsets.push(e.readInt32())}),c.createBoxCtor(`dac3`,`AC3SpecificBox`,function(e){var t=e.readUint8(),n=e.readUint8(),r=e.readUint8();this.fscod=t>>6,this.bsid=t>>1&31,this.bsmod=(t&1)<<2|n>>6&3,this.acmod=n>>3&7,this.lfeon=n>>2&1,this.bit_rate_code=n&3|r>>5&7}),c.createBoxCtor(`dec3`,`EC3SpecificBox`,function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=t&7,this.ind_subs=[];for(var n=0;n<this.num_ind_sub+1;n++){var r={};this.ind_subs.push(r);var a=e.readUint8(),o=e.readUint8(),s=e.readUint8();r.fscod=a>>6,r.bsid=a>>1&31,r.bsmod=(a&1)<<4|o>>4&15,r.acmod=o>>1&7,r.lfeon=o&1,r.num_dep_sub=s>>1&15,r.num_dep_sub>0&&(r.chan_loc=(s&1)<<8|e.readUint8())}}),c.createFullBoxCtor(`dfLa`,`FLACSpecificBox`,function(e){var t=127,n=128,r=[],a=[`STREAMINFO`,`PADDING`,`APPLICATION`,`SEEKTABLE`,`VORBIS_COMMENT`,`CUESHEET`,`PICTURE`,`RESERVED`];do{var o=e.readUint8(),s=Math.min(o&t,a.length-1);if(s?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),r.push(a[s]),o&n)break}while(!0);this.numMetadataBlocks=r.length+` (`+r.join(`, `)+`)`}),c.createBoxCtor(`dimm`,`hintimmediateBytesSent`,function(e){this.bytessent=e.readUint64()}),c.createBoxCtor(`dmax`,`hintlongestpacket`,function(e){this.time=e.readUint32()}),c.createBoxCtor(`dmed`,`hintmediaBytesSent`,function(e){this.bytessent=e.readUint64()}),c.createBoxCtor(`dOps`,`OpusSpecificBox`,function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),this.ChannelMappingFamily!==0){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t<this.OutputChannelCount;t++)this.ChannelMapping[t]=e.readUint8()}}),c.createFullBoxCtor(`dref`,`DataReferenceBox`,function(e){var t,n;this.entries=[];for(var r=e.readUint32(),a=0;a<r;a++)if(t=c.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),t.code===c.OK)n=t.box,this.entries.push(n);else return}),c.createBoxCtor(`drep`,`hintrepeatedBytesSent`,function(e){this.bytessent=e.readUint64()}),c.createFullBoxCtor(`elng`,`ExtendedLanguageBox`,function(e){this.extended_language=e.readString(this.size-this.hdr_size)}),c.createFullBoxCtor(`elst`,`EditListBox`,function(e){this.entries=[];for(var t=e.readUint32(),n=0;n<t;n++){var r={};this.entries.push(r),this.version===1?(r.segment_duration=e.readUint64(),r.media_time=e.readInt64()):(r.segment_duration=e.readUint32(),r.media_time=e.readInt32()),r.media_rate_integer=e.readInt16(),r.media_rate_fraction=e.readInt16()}}),c.createFullBoxCtor(`emsg`,`EventMessageBox`,function(e){this.version==1?(this.timescale=e.readUint32(),this.presentation_time=e.readUint64(),this.event_duration=e.readUint32(),this.id=e.readUint32(),this.scheme_id_uri=e.readCString(),this.value=e.readCString()):(this.scheme_id_uri=e.readCString(),this.value=e.readCString(),this.timescale=e.readUint32(),this.presentation_time_delta=e.readUint32(),this.event_duration=e.readUint32(),this.id=e.readUint32());var t=this.size-this.hdr_size-(16+(this.scheme_id_uri.length+1)+(this.value.length+1));this.version==1&&(t-=4),this.message_data=e.readUint8Array(t)}),c.createEntityToGroupCtor=function(e,t){c[e+`Box`]=function(t){c.FullBox.call(this,e,t)},c[e+`Box`].prototype=new c.FullBox,c[e+`Box`].prototype.parse=function(e){if(this.parseFullHeader(e),t)t.call(this,e);else for(this.group_id=e.readUint32(),this.num_entities_in_group=e.readUint32(),this.entity_ids=[],i=0;i<this.num_entities_in_group;i++){var n=e.readUint32();this.entity_ids.push(n)}}},c.createEntityToGroupCtor(`aebr`),c.createEntityToGroupCtor(`afbr`),c.createEntityToGroupCtor(`albc`),c.createEntityToGroupCtor(`altr`),c.createEntityToGroupCtor(`brst`),c.createEntityToGroupCtor(`dobr`),c.createEntityToGroupCtor(`eqiv`),c.createEntityToGroupCtor(`favc`),c.createEntityToGroupCtor(`fobr`),c.createEntityToGroupCtor(`iaug`),c.createEntityToGroupCtor(`pano`),c.createEntityToGroupCtor(`slid`),c.createEntityToGroupCtor(`ster`),c.createEntityToGroupCtor(`tsyn`),c.createEntityToGroupCtor(`wbbr`),c.createEntityToGroupCtor(`prgr`),c.createEntityToGroupCtor(`pymd`,function(e){this.group_id=e.readUint32(),this.num_entities_in_group=e.readUint32(),this.entity_ids=[];for(var t=0;t<this.num_entities_in_group;t++){var n=e.readUint32();this.entity_ids.push(n)}for(this.tile_size_x=e.readUint16(),this.tile_size_y=e.readUint16(),this.layer_binning=[],this.tiles_in_layer_column_minus1=[],this.tiles_in_layer_row_minus1=[],t=0;t<this.num_entities_in_group;t++)this.layer_binning[t]=e.readUint16(),this.tiles_in_layer_row_minus1[t]=e.readUint16(),this.tiles_in_layer_column_minus1[t]=e.readUint16()}),c.createFullBoxCtor(`esds`,`ElementaryStreamDescriptorBox`,function(e){var t=e.readUint8Array(this.size-this.hdr_size);if(s!==void 0){var n=new s;this.esd=n.parseOneDescriptor(new r(t.buffer,0,r.BIG_ENDIAN))}}),c.createBoxCtor(`fiel`,`FieldHandlingBox`,function(e){this.fieldCount=e.readUint8(),this.fieldOrdering=e.readUint8()}),c.createBoxCtor(`frma`,`OriginalFormatBox`,function(e){this.data_format=e.readString(4)}),c.createBoxCtor(`ftyp`,`FileTypeBox`,function(e){var t=this.size-this.hdr_size;this.major_brand=e.readString(4),this.minor_version=e.readUint32(),t-=8,this.compatible_brands=[];for(var n=0;t>=4;)this.compatible_brands[n]=e.readString(4),t-=4,n++}),c.createFullBoxCtor(`hdlr`,`HandlerBox`,function(e){this.version===0&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),this.name[this.name.length-1]===`\0`&&(this.name=this.name.slice(0,-1)))}),c.createBoxCtor(`hvcC`,`HEVCConfigurationBox`,function(e){var t,n,r,a;this.configurationVersion=e.readUint8(),a=e.readUint8(),this.general_profile_space=a>>6,this.general_tier_flag=(a&32)>>5,this.general_profile_idc=a&31,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=e.readUint16()&4095,this.parallelismType=e.readUint8()&3,this.chroma_format_idc=e.readUint8()&3,this.bit_depth_luma_minus8=e.readUint8()&7,this.bit_depth_chroma_minus8=e.readUint8()&7,this.avgFrameRate=e.readUint16(),a=e.readUint8(),this.constantFrameRate=a>>6,this.numTemporalLayers=(a&13)>>3,this.temporalIdNested=(a&4)>>2,this.lengthSizeMinusOne=a&3,this.nalu_arrays=[],this.nalu_arrays.toString=function(){var e=`<table class='inner-table'>`;e+=`<thead><tr><th>completeness</th><th>nalu_type</th><th>nalu_data</th></tr></thead>`,e+=`<tbody>`;for(var t=0;t<this.length;t++){var n=this[t];e+=`<tr>`,e+=`<td rowspan='`+n.length+`'>`+n.completeness+`</td>`,e+=`<td rowspan='`+n.length+`'>`+n.nalu_type+`</td>`;for(var r=0;r<n.length;r++){var a=n[r];r!==0&&(e+=`<tr>`),e+=`<td>`,e+=a.data.reduce(function(e,t){return e+t.toString(16).padStart(2,`0`)},`0x`),e+=`</td></tr>`}}return e+=`</tbody></table>`,e};var o=e.readUint8();for(t=0;t<o;t++){var s=[];this.nalu_arrays.push(s),a=e.readUint8(),s.completeness=(a&128)>>7,s.nalu_type=a&63;var c=e.readUint16();for(n=0;n<c;n++){var l={};s.push(l),r=e.readUint16(),l.data=e.readUint8Array(r)}}}),c.createFullBoxCtor(`iinf`,`ItemInfoBox`,function(e){var n;this.version===0?this.entry_count=e.readUint16():this.entry_count=e.readUint32(),this.item_infos=[];for(var r=0;r<this.entry_count;r++)if(n=c.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),n.code===c.OK)n.box.type!==`infe`&&t.error(`BoxParser`,`Expected 'infe' box, got `+n.box.type),this.item_infos[r]=n.box;else return}),c.createFullBoxCtor(`iloc`,`ItemLocationBox`,function(e){var t=e.readUint8();this.offset_size=t>>4&15,this.length_size=t&15,t=e.readUint8(),this.base_offset_size=t>>4&15,this.version===1||this.version===2?this.index_size=t&15:this.index_size=0,this.items=[];var n=0;if(this.version<2)n=e.readUint16();else if(this.version===2)n=e.readUint32();else throw`version of iloc box not supported`;for(var r=0;r<n;r++){var a={};if(this.items.push(a),this.version<2)a.item_ID=e.readUint16();else if(this.version===2)a.item_ID=e.readUint32();else throw`version of iloc box not supported`;switch(this.version===1||this.version===2?a.construction_method=e.readUint16()&15:a.construction_method=0,a.data_reference_index=e.readUint16(),this.base_offset_size){case 0:a.base_offset=0;break;case 4:a.base_offset=e.readUint32();break;case 8:a.base_offset=e.readUint64();break;default:throw`Error reading base offset size`}var o=e.readUint16();a.extents=[];for(var s=0;s<o;s++){var c={};if(a.extents.push(c),this.version===1||this.version===2)switch(this.index_size){case 0:c.extent_index=0;break;case 4:c.extent_index=e.readUint32();break;case 8:c.extent_index=e.readUint64();break;default:throw`Error reading extent index`}switch(this.offset_size){case 0:c.extent_offset=0;break;case 4:c.extent_offset=e.readUint32();break;case 8:c.extent_offset=e.readUint64();break;default:throw`Error reading extent index`}switch(this.length_size){case 0:c.extent_length=0;break;case 4:c.extent_length=e.readUint32();break;case 8:c.extent_length=e.readUint64();break;default:throw`Error reading extent index`}}}}),c.createBoxCtor(`imir`,`ImageMirror`,function(e){var t=e.readUint8();this.reserved=t>>7,this.axis=t&1}),c.createFullBoxCtor(`infe`,`ItemInfoEntry`,function(e){if((this.version===0||this.version===1)&&(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),this.version===1){this.extension_type=e.readString(4),t.warn(`BoxParser`,`Cannot parse extension type`),e.seek(this.start+this.size);return}this.version>=2&&(this.version===2?this.item_ID=e.readUint16():this.version===3&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),this.item_type===`mime`?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):this.item_type===`uri `&&(this.item_uri_type=e.readCString()))}),c.createFullBoxCtor(`ipma`,`ItemPropertyAssociationBox`,function(e){var t,n;for(entry_count=e.readUint32(),this.associations=[],t=0;t<entry_count;t++){var r={};this.associations.push(r),this.version<1?r.id=e.readUint16():r.id=e.readUint32();var a=e.readUint8();for(r.props=[],n=0;n<a;n++){var o=e.readUint8(),s={};r.props.push(s),s.essential=(o&128)>>7==1,this.flags&1?s.property_index=(o&127)<<8|e.readUint8():s.property_index=o&127}}}),c.createFullBoxCtor(`iref`,`ItemReferenceBox`,function(e){var n,r;for(this.references=[];e.getPosition()<this.start+this.size;)if(n=c.parseOneBox(e,!0,this.size-(e.getPosition()-this.start)),n.code===c.OK)r=this.version===0?new c.SingleItemTypeReferenceBox(n.type,n.size,n.hdr_size,n.start):new c.SingleItemTypeReferenceBoxLarge(n.type,n.size,n.hdr_size,n.start),r.write===c.Box.prototype.write&&r.type!==`mdat`&&(t.warn(`BoxParser`,r.type+` box writing not yet implemented, keeping unparsed data in memory for later write`),r.parseDataAndRewind(e)),r.parse(e),this.references.push(r);else return}),c.createBoxCtor(`irot`,`ImageRotation`,function(e){this.angle=e.readUint8()&3}),c.createFullBoxCtor(`ispe`,`ImageSpatialExtentsProperty`,function(e){this.image_width=e.readUint32(),this.image_height=e.readUint32()}),c.createFullBoxCtor(`kind`,`KindBox`,function(e){this.schemeURI=e.readCString(),this.value=e.readCString()}),c.createFullBoxCtor(`leva`,`LevelAssignmentBox`,function(e){var n=e.readUint8();this.levels=[];for(var r=0;r<n;r++){var a={};this.levels[r]=a,a.track_ID=e.readUint32();var o=e.readUint8();switch(a.padding_flag=o>>7,a.assignment_type=o&127,a.assignment_type){case 0:a.grouping_type=e.readString(4);break;case 1:a.grouping_type=e.readString(4),a.grouping_type_parameter=e.readUint32();break;case 2:break;case 3:break;case 4:a.sub_track_id=e.readUint32();break;default:t.warn(`BoxParser`,`Unknown leva assignement type`)}}}),c.createBoxCtor(`lhvC`,`LHEVCConfigurationBox`,function(e){var t,n,r;this.configurationVersion=e.readUint8(),this.min_spatial_segmentation_idc=e.readUint16()&4095,this.parallelismType=e.readUint8()&3,r=e.readUint8(),this.numTemporalLayers=(r&13)>>3,this.temporalIdNested=(r&4)>>2,this.lengthSizeMinusOne=r&3,this.nalu_arrays=[],this.nalu_arrays.toString=function(){var e=`<table class='inner-table'>`;e+=`<thead><tr><th>completeness</th><th>nalu_type</th><th>nalu_data</th></tr></thead>`,e+=`<tbody>`;for(var t=0;t<this.length;t++){var n=this[t];e+=`<tr>`,e+=`<td rowspan='`+n.length+`'>`+n.completeness+`</td>`,e+=`<td rowspan='`+n.length+`'>`+n.nalu_type+`</td>`;for(var r=0;r<n.length;r++){var a=n[r];r!==0&&(e+=`<tr>`),e+=`<td>`,e+=a.data.reduce(function(e,t){return e+t.toString(16).padStart(2,`0`)},`0x`),e+=`</td></tr>`}}return e+=`</tbody></table>`,e};var a=e.readUint8();for(t=0;t<a;t++){var o=[];this.nalu_arrays.push(o),r=e.readUint8(),o.completeness=(r&128)>>7,o.nalu_type=r&63;var s=e.readUint16();for(n=0;n<s;n++){var c={};o.push(c);var l=e.readUint16();c.data=e.readUint8Array(l)}}}),c.createBoxCtor(`lsel`,`LayerSelectorProperty`,function(e){this.layer_id=e.readUint16()}),c.createBoxCtor(`maxr`,`hintmaxrate`,function(e){this.period=e.readUint32(),this.bytes=e.readUint32()});function u(e,t){this.x=e,this.y=t}u.prototype.toString=function(){return`(`+this.x+`,`+this.y+`)`},c.createBoxCtor(`mdcv`,`MasteringDisplayColourVolumeBox`,function(e){this.display_primaries=[],this.display_primaries[0]=new u(e.readUint16(),e.readUint16()),this.display_primaries[1]=new u(e.readUint16(),e.readUint16()),this.display_primaries[2]=new u(e.readUint16(),e.readUint16()),this.white_point=new u(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()}),c.createFullBoxCtor(`mdhd`,`MediaHeaderBox`,function(e){this.version==1?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()}),c.createFullBoxCtor(`mehd`,`MovieExtendsHeaderBox`,function(e){this.flags&1&&(t.warn(`BoxParser`,`mehd box incorrectly uses flags set to 1, converting version to 1`),this.version=1),this.version==1?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()}),c.createFullBoxCtor(`meta`,`MetaBox`,function(e){this.boxes=[],c.ContainerBox.prototype.parse.call(this,e)}),c.createFullBoxCtor(`mfhd`,`MovieFragmentHeaderBox`,function(e){this.sequence_number=e.readUint32()}),c.createFullBoxCtor(`mfro`,`MovieFragmentRandomAccessOffsetBox`,function(e){this._size=e.readUint32()}),c.createFullBoxCtor(`mskC`,`MaskConfigurationProperty`,function(e){this.bits_per_pixel=e.readUint8()}),c.createFullBoxCtor(`mvhd`,`MovieHeaderBox`,function(e){this.version==1?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()}),c.createBoxCtor(`npck`,`hintPacketsSent`,function(e){this.packetssent=e.readUint32()}),c.createBoxCtor(`nump`,`hintPacketsSent`,function(e){this.packetssent=e.readUint64()}),c.createFullBoxCtor(`padb`,`PaddingBitsBox`,function(e){var t=e.readUint32();this.padbits=[];for(var n=0;n<Math.floor((t+1)/2);n++)this.padbits=e.readUint8()}),c.createBoxCtor(`pasp`,`PixelAspectRatioBox`,function(e){this.hSpacing=e.readUint32(),this.vSpacing=e.readUint32()}),c.createBoxCtor(`payl`,`CuePayloadBox`,function(e){this.text=e.readString(this.size-this.hdr_size)}),c.createBoxCtor(`payt`,`hintpayloadID`,function(e){this.payloadID=e.readUint32();var t=e.readUint8();this.rtpmap_string=e.readString(t)}),c.createFullBoxCtor(`pdin`,`ProgressiveDownloadInfoBox`,function(e){var t=(this.size-this.hdr_size)/8;this.rate=[],this.initial_delay=[];for(var n=0;n<t;n++)this.rate[n]=e.readUint32(),this.initial_delay[n]=e.readUint32()}),c.createFullBoxCtor(`pitm`,`PrimaryItemBox`,function(e){this.version===0?this.item_id=e.readUint16():this.item_id=e.readUint32()}),c.createFullBoxCtor(`pixi`,`PixelInformationProperty`,function(e){var t;for(this.num_channels=e.readUint8(),this.bits_per_channels=[],t=0;t<this.num_channels;t++)this.bits_per_channels[t]=e.readUint8()}),c.createBoxCtor(`pmax`,`hintlargestpacket`,function(e){this.bytes=e.readUint32()}),c.createFullBoxCtor(`prdi`,`ProgressiveDerivedImageItemInformationProperty`,function(e){if(this.step_count=e.readUint16(),this.item_count=[],this.flags&2)for(var t=0;t<this.step_count;t++)this.item_count[t]=e.readUint16()}),c.createFullBoxCtor(`prft`,`ProducerReferenceTimeBox`,function(e){this.ref_track_id=e.readUint32(),this.ntp_timestamp=e.readUint64(),this.version===0?this.media_time=e.readUint32():this.media_time=e.readUint64()}),c.createFullBoxCtor(`pssh`,`ProtectionSystemSpecificHeaderBox`,function(e){if(this.system_id=c.parseHex16(e),this.version>0){var t=e.readUint32();this.kid=[];for(var n=0;n<t;n++)this.kid[n]=c.parseHex16(e)}var r=e.readUint32();r>0&&(this.data=e.readUint8Array(r))}),c.createFullBoxCtor(`clef`,`TrackCleanApertureDimensionsBox`,function(e){this.width=e.readUint32(),this.height=e.readUint32()}),c.createFullBoxCtor(`enof`,`TrackEncodedPixelsDimensionsBox`,function(e){this.width=e.readUint32(),this.height=e.readUint32()}),c.createFullBoxCtor(`prof`,`TrackProductionApertureDimensionsBox`,function(e){this.width=e.readUint32(),this.height=e.readUint32()}),c.createContainerBoxCtor(`tapt`,`TrackApertureModeDimensionsBox`,null,[`clef`,`prof`,`enof`]),c.createBoxCtor(`rtp `,`rtpmoviehintinformation`,function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)}),c.createFullBoxCtor(`saio`,`SampleAuxiliaryInformationOffsetsBox`,function(e){this.flags&1&&(this.aux_info_type=e.readString(4),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var n=0;n<t;n++)this.version===0?this.offset[n]=e.readUint32():this.offset[n]=e.readUint64()}),c.createFullBoxCtor(`saiz`,`SampleAuxiliaryInformationSizesBox`,function(e){if(this.flags&1&&(this.aux_info_type=e.readString(4),this.aux_info_type_parameter=e.readUint32()),this.default_sample_info_size=e.readUint8(),this.sample_count=e.readUint32(),this.sample_info_size=[],this.default_sample_info_size===0)for(var t=0;t<this.sample_count;t++)this.sample_info_size[t]=e.readUint8()}),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA,`mett`,function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA,`metx`,function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.parseFooter(e)}),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE,`sbtt`,function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE,`stpp`,function(e){this.parseHeader(e),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.auxiliary_mime_types=e.readCString(),this.parseFooter(e)}),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE,`stxt`,function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE,`tx3g`,function(e){this.parseHeader(e),this.displayFlags=e.readUint32(),this.horizontal_justification=e.readInt8(),this.vertical_justification=e.readInt8(),this.bg_color_rgba=e.readUint8Array(4),this.box_record=e.readInt16Array(4),this.style_record=e.readUint8Array(12),this.parseFooter(e)}),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA,`wvtt`,function(e){this.parseHeader(e),this.parseFooter(e)}),c.createSampleGroupCtor(`alst`,function(e){var t,n=e.readUint16();for(this.first_output_sample=e.readUint16(),this.sample_offset=[],t=0;t<n;t++)this.sample_offset[t]=e.readUint32();var r=this.description_length-4-4*n;for(this.num_output_samples=[],this.num_total_samples=[],t=0;t<r/4;t++)this.num_output_samples[t]=e.readUint16(),this.num_total_samples[t]=e.readUint16()}),c.createSampleGroupCtor(`avll`,function(e){this.layerNumber=e.readUint8(),this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()}),c.createSampleGroupCtor(`avss`,function(e){this.subSequenceIdentifier=e.readUint16(),this.layerNumber=e.readUint8();var t=e.readUint8();this.durationFlag=t>>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var n=e.readUint8(),r=0;r<n;r++){var a={};this.dependency.push(a),a.subSeqDirectionFlag=e.readUint8(),a.layerNumber=e.readUint8(),a.subSequenceIdentifier=e.readUint16()}}),c.createSampleGroupCtor(`dtrt`,function(e){t.warn(`BoxParser`,`Sample Group type: `+this.grouping_type+` not fully parsed`)}),c.createSampleGroupCtor(`mvif`,function(e){t.warn(`BoxParser`,`Sample Group type: `+this.grouping_type+` not fully parsed`)}),c.createSampleGroupCtor(`prol`,function(e){this.roll_distance=e.readInt16()}),c.createSampleGroupCtor(`rap `,function(e){var t=e.readUint8();this.num_leading_samples_known=t>>7,this.num_leading_samples=t&127}),c.createSampleGroupCtor(`rash`,function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(this.operation_point_count===1?2:this.operation_point_count*6)+9)t.warn(`BoxParser`,`Mismatch in `+this.grouping_type+` sample group length`),this.data=e.readUint8Array(this.description_length-2);else{if(this.operation_point_count===1)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var n=0;n<this.operation_point_count;n++)this.available_bitrate[n]=e.readUint32(),this.target_rate_share[n]=e.readUint16()}this.maximum_bitrate=e.readUint32(),this.minimum_bitrate=e.readUint32(),this.discard_priority=e.readUint8()}}),c.createSampleGroupCtor(`roll`,function(e){this.roll_distance=e.readInt16()}),c.SampleGroupEntry.prototype.parse=function(e){t.warn(`BoxParser`,`Unknown Sample Group type: `+this.grouping_type),this.data=e.readUint8Array(this.description_length)},c.createSampleGroupCtor(`scif`,function(e){t.warn(`BoxParser`,`Sample Group type: `+this.grouping_type+` not fully parsed`)}),c.createSampleGroupCtor(`scnm`,function(e){t.warn(`BoxParser`,`Sample Group type: `+this.grouping_type+` not fully parsed`)}),c.createSampleGroupCtor(`seig`,function(e){this.reserved=e.readUint8();var t=e.readUint8();this.crypt_byte_block=t>>4,this.skip_byte_block=t&15,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=c.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,this.isProtected===1&&this.Per_Sample_IV_Size===0&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))}),c.createSampleGroupCtor(`stsa`,function(e){t.warn(`BoxParser`,`Sample Group type: `+this.grouping_type+` not fully parsed`)}),c.createSampleGroupCtor(`sync`,function(e){var t=e.readUint8();this.NAL_unit_type=t&63}),c.createSampleGroupCtor(`tele`,function(e){var t=e.readUint8();this.level_independently_decodable=t>>7}),c.createSampleGroupCtor(`tsas`,function(e){t.warn(`BoxParser`,`Sample Group type: `+this.grouping_type+` not fully parsed`)}),c.createSampleGroupCtor(`tscl`,function(e){t.warn(`BoxParser`,`Sample Group type: `+this.grouping_type+` not fully parsed`)}),c.createSampleGroupCtor(`vipr`,function(e){t.warn(`BoxParser`,`Sample Group type: `+this.grouping_type+` not fully parsed`)}),c.createFullBoxCtor(`sbgp`,`SampleToGroupBox`,function(e){this.grouping_type=e.readString(4),this.version===1?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),n=0;n<t;n++){var r={};this.entries.push(r),r.sample_count=e.readInt32(),r.group_description_index=e.readInt32()}});function d(e,t){this.bad_pixel_row=e,this.bad_pixel_column=t}d.prototype.toString=function(){return`[row: `+this.bad_pixel_row+`, column: `+this.bad_pixel_column+`]`},c.createFullBoxCtor(`sbpm`,`SensorBadPixelsMapBox`,function(e){var t;for(this.component_count=e.readUint16(),this.component_index=[],t=0;t<this.component_count;t++)this.component_index.push(e.readUint16());var n=e.readUint8();for(this.correction_applied=(n&128)==128,this.num_bad_rows=e.readUint32(),this.num_bad_cols=e.readUint32(),this.num_bad_pixels=e.readUint32(),this.bad_rows=[],this.bad_columns=[],this.bad_pixels=[],t=0;t<this.num_bad_rows;t++)this.bad_rows.push(e.readUint32());for(t=0;t<this.num_bad_cols;t++)this.bad_columns.push(e.readUint32());for(t=0;t<this.num_bad_pixels;t++){var r=e.readUint32(),a=e.readUint32();this.bad_pixels.push(new d(r,a))}}),c.createFullBoxCtor(`schm`,`SchemeTypeBox`,function(e){this.scheme_type=e.readString(4),this.scheme_version=e.readUint32(),this.flags&1&&(this.scheme_uri=e.readString(this.size-this.hdr_size-8))}),c.createBoxCtor(`sdp `,`rtptracksdphintinformation`,function(e){this.sdptext=e.readString(this.size-this.hdr_size)}),c.createFullBoxCtor(`sdtp`,`SampleDependencyTypeBox`,function(e){var t,n=this.size-this.hdr_size;this.is_leading=[],this.sample_depends_on=[],this.sample_is_depended_on=[],this.sample_has_redundancy=[];for(var r=0;r<n;r++)t=e.readUint8(),this.is_leading[r]=t>>6,this.sample_depends_on[r]=t>>4&3,this.sample_is_depended_on[r]=t>>2&3,this.sample_has_redundancy[r]=t&3}),c.createFullBoxCtor(`senc`,`SampleEncryptionBox`),c.createFullBoxCtor(`sgpd`,`SampleGroupDescriptionBox`,function(e){this.grouping_type=e.readString(4),t.debug(`BoxParser`,`Found Sample Groups of type `+this.grouping_type),this.version===1?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var n=e.readUint32(),r=0;r<n;r++){var a=c[this.grouping_type+`SampleGroupEntry`]?new c[this.grouping_type+`SampleGroupEntry`](this.grouping_type):new c.SampleGroupEntry(this.grouping_type);this.entries.push(a),this.version===1&&this.default_length===0?a.description_length=e.readUint32():a.description_length=this.default_length,a.write===c.SampleGroupEntry.prototype.write&&(t.info(`BoxParser`,`SampleGroup for type `+this.grouping_type+` writing not yet implemented, keeping unparsed data in memory for later write`),a.data=e.readUint8Array(a.description_length),e.position-=a.description_length),a.parse(e)}}),c.createFullBoxCtor(`sidx`,`CompressedSegmentIndexBox`,function(e){this.reference_ID=e.readUint32(),this.timescale=e.readUint32(),this.version===0?(this.earliest_presentation_time=e.readUint32(),this.first_offset=e.readUint32()):(this.earliest_presentation_time=e.readUint64(),this.first_offset=e.readUint64()),e.readUint16(),this.references=[];for(var t=e.readUint16(),n=0;n<t;n++){var r={};this.references.push(r);var a=e.readUint32();r.reference_type=a>>31&1,r.referenced_size=a&2147483647,r.subsegment_duration=e.readUint32(),a=e.readUint32(),r.starts_with_SAP=a>>31&1,r.SAP_type=a>>28&7,r.SAP_delta_time=a&268435455}}),c.SingleItemTypeReferenceBox=function(e,t,n,r){c.Box.call(this,e,t),this.hdr_size=n,this.start=r},c.SingleItemTypeReferenceBox.prototype=new c.Box,c.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var n=0;n<t;n++)this.references[n]={},this.references[n].to_item_ID=e.readUint16()},c.SingleItemTypeReferenceBoxLarge=function(e,t,n,r){c.Box.call(this,e,t),this.hdr_size=n,this.start=r},c.SingleItemTypeReferenceBoxLarge.prototype=new c.Box,c.SingleItemTypeReferenceBoxLarge.prototype.parse=function(e){this.from_item_ID=e.readUint32();var t=e.readUint16();this.references=[];for(var n=0;n<t;n++)this.references[n]={},this.references[n].to_item_ID=e.readUint32()},c.createFullBoxCtor(`SmDm`,`SMPTE2086MasteringDisplayMetadataBox`,function(e){this.primaryRChromaticity_x=e.readUint16(),this.primaryRChromaticity_y=e.readUint16(),this.primaryGChromaticity_x=e.readUint16(),this.primaryGChromaticity_y=e.readUint16(),this.primaryBChromaticity_x=e.readUint16(),this.primaryBChromaticity_y=e.readUint16(),this.whitePointChromaticity_x=e.readUint16(),this.whitePointChromaticity_y=e.readUint16(),this.luminanceMax=e.readUint32(),this.luminanceMin=e.readUint32()}),c.createFullBoxCtor(`smhd`,`SoundMediaHeaderBox`,function(e){this.balance=e.readUint16(),e.readUint16()}),c.createFullBoxCtor(`ssix`,`CompressedSubsegmentIndexBox`,function(e){this.subsegments=[];for(var t=e.readUint32(),n=0;n<t;n++){var r={};this.subsegments.push(r),r.ranges=[];for(var a=e.readUint32(),o=0;o<a;o++){var s={};r.ranges.push(s),s.level=e.readUint8(),s.range_size=e.readUint24()}}}),c.createFullBoxCtor(`stco`,`ChunkOffsetBox`,function(e){var t=e.readUint32();if(this.chunk_offsets=[],this.version===0)for(var n=0;n<t;n++)this.chunk_offsets.push(e.readUint32())}),c.createFullBoxCtor(`stdp`,`DegradationPriorityBox`,function(e){var t=(this.size-this.hdr_size)/2;this.priority=[];for(var n=0;n<t;n++)this.priority[n]=e.readUint16()}),c.createFullBoxCtor(`sthd`,`SubtitleMediaHeaderBox`),c.createFullBoxCtor(`stri`,`SubTrackInformationBox`,function(e){this.switch_group=e.readUint16(),this.alternate_group=e.readUint16(),this.sub_track_id=e.readUint32();var t=(this.size-this.hdr_size-8)/4;this.attribute_list=[];for(var n=0;n<t;n++)this.attribute_list[n]=e.readUint32()}),c.createFullBoxCtor(`stsc`,`SampleToChunkBox`,function(e){var t=e.readUint32(),n;if(this.first_chunk=[],this.samples_per_chunk=[],this.sample_description_index=[],this.version===0)for(n=0;n<t;n++)this.first_chunk.push(e.readUint32()),this.samples_per_chunk.push(e.readUint32()),this.sample_description_index.push(e.readUint32())}),c.createFullBoxCtor(`stsd`,`SampleDescriptionBox`,function(e){var n,r,a,o;for(this.entries=[],a=e.readUint32(),n=1;n<=a;n++)if(r=c.parseOneBox(e,!0,this.size-(e.getPosition()-this.start)),r.code===c.OK)c[r.type+`SampleEntry`]?(o=new c[r.type+`SampleEntry`](r.size),o.hdr_size=r.hdr_size,o.start=r.start):(t.warn(`BoxParser`,`Unknown sample entry type: `+r.type),o=new c.SampleEntry(r.type,r.size,r.hdr_size,r.start)),o.write===c.SampleEntry.prototype.write&&(t.info(`BoxParser`,`SampleEntry `+o.type+` box writing not yet implemented, keeping unparsed data in memory for later write`),o.parseDataAndRewind(e)),o.parse(e),this.entries.push(o);else return}),c.createFullBoxCtor(`stsg`,`SubTrackSampleGroupBox`,function(e){this.grouping_type=e.readUint32();var t=e.readUint16();this.group_description_index=[];for(var n=0;n<t;n++)this.group_description_index[n]=e.readUint32()}),c.createFullBoxCtor(`stsh`,`ShadowSyncSampleBox`,function(e){var t=e.readUint32(),n;if(this.shadowed_sample_numbers=[],this.sync_sample_numbers=[],this.version===0)for(n=0;n<t;n++)this.shadowed_sample_numbers.push(e.readUint32()),this.sync_sample_numbers.push(e.readUint32())}),c.createFullBoxCtor(`stss`,`SyncSampleBox`,function(e){var t,n=e.readUint32();if(this.version===0)for(this.sample_numbers=[],t=0;t<n;t++)this.sample_numbers.push(e.readUint32())}),c.createFullBoxCtor(`stsz`,`SampleSizeBox`,function(e){var t;if(this.sample_sizes=[],this.version===0)for(this.sample_size=e.readUint32(),this.sample_count=e.readUint32(),t=0;t<this.sample_count;t++)this.sample_size===0?this.sample_sizes.push(e.readUint32()):this.sample_sizes[t]=this.sample_size}),c.createFullBoxCtor(`stts`,`TimeToSampleBox`,function(e){var n=e.readUint32(),r,a;if(this.sample_counts=[],this.sample_deltas=[],this.version===0)for(r=0;r<n;r++)this.sample_counts.push(e.readUint32()),a=e.readInt32(),a<0&&(t.warn(`BoxParser`,`File uses negative stts sample delta, using value 1 instead, sync may be lost!`),a=1),this.sample_deltas.push(a)}),c.createFullBoxCtor(`stvi`,`StereoVideoBox`,function(e){var t=e.readUint32();this.single_view_allowed=t&3,this.stereo_scheme=e.readUint32();var n=e.readUint32();this.stereo_indication_type=e.readString(n);var r,a;for(this.boxes=[];e.getPosition()<this.start+this.size;)if(r=c.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),r.code===c.OK)a=r.box,this.boxes.push(a),this[a.type]=a;else return}),c.createBoxCtor(`styp`,`SegmentTypeBox`,function(e){c.ftypBox.prototype.parse.call(this,e)}),c.createFullBoxCtor(`stz2`,`CompactSampleSizeBox`,function(e){var n,r;if(this.sample_sizes=[],this.version===0)if(this.reserved=e.readUint24(),this.field_size=e.readUint8(),r=e.readUint32(),this.field_size===4)for(n=0;n<r;n+=2){var a=e.readUint8();this.sample_sizes[n]=a>>4&15,this.sample_sizes[n+1]=a&15}else if(this.field_size===8)for(n=0;n<r;n++)this.sample_sizes[n]=e.readUint8();else if(this.field_size===16)for(n=0;n<r;n++)this.sample_sizes[n]=e.readUint16();else t.error(`BoxParser`,`Error in length field in stz2 box`)}),c.createFullBoxCtor(`subs`,`SubSampleInformationBox`,function(e){var t,n,r=e.readUint32(),a;for(this.entries=[],t=0;t<r;t++){var o={};if(this.entries[t]=o,o.sample_delta=e.readUint32(),o.subsamples=[],a=e.readUint16(),a>0)for(n=0;n<a;n++){var s={};o.subsamples.push(s),this.version==1?s.size=e.readUint32():s.size=e.readUint16(),s.priority=e.readUint8(),s.discardable=e.readUint8(),s.codec_specific_parameters=e.readUint32()}}}),c.createFullBoxCtor(`tenc`,`TrackEncryptionBox`,function(e){if(e.readUint8(),this.version===0)e.readUint8();else{var t=e.readUint8();this.default_crypt_byte_block=t>>4&15,this.default_skip_byte_block=t&15}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=c.parseHex16(e),this.default_isProtected===1&&this.default_Per_Sample_IV_Size===0&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))}),c.createFullBoxCtor(`tfdt`,`TrackFragmentBaseMediaDecodeTimeBox`,function(e){this.version==1?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()}),c.createFullBoxCtor(`tfhd`,`TrackFragmentHeaderBox`,function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&c.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&c.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&c.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&c.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&c.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0}),c.createFullBoxCtor(`tfra`,`TrackFragmentRandomAccessBox`,function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=t&3,this.entries=[];for(var n=e.readUint32(),r=0;r<n;r++)this.version===1?(this.time=e.readUint64(),this.moof_offset=e.readUint64()):(this.time=e.readUint32(),this.moof_offset=e.readUint32()),this.traf_number=e[`readUint`+8*(this.length_size_of_traf_num+1)](),this.trun_number=e[`readUint`+8*(this.length_size_of_trun_num+1)](),this.sample_number=e[`readUint`+8*(this.length_size_of_sample_num+1)]()}),c.createFullBoxCtor(`tkhd`,`TrackHeaderBox`,function(e){this.version==1?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint32()),e.readUint32Array(2),this.layer=e.readInt16(),this.alternate_group=e.readInt16(),this.volume=e.readInt16()>>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()}),c.createBoxCtor(`tmax`,`hintmaxrelativetime`,function(e){this.time=e.readUint32()}),c.createBoxCtor(`tmin`,`hintminrelativetime`,function(e){this.time=e.readUint32()}),c.createBoxCtor(`totl`,`hintBytesSent`,function(e){this.bytessent=e.readUint32()}),c.createBoxCtor(`tpay`,`hintBytesSent`,function(e){this.bytessent=e.readUint32()}),c.createBoxCtor(`tpyl`,`hintBytesSent`,function(e){this.bytessent=e.readUint64()}),c.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},c.createTrackGroupCtor(`msrc`),c.TrackReferenceTypeBox=function(e,t,n,r){c.Box.call(this,e,t),this.hdr_size=n,this.start=r},c.TrackReferenceTypeBox.prototype=new c.Box,c.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},c.trefBox.prototype.parse=function(e){for(var n,r;e.getPosition()<this.start+this.size;)if(n=c.parseOneBox(e,!0,this.size-(e.getPosition()-this.start)),n.code===c.OK)r=new c.TrackReferenceTypeBox(n.type,n.size,n.hdr_size,n.start),r.write===c.Box.prototype.write&&r.type!==`mdat`&&(t.info(`BoxParser`,`TrackReference `+r.type+` box writing not yet implemented, keeping unparsed data in memory for later write`),r.parseDataAndRewind(e)),r.parse(e),this.boxes.push(r);else return},c.createFullBoxCtor(`trep`,`TrackExtensionPropertiesBox`,function(e){for(this.track_ID=e.readUint32(),this.boxes=[];e.getPosition()<this.start+this.size;)if(ret=c.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),ret.code===c.OK)box=ret.box,this.boxes.push(box);else return}),c.createFullBoxCtor(`trex`,`TrackExtendsBox`,function(e){this.track_id=e.readUint32(),this.default_sample_description_index=e.readUint32(),this.default_sample_duration=e.readUint32(),this.default_sample_size=e.readUint32(),this.default_sample_flags=e.readUint32()}),c.createBoxCtor(`trpy`,`hintBytesSent`,function(e){this.bytessent=e.readUint64()}),c.createFullBoxCtor(`trun`,`TrackRunBox`,function(e){var t=0;if(this.sample_count=e.readUint32(),t+=4,this.size-this.hdr_size>t&&this.flags&c.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&c.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var n=0;n<this.sample_count;n++)this.flags&c.TRUN_FLAGS_DURATION&&(this.sample_duration[n]=e.readUint32()),this.flags&c.TRUN_FLAGS_SIZE&&(this.sample_size[n]=e.readUint32()),this.flags&c.TRUN_FLAGS_FLAGS&&(this.sample_flags[n]=e.readUint32()),this.flags&c.TRUN_FLAGS_CTS_OFFSET&&(this.version===0?this.sample_composition_time_offset[n]=e.readUint32():this.sample_composition_time_offset[n]=e.readInt32())}),c.createFullBoxCtor(`tsel`,`TrackSelectionBox`,function(e){this.switch_group=e.readUint32();var t=(this.size-this.hdr_size-4)/4;this.attribute_list=[];for(var n=0;n<t;n++)this.attribute_list[n]=e.readUint32()}),c.createFullBoxCtor(`txtC`,`TextConfigBox`,function(e){this.config=e.readCString()}),c.createBoxCtor(`tyco`,`TypeCombinationBox`,function(e){var t=(this.size-this.hdr_size)/4;this.compatible_brands=[];for(var n=0;n<t;n++)this.compatible_brands[n]=e.readString(4)}),c.createFullBoxCtor(`udes`,`UserDescriptionProperty`,function(e){this.lang=e.readCString(),this.name=e.readCString(),this.description=e.readCString(),this.tags=e.readCString()}),c.createFullBoxCtor(`uncC`,`UncompressedFrameConfigBox`,function(e){var t;if(this.profile=e.readString(4),this.version!=1&&this.version==0){for(this.component_count=e.readUint32(),this.component_index=[],this.component_bit_depth_minus_one=[],this.component_format=[],this.component_align_size=[],t=0;t<this.component_count;t++)this.component_index.push(e.readUint16()),this.component_bit_depth_minus_one.push(e.readUint8()),this.component_format.push(e.readUint8()),this.component_align_size.push(e.readUint8());this.sampling_type=e.readUint8(),this.interleave_type=e.readUint8(),this.block_size=e.readUint8();var n=e.readUint8();this.component_little_endian=n>>7&1,this.block_pad_lsb=n>>6&1,this.block_little_endian=n>>5&1,this.block_reversed=n>>4&1,this.pad_unknown=n>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}}),c.createFullBoxCtor(`url `,`DataEntryUrlBox`,function(e){this.flags!==1&&(this.location=e.readCString())}),c.createFullBoxCtor(`urn `,`DataEntryUrnBox`,function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())}),c.createUUIDBox(`a5d40b30e81411ddba2f0800200c9a66`,`LiveServerManifestBox`,!0,!1,function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#039;`)}),c.createUUIDBox(`d08a4f1810f34a82b6c832d8aba183d3`,`PiffProtectionSystemSpecificHeaderBox`,!0,!1,function(e){this.system_id=c.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))}),c.createUUIDBox(`a2394f525a9b4f14a2446c427c648df4`,`PiffSampleEncryptionBox`,!0,!1),c.createUUIDBox(`8974dbce7be74c5184f97148f9882554`,`PiffTrackEncryptionBox`,!0,!1,function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=c.parseHex16(e)}),c.createUUIDBox(`d4807ef2ca3946958e5426cb9e46a79f`,`TfrfBox`,!0,!1,function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t<this.fragment_count;t++){var n={},r=0,a=0;this.version===1?(r=e.readUint64(),a=e.readUint64()):(r=e.readUint32(),a=e.readUint32()),n.absolute_time=r,n.absolute_duration=a,this.entries.push(n)}}),c.createUUIDBox(`6d1d9b0542d544e680e2141daff757b2`,`TfxdBox`,!0,!1,function(e){this.version===1?(this.absolute_time=e.readUint64(),this.duration=e.readUint64()):(this.absolute_time=e.readUint32(),this.duration=e.readUint32())}),c.createFullBoxCtor(`vmhd`,`VideoMediaHeaderBox`,function(e){this.graphicsmode=e.readUint16(),this.opcolor=e.readUint16Array(3)}),c.createFullBoxCtor(`vpcC`,`VPCodecConfigurationRecord`,function(e){var t;this.version===1?(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=t&1,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=t&15,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=t&1,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))}),c.createBoxCtor(`vttC`,`WebVTTConfigurationBox`,function(e){this.text=e.readString(this.size-this.hdr_size)}),c.createFullBoxCtor(`vvcC`,`VvcConfigurationBox`,function(e){var t,n,r={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<<e)-1;return this.num_held_bits-=e,t}};if(r.stream_read_1_bytes(e),r.extract_bits(5),this.lengthSizeMinusOne=r.extract_bits(2),this.ptl_present_flag=r.extract_bits(1),this.ptl_present_flag){if(r.stream_read_2_bytes(e),this.ols_idx=r.extract_bits(9),this.num_sublayers=r.extract_bits(3),this.constant_frame_rate=r.extract_bits(2),this.chroma_format_idc=r.extract_bits(2),r.stream_read_1_bytes(e),this.bit_depth_minus8=r.extract_bits(3),r.extract_bits(5),r.stream_read_2_bytes(e),r.extract_bits(2),this.num_bytes_constraint_info=r.extract_bits(6),this.general_profile_idc=r.extract_bits(7),this.general_tier_flag=r.extract_bits(1),this.general_level_idc=e.readUint8(),r.stream_read_1_bytes(e),this.ptl_frame_only_constraint_flag=r.extract_bits(1),this.ptl_multilayer_enabled_flag=r.extract_bits(1),this.general_constraint_info=new Uint8Array(this.num_bytes_constraint_info),this.num_bytes_constraint_info){for(t=0;t<this.num_bytes_constraint_info-1;t++){var a=r.extract_bits(6);r.stream_read_1_bytes(e);var o=r.extract_bits(2);this.general_constraint_info[t]=a<<2|o}this.general_constraint_info[this.num_bytes_constraint_info-1]=r.extract_bits(6)}else r.extract_bits(6);if(this.num_sublayers>1){for(r.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,n=this.num_sublayers-2;n>=0;--n){var s=r.extract_bits(1);this.ptl_sublayer_present_mask|=s<<n}for(n=this.num_sublayers;n<=8&&this.num_sublayers>1;++n)r.extract_bits(1);for(this.sublayer_level_idc=[],n=this.num_sublayers-2;n>=0;--n)this.ptl_sublayer_present_mask&1<<n&&(this.sublayer_level_idc[n]=e.readUint8())}if(this.ptl_num_sub_profiles=e.readUint8(),this.general_sub_profile_idc=[],this.ptl_num_sub_profiles)for(t=0;t<this.ptl_num_sub_profiles;t++)this.general_sub_profile_idc.push(e.readUint32());this.max_picture_width=e.readUint16(),this.max_picture_height=e.readUint16(),this.avg_frame_rate=e.readUint16()}var c=12,l=13;this.nalu_arrays=[];var u=e.readUint8();for(t=0;t<u;t++){var d=[];this.nalu_arrays.push(d),r.stream_read_1_bytes(e),d.completeness=r.extract_bits(1),r.extract_bits(2),d.nalu_type=r.extract_bits(5);var f=1;for(d.nalu_type!=l&&d.nalu_type!=c&&(f=e.readUint16()),n=0;n<f;n++){var p=e.readUint16();d.push({data:e.readUint8Array(p),length:p})}}}),c.createFullBoxCtor(`vvnC`,`VvcNALUConfigBox`,function(e){var t=strm.readUint8();this.lengthSizeMinusOne=t&3}),c.SampleEntry.prototype.isVideo=function(){return!1},c.SampleEntry.prototype.isAudio=function(){return!1},c.SampleEntry.prototype.isSubtitle=function(){return!1},c.SampleEntry.prototype.isMetadata=function(){return!1},c.SampleEntry.prototype.isHint=function(){return!1},c.SampleEntry.prototype.getCodec=function(){return this.type.replace(`.`,``)},c.SampleEntry.prototype.getWidth=function(){return``},c.SampleEntry.prototype.getHeight=function(){return``},c.SampleEntry.prototype.getChannelCount=function(){return``},c.SampleEntry.prototype.getSampleRate=function(){return``},c.SampleEntry.prototype.getSampleSize=function(){return``},c.VisualSampleEntry.prototype.isVideo=function(){return!0},c.VisualSampleEntry.prototype.getWidth=function(){return this.width},c.VisualSampleEntry.prototype.getHeight=function(){return this.height},c.AudioSampleEntry.prototype.isAudio=function(){return!0},c.AudioSampleEntry.prototype.getChannelCount=function(){return this.channel_count},c.AudioSampleEntry.prototype.getSampleRate=function(){return this.samplerate},c.AudioSampleEntry.prototype.getSampleSize=function(){return this.samplesize},c.SubtitleSampleEntry.prototype.isSubtitle=function(){return!0},c.MetadataSampleEntry.prototype.isMetadata=function(){return!0},c.decimalToHex=function(e,t){var n=Number(e).toString(16);for(t??=t=2;n.length<t;)n=`0`+n;return n},c.avc1SampleEntry.prototype.getCodec=c.avc2SampleEntry.prototype.getCodec=c.avc3SampleEntry.prototype.getCodec=c.avc4SampleEntry.prototype.getCodec=function(){var e=c.SampleEntry.prototype.getCodec.call(this);return this.avcC?e+`.`+c.decimalToHex(this.avcC.AVCProfileIndication)+c.decimalToHex(this.avcC.profile_compatibility)+c.decimalToHex(this.avcC.AVCLevelIndication):e},c.hev1SampleEntry.prototype.getCodec=c.hvc1SampleEntry.prototype.getCodec=function(){var e,t=c.SampleEntry.prototype.getCodec.call(this);if(this.hvcC){switch(t+=`.`,this.hvcC.general_profile_space){case 0:t+=``;break;case 1:t+=`A`;break;case 2:t+=`B`;break;case 3:t+=`C`;break}t+=this.hvcC.general_profile_idc,t+=`.`;var n=this.hvcC.general_profile_compatibility,r=0;for(e=0;e<32&&(r|=n&1,e!=31);e++)r<<=1,n>>=1;t+=c.decimalToHex(r,0),t+=`.`,this.hvcC.general_tier_flag===0?t+=`L`:t+=`H`,t+=this.hvcC.general_level_idc;var a=!1,o=``;for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||a)&&(o=`.`+c.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+o,a=!0);t+=o}return t},c.vvc1SampleEntry.prototype.getCodec=c.vvi1SampleEntry.prototype.getCodec=function(){var e,t=c.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+=`.`+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=`.H`:t+=`.L`,t+=this.vvcC.general_level_idc;var n=``;if(this.vvcC.general_constraint_info){var r=[],a=0;a|=this.vvcC.ptl_frame_only_constraint<<7,a|=this.vvcC.ptl_multilayer_enabled<<6;var o;for(e=0;e<this.vvcC.general_constraint_info.length;++e)a|=this.vvcC.general_constraint_info[e]>>2&63,r.push(a),a&&(o=e),a=this.vvcC.general_constraint_info[e]>>2&3;if(o===void 0)n=`.CA`;else{n=`.C`;var s=`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`,l=0,u=0;for(e=0;e<=o;++e)for(l=l<<8|r[e],u+=8;u>=5;){var d=l>>u-5&31;n+=s[d],u-=5,l&=(1<<u)-1}u&&(l<<=5-u,n+=s[l&31])}}t+=n}return t},c.mp4aSampleEntry.prototype.getCodec=function(){var e=c.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),n=this.esds.esd.getAudioConfig();return e+`.`+c.decimalToHex(t)+(n?`.`+n:``)}else return e},c.stxtSampleEntry.prototype.getCodec=function(){var e=c.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+`.`+this.mime_format:e},c.vp08SampleEntry.prototype.getCodec=c.vp09SampleEntry.prototype.getCodec=function(){var e=c.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;t==0&&(t=`00`);var n=this.vpcC.bitDepth;return n==8&&(n=`08`),e+`.0`+this.vpcC.profile+`.`+t+`.`+n},c.av01SampleEntry.prototype.getCodec=function(){var e=c.SampleEntry.prototype.getCodec.call(this),t=this.av1C.seq_level_idx_0;t<10&&(t=`0`+t);var n;return this.av1C.seq_profile===2&&this.av1C.high_bitdepth===1?n=this.av1C.twelve_bit===1?`12`:`10`:this.av1C.seq_profile<=2&&(n=this.av1C.high_bitdepth===1?`10`:`08`),e+`.`+this.av1C.seq_profile+`.`+t+(this.av1C.seq_tier_0?`H`:`M`)+`.`+n},c.Box.prototype.writeHeader=function(e,n){this.size+=8,this.size>a&&(this.size+=8),this.type===`uuid`&&(this.size+=16),t.debug(`BoxWriter`,`Writing box `+this.type+` of size: `+this.size+` at position `+e.getPosition()+(n||``)),this.size>a?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),this.type===`uuid`&&e.writeUint8Array(this.uuid),this.size>a&&e.writeUint64(this.size)},c.FullBox.prototype.writeHeader=function(e){this.size+=4,c.Box.prototype.writeHeader.call(this,e,` v=`+this.version+` f=`+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},c.Box.prototype.write=function(e){this.type===`mdat`?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},c.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var n=0;n<this.boxes.length;n++)this.boxes[n]&&(this.boxes[n].write(e),this.size+=this.boxes[n].size);t.debug(`BoxWriter`,`Adjusting box `+this.type+` with new size `+this.size),e.adjustUint32(this.sizePosition,this.size)},c.TrackReferenceTypeBox.prototype.write=function(e){this.size=this.track_ids.length*4,this.writeHeader(e),e.writeUint32Array(this.track_ids)},c.avcCBox.prototype.write=function(e){var t;for(this.size=7,t=0;t<this.SPS.length;t++)this.size+=2+this.SPS[t].length;for(t=0;t<this.PPS.length;t++)this.size+=2+this.PPS[t].length;for(this.ext&&(this.size+=this.ext.length),this.writeHeader(e),e.writeUint8(this.configurationVersion),e.writeUint8(this.AVCProfileIndication),e.writeUint8(this.profile_compatibility),e.writeUint8(this.AVCLevelIndication),e.writeUint8(this.lengthSizeMinusOne+252),e.writeUint8(this.SPS.length+224),t=0;t<this.SPS.length;t++)e.writeUint16(this.SPS[t].length),e.writeUint8Array(this.SPS[t].nalu);for(e.writeUint8(this.PPS.length),t=0;t<this.PPS.length;t++)e.writeUint16(this.PPS[t].length),e.writeUint8Array(this.PPS[t].nalu);this.ext&&e.writeUint8Array(this.ext)},c.co64Box.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),t=0;t<this.chunk_offsets.length;t++)e.writeUint64(this.chunk_offsets[t])},c.cslgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeInt32(this.compositionToDTSShift),e.writeInt32(this.leastDecodeToDisplayDelta),e.writeInt32(this.greatestDecodeToDisplayDelta),e.writeInt32(this.compositionStartTime),e.writeInt32(this.compositionEndTime)},c.cttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),this.version===1?e.writeInt32(this.sample_offsets[t]):e.writeUint32(this.sample_offsets[t])},c.drefBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.entries.length);for(var n=0;n<this.entries.length;n++)this.entries[n].write(e),this.size+=this.entries[n].size;t.debug(`BoxWriter`,`Adjusting box `+this.type+` with new size `+this.size),e.adjustUint32(this.sizePosition,this.size)},c.elngBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.extended_language.length,this.writeHeader(e),e.writeString(this.extended_language)},c.elstBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+12*this.entries.length,this.writeHeader(e),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var n=this.entries[t];e.writeUint32(n.segment_duration),e.writeInt32(n.media_time),e.writeInt16(n.media_rate_integer),e.writeInt16(n.media_rate_fraction)}},c.emsgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=16+this.message_data.length+(this.scheme_id_uri.length+1)+(this.value.length+1),this.writeHeader(e),e.writeCString(this.scheme_id_uri),e.writeCString(this.value),e.writeUint32(this.timescale),e.writeUint32(this.presentation_time_delta),e.writeUint32(this.event_duration),e.writeUint32(this.id),e.writeUint8Array(this.message_data)},c.ftypBox.prototype.write=function(e){this.size=8+4*this.compatible_brands.length,this.writeHeader(e),e.writeString(this.major_brand,null,4),e.writeUint32(this.minor_version);for(var t=0;t<this.compatible_brands.length;t++)e.writeString(this.compatible_brands[t],null,4)},c.hdlrBox.prototype.write=function(e){this.size=20+this.name.length+1,this.version=0,this.flags=0,this.writeHeader(e),e.writeUint32(0),e.writeString(this.handler,null,4),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeCString(this.name)},c.hvcCBox.prototype.write=function(e){var t,n;for(this.size=23,t=0;t<this.nalu_arrays.length;t++)for(this.size+=3,n=0;n<this.nalu_arrays[t].length;n++)this.size+=2+this.nalu_arrays[t][n].data.length;for(this.writeHeader(e),e.writeUint8(this.configurationVersion),e.writeUint8((this.general_profile_space<<6)+(this.general_tier_flag<<5)+this.general_profile_idc),e.writeUint32(this.general_profile_compatibility),e.writeUint8Array(this.general_constraint_indicator),e.writeUint8(this.general_level_idc),e.writeUint16(this.min_spatial_segmentation_idc+(15<<24)),e.writeUint8(this.parallelismType+252),e.writeUint8(this.chroma_format_idc+252),e.writeUint8(this.bit_depth_luma_minus8+248),e.writeUint8(this.bit_depth_chroma_minus8+248),e.writeUint16(this.avgFrameRate),e.writeUint8((this.constantFrameRate<<6)+(this.numTemporalLayers<<3)+(this.temporalIdNested<<2)+this.lengthSizeMinusOne),e.writeUint8(this.nalu_arrays.length),t=0;t<this.nalu_arrays.length;t++)for(e.writeUint8((this.nalu_arrays[t].completeness<<7)+this.nalu_arrays[t].nalu_type),e.writeUint16(this.nalu_arrays[t].length),n=0;n<this.nalu_arrays[t].length;n++)e.writeUint16(this.nalu_arrays[t][n].data.length),e.writeUint8Array(this.nalu_arrays[t][n].data)},c.kindBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.schemeURI.length+1+(this.value.length+1),this.writeHeader(e),e.writeCString(this.schemeURI),e.writeCString(this.value)},c.mdhdBox.prototype.write=function(e){this.size=20,this.flags=0,this.version=0,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint16(this.language),e.writeUint16(0)},c.mehdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.fragment_duration)},c.mfhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.sequence_number)},c.mvhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=96,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint32(this.rate),e.writeUint16(this.volume<<8),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32Array(this.matrix),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(this.next_track_id)},c.SampleEntry.prototype.writeHeader=function(e){this.size=8,c.Box.prototype.writeHeader.call(this,e),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint16(this.data_reference_index)},c.SampleEntry.prototype.writeFooter=function(e){for(var n=0;n<this.boxes.length;n++)this.boxes[n].write(e),this.size+=this.boxes[n].size;t.debug(`BoxWriter`,`Adjusting box `+this.type+` with new size `+this.size),e.adjustUint32(this.sizePosition,this.size)},c.SampleEntry.prototype.write=function(e){this.writeHeader(e),e.writeUint8Array(this.data),this.size+=this.data.length,t.debug(`BoxWriter`,`Adjusting box `+this.type+` with new size `+this.size),e.adjustUint32(this.sizePosition,this.size)},c.VisualSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=70,e.writeUint16(0),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.width),e.writeUint16(this.height),e.writeUint32(this.horizresolution),e.writeUint32(this.vertresolution),e.writeUint32(0),e.writeUint16(this.frame_count),e.writeUint8(Math.min(31,this.compressorname.length)),e.writeString(this.compressorname,null,31),e.writeUint16(this.depth),e.writeInt16(-1),this.writeFooter(e)},c.AudioSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=20,e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.channel_count),e.writeUint16(this.samplesize),e.writeUint16(0),e.writeUint16(0),e.writeUint32(this.samplerate<<16),this.writeFooter(e)},c.stppSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=this.namespace.length+1+this.schema_location.length+1+this.auxiliary_mime_types.length+1,e.writeCString(this.namespace),e.writeCString(this.schema_location),e.writeCString(this.auxiliary_mime_types),this.writeFooter(e)},c.SampleGroupEntry.prototype.write=function(e){e.writeUint8Array(this.data)},c.sbgpBox.prototype.write=function(e){this.version=1,this.flags=0,this.size=12+8*this.entries.length,this.writeHeader(e),e.writeString(this.grouping_type,null,4),e.writeUint32(this.grouping_type_parameter),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var n=this.entries[t];e.writeInt32(n.sample_count),e.writeInt32(n.group_description_index)}},c.sgpdBox.prototype.write=function(e){var t,n;for(this.flags=0,this.size=12,t=0;t<this.entries.length;t++)n=this.entries[t],this.version===1&&(this.default_length===0&&(this.size+=4),this.size+=n.data.length);for(this.writeHeader(e),e.writeString(this.grouping_type,null,4),this.version===1&&e.writeUint32(this.default_length),this.version>=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t<this.entries.length;t++)n=this.entries[t],this.version===1&&this.default_length===0&&e.writeUint32(n.description_length),n.write(e)},c.sidxBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20+12*this.references.length,this.writeHeader(e),e.writeUint32(this.reference_ID),e.writeUint32(this.timescale),e.writeUint32(this.earliest_presentation_time),e.writeUint32(this.first_offset),e.writeUint16(0),e.writeUint16(this.references.length);for(var t=0;t<this.references.length;t++){var n=this.references[t];e.writeUint32(n.reference_type<<31|n.referenced_size),e.writeUint32(n.subsegment_duration),e.writeUint32(n.starts_with_SAP<<31|n.SAP_type<<28|n.SAP_delta_time)}},c.smhdBox.prototype.write=function(e){this.version=0,this.flags=1,this.size=4,this.writeHeader(e),e.writeUint16(this.balance),e.writeUint16(0)},c.stcoBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),e.writeUint32Array(this.chunk_offsets)},c.stscBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+12*this.first_chunk.length,this.writeHeader(e),e.writeUint32(this.first_chunk.length),t=0;t<this.first_chunk.length;t++)e.writeUint32(this.first_chunk[t]),e.writeUint32(this.samples_per_chunk[t]),e.writeUint32(this.sample_description_index[t])},c.stsdBox.prototype.write=function(e){var n;for(this.version=0,this.flags=0,this.size=0,this.writeHeader(e),e.writeUint32(this.entries.length),this.size+=4,n=0;n<this.entries.length;n++)this.entries[n].write(e),this.size+=this.entries[n].size;t.debug(`BoxWriter`,`Adjusting box `+this.type+` with new size `+this.size),e.adjustUint32(this.sizePosition,this.size)},c.stshBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.shadowed_sample_numbers.length,this.writeHeader(e),e.writeUint32(this.shadowed_sample_numbers.length),t=0;t<this.shadowed_sample_numbers.length;t++)e.writeUint32(this.shadowed_sample_numbers[t]),e.writeUint32(this.sync_sample_numbers[t])},c.stssBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.sample_numbers.length,this.writeHeader(e),e.writeUint32(this.sample_numbers.length),e.writeUint32Array(this.sample_numbers)},c.stszBox.prototype.write=function(e){var t,n=!0;if(this.version=0,this.flags=0,this.sample_sizes.length>0)for(t=0;t+1<this.sample_sizes.length;)if(this.sample_sizes[t+1]!==this.sample_sizes[0]){n=!1;break}else t++;else n=!1;this.size=8,n||(this.size+=4*this.sample_sizes.length),this.writeHeader(e),n?e.writeUint32(this.sample_sizes[0]):e.writeUint32(0),e.writeUint32(this.sample_sizes.length),n||e.writeUint32Array(this.sample_sizes)},c.sttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),e.writeUint32(this.sample_deltas[t])},c.tfdtBox.prototype.write=function(e){var t=2**32-1;this.version=+(this.baseMediaDecodeTime>t),this.flags=0,this.size=4,this.version===1&&(this.size+=4),this.writeHeader(e),this.version===1?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},c.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&c.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&c.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&c.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&c.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&c.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&c.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&c.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&c.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&c.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&c.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},c.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},c.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},c.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&c.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&c.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&c.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&c.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&c.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&c.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&c.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&c.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t<this.sample_count;t++)this.flags&c.TRUN_FLAGS_DURATION&&e.writeUint32(this.sample_duration[t]),this.flags&c.TRUN_FLAGS_SIZE&&e.writeUint32(this.sample_size[t]),this.flags&c.TRUN_FLAGS_FLAGS&&e.writeUint32(this.sample_flags[t]),this.flags&c.TRUN_FLAGS_CTS_OFFSET&&(this.version===0?e.writeUint32(this.sample_composition_time_offset[t]):e.writeInt32(this.sample_composition_time_offset[t]))},c[`url Box`].prototype.write=function(e){this.version=0,this.location?(this.flags=0,this.size=this.location.length+1):(this.flags=1,this.size=0),this.writeHeader(e),this.location&&e.writeCString(this.location)},c[`urn Box`].prototype.write=function(e){this.version=0,this.flags=0,this.size=this.name.length+1+(this.location?this.location.length+1:0),this.writeHeader(e),e.writeCString(this.name),this.location&&e.writeCString(this.location)},c.vmhdBox.prototype.write=function(e){this.version=0,this.flags=1,this.size=8,this.writeHeader(e),e.writeUint16(this.graphicsmode),e.writeUint16Array(this.opcolor)},c.cttsBox.prototype.unpack=function(e){var t,n,r=0;for(t=0;t<this.sample_counts.length;t++)for(n=0;n<this.sample_counts[t];n++)e[r].pts=e[r].dts+this.sample_offsets[t],r++},c.sttsBox.prototype.unpack=function(e){var t,n,r=0;for(t=0;t<this.sample_counts.length;t++)for(n=0;n<this.sample_counts[t];n++)r===0?e[r].dts=0:e[r].dts=e[r-1].dts+this.sample_deltas[t],r++},c.stcoBox.prototype.unpack=function(e){var t;for(t=0;t<this.chunk_offsets.length;t++)e[t].offset=this.chunk_offsets[t]},c.stscBox.prototype.unpack=function(e){var t,n,r,a=0,o=0;for(t=0;t<this.first_chunk.length;t++)for(n=0;n<(t+1<this.first_chunk.length?this.first_chunk[t+1]:1/0);n++)for(o++,r=0;r<this.samples_per_chunk[t];r++){if(e[a])e[a].description_index=this.sample_description_index[t],e[a].chunk_index=o;else return;a++}},c.stszBox.prototype.unpack=function(e){var t;for(t=0;t<this.sample_sizes.length;t++)e[t].size=this.sample_sizes[t]},c.DIFF_BOXES_PROP_NAMES=[`boxes`,`entries`,`references`,`subsamples`,`items`,`item_infos`,`extents`,`associations`,`subsegments`,`ranges`,`seekLists`,`seekPoints`,`esd`,`levels`],c.DIFF_PRIMITIVE_ARRAY_PROP_NAMES=[`compatible_brands`,`matrix`,`opcolor`,`sample_counts`,`sample_deltas`,`first_chunk`,`samples_per_chunk`,`sample_sizes`,`chunk_offsets`,`sample_offsets`,`sample_description_index`,`sample_duration`],c.boxEqualFields=function(e,t){if(e&&!t)return!1;for(var n in e)if(c.DIFF_BOXES_PROP_NAMES.indexOf(n)>-1)continue;else if(e[n]instanceof c.Box||t[n]instanceof c.Box)continue;else if(e[n]===void 0||t[n]===void 0)continue;else if(typeof e[n]==`function`||typeof t[n]==`function`)continue;else if(e.subBoxNames&&e.subBoxNames.indexOf(n.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(n.slice(0,4))>-1)continue;else if(n===`data`||n===`start`||n===`size`||n===`creation_time`||n===`modification_time`)continue;else if(c.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(n)>-1)continue;else if(e[n]!==t[n])return!1;return!0},c.boxEqual=function(e,t){if(!c.boxEqualFields(e,t))return!1;for(var n=0;n<c.DIFF_BOXES_PROP_NAMES.length;n++){var r=c.DIFF_BOXES_PROP_NAMES[n];if(e[r]&&t[r]&&!c.boxEqual(e[r],t[r]))return!1}return!0};var f=function(){};f.prototype.parseSample=function(e){var t,r,a=new n(e.buffer);for(t=[];!a.isEos();)r=c.parseOneBox(a,!1),r.code===c.OK&&r.box.type===`vttc`&&t.push(r.box);return t},f.prototype.getText=function(e,t,n){function r(e,t,n){return n||=`0`,e+=``,e.length>=t?e:Array(t-e.length+1).join(n)+e}function a(e){var t=Math.floor(e/3600),n=Math.floor((e-t*3600)/60),a=Math.floor(e-t*3600-n*60),o=Math.floor((e-t*3600-n*60-a)*1e3);return``+r(t,2)+`:`+r(n,2)+`:`+r(a,2)+`.`+r(o,3)}for(var o=this.parseSample(n),s=``,c=0;c<o.length;c++){var l=o[c];s+=a(e)+` --> `+a(t)+`\r
150
- `,s+=l.payl.text}return s};var p=function(){};p.prototype.parseSample=function(e){var t={},r;t.resources=[];var a=new n(e.data.buffer);if(!e.subsamples||e.subsamples.length===0)t.documentString=a.readString(e.data.length);else if(t.documentString=a.readString(e.subsamples[0].size),e.subsamples.length>1)for(r=1;r<e.subsamples.length;r++)t.resources[r]=a.readUint8Array(e.subsamples[r].size);return typeof DOMParser<`u`&&(t.document=new DOMParser().parseFromString(t.documentString,`application/xml`)),t};var m=function(){};m.prototype.parseSample=function(e){return new n(e.data.buffer).readString(e.data.length)},m.prototype.parseConfig=function(e){var t,r=new n(e.buffer);return r.readUint32(),t=r.readCString(),t},e!==void 0&&(e.VTTin4Parser=f,e.XMLSubtitlein4Parser=p,e.Textin4Parser=m);var h=function(e){this.stream=e||new o,this.boxes=[],this.mdats=[],this.moofs=[],this.isProgressive=!1,this.moovStartFound=!1,this.onMoovStart=null,this.moovStartSent=!1,this.onReady=null,this.readySent=!1,this.onSegment=null,this.onSamples=null,this.onError=null,this.sampleListBuilt=!1,this.fragmentedTracks=[],this.extractedTracks=[],this.isFragmentationInitialized=!1,this.sampleProcessingStarted=!1,this.nextMoofNumber=0,this.itemListBuilt=!1,this.items=[],this.entity_groups=[],this.onSidx=null,this.sidxSent=!1};h.prototype.setSegmentOptions=function(e,t,n){var r=this.getTrackById(e);if(r){var a={};this.fragmentedTracks.push(a),a.id=e,a.user=t,a.trak=r,r.nextSample=0,a.segmentStream=null,a.nb_samples=1e3,a.rapAlignement=!0,n&&(n.nbSamples&&(a.nb_samples=n.nbSamples),n.rapAlignement&&(a.rapAlignement=n.rapAlignement))}},h.prototype.unsetSegmentOptions=function(e){for(var t=-1,n=0;n<this.fragmentedTracks.length;n++)this.fragmentedTracks[n].id==e&&(t=n);t>-1&&this.fragmentedTracks.splice(t,1)},h.prototype.setExtractionOptions=function(e,t,n){var r=this.getTrackById(e);if(r){var a={};this.extractedTracks.push(a),a.id=e,a.user=t,a.trak=r,r.nextSample=0,a.nb_samples=1e3,a.samples=[],n&&n.nbSamples&&(a.nb_samples=n.nbSamples)}},h.prototype.unsetExtractionOptions=function(e){for(var t=-1,n=0;n<this.extractedTracks.length;n++)this.extractedTracks[n].id==e&&(t=n);t>-1&&this.extractedTracks.splice(t,1)},h.prototype.parse=function(){var e,n,r=!1;if(!(this.restoreParsePosition&&!this.restoreParsePosition()))for(;;)if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}else if(this.saveParsePosition&&this.saveParsePosition(),e=c.parseOneBox(this.stream,r),e.code===c.ERR_NOT_ENOUGH_DATA)if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}else return;else{var a;switch(n=e.box,a=n.type===`uuid`?n.uuid:n.type,this.boxes.push(n),a){case`mdat`:this.mdats.push(n);break;case`moof`:this.moofs.push(n);break;case`moov`:this.moovStartFound=!0,this.mdats.length===0&&(this.isProgressive=!0);default:this[a]!==void 0&&t.warn(`ISOFile`,`Duplicate Box of type: `+a+`, overriding previous occurrence`),this[a]=n;break}this.updateUsedBytes&&this.updateUsedBytes(n,e)}},h.prototype.checkBuffer=function(e){if(e==null)throw`Buffer must be defined and non empty`;if(e.fileStart===void 0)throw`Buffer must have a fileStart property`;return e.byteLength===0?(t.warn(`ISOFile`,`Ignoring empty buffer (fileStart: `+e.fileStart+`)`),this.stream.logBufferLevel(),!1):(t.info(`ISOFile`,`Processing buffer (fileStart: `+e.fileStart+`)`),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),this.stream.initialized()?!0:(t.warn(`ISOFile`,`Not ready to start parsing`),!1))},h.prototype.appendBuffer=function(e,n){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||=(this.buildSampleLists(),!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(n),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(t.info(`ISOFile`,`Done processing buffer (fileStart: `+e.fileStart+`) - next buffer to fetch should have a fileStart position of `+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),t.info(`ISOFile`,`Sample data size in memory: `+this.getAllocatedSampleDataSize())),r},h.prototype.getInfo=function(){var e,t,n={},r,a,o,s,c=new Date(`1904-01-01T00:00:00Z`).getTime();if(this.moov)for(n.hasMoov=!0,n.duration=this.moov.mvhd.duration,n.timescale=this.moov.mvhd.timescale,n.isFragmented=this.moov.mvex!=null,n.isFragmented&&this.moov.mvex.mehd&&(n.fragment_duration=this.moov.mvex.mehd.fragment_duration),n.isProgressive=this.isProgressive,n.hasIOD=this.moov.iods!=null,n.brands=[],n.brands.push(this.ftyp.major_brand),n.brands=n.brands.concat(this.ftyp.compatible_brands),n.created=new Date(c+this.moov.mvhd.creation_time*1e3),n.modified=new Date(c+this.moov.mvhd.modification_time*1e3),n.tracks=[],n.audioTracks=[],n.videoTracks=[],n.subtitleTracks=[],n.metadataTracks=[],n.hintTracks=[],n.otherTracks=[],e=0;e<this.moov.traks.length;e++){if(r=this.moov.traks[e],s=r.mdia.minf.stbl.stsd.entries[0],a={},n.tracks.push(a),a.id=r.tkhd.track_id,a.name=r.mdia.hdlr.name,a.references=[],r.tref)for(t=0;t<r.tref.boxes.length;t++)o={},a.references.push(o),o.type=r.tref.boxes[t].type,o.track_ids=r.tref.boxes[t].track_ids;r.edts&&(a.edits=r.edts.elst.entries),a.created=new Date(c+r.tkhd.creation_time*1e3),a.modified=new Date(c+r.tkhd.modification_time*1e3),a.movie_duration=r.tkhd.duration,a.movie_timescale=n.timescale,a.layer=r.tkhd.layer,a.alternate_group=r.tkhd.alternate_group,a.volume=r.tkhd.volume,a.matrix=r.tkhd.matrix,a.track_width=r.tkhd.width/65536,a.track_height=r.tkhd.height/65536,a.timescale=r.mdia.mdhd.timescale,a.cts_shift=r.mdia.minf.stbl.cslg,a.duration=r.mdia.mdhd.duration,a.samples_duration=r.samples_duration,a.codec=s.getCodec(),a.kind=r.udta&&r.udta.kinds.length?r.udta.kinds[0]:{schemeURI:``,value:``},a.language=r.mdia.elng?r.mdia.elng.extended_language:r.mdia.mdhd.languageString,a.nb_samples=r.samples.length,a.size=r.samples_size,a.bitrate=a.size*8*a.timescale/a.samples_duration,s.isAudio()?(a.type=`audio`,n.audioTracks.push(a),a.audio={},a.audio.sample_rate=s.getSampleRate(),a.audio.channel_count=s.getChannelCount(),a.audio.sample_size=s.getSampleSize()):s.isVideo()?(a.type=`video`,n.videoTracks.push(a),a.video={},a.video.width=s.getWidth(),a.video.height=s.getHeight()):s.isSubtitle()?(a.type=`subtitles`,n.subtitleTracks.push(a)):s.isHint()?(a.type=`metadata`,n.hintTracks.push(a)):s.isMetadata()?(a.type=`metadata`,n.metadataTracks.push(a)):(a.type=`metadata`,n.otherTracks.push(a))}else n.hasMoov=!1;if(n.mime=``,n.hasMoov&&n.tracks){for(n.videoTracks&&n.videoTracks.length>0?n.mime+=`video/mp4; codecs="`:n.audioTracks&&n.audioTracks.length>0?n.mime+=`audio/mp4; codecs="`:n.mime+=`application/mp4; codecs="`,e=0;e<n.tracks.length;e++)e!==0&&(n.mime+=`,`),n.mime+=n.tracks[e].codec;n.mime+=`"; profiles="`,n.mime+=this.ftyp.compatible_brands.join(),n.mime+=`"`}return n},h.prototype.setNextSeekPositionFromSample=function(e){e&&(this.nextSeekPosition?this.nextSeekPosition=Math.min(e.offset+e.alreadyRead,this.nextSeekPosition):this.nextSeekPosition=e.offset+e.alreadyRead)},h.prototype.processSamples=function(e){var n,r;if(this.sampleProcessingStarted){if(this.isFragmentationInitialized&&this.onSegment!==null)for(n=0;n<this.fragmentedTracks.length;n++){var a=this.fragmentedTracks[n];for(r=a.trak;r.nextSample<r.samples.length&&this.sampleProcessingStarted;){t.debug(`ISOFile`,`Creating media fragment on track #`+a.id+` for sample `+r.nextSample);var o=this.createFragment(a.id,r.nextSample,a.segmentStream);if(o)a.segmentStream=o,r.nextSample++;else break;if((r.nextSample%a.nb_samples===0||e||r.nextSample>=r.samples.length)&&(t.info(`ISOFile`,`Sending fragmented data on track #`+a.id+` for samples [`+Math.max(0,r.nextSample-a.nb_samples)+`,`+(r.nextSample-1)+`]`),t.info(`ISOFile`,`Sample data size in memory: `+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(a.id,a.user,a.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),a.segmentStream=null,a!==this.fragmentedTracks[n]))break}}if(this.onSamples!==null)for(n=0;n<this.extractedTracks.length;n++){var s=this.extractedTracks[n];for(r=s.trak;r.nextSample<r.samples.length&&this.sampleProcessingStarted;){t.debug(`ISOFile`,`Exporting on track #`+s.id+` sample #`+r.nextSample);var c=this.getSample(r,r.nextSample);if(c)r.nextSample++,s.samples.push(c);else{this.setNextSeekPositionFromSample(r.samples[r.nextSample]);break}if((r.nextSample%s.nb_samples===0||r.nextSample>=r.samples.length)&&(t.debug(`ISOFile`,`Sending samples on track #`+s.id+` for sample `+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[n]))break}}}},h.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},h.prototype.getBoxes=function(e,t){var n=[];return h._sweep.call(this,e,n,t),n},h._sweep=function(e,t,n){for(var r in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&n)return;h._sweep.call(this.boxes[r],e,t,n)}},h.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);if(t)return t.samples},h.prototype.getTrackSample=function(e,t){var n=this.getTrackById(e);return this.getSample(n,t)},h.prototype.releaseUsedSamples=function(e,n){var r=0,a=this.getTrackById(e);a.lastValidSample||=0;for(var o=a.lastValidSample;o<n;o++)r+=this.releaseSample(a,o);t.info(`ISOFile`,`Track #`+e+` released samples up to `+n+` (released size: `+r+`, remaining: `+this.samplesDataSize+`)`),a.lastValidSample=n},h.prototype.start=function(){this.sampleProcessingStarted=!0,this.processSamples(!1)},h.prototype.stop=function(){this.sampleProcessingStarted=!1},h.prototype.flush=function(){t.info(`ISOFile`,`Flushing remaining samples`),this.updateSampleLists(),this.processSamples(!0),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0)},h.prototype.seekTrack=function(e,n,r){var a,o,s=1/0,c=0,l=0,u;if(r.samples.length===0)return t.info(`ISOFile`,`No sample in track, cannot seek! Using time `+t.getDurationString(0,1)+` and offset: 0`),{offset:0,time:0};for(a=0;a<r.samples.length;a++){if(o=r.samples[a],a===0)l=0,u=o.timescale;else if(o.cts>e*o.timescale){l=a-1;break}n&&o.is_sync&&(c=a)}for(n&&(l=c),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return s=r.samples[l].offset+r.samples[l].alreadyRead,t.info(`ISOFile`,`Seeking to `+(n?`RAP`:``)+` sample #`+r.nextSample+` on track `+r.tkhd.track_id+`, time `+t.getDurationString(e,u)+` and offset: `+s),{offset:s,time:e/u}},h.prototype.getTrackDuration=function(e){var t;return e.samples?(t=e.samples[e.samples.length-1],(t.cts+t.duration)/t.timescale):1/0},h.prototype.seek=function(e,n){var r=this.moov,a,o,s,c={offset:1/0,time:1/0};if(this.moov){for(s=0;s<r.traks.length;s++)a=r.traks[s],!(e>this.getTrackDuration(a))&&(o=this.seekTrack(e,n,a),o.offset<c.offset&&(c.offset=o.offset),o.time<c.time&&(c.time=o.time));return t.info(`ISOFile`,`Seeking at time `+t.getDurationString(c.time,1)+` needs a buffer with a fileStart position of `+c.offset),c.offset===1/0?c={offset:this.nextParsePosition,time:0}:c.offset=this.stream.getEndFilePositionAfter(c.offset),t.info(`ISOFile`,`Adjusted seek position (after checking data already in buffer): `+c.offset),c}else throw`Cannot seek: moov not received!`},h.prototype.equal=function(e){for(var t=0;t<this.boxes.length&&t<e.boxes.length;){var n=this.boxes[t],r=e.boxes[t];if(!c.boxEqual(n,r))return!1;t++}return!0},e!==void 0&&(e.ISOFile=h),h.prototype.lastBoxStartPosition=0,h.prototype.parsingMdat=null,h.prototype.nextParsePosition=0,h.prototype.discardMdatData=!1,h.prototype.processIncompleteBox=function(e){var t,n,r;return e.type===`mdat`?(t=new c[e.type+`Box`](e.size),this.parsingMdat=t,this.boxes.push(t),this.mdats.push(t),t.start=e.start,t.hdr_size=e.hdr_size,this.stream.addUsedBytes(t.hdr_size),this.lastBoxStartPosition=t.start+t.size,r=this.stream.seek(t.start+t.size,!1,this.discardMdatData),r?(this.parsingMdat=null,!0):(this.moovStartFound?this.nextParsePosition=this.stream.findEndContiguousBuf():this.nextParsePosition=t.start+t.size,!1)):(e.type===`moov`&&(this.moovStartFound=!0,this.mdats.length===0&&(this.isProgressive=!0)),n=this.stream.mergeNextBuffer?this.stream.mergeNextBuffer():!1,n?(this.nextParsePosition=this.stream.getEndPosition(),!0):(e.type?this.moovStartFound?this.nextParsePosition=this.stream.getEndPosition():this.nextParsePosition=this.stream.getPosition()+e.size:this.nextParsePosition=this.stream.getEndPosition(),!1))},h.prototype.hasIncompleteMdat=function(){return this.parsingMdat!==null},h.prototype.processIncompleteMdat=function(){var e=this.parsingMdat;return this.stream.seek(e.start+e.size,!1,this.discardMdatData)?(t.debug(`ISOFile`,`Found 'mdat' end in buffered data`),this.parsingMdat=null,!0):(this.nextParsePosition=this.stream.findEndContiguousBuf(),!1)},h.prototype.restoreParsePosition=function(){return this.stream.seek(this.lastBoxStartPosition,!0,this.discardMdatData)},h.prototype.saveParsePosition=function(){this.lastBoxStartPosition=this.stream.getPosition()},h.prototype.updateUsedBytes=function(e,t){this.stream.addUsedBytes&&(e.type===`mdat`?(this.stream.addUsedBytes(e.hdr_size),this.discardMdatData&&this.stream.addUsedBytes(e.size-e.hdr_size)):this.stream.addUsedBytes(e.size))},h.prototype.add=c.Box.prototype.add,h.prototype.addBox=c.Box.prototype.addBox,h.prototype.init=function(e){var t=e||{};this.add(`ftyp`).set(`major_brand`,t.brands&&t.brands[0]||`iso4`).set(`minor_version`,0).set(`compatible_brands`,t.brands||[`iso4`]);var n=this.add(`moov`);return n.add(`mvhd`).set(`timescale`,t.timescale||600).set(`rate`,t.rate||65536).set(`creation_time`,0).set(`modification_time`,0).set(`duration`,t.duration||0).set(`volume`,t.width?0:256).set(`matrix`,[65536,0,0,0,65536,0,0,0,1073741824]).set(`next_track_id`,1),n.add(`mvex`),this},h.prototype.addTrack=function(e){this.moov||this.init(e);var t=e||{};t.width=t.width||320,t.height=t.height||320,t.id=t.id||this.moov.mvhd.next_track_id,t.type=t.type||`avc1`;var r=this.moov.add(`trak`);this.moov.mvhd.next_track_id=t.id+1,r.add(`tkhd`).set(`flags`,c.TKHD_FLAG_ENABLED|c.TKHD_FLAG_IN_MOVIE|c.TKHD_FLAG_IN_PREVIEW).set(`creation_time`,0).set(`modification_time`,0).set(`track_id`,t.id).set(`duration`,t.duration||0).set(`layer`,t.layer||0).set(`alternate_group`,0).set(`volume`,1).set(`matrix`,[65536,0,0,0,65536,0,0,0,1073741824]).set(`width`,t.width<<16).set(`height`,t.height<<16);var a=r.add(`mdia`);a.add(`mdhd`).set(`creation_time`,0).set(`modification_time`,0).set(`timescale`,t.timescale||1).set(`duration`,t.media_duration||0).set(`language`,t.language||`und`),a.add(`hdlr`).set(`handler`,t.hdlr||`vide`).set(`name`,t.name||`Track created with MP4Box.js`),a.add(`elng`).set(`extended_language`,t.language||`fr-FR`);var o=a.add(`minf`);if(c[t.type+`SampleEntry`]!==void 0){var s=new c[t.type+`SampleEntry`];s.data_reference_index=1;var l=``;for(var u in c.sampleEntryCodes)for(var d=c.sampleEntryCodes[u],f=0;f<d.length;f++)if(d.indexOf(t.type)>-1){l=u;break}switch(l){case`Visual`:if(o.add(`vmhd`).set(`graphicsmode`,0).set(`opcolor`,[0,0,0]),s.set(`width`,t.width).set(`height`,t.height).set(`horizresolution`,72<<16).set(`vertresolution`,72<<16).set(`frame_count`,1).set(`compressorname`,t.type+` Compressor`).set(`depth`,24),t.avcDecoderConfigRecord){var p=new c.avcCBox;p.parse(new n(t.avcDecoderConfigRecord)),s.addBox(p)}else if(t.hevcDecoderConfigRecord){var m=new c.hvcCBox;m.parse(new n(t.hevcDecoderConfigRecord)),s.addBox(m)}break;case`Audio`:o.add(`smhd`).set(`balance`,t.balance||0),s.set(`channel_count`,t.channel_count||2).set(`samplesize`,t.samplesize||16).set(`samplerate`,t.samplerate||65536);break;case`Hint`:o.add(`hmhd`);break;case`Subtitle`:switch(o.add(`sthd`),t.type){case`stpp`:s.set(`namespace`,t.namespace||`nonamespace`).set(`schema_location`,t.schema_location||``).set(`auxiliary_mime_types`,t.auxiliary_mime_types||``);break}break;case`Metadata`:o.add(`nmhd`);break;case`System`:o.add(`nmhd`);break;default:o.add(`nmhd`);break}t.description&&s.addBox(t.description),t.description_boxes&&t.description_boxes.forEach(function(e){s.addBox(e)}),o.add(`dinf`).add(`dref`).addEntry(new c[`url Box`]().set(`flags`,1));var h=o.add(`stbl`);return h.add(`stsd`).addEntry(s),h.add(`stts`).set(`sample_counts`,[]).set(`sample_deltas`,[]),h.add(`stsc`).set(`first_chunk`,[]).set(`samples_per_chunk`,[]).set(`sample_description_index`,[]),h.add(`stco`).set(`chunk_offsets`,[]),h.add(`stsz`).set(`sample_sizes`,[]),this.moov.mvex.add(`trex`).set(`track_id`,t.id).set(`default_sample_description_index`,t.default_sample_description_index||1).set(`default_sample_duration`,t.default_sample_duration||0).set(`default_sample_size`,t.default_sample_size||0).set(`default_sample_flags`,t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},c.Box.prototype.computeSize=function(e){var t=e||new r;t.endianness=r.BIG_ENDIAN,this.write(t)},h.prototype.addSample=function(e,t,n){var r=n||{},a={},o=this.getTrackById(e);if(o!==null){a.number=o.samples.length,a.track_id=o.tkhd.track_id,a.timescale=o.mdia.mdhd.timescale,a.description_index=r.sample_description_index?r.sample_description_index-1:0,a.description=o.mdia.minf.stbl.stsd.entries[a.description_index],a.data=t,a.size=t.byteLength,a.alreadyRead=a.size,a.duration=r.duration||1,a.cts=r.cts||0,a.dts=r.dts||0,a.is_sync=r.is_sync||!1,a.is_leading=r.is_leading||0,a.depends_on=r.depends_on||0,a.is_depended_on=r.is_depended_on||0,a.has_redundancy=r.has_redundancy||0,a.degradation_priority=r.degradation_priority||0,a.offset=0,a.subsamples=r.subsamples,o.samples.push(a),o.samples_size+=a.size,o.samples_duration+=a.duration,o.first_dts===void 0&&(o.first_dts=r.dts),this.processSamples();var s=this.createSingleSampleMoof(a);return this.addBox(s),s.computeSize(),s.trafs[0].truns[0].data_offset=s.size+8,this.add(`mdat`).data=new Uint8Array(t),a}},h.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var n=new c.moofBox;n.add(`mfhd`).set(`sequence_number`,this.nextMoofNumber),this.nextMoofNumber++;var r=n.add(`traf`),a=this.getTrackById(e.track_id);return r.add(`tfhd`).set(`track_id`,e.track_id).set(`flags`,c.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),r.add(`tfdt`).set(`baseMediaDecodeTime`,e.dts-(a.first_dts||0)),r.add(`trun`).set(`flags`,c.TRUN_FLAGS_DATA_OFFSET|c.TRUN_FLAGS_DURATION|c.TRUN_FLAGS_SIZE|c.TRUN_FLAGS_FLAGS|c.TRUN_FLAGS_CTS_OFFSET).set(`data_offset`,0).set(`first_sample_flags`,0).set(`sample_count`,1).set(`sample_duration`,[e.duration]).set(`sample_size`,[e.size]).set(`sample_flags`,[t]).set(`sample_composition_time_offset`,[e.cts-e.dts]),n},h.prototype.lastMoofIndex=0,h.prototype.samplesDataSize=0,h.prototype.resetTables=function(){var e,t,n,r,a,o,s,c;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e<this.moov.traks.length;e++){t=this.moov.traks[e],t.tkhd.duration=0,t.mdia.mdhd.duration=0,n=t.mdia.minf.stbl.stco||t.mdia.minf.stbl.co64,n.chunk_offsets=[],r=t.mdia.minf.stbl.stsc,r.first_chunk=[],r.samples_per_chunk=[],r.sample_description_index=[],a=t.mdia.minf.stbl.stsz||t.mdia.minf.stbl.stz2,a.sample_sizes=[],o=t.mdia.minf.stbl.stts,o.sample_counts=[],o.sample_deltas=[],s=t.mdia.minf.stbl.ctts,s&&(s.sample_counts=[],s.sample_offsets=[]),c=t.mdia.minf.stbl.stss;var l=t.mdia.minf.stbl.boxes.indexOf(c);l!=-1&&(t.mdia.minf.stbl.boxes[l]=null)}},h.initSampleGroups=function(e,t,n,r,a){var o,s,c,l;function u(e,t,n){this.grouping_type=e,this.grouping_type_parameter=t,this.sbgp=n,this.last_sample_in_run=-1,this.entry_index=-1}for(t&&(t.sample_groups_info=[]),e.sample_groups_info||=[],s=0;s<n.length;s++){for(l=n[s].grouping_type+`/`+n[s].grouping_type_parameter,c=new u(n[s].grouping_type,n[s].grouping_type_parameter,n[s]),t&&(t.sample_groups_info[l]=c),e.sample_groups_info[l]||(e.sample_groups_info[l]=c),o=0;o<r.length;o++)r[o].grouping_type===n[s].grouping_type&&(c.description=r[o],c.description.used=!0);if(a)for(o=0;o<a.length;o++)a[o].grouping_type===n[s].grouping_type&&(c.fragment_description=a[o],c.fragment_description.used=!0,c.is_fragment=!0)}if(!t)for(s=0;s<r.length;s++)!r[s].used&&r[s].version>=2&&(l=r[s].grouping_type+`/0`,c=new u(r[s].grouping_type,0),e.sample_groups_info[l]||(e.sample_groups_info[l]=c));else if(a)for(s=0;s<a.length;s++)!a[s].used&&a[s].version>=2&&(l=a[s].grouping_type+`/0`,c=new u(a[s].grouping_type,0),c.is_fragment=!0,t.sample_groups_info[l]||(t.sample_groups_info[l]=c))},h.setSampleGroupProperties=function(e,t,n,r){var a,o;for(a in t.sample_groups=[],r)if(t.sample_groups[a]={},t.sample_groups[a].grouping_type=r[a].grouping_type,t.sample_groups[a].grouping_type_parameter=r[a].grouping_type_parameter,n>=r[a].last_sample_in_run&&(r[a].last_sample_in_run<0&&(r[a].last_sample_in_run=0),r[a].entry_index++,r[a].entry_index<=r[a].sbgp.entries.length-1&&(r[a].last_sample_in_run+=r[a].sbgp.entries[r[a].entry_index].sample_count)),r[a].entry_index<=r[a].sbgp.entries.length-1?t.sample_groups[a].group_description_index=r[a].sbgp.entries[r[a].entry_index].group_description_index:t.sample_groups[a].group_description_index=-1,t.sample_groups[a].group_description_index!==0){var s=r[a].fragment_description?r[a].fragment_description:r[a].description;t.sample_groups[a].group_description_index>0?(o=t.sample_groups[a].group_description_index>65535?(t.sample_groups[a].group_description_index>>16)-1:t.sample_groups[a].group_description_index-1,s&&o>=0&&(t.sample_groups[a].description=s.entries[o])):s&&s.version>=2&&s.default_group_description_index>0&&(t.sample_groups[a].description=s.entries[s.default_group_description_index-1])}},h.process_sdtp=function(e,t,n){t&&(e?(t.is_leading=e.is_leading[n],t.depends_on=e.sample_depends_on[n],t.is_depended_on=e.sample_is_depended_on[n],t.has_redundancy=e.sample_has_redundancy[n]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},h.prototype.buildSampleLists=function(){var e,t;for(e=0;e<this.moov.traks.length;e++)t=this.moov.traks[e],this.buildTrakSampleLists(t)},h.prototype.buildTrakSampleLists=function(e){var t,n,r,a,o,s,c,l,u,d,f,p,m,g,_,v,y,b,x,S,C,w,T,E;if(e.samples=[],e.samples_duration=0,e.samples_size=0,n=e.mdia.minf.stbl.stco||e.mdia.minf.stbl.co64,r=e.mdia.minf.stbl.stsc,a=e.mdia.minf.stbl.stsz||e.mdia.minf.stbl.stz2,o=e.mdia.minf.stbl.stts,s=e.mdia.minf.stbl.ctts,c=e.mdia.minf.stbl.stss,l=e.mdia.minf.stbl.stsd,u=e.mdia.minf.stbl.subs,p=e.mdia.minf.stbl.stdp,d=e.mdia.minf.stbl.sbgps,f=e.mdia.minf.stbl.sgpds,b=-1,x=-1,S=-1,C=-1,w=0,T=0,E=0,h.initSampleGroups(e,null,d,f),a!==void 0){for(t=0;t<a.sample_sizes.length;t++){var D={};D.number=t,D.track_id=e.tkhd.track_id,D.timescale=e.mdia.mdhd.timescale,D.alreadyRead=0,e.samples[t]=D,D.size=a.sample_sizes[t],e.samples_size+=D.size,t===0?(g=1,m=0,D.chunk_index=g,D.chunk_run_index=m,y=r.samples_per_chunk[m],v=0,_=m+1<r.first_chunk.length?r.first_chunk[m+1]-1:1/0):t<y?(D.chunk_index=g,D.chunk_run_index=m):(g++,D.chunk_index=g,v=0,g<=_||(m++,_=m+1<r.first_chunk.length?r.first_chunk[m+1]-1:1/0),D.chunk_run_index=m,y+=r.samples_per_chunk[m]),D.description_index=r.sample_description_index[D.chunk_run_index]-1,D.description=l.entries[D.description_index],D.offset=n.chunk_offsets[D.chunk_index-1]+v,v+=D.size,t>b&&(x++,b<0&&(b=0),b+=o.sample_counts[x]),t>0?(e.samples[t-1].duration=o.sample_deltas[x],e.samples_duration+=e.samples[t-1].duration,D.dts=e.samples[t-1].dts+e.samples[t-1].duration):D.dts=0,s?(t>=S&&(C++,S<0&&(S=0),S+=s.sample_counts[C]),D.cts=e.samples[t].dts+s.sample_offsets[C]):D.cts=D.dts,c?(t==c.sample_numbers[w]-1?(D.is_sync=!0,w++):(D.is_sync=!1,D.degradation_priority=0),u&&u.entries[T].sample_delta+E==t+1&&(D.subsamples=u.entries[T].subsamples,E+=u.entries[T].sample_delta,T++)):D.is_sync=!0,h.process_sdtp(e.mdia.minf.stbl.sdtp,D,D.number),p?D.degradation_priority=p.priority[t]:D.degradation_priority=0,u&&u.entries[T].sample_delta+E==t&&(D.subsamples=u.entries[T].subsamples,E+=u.entries[T].sample_delta),(d.length>0||f.length>0)&&h.setSampleGroupProperties(e,D,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},h.prototype.updateSampleLists=function(){var e,t,n,r,a,o,s,l,u,d,f,p,m,g,_;if(this.moov!==void 0){for(;this.lastMoofIndex<this.moofs.length;)if(u=this.moofs[this.lastMoofIndex],this.lastMoofIndex++,u.type==`moof`)for(d=u,e=0;e<d.trafs.length;e++){for(f=d.trafs[e],p=this.getTrackById(f.tfhd.track_id),m=this.getTrexById(f.tfhd.track_id),r=f.tfhd.flags&c.TFHD_FLAG_SAMPLE_DESC?f.tfhd.default_sample_description_index:m?m.default_sample_description_index:1,a=f.tfhd.flags&c.TFHD_FLAG_SAMPLE_DUR?f.tfhd.default_sample_duration:m?m.default_sample_duration:0,o=f.tfhd.flags&c.TFHD_FLAG_SAMPLE_SIZE?f.tfhd.default_sample_size:m?m.default_sample_size:0,s=f.tfhd.flags&c.TFHD_FLAG_SAMPLE_FLAGS?f.tfhd.default_sample_flags:m?m.default_sample_flags:0,f.sample_number=0,f.sbgps.length>0&&h.initSampleGroups(p,f,f.sbgps,p.mdia.minf.stbl.sgpds,f.sgpds),t=0;t<f.truns.length;t++){var v=f.truns[t];for(n=0;n<v.sample_count;n++){g={},g.moof_number=this.lastMoofIndex,g.number_in_traf=f.sample_number,f.sample_number++,g.number=p.samples.length,f.first_sample_index=p.samples.length,p.samples.push(g),g.track_id=p.tkhd.track_id,g.timescale=p.mdia.mdhd.timescale,g.description_index=r-1,g.description=p.mdia.minf.stbl.stsd.entries[g.description_index],g.size=o,v.flags&c.TRUN_FLAGS_SIZE&&(g.size=v.sample_size[n]),p.samples_size+=g.size,g.duration=a,v.flags&c.TRUN_FLAGS_DURATION&&(g.duration=v.sample_duration[n]),p.samples_duration+=g.duration,p.first_traf_merged||n>0?g.dts=p.samples[p.samples.length-2].dts+p.samples[p.samples.length-2].duration:(f.tfdt?g.dts=f.tfdt.baseMediaDecodeTime:g.dts=0,p.first_traf_merged=!0),g.cts=g.dts,v.flags&c.TRUN_FLAGS_CTS_OFFSET&&(g.cts=g.dts+v.sample_composition_time_offset[n]),_=s,v.flags&c.TRUN_FLAGS_FLAGS?_=v.sample_flags[n]:n===0&&v.flags&c.TRUN_FLAGS_FIRST_FLAG&&(_=v.first_sample_flags),g.is_sync=!(_>>16&1),g.is_leading=_>>26&3,g.depends_on=_>>24&3,g.is_depended_on=_>>22&3,g.has_redundancy=_>>20&3,g.degradation_priority=_&65535;var y=!!(f.tfhd.flags&c.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(f.tfhd.flags&c.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),x=!!(v.flags&c.TRUN_FLAGS_DATA_OFFSET),S=0;S=y?f.tfhd.base_data_offset:b||t===0?d.start:l,t===0&&n===0?x?g.offset=S+v.data_offset:g.offset=S:g.offset=l,l=g.offset+g.size,(f.sbgps.length>0||f.sgpds.length>0||p.mdia.minf.stbl.sbgps.length>0||p.mdia.minf.stbl.sgpds.length>0)&&h.setSampleGroupProperties(p,g,g.number_in_traf,f.sample_groups_info)}}if(f.subs){p.has_fragment_subsamples=!0;var C=f.first_sample_index;for(t=0;t<f.subs.entries.length;t++)C+=f.subs.entries[t].sample_delta,g=p.samples[C-1],g.subsamples=f.subs.entries[t].subsamples}}}},h.prototype.getSample=function(e,n){var a,o=e.samples[n];if(!this.moov)return null;if(!o.data)o.data=new Uint8Array(o.size),o.alreadyRead=0,this.samplesDataSize+=o.size,t.debug(`ISOFile`,`Allocating sample #`+n+` on track #`+e.tkhd.track_id+` of size `+o.size+` (total: `+this.samplesDataSize+`)`);else if(o.alreadyRead==o.size)return o;for(;;){var s=this.stream.findPosition(!0,o.offset+o.alreadyRead,!1);if(s>-1){a=this.stream.buffers[s];var c=a.byteLength-(o.offset+o.alreadyRead-a.fileStart);if(o.size-o.alreadyRead<=c)return t.debug(`ISOFile`,`Getting sample #`+n+` data (alreadyRead: `+o.alreadyRead+` offset: `+(o.offset+o.alreadyRead-a.fileStart)+` read size: `+(o.size-o.alreadyRead)+` full size: `+o.size+`)`),r.memcpy(o.data.buffer,o.alreadyRead,a,o.offset+o.alreadyRead-a.fileStart,o.size-o.alreadyRead),a.usedBytes+=o.size-o.alreadyRead,this.stream.logBufferLevel(),o.alreadyRead=o.size,o;if(c===0)return null;t.debug(`ISOFile`,`Getting sample #`+n+` partial data (alreadyRead: `+o.alreadyRead+` offset: `+(o.offset+o.alreadyRead-a.fileStart)+` read size: `+c+` full size: `+o.size+`)`),r.memcpy(o.data.buffer,o.alreadyRead,a,o.offset+o.alreadyRead-a.fileStart,c),o.alreadyRead+=c,a.usedBytes+=c,this.stream.logBufferLevel()}else return null}},h.prototype.releaseSample=function(e,t){var n=e.samples[t];return n.data?(this.samplesDataSize-=n.size,n.data=null,n.alreadyRead=0,n.size):0},h.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},h.prototype.getCodecs=function(){var e,t=``;for(e=0;e<this.moov.traks.length;e++){var n=this.moov.traks[e];e>0&&(t+=`,`),t+=n.mdia.minf.stbl.stsd.entries[0].getCodec()}return t},h.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t<this.moov.mvex.trexs.length;t++){var n=this.moov.mvex.trexs[t];if(n.track_id==e)return n}return null},h.prototype.getTrackById=function(e){if(this.moov===void 0)return null;for(var t=0;t<this.moov.traks.length;t++){var n=this.moov.traks[t];if(n.tkhd.track_id==e)return n}return null},h.prototype.itemsDataSize=0,h.prototype.flattenItemInfo=function(){var e=this.items,n=this.entity_groups,r,a,o,s=this.meta;if(s!=null&&s.hdlr!==void 0&&s.iinf!==void 0){for(r=0;r<s.iinf.item_infos.length;r++)o={},o.id=s.iinf.item_infos[r].item_ID,e[o.id]=o,o.ref_to=[],o.name=s.iinf.item_infos[r].item_name,s.iinf.item_infos[r].protection_index>0&&(o.protection=s.ipro.protections[s.iinf.item_infos[r].protection_index-1]),s.iinf.item_infos[r].item_type?o.type=s.iinf.item_infos[r].item_type:o.type=`mime`,o.content_type=s.iinf.item_infos[r].content_type,o.content_encoding=s.iinf.item_infos[r].content_encoding,o.item_uri_type=s.iinf.item_infos[r].item_uri_type;if(s.grpl)for(r=0;r<s.grpl.boxes.length;r++)entity_group={},entity_group.id=s.grpl.boxes[r].group_id,entity_group.entity_ids=s.grpl.boxes[r].entity_ids,entity_group.type=s.grpl.boxes[r].type,n[entity_group.id]=entity_group;if(s.iloc)for(r=0;r<s.iloc.items.length;r++){var c=s.iloc.items[r];switch(o=e[c.item_ID],c.data_reference_index!==0&&(t.warn(`Item storage with reference to other files: not supported`),o.source=s.dinf.boxes[c.data_reference_index-1]),c.construction_method){case 0:break;case 1:break;case 2:t.warn(`Item storage with construction_method : not supported`);break}for(o.extents=[],o.size=0,a=0;a<c.extents.length;a++)o.extents[a]={},o.extents[a].offset=c.extents[a].extent_offset+c.base_offset,c.construction_method==1&&(o.extents[a].offset+=s.idat.start+s.idat.hdr_size),o.extents[a].length=c.extents[a].extent_length,o.extents[a].alreadyRead=0,o.size+=o.extents[a].length}if(s.pitm&&(e[s.pitm.item_id].primary=!0),s.iref)for(r=0;r<s.iref.references.length;r++){var l=s.iref.references[r];for(a=0;a<l.references.length;a++)e[l.from_item_ID].ref_to.push({type:l.type,id:l.references[a]})}if(s.iprp)for(var u=0;u<s.iprp.ipmas.length;u++){var d=s.iprp.ipmas[u];for(r=0;r<d.associations.length;r++){var f=d.associations[r];if(o=e[f.id],o||=n[f.id],o)for(o.properties===void 0&&(o.properties={},o.properties.boxes=[]),a=0;a<f.props.length;a++){var p=f.props[a];if(p.property_index>0&&p.property_index-1<s.iprp.ipco.boxes.length){var m=s.iprp.ipco.boxes[p.property_index-1];o.properties[m.type]=m,o.properties.boxes.push(m)}}}}}},h.prototype.getItem=function(e){var n,a;if(!this.meta)return null;if(a=this.items[e],!a.data&&a.size)a.data=new Uint8Array(a.size),a.alreadyRead=0,this.itemsDataSize+=a.size,t.debug(`ISOFile`,`Allocating item #`+e+` of size `+a.size+` (total: `+this.itemsDataSize+`)`);else if(a.alreadyRead===a.size)return a;for(var o=0;o<a.extents.length;o++){var s=a.extents[o];if(s.alreadyRead!==s.length){var c=this.stream.findPosition(!0,s.offset+s.alreadyRead,!1);if(c>-1){n=this.stream.buffers[c];var l=n.byteLength-(s.offset+s.alreadyRead-n.fileStart);if(s.length-s.alreadyRead<=l)t.debug(`ISOFile`,`Getting item #`+e+` extent #`+o+` data (alreadyRead: `+s.alreadyRead+` offset: `+(s.offset+s.alreadyRead-n.fileStart)+` read size: `+(s.length-s.alreadyRead)+` full extent size: `+s.length+` full item size: `+a.size+`)`),r.memcpy(a.data.buffer,a.alreadyRead,n,s.offset+s.alreadyRead-n.fileStart,s.length-s.alreadyRead),n.usedBytes+=s.length-s.alreadyRead,this.stream.logBufferLevel(),a.alreadyRead+=s.length-s.alreadyRead,s.alreadyRead=s.length;else return t.debug(`ISOFile`,`Getting item #`+e+` extent #`+o+` partial data (alreadyRead: `+s.alreadyRead+` offset: `+(s.offset+s.alreadyRead-n.fileStart)+` read size: `+l+` full extent size: `+s.length+` full item size: `+a.size+`)`),r.memcpy(a.data.buffer,a.alreadyRead,n,s.offset+s.alreadyRead-n.fileStart,l),s.alreadyRead+=l,a.alreadyRead+=l,n.usedBytes+=l,this.stream.logBufferLevel(),null}else return null}}return a.alreadyRead===a.size?a:null},h.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var n=0;n<t.extents.length;n++){var r=t.extents[n];r.alreadyRead=0}return t.size}else return 0},h.prototype.processItems=function(e){for(var t in this.items){var n=this.items[t];this.getItem(n.id),e&&!n.sent&&(e(n),n.sent=!0,n.data=null)}},h.prototype.hasItem=function(e){for(var t in this.items){var n=this.items[t];if(n.name===e)return n.id}return-1},h.prototype.getMetaHandler=function(){return this.meta?this.meta.hdlr.handler:null},h.prototype.getPrimaryItem=function(){return!this.meta||!this.meta.pitm?null:this.getItem(this.meta.pitm.item_id)},h.prototype.itemToFragmentedTrackFile=function(e){var t=e||{},n=null;if(n=t.itemId?this.getItem(t.itemId):this.getPrimaryItem(),n==null)return null;var r=new h;r.discardMdatData=!1;var a={type:n.type,description_boxes:n.properties.boxes};n.properties.ispe&&(a.width=n.properties.ispe.image_width,a.height=n.properties.ispe.image_height);var o=r.addTrack(a);return o?(r.addSample(o,n.data),r):null},h.prototype.write=function(e){for(var t=0;t<this.boxes.length;t++)this.boxes[t].write(e)},h.prototype.createFragment=function(e,n,a){var o=this.getTrackById(e),s=this.getSample(o,n);if(s==null)return this.setNextSeekPositionFromSample(o.samples[n]),null;var l=a||new r;l.endianness=r.BIG_ENDIAN;var u=this.createSingleSampleMoof(s);u.write(l),u.trafs[0].truns[0].data_offset=u.size+8,t.debug(`MP4Box`,`Adjusting data_offset with new value `+u.trafs[0].truns[0].data_offset),l.adjustUint32(u.trafs[0].truns[0].data_offset_position,u.trafs[0].truns[0].data_offset);var d=new c.mdatBox;return d.data=s.data,d.write(l),l},h.writeInitializationSegment=function(e,n,a,o){var s;t.debug(`ISOFile`,`Generating initialization segment`);var c=new r;c.endianness=r.BIG_ENDIAN,e.write(c);var l=n.add(`mvex`);for(a&&l.add(`mehd`).set(`fragment_duration`,a),s=0;s<n.traks.length;s++)l.add(`trex`).set(`track_id`,n.traks[s].tkhd.track_id).set(`default_sample_description_index`,1).set(`default_sample_duration`,o).set(`default_sample_size`,0).set(`default_sample_flags`,65536);return n.write(c),c.buffer},h.prototype.save=function(e){var t=new r;t.endianness=r.BIG_ENDIAN,this.write(t),t.save(e)},h.prototype.getBuffer=function(){var e=new r;return e.endianness=r.BIG_ENDIAN,this.write(e),e.buffer},h.prototype.initializeSegmentation=function(){var e,n,r,a;for(this.onSegment===null&&t.warn(`MP4Box`,`No segmentation callback set!`),this.isFragmentationInitialized||(this.isFragmentationInitialized=!0,this.nextMoofNumber=0,this.resetTables()),n=[],e=0;e<this.fragmentedTracks.length;e++){var o=new c.moovBox;o.mvhd=this.moov.mvhd,o.boxes.push(o.mvhd),r=this.getTrackById(this.fragmentedTracks[e].id),o.boxes.push(r),o.traks.push(r),a={},a.id=r.tkhd.track_id,a.user=this.fragmentedTracks[e].user,a.buffer=h.writeInitializationSegment(this.ftyp,o,this.moov.mvex&&this.moov.mvex.mehd?this.moov.mvex.mehd.fragment_duration:void 0,this.moov.traks[e].samples.length>0?this.moov.traks[e].samples[0].duration:0),n.push(a)}return n},c.Box.prototype.printHeader=function(e){this.size+=8,this.size>a&&(this.size+=8),this.type===`uuid`&&(this.size+=16),e.log(e.indent+`size:`+this.size),e.log(e.indent+`type:`+this.type)},c.FullBox.prototype.printHeader=function(e){this.size+=4,c.Box.prototype.printHeader.call(this,e),e.log(e.indent+`version:`+this.version),e.log(e.indent+`flags:`+this.flags)},c.Box.prototype.print=function(e){this.printHeader(e)},c.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t<this.boxes.length;t++)if(this.boxes[t]){var n=e.indent;e.indent+=` `,this.boxes[t].print(e),e.indent=n}},h.prototype.print=function(e){e.indent=``;for(var t=0;t<this.boxes.length;t++)this.boxes[t]&&this.boxes[t].print(e)},c.mvhdBox.prototype.print=function(e){c.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+`creation_time: `+this.creation_time),e.log(e.indent+`modification_time: `+this.modification_time),e.log(e.indent+`timescale: `+this.timescale),e.log(e.indent+`duration: `+this.duration),e.log(e.indent+`rate: `+this.rate),e.log(e.indent+`volume: `+(this.volume>>8)),e.log(e.indent+`matrix: `+this.matrix.join(`, `)),e.log(e.indent+`next_track_id: `+this.next_track_id)},c.tkhdBox.prototype.print=function(e){c.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+`creation_time: `+this.creation_time),e.log(e.indent+`modification_time: `+this.modification_time),e.log(e.indent+`track_id: `+this.track_id),e.log(e.indent+`duration: `+this.duration),e.log(e.indent+`volume: `+(this.volume>>8)),e.log(e.indent+`matrix: `+this.matrix.join(`, `)),e.log(e.indent+`layer: `+this.layer),e.log(e.indent+`alternate_group: `+this.alternate_group),e.log(e.indent+`width: `+this.width),e.log(e.indent+`height: `+this.height)};var g={};g.createFile=function(e,t){var n=e===void 0?!0:e,r=new h(t);return r.discardMdatData=!n,r},e!==void 0&&(e.createFile=g.createFile)}))());function T0(e,t){let n=e.getTrackById(t)?.mdia?.minf?.stbl?.stsd?.entries??[];for(let e of n){let t=e.hvcC??e.avcC;if(t){let e=new w0.DataStream(void 0,0,w0.DataStream.BIG_ENDIAN);return t.write(e),new Uint8Array(e.buffer,8)}}}async function E0(e){let t=w0.createFile(),{config:n,trackId:r}=await new Promise((n,r)=>{t.onError=e=>r(Error(`mp4box: ${e}`)),t.onReady=e=>{let a=e.videoTracks?.[0];if(!a){r(Error(`no video track`));return}let o=T0(t,a.id);n({config:{codec:a.codec,codedWidth:a.video?.width,codedHeight:a.video?.height,...o?{description:o}:{}},trackId:a.id})};let a=e;a.fileStart=0,t.appendBuffer(a),t.flush()});return{config:n,chunk:await new Promise((e,n)=>{t.onSamples=(t,r,a)=>{let o=a.find(e=>e.is_sync)??a[0];if(!o){n(Error(`no sample`));return}e(new EncodedVideoChunk({type:`key`,timestamp:Math.round(o.cts/o.timescale*1e6),data:o.data}))},t.setExtractionOptions(r,null,{nbSamples:1}),t.start()})}}var D0=class{decoder=null;async decodeSegment(e){let{config:t,chunk:n}=await E0(e);if(!(await VideoDecoder.isConfigSupported(t)).supported)throw Error(`unsupported codec: ${t.codec}`);return await new Promise((e,r)=>{this.decoder&&this.decoder.state!==`closed`&&this.decoder.close();let a=new VideoDecoder({output:t=>e(t),error:e=>r(e)});a.configure(t),this.decoder=a,a.decode(n),a.flush().catch(r)})}close(){this.decoder&&this.decoder.state!==`closed`&&this.decoder.close(),this.decoder=null}};function O0({url:e,autoPlay:t=!0,muted:n=!1,className:r}){let a=(0,S.useRef)(null),[o,s]=(0,S.useState)(null);return(0,S.useEffect)(()=>{let n=a.current;if(!n||!e)return;s(null),n.src=e;let r=()=>{t&&n.play().catch(()=>{})},o=()=>s(`Could not load this recording.`);return n.addEventListener(`loadedmetadata`,r),n.addEventListener(`error`,o),()=>{n.removeEventListener(`loadedmetadata`,r),n.removeEventListener(`error`,o),n.removeAttribute(`src`),n.load()}},[e,t]),(0,S.useEffect)(()=>{let e=a.current;e&&(e.muted=n)},[n]),(0,C.jsxs)(`div`,{className:`relative h-full w-full bg-black ${r??``}`,children:[(0,C.jsx)(`video`,{ref:a,playsInline:!0,muted:n,className:`h-full w-full`}),o?(0,C.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center px-4 text-center text-sm text-amber-400`,children:o}):null]})}var k0=av([U({kind:K(`adaptive`)}),U({kind:K(`profile`),profile:Yv})]),A0=U({serverUrl:L().min(1),token:L().min(1),deviceId:R().int().nonnegative(),target:k0,muted:z(),stats:z().optional(),highlight:x1.optional(),snapshot:L().optional(),hlsRecordedPlayback:z().optional()}),j0=300*1e3;function M0(e,t){try{return new URL(t,e).toString()}catch{return t}}var N0=[`live`,`loading`,`playing`,`paused`,`gap`,`ended`,`error`];function P0(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t;return n.t===`state`&&typeof n.state==`string`&&N0.includes(n.state)?{kind:`state`,state:n.state}:n.t===`position`&&typeof n.epochMs==`number`?{kind:`position`,epochMs:n.epochMs}:null}catch{return null}}function F0(e,t){E1(t===void 0?{type:`state`,state:e}:{type:`state`,state:e,message:t})}function I0(e){switch(e){case`playing`:return`playing`;case`error`:return`error`;case`connecting`:case`disconnected`:case`idle`:return`connecting`}}function L0(e){return e.kind===`adaptive`?{kind:`adaptive`}:{kind:`profile`,profile:e.profile}}function R0(e){return e.kind===`adaptive`?`embed:adaptive`:`embed:profile:${e.profile}`}function z0(e){let t=A0.safeParse(e);return t.success?{ok:!0,config:t.data}:{ok:!1,error:t.error.issues.map(e=>`${e.path.join(`.`)||`(root)`}: ${e.message}`).join(`; `)}}function B0({message:e}){return(0,S.useEffect)(()=>{F0(`error`,e)},[e]),(0,C.jsxs)(`div`,{style:{position:`fixed`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#000`,color:`#f87171`,fontFamily:`system-ui, sans-serif`,fontSize:13,padding:16,textAlign:`center`},children:[`Embed config error: `,e]})}function V0({system:e,deviceId:t,token:n,initialTarget:r,initialMuted:a,initialStats:o,initialHighlight:s,initialSnapshot:c,hlsRecordedPlayback:l}){let[u,d]=(0,S.useState)(r),[f,p]=(0,S.useState)(a),[m,h]=(0,S.useState)(o),[g,_]=(0,S.useState)(s),[v,y]=(0,S.useState)(c),[b,x]=(0,S.useState)(0),[w,T]=(0,S.useState)({w:window.innerWidth,h:window.innerHeight}),[E,D]=(0,S.useState)(null),O=(0,S.useRef)(null);O.current=E,(0,S.useEffect)(()=>{l&&(document.cookie=`camstack_session=${n}; path=/; SameSite=Lax`)},[l,n]);let ee=Y1(e,t,g),te=M1(),ne=(0,S.useRef)(te.setActiveMic);ne.current=te.setActiveMic;let re=(0,S.useRef)(null),ie=(0,S.useRef)(!1),ae=(0,S.useRef)(()=>{}),k=(0,S.useRef)(e=>{re.current=e,e.onmessage=e=>{let t=e.data;if(typeof t!=`string`)return;let n=P0(t);n&&(n.kind===`position`?(ie.current&&ae.current(),E1({type:`position`,positionMs:n.epochMs})):(n.state===`playing`&&ie.current&&ae.current(),E1({type:`recState`,state:n.state})))},e.onclose=()=>{re.current===e&&(re.current=null)}}).current,oe=(0,S.useRef)(e=>{let t=f0(e);if(!t)return;let n=re.current;n&&n.readyState===`open`&&n.send(JSON.stringify(t))}).current,{handleOffer:A,getIceServers:se,addIceCandidate:ce,getIceCandidates:le,closeSession:ue,getSessionState:de}=v1(e.trpcClient,t),fe=(0,S.useMemo)(()=>L0(u),[u]),pe=(0,S.useMemo)(()=>(e,t)=>A(fe,e,t),[A,fe]),me=(0,S.useMemo)(()=>(e,t,n)=>A(n,t,e),[A]),he=(0,S.useRef)(null),[ge,_e]=(0,S.useState)(!1),[ve,ye]=(0,S.useState)(!1),be=(0,S.useRef)(!1);be.current=ve;let xe=(0,S.useRef)(null);ae.current=(0,S.useCallback)(()=>{ie.current=!1,xe.current&&=(clearTimeout(xe.current),null),_e(!1)},[]);let Se=(0,S.useCallback)(()=>{be.current?(ie.current=!0,xe.current&&clearTimeout(xe.current),xe.current=setTimeout(()=>ae.current(),4e3)):_e(!1)},[]),Ce=(0,S.useRef)(Se);Ce.current=Se;let we=(0,S.useRef)(null),Te=(0,S.useRef)(null),Ee=(0,S.useRef)([]),De=(0,S.useRef)(null),Oe=(0,S.useMemo)(()=>({Authorization:`Bearer ${n}`}),[n]),ke=(0,S.useMemo)(()=>async n=>{let r=De.current;if(r&&n>=r.fromMs&&n<r.toMs&&Ee.current.length>0)return Ee.current;let a=new Date(n);a.setHours(0,0,0,0);let o=a.getTime(),s=o+1440*60*1e3,c=await e.trpcClient.recording.getPlaybackManifest.query({deviceId:t,fromMs:o,toMs:s});return c?.playbackUrl?(Ee.current=await y0(c.playbackUrl,Oe),De.current={fromMs:o,toMs:s},Ee.current):Ee.current},[e,t,Oe]),Ae=(0,S.useMemo)(()=>e=>{let t=he.current,n=t?.getContext(`2d`);if(!t||!n)return;t.width=w.w,t.height=w.h;let r=e.displayWidth||e.codedWidth,a=e.displayHeight||e.codedHeight,o=Math.min(w.w/r,w.h/a),s=r*o,c=a*o;n.clearRect(0,0,w.w,w.h),n.drawImage(e,(w.w-s)/2,(w.h-c)/2,s,c),ye(!0)},[w.w,w.h]),je=(0,S.useRef)(Ae);je.current=Ae;let Me=(0,S.useMemo)(()=>async e=>{we.current||=new D0,Te.current||=new C0({ensureIndex:e=>ke(e),fetchBytes:async(e,t)=>{let n=await fetch(e,{signal:t,headers:Oe});if(!n.ok)throw Error(`segment fetch failed: ${n.status}`);return n.arrayBuffer()},decode:e=>{let t=we.current;if(!t)throw Error(`decoder not initialised`);return t.decodeSegment(e)},draw:e=>je.current(e)});try{await Te.current.scrubTo(e)}catch{}},[ke,Oe]),Ne=(0,S.useRef)(Me);Ne.current=Me,(0,S.useEffect)(()=>()=>{Te.current?.dispose()},[]);let Pe=(0,S.useMemo)(()=>async n=>{let r=n-j0,a=n+j0;E1({type:`recState`,state:`loading`});try{let o=await e.trpcClient.recording.getPlaybackManifest.query({deviceId:t,fromMs:r,toMs:a});if(!o?.playbackUrl){E1({type:`recState`,state:`gap`});return}D({url:M0(e.serverUrl,o.playbackUrl),windowStartMs:r,windowEndMs:a,targetMs:n}),E1({type:`recState`,state:`playing`}),E1({type:`position`,positionMs:n})}catch{E1({type:`recState`,state:`error`})}},[e,t]),Fe=(0,S.useRef)(Pe);Fe.current=Pe;let Ie=(0,S.useMemo)(()=>e=>{let t=O.current;if(!t){Fe.current(e);return}if(e>=t.windowStartMs&&e<=t.windowEndMs){let n=ze.current;if(n){n.currentTime=Math.max(0,(e-t.windowStartMs)/1e3),E1({type:`position`,positionMs:e});return}}Fe.current(e)},[]),Le=(0,S.useRef)(Ie);Le.current=Ie;let Re=(0,S.useRef)(null),ze=(0,S.useRef)(null);(0,S.useEffect)(()=>{ze.current=E?Re.current?.querySelector(`video`)??null:null},[E]),(0,S.useEffect)(()=>(window.__camstackEmbed={setMuted:e=>p(e),setTarget:e=>{let t=k0.safeParse(e);t.success&&d(t.data)},setStats:e=>h(e),setHighlight:e=>_(e),setSnapshot:e=>y(e),setMic:e=>ne.current(e?t:null),fit:(e,t)=>T({w:e,h:t}),reconnect:()=>x(e=>e+1),playRecorded:(e,t,n)=>{l?Fe.current(t):oe({kind:`playRecorded`,deviceId:e,epochMs:t,profile:n})},seek:e=>{l&&O.current?Le.current(e):oe({kind:`seekTo`,epochMs:e})},scrubCommit:e=>{if(l&&O.current){Le.current(e);return}oe({kind:`scrubEnd`,epochMs:e}),Ce.current()},scrubStart:()=>{l&&O.current||(ye(!1),_e(!0),oe({kind:`scrubStart`}))},scrubTo:e=>{l&&O.current||Ne.current(e)},scrubEnd:e=>{if(l&&O.current){Le.current(e);return}oe({kind:`scrubEnd`,epochMs:e}),Ce.current()},setRate:e=>{if(l&&O.current){let t=ze.current;t&&(e===0?t.pause():t.play().catch(()=>{}));return}oe({kind:e===0?`pause`:`play`})},goLive:()=>{if(l&&O.current){D(null),E1({type:`recState`,state:`live`});return}oe({kind:`goLive`})}},()=>{window.__camstackEmbed&&delete window.__camstackEmbed}),[t,l]),(0,S.useEffect)(()=>{E1({type:`micState`,state:te.micState})},[te.micState]),(0,S.useEffect)(()=>D1(e=>{let t=window.__camstackEmbed;if(t)switch(e.kind){case`setMuted`:t.setMuted(e.value);break;case`setTarget`:t.setTarget(e.value);break;case`setStats`:t.setStats(e.value);break;case`setHighlight`:t.setHighlight(e.value);break;case`setSnapshot`:t.setSnapshot(e.value);break;case`setMic`:t.setMic(e.value);break;case`fit`:t.fit(e.w,e.h);break;case`reconnect`:t.reconnect();break;case`playRecorded`:t.playRecorded(e.deviceId,e.epochMs,e.profile);break;case`seek`:t.seek(e.value);break;case`scrubCommit`:t.scrubCommit(e.value);break;case`scrubStart`:t.scrubStart();break;case`scrubTo`:t.scrubTo(e.value);break;case`scrubEnd`:t.scrubEnd(e.value);break;case`setRate`:t.setRate(e.value);break;case`goLive`:t.goLive();break;default:break}}),[]);let Be=R0(u);return(0,C.jsxs)(`div`,{style:{position:`fixed`,left:0,top:0,width:w.w,height:w.h,background:`#000`},children:[(0,C.jsx)(HH,{serverUrl:e.serverUrl,streamKey:Be,autoPlay:!0,muted:f,showControls:!1,showStats:m,onPlaybackStats:e=>E1({type:`log`,scope:`playback`,msg:`stats`,data:e}),className:`w-full h-full`,handleOffer:pe,reoffer:me,getSessionState:de,getIceServers:se,addIceCandidate:ce,getIceCandidates:le,closeSession:ue,reconnectSignal:b,posterUrl:v,onControlChannel:k,onStateChange:e=>F0(I0(e)),onError:e=>F0(`error`,e)},Be),E?(0,C.jsx)(`div`,{ref:Re,style:{position:`absolute`,inset:0,zIndex:1,background:`#000`},children:(0,C.jsx)(O0,{url:E.url,muted:f,autoPlay:!0},E.url)}):null,(0,C.jsx)(`canvas`,{ref:he,style:{position:`absolute`,inset:0,width:`100%`,height:`100%`,background:`#000`,pointerEvents:`none`,transform:`translateZ(0)`,zIndex:2,display:ge&&ve?`block`:`none`}}),ee&&(()=>{let e=g?.appearance,t=ee===`motion`?e?.motionColor??X1.motion:ee===`audio`?e?.audioColor??X1.audio:e?.detectionColor??X1.detection;return(0,C.jsx)(`div`,{style:{position:`absolute`,inset:0,border:`${e?.thickness??3}px solid ${t}`,boxShadow:`inset 0 0 12px ${t}`,pointerEvents:`none`,transform:`translateZ(0)`}})})()]})}function H0(){let e=k1(`player`,()=>window.__CAMSTACK_EMBED__,z0),t=(0,S.useMemo)(()=>e===null||!e.ok?null:{system:xN({serverUrl:e.config.serverUrl,token:e.config.token}),queryClient:new st({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}})},[e]);return(0,S.useEffect)(()=>{if(t)return()=>{t.system.close()}},[t]),e===null?null:e.ok?t?(0,C.jsx)(xB,{system:t.system,children:(0,C.jsx)(ut,{client:t.queryClient,children:(0,C.jsx)(X.Provider,{client:t.system.trpcClient,queryClient:t.queryClient,children:(0,C.jsx)(V0,{system:t.system,deviceId:e.config.deviceId,token:e.config.token,initialTarget:e.config.target,initialMuted:e.config.muted,initialStats:e.config.stats??!1,initialHighlight:e.config.highlight,initialSnapshot:e.config.snapshot,hlsRecordedPlayback:e.config.hlsRecordedPlayback??!1})})})}):(0,C.jsx)(B0,{message:`Failed to initialise the embed player`}):(0,C.jsx)(B0,{message:e.error})}var U0=U({serverUrl:L().min(1),token:L().min(1),deviceId:R().int().nonnegative(),startMs:R().int().nonnegative().optional()});function W0(e){if(e==null)return{ok:!1,error:`config is required`};let t=U0.safeParse(e);return t.success?{ok:!0,config:t.data}:{ok:!1,error:t.error.issues.map(e=>`${e.path.join(`.`)||`(root)`}: ${e.message}`).join(`; `)}}var G0=360*60*1e3;function K0(e){E1(e)}function q0(e,t,n){try{E1({type:`log`,scope:e,msg:t,data:n})}catch{}try{console.debug(`[rec-embed:${e}] ${t}`,n??``)}catch{}}function J0({system:e,config:t}){let n=(0,S.useRef)(null),r=(0,S.useRef)(null),a=(0,S.useRef)(0),o=(0,S.useRef)(0),[s,c]=(0,S.useState)({w:window.innerWidth,h:window.innerHeight}),[l,u]=(0,S.useState)(!1),d=(0,S.useRef)(!1),f=(0,S.useRef)(null),p=(0,S.useRef)(null),m=(0,S.useRef)([]),h=(0,S.useRef)(null),g=(0,S.useMemo)(()=>async r=>{let s=n.current;if(s){o.current=performance.now(),q0(`loadAt`,`start`,{epochMs:r,window:G0}),K0({type:`state`,state:`loading`});try{let n=await e.trpcClient.recording.getPlaybackManifest.query({deviceId:t.deviceId,fromMs:r,toMs:r+G0});if(q0(`loadAt`,`manifest`,{playbackUrl:n?.playbackUrl??null,endpoints:n?.playbackEndpoints?.length??0,localMaster:!!n?.localMasterPath}),!n?.playbackUrl){K0({type:`state`,state:`error`,message:`no footage`}),u(!1);return}a.current=r,s.src=n.playbackUrl,s.currentTime=0,await s.play().catch(e=>{q0(`loadAt`,`play-rejected`,{msg:String(e)})}),q0(`loadAt`,`src-set`,{src:n.playbackUrl})}catch(e){q0(`loadAt`,`error`,{msg:e instanceof Error?e.message:String(e)}),K0({type:`state`,state:`error`,message:e instanceof Error?e.message:String(e)}),u(!1)}}},[e,t.deviceId]),_=(0,S.useMemo)(()=>async n=>{let r=h.current;if(r&&n>=r.fromMs&&n<r.toMs&&m.current.length>0)return m.current;let a=new Date(n);a.setHours(0,0,0,0);let o=a.getTime(),s=o+1440*60*1e3,c=await e.trpcClient.recording.getPlaybackManifest.query({deviceId:t.deviceId,fromMs:o,toMs:s});return q0(`scrub`,`dayIndex-manifest`,{playbackUrl:c?.playbackUrl??null,fromMs:o,toMs:s}),c?.playbackUrl?(m.current=await y0(c.playbackUrl),h.current={fromMs:o,toMs:s},q0(`scrub`,`dayIndex-built`,{len:m.current.length,fromMs:o,toMs:s}),m.current):m.current},[e,t.deviceId]),v=(0,S.useMemo)(()=>e=>{let t=r.current,n=t?.getContext(`2d`);if(!t||!n)return;t.width=s.w,t.height=s.h;let a=e.displayWidth||e.codedWidth,o=e.displayHeight||e.codedHeight,c=Math.min(s.w/a,s.h/o),l=a*c,u=o*c;n.clearRect(0,0,s.w,s.h),n.drawImage(e,(s.w-l)/2,(s.h-u)/2,l,u)},[s.w,s.h]),y=(0,S.useRef)(v);y.current=v;let b=(0,S.useMemo)(()=>async e=>{f.current||=new D0,p.current||=new C0({ensureIndex:e=>_(e),fetchBytes:async(e,t)=>{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`segment fetch failed: ${n.status}`);return n.arrayBuffer()},decode:e=>{let t=f.current;if(!t)throw Error(`decoder not initialised`);return t.decodeSegment(e)},draw:e=>y.current(e),onTiming:e=>q0(`scrub`,`timing`,e)});let t=p.current;if(t)try{await t.scrubTo(e),q0(`scrub`,`drawn`,{epochMs:e})}catch(e){q0(`scrub`,`error`,{msg:e instanceof Error?e.message:String(e)}),d.current||(d.current=!0,K0({type:`state`,state:`error`,message:`scrub: ${e instanceof Error?e.message:String(e)}`}))}},[_]);return(0,S.useEffect)(()=>(q0(`init`,`mounted`,{deviceId:t.deviceId,startMs:t.startMs??null,hasWebCodecs:window.VideoDecoder!==void 0,ua:navigator.userAgent}),window.__camstackRecording={seekTo:e=>{q0(`cmd`,`seekTo`,{epochMs:e}),g(e)},play:()=>{q0(`cmd`,`play`),n.current?.play().catch(()=>{})},pause:()=>{q0(`cmd`,`pause`),n.current?.pause()},setRate:e=>{q0(`cmd`,`setRate`,{rate:e}),n.current&&(n.current.playbackRate=e)},fit:(e,t)=>{q0(`cmd`,`fit`,{w:e,h:t}),c({w:e,h:t})},scrubStart:()=>{q0(`cmd`,`scrubStart`),d.current=!1,u(!0)},scrubTo:e=>{q0(`cmd`,`scrubTo`,{epochMs:e}),b(e)},scrubEnd:e=>{q0(`cmd`,`scrubEnd`,{epochMs:e}),p.current?.dispose(),p.current=null,g(e)}},t.startMs&&t.startMs>0&&g(t.startMs),()=>{window.__camstackRecording&&delete window.__camstackRecording,p.current?.dispose(),p.current=null,f.current?.close(),f.current=null}),[g,b,t.startMs,t.deviceId]),(0,S.useEffect)(()=>D1(e=>{let t=window.__camstackRecording;if(t)switch(e.kind){case`seekTo`:t.seekTo(e.value);break;case`play`:t.play();break;case`pause`:t.pause();break;case`setRate`:t.setRate(e.value);break;case`scrubStart`:t.scrubStart();break;case`scrubTo`:t.scrubTo(e.value);break;case`scrubEnd`:t.scrubEnd(e.value);break;case`fit`:t.fit(e.w,e.h);break;default:break}}),[]),(0,C.jsxs)(`div`,{style:{position:`fixed`,left:0,top:0,width:s.w,height:s.h,background:`#000`},children:[(0,C.jsx)(`video`,{ref:n,playsInline:!0,controls:!1,style:{width:`100%`,height:`100%`,objectFit:`contain`,background:`#000`},onLoadedMetadata:e=>q0(`video`,`loadedmetadata`,{w:e.currentTarget.videoWidth,h:e.currentTarget.videoHeight,dur:e.currentTarget.duration}),onPlaying:()=>{q0(`video`,`playing`,{vodStartMs:Math.round(performance.now()-o.current)}),K0({type:`state`,state:`playing`}),u(!1)},onPause:()=>K0({type:`state`,state:`paused`}),onEnded:()=>K0({type:`state`,state:`ended`}),onError:e=>{let t=e.currentTarget.error;q0(`video`,`error`,{code:t?.code??null,message:t?.message??null}),K0({type:`state`,state:`error`,message:t?.message||`video error`}),u(!1)},onTimeUpdate:e=>K0({type:`position`,positionMs:a.current+e.currentTarget.currentTime*1e3})}),(0,C.jsx)(`canvas`,{ref:r,style:{position:`absolute`,left:0,top:0,width:`100%`,height:`100%`,background:`#000`,display:l?`block`:`none`}})]})}function Y0(){let e=k1(`recording`,()=>window.__CAMSTACK_RECORDING__,W0),t=(0,S.useMemo)(()=>e===null||!e.ok?null:(document.cookie=`camstack_session=${e.config.token}; path=/; SameSite=Lax`,xN({serverUrl:e.config.serverUrl,token:e.config.token})),[e]);return(0,S.useEffect)(()=>()=>t?.close(),[t]),e===null?null:e.ok?t?(0,C.jsx)(J0,{system:t,config:e.config}):(K0({type:`state`,state:`error`,message:`init failed`}),null):(K0({type:`state`,state:`error`,message:e.error}),null)}function X0(){let e=new URLSearchParams(location.search).get(`mode`)??`grid`;return e===`player`?(0,C.jsx)(H0,{}):e===`recording`?(0,C.jsx)(Y0,{}):(0,C.jsx)(d0,{})}var Z0=document.getElementById(`root`);Z0&&(0,x.createRoot)(Z0).render((0,C.jsx)(X0,{}));