hashquiz 1.0.0-beta.11 → 1.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -4
- package/bin/hashquiz.js +95 -34
- package/package.json +1 -1
- package/web/assets/{SoloEndView-CrTGhioe.css → CreateQuizCard-BbPt21cH.css} +1 -1
- package/web/assets/CreateQuizCard-xKw4VRLN.js +1 -0
- package/web/assets/SoloCatalog-CU8R7j8B.css +1 -0
- package/web/assets/SoloCatalog-Z6TlUytv.js +1 -0
- package/web/assets/SoloEndView-C5wzMB0_.css +1 -0
- package/web/assets/SoloEndView-Cr_3rclv.js +1 -0
- package/web/assets/{SoloIntroView-Db4kFtLD.js → SoloIntroView-C-yZ2RJO.js} +1 -1
- package/web/assets/{SoloLeaderboard-BtOBBX6D.js → SoloLeaderboard-D1uDfizB.js} +1 -1
- package/web/assets/{SoloQuestionView-Bo5XB8rw.js → SoloQuestionView-D-PR4AaF.js} +1 -1
- package/web/assets/{deps-BMfrnC0X.js → deps-CxwVlDwg.js} +1 -1
- package/web/assets/index-CajH5pNL.css +1 -0
- package/web/assets/{index-CC2v29ew.js → index-aCeTHNHW.js} +5 -5
- package/web/host/assets/{index-lLkFF7hQ.js → index-B_dXXjPe.js} +2 -2
- package/web/host/assets/{index-B4fsdNqb.css → index-DlgQjMRR.css} +1 -1
- package/web/host/index.html +2 -2
- package/web/index.html +2 -2
- package/web/assets/CreateQuizCard-BZJu4DlD.js +0 -1
- package/web/assets/CreateQuizCard-Dhgs7VcA.css +0 -1
- package/web/assets/SoloCatalog-BHS5PBPk.js +0 -1
- package/web/assets/SoloCatalog-DwmTmIzR.css +0 -1
- package/web/assets/SoloEndView-qSQsU1-X.js +0 -1
- package/web/assets/index-O6tGcYhE.css +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/deps-
|
|
2
|
-
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__esmMin=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},__commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),__copyProps=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let a of __getOwnPropNames(t))!__hasOwnProp.call(e,a)&&a!==n&&(r=__getOwnPropDesc(t,a),__defProp(e,a,{get:r&&r.get&&!r.configurable?r.get:()=>t[a],enumerable:!r||r.enumerable}));return e},__toESM=(e,t,n)=>(n=e==null?{}:__create(__getProtoOf(e)),__copyProps(t||!e||!e.__esModule||!__hasOwnProp.call(e,`default`)?__defProp(n,`default`,{value:e,enumerable:!0}):n,e));(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),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var global$1=globalThis||self;function makeMap(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var EMPTY_OBJ={},EMPTY_ARR=[],NOOP=()=>{},NO=()=>!1,isOn=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),isModelListener=e=>e.startsWith(`onUpdate:`),extend=Object.assign,remove$1=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},hasOwnProperty$1=Object.prototype.hasOwnProperty,hasOwn=(e,t)=>hasOwnProperty$1.call(e,t),isArray=Array.isArray,isMap=e=>toTypeString(e)===`[object Map]`,isSet=e=>toTypeString(e)===`[object Set]`,isDate=e=>toTypeString(e)===`[object Date]`,isFunction=e=>typeof e==`function`,isString=e=>typeof e==`string`,isSymbol=e=>typeof e==`symbol`,isObject=e=>typeof e==`object`&&!!e,isPromise=e=>(isObject(e)||isFunction(e))&&isFunction(e.then)&&isFunction(e.catch),objectToString=Object.prototype.toString,toTypeString=e=>objectToString.call(e),toRawType=e=>toTypeString(e).slice(8,-1),isPlainObject$2=e=>toTypeString(e)===`[object Object]`,isIntegerKey=e=>isString(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,isReservedProp=makeMap(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),cacheStringFunction=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},camelizeRE=/-\w/g,camelize=cacheStringFunction(e=>e.replace(camelizeRE,e=>e.slice(1).toUpperCase())),hyphenateRE=/\B([A-Z])/g,hyphenate=cacheStringFunction(e=>e.replace(hyphenateRE,`-$1`).toLowerCase()),capitalize=cacheStringFunction(e=>e.charAt(0).toUpperCase()+e.slice(1)),toHandlerKey=cacheStringFunction(e=>e?`on${capitalize(e)}`:``),hasChanged=(e,t)=>!Object.is(e,t),invokeArrayFns=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},def=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},looseToNumber=e=>{let t=parseFloat(e);return isNaN(t)?e:t},toNumber$1=e=>{let t=isString(e)?Number(e):NaN;return isNaN(t)?e:t},_globalThis,getGlobalThis=()=>_globalThis||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global$1===void 0?{}:global$1;function normalizeStyle(e){if(isArray(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],a=isString(r)?parseStringStyle(r):normalizeStyle(r);if(a)for(let e in a)t[e]=a[e]}return t}if(isString(e)||isObject(e))return e}var listDelimiterRE=/;(?![^(]*\))/g,propertyDelimiterRE=/:([^]+)/,styleCommentRE=/\/\*[^]*?\*\//g;function parseStringStyle(e){let t={};return e.replace(styleCommentRE,``).split(listDelimiterRE).forEach(e=>{if(e){let n=e.split(propertyDelimiterRE);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function normalizeClass(e){let t=``;if(isString(e))t=e;else if(isArray(e))for(let n=0;n<e.length;n++){let r=normalizeClass(e[n]);r&&(t+=r+` `)}else if(isObject(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var specialBooleanAttrs=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,isSpecialBooleanAttr=makeMap(specialBooleanAttrs),isBooleanAttr=makeMap(specialBooleanAttrs+`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);function includeBooleanAttr(e){return!!e||e===``}function looseCompareArrays(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=looseEqual(e[r],t[r]);return n}function looseEqual(e,t){if(e===t)return!0;let n=isDate(e),r=isDate(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=isSymbol(e),r=isSymbol(t),n||r)return e===t;if(n=isArray(e),r=isArray(t),n||r)return n&&r?looseCompareArrays(e,t):!1;if(n=isObject(e),r=isObject(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e){let r=e.hasOwnProperty(n),a=t.hasOwnProperty(n);if(r&&!a||!r&&a||!looseEqual(e[n],t[n]))return!1}}return String(e)===String(t)}function looseIndexOf(e,t){return e.findIndex(e=>looseEqual(e,t))}var isRef$1=e=>!!(e&&e.__v_isRef===!0),toDisplayString=e=>isString(e)?e:e==null?``:isArray(e)||isObject(e)&&(e.toString===objectToString||!isFunction(e.toString))?isRef$1(e)?toDisplayString(e.value):JSON.stringify(e,replacer,2):String(e),replacer=(e,t)=>isRef$1(t)?replacer(e,t.value):isMap(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[stringifySymbol(t,r)+` =>`]=n,e),{})}:isSet(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>stringifySymbol(e))}:isSymbol(t)?stringifySymbol(t):isObject(t)&&!isArray(t)&&!isPlainObject$2(t)?String(t):t,stringifySymbol=(e,t=``)=>{var n;return isSymbol(e)?`Symbol(${e.description??t})`:e},activeEffectScope,EffectScope=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=activeEffectScope,!e&&activeEffectScope&&(this.index=(activeEffectScope.scopes||(activeEffectScope.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){let t=activeEffectScope;try{return activeEffectScope=this,e()}finally{activeEffectScope=t}}}on(){++this._on===1&&(this.prevScope=activeEffectScope,activeEffectScope=this)}off(){this._on>0&&--this._on===0&&(activeEffectScope=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function effectScope(e){return new EffectScope(e)}function getCurrentScope(){return activeEffectScope}function onScopeDispose(e,t=!1){activeEffectScope&&activeEffectScope.cleanups.push(e)}var activeSub,pausedQueueEffects=new WeakSet,ReactiveEffect=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,activeEffectScope&&activeEffectScope.active&&activeEffectScope.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,pausedQueueEffects.has(this)&&(pausedQueueEffects.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||batch(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,cleanupEffect(this),prepareDeps(this);let e=activeSub,t=shouldTrack;activeSub=this,shouldTrack=!0;try{return this.fn()}finally{cleanupDeps(this),activeSub=e,shouldTrack=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)removeSub(e);this.deps=this.depsTail=void 0,cleanupEffect(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?pausedQueueEffects.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){isDirty(this)&&this.run()}get dirty(){return isDirty(this)}},batchDepth=0,batchedSub,batchedComputed;function batch(e,t=!1){e.flags|=8,t?(e.next=batchedComputed,batchedComputed=e):(e.next=batchedSub,batchedSub=e)}function startBatch(){batchDepth++}function endBatch(){if(--batchDepth>0)return;if(batchedComputed){let e=batchedComputed;for(batchedComputed=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;batchedSub;){let t=batchedSub;for(batchedSub=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function prepareDeps(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function cleanupDeps(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),removeSub(r),removeDep(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function isDirty(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(refreshComputed(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function refreshComputed(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===globalVersion)||(e.globalVersion=globalVersion,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!isDirty(e))))return;e.flags|=2;let t=e.dep,n=activeSub,r=shouldTrack;activeSub=e,shouldTrack=!0;try{prepareDeps(e);let n=e.fn(e._value);(t.version===0||hasChanged(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{activeSub=n,shouldTrack=r,cleanupDeps(e),e.flags&=-3}}function removeSub(e,t=!1){let{dep:n,prevSub:r,nextSub:a}=e;if(r&&(r.nextSub=a,e.prevSub=void 0),a&&(a.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)removeSub(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function removeDep(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var shouldTrack=!0,trackStack=[];function pauseTracking(){trackStack.push(shouldTrack),shouldTrack=!1}function resetTracking(){let e=trackStack.pop();shouldTrack=e===void 0||e}function cleanupEffect(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=activeSub;activeSub=void 0;try{t()}finally{activeSub=e}}}var globalVersion=0,Link=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},Dep=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!activeSub||!shouldTrack||activeSub===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==activeSub)t=this.activeLink=new Link(activeSub,this),activeSub.deps?(t.prevDep=activeSub.depsTail,activeSub.depsTail.nextDep=t,activeSub.depsTail=t):activeSub.deps=activeSub.depsTail=t,addSub(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=activeSub.depsTail,t.nextDep=void 0,activeSub.depsTail.nextDep=t,activeSub.depsTail=t,activeSub.deps===t&&(activeSub.deps=e)}return t}trigger(e){this.version++,globalVersion++,this.notify(e)}notify(e){startBatch();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{endBatch()}}};function addSub(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)addSub(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var targetMap=new WeakMap,ITERATE_KEY=Symbol(``),MAP_KEY_ITERATE_KEY=Symbol(``),ARRAY_ITERATE_KEY=Symbol(``);function track(e,t,n){if(shouldTrack&&activeSub){let t=targetMap.get(e);t||targetMap.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new Dep),r.map=t,r.key=n),r.track()}}function trigger(e,t,n,r,a,o){let s=targetMap.get(e);if(!s){globalVersion++;return}let c=e=>{e&&e.trigger()};if(startBatch(),t===`clear`)s.forEach(c);else{let a=isArray(e),o=a&&isIntegerKey(n);if(a&&n===`length`){let e=Number(r);s.forEach((t,n)=>{(n===`length`||n===ARRAY_ITERATE_KEY||!isSymbol(n)&&n>=e)&&c(t)})}else switch((n!==void 0||s.has(void 0))&&c(s.get(n)),o&&c(s.get(ARRAY_ITERATE_KEY)),t){case`add`:a?o&&c(s.get(`length`)):(c(s.get(ITERATE_KEY)),isMap(e)&&c(s.get(MAP_KEY_ITERATE_KEY)));break;case`delete`:a||(c(s.get(ITERATE_KEY)),isMap(e)&&c(s.get(MAP_KEY_ITERATE_KEY)));break;case`set`:isMap(e)&&c(s.get(ITERATE_KEY))}}endBatch()}function getDepFromReactive(e,t){let n=targetMap.get(e);return n&&n.get(t)}function reactiveReadArray(e){let t=toRaw(e);return t===e?t:(track(t,`iterate`,ARRAY_ITERATE_KEY),isShallow(e)?t:t.map(toReactive))}function shallowReadArray(e){return track(e=toRaw(e),`iterate`,ARRAY_ITERATE_KEY),e}function toWrapped(e,t){return isReadonly(e)?toReadonly(isReactive(e)?toReactive(t):t):toReactive(t)}var arrayInstrumentations={__proto__:null,[Symbol.iterator](){return iterator(this,Symbol.iterator,e=>toWrapped(this,e))},concat(...e){return reactiveReadArray(this).concat(...e.map(e=>isArray(e)?reactiveReadArray(e):e))},entries(){return iterator(this,`entries`,e=>(e[1]=toWrapped(this,e[1]),e))},every(e,t){return apply(this,`every`,e,t,void 0,arguments)},filter(e,t){return apply(this,`filter`,e,t,e=>e.map(e=>toWrapped(this,e)),arguments)},find(e,t){return apply(this,`find`,e,t,e=>toWrapped(this,e),arguments)},findIndex(e,t){return apply(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return apply(this,`findLast`,e,t,e=>toWrapped(this,e),arguments)},findLastIndex(e,t){return apply(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return apply(this,`forEach`,e,t,void 0,arguments)},includes(...e){return searchProxy(this,`includes`,e)},indexOf(...e){return searchProxy(this,`indexOf`,e)},join(e){return reactiveReadArray(this).join(e)},lastIndexOf(...e){return searchProxy(this,`lastIndexOf`,e)},map(e,t){return apply(this,`map`,e,t,void 0,arguments)},pop(){return noTracking(this,`pop`)},push(...e){return noTracking(this,`push`,e)},reduce(e,...t){return reduce(this,`reduce`,e,t)},reduceRight(e,...t){return reduce(this,`reduceRight`,e,t)},shift(){return noTracking(this,`shift`)},some(e,t){return apply(this,`some`,e,t,void 0,arguments)},splice(...e){return noTracking(this,`splice`,e)},toReversed(){return reactiveReadArray(this).toReversed()},toSorted(e){return reactiveReadArray(this).toSorted(e)},toSpliced(...e){return reactiveReadArray(this).toSpliced(...e)},unshift(...e){return noTracking(this,`unshift`,e)},values(){return iterator(this,`values`,e=>toWrapped(this,e))}};function iterator(e,t,n){let r=shallowReadArray(e),a=r[t]();return r!==e&&!isShallow(e)&&(a._next=a.next,a.next=()=>{let e=a._next();return e.done||(e.value=n(e.value)),e}),a}var arrayProto=Array.prototype;function apply(e,t,n,r,a,o){let s=shallowReadArray(e),c=s!==e&&!isShallow(e),l=s[t];if(l!==arrayProto[t]){let t=l.apply(e,o);return c?toReactive(t):t}let u=n;s!==e&&(c?u=function(t,r){return n.call(this,toWrapped(e,t),r,e)}:n.length>2&&(u=function(t,r){return n.call(this,t,r,e)}));let d=l.call(s,u,r);return c&&a?a(d):d}function reduce(e,t,n,r){let a=shallowReadArray(e),o=a!==e&&!isShallow(e),s=n,c=!1;a!==e&&(o?(c=r.length===0,s=function(t,r,a){return c&&(c=!1,t=toWrapped(e,t)),n.call(this,t,toWrapped(e,r),a,e)}):n.length>3&&(s=function(t,r,a){return n.call(this,t,r,a,e)}));let l=a[t](s,...r);return c?toWrapped(e,l):l}function searchProxy(e,t,n){let r=toRaw(e);track(r,`iterate`,ARRAY_ITERATE_KEY);let a=r[t](...n);return(a===-1||a===!1)&&isProxy(n[0])?(n[0]=toRaw(n[0]),r[t](...n)):a}function noTracking(e,t,n=[]){pauseTracking(),startBatch();let r=toRaw(e)[t].apply(e,n);return endBatch(),resetTracking(),r}var isNonTrackableKeys=makeMap(`__proto__,__v_isRef,__isVue`),builtInSymbols=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(isSymbol));function hasOwnProperty(e){isSymbol(e)||(e=String(e));let t=toRaw(this);return track(t,`has`,e),t.hasOwnProperty(e)}var BaseReactiveHandler=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,a=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return a;if(t===`__v_raw`)return n===(r?a?shallowReadonlyMap:readonlyMap:a?shallowReactiveMap:reactiveMap).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let o=isArray(e);if(!r){let e;if(o&&(e=arrayInstrumentations[t]))return e;if(t===`hasOwnProperty`)return hasOwnProperty}let s=Reflect.get(e,t,isRef(e)?e:n);if((isSymbol(t)?builtInSymbols.has(t):isNonTrackableKeys(t))||(r||track(e,`get`,t),a))return s;if(isRef(s)){let e=o&&isIntegerKey(t)?s:s.value;return r&&isObject(e)?readonly(e):e}return isObject(s)?r?readonly(s):reactive(s):s}},MutableReactiveHandler=class extends BaseReactiveHandler{constructor(e=!1){super(!1,e)}set(e,t,n,r){let a=e[t],o=isArray(e)&&isIntegerKey(t);if(!this._isShallow){let e=isReadonly(a);if(!isShallow(n)&&!isReadonly(n)&&(a=toRaw(a),n=toRaw(n)),!o&&isRef(a)&&!isRef(n))return e||(a.value=n),!0}let s=o?Number(t)<e.length:hasOwn(e,t),c=Reflect.set(e,t,n,isRef(e)?e:r);return e===toRaw(r)&&(s?hasChanged(n,a)&&trigger(e,`set`,t,n,a):trigger(e,`add`,t,n)),c}deleteProperty(e,t){let n=hasOwn(e,t),r=e[t],a=Reflect.deleteProperty(e,t);return a&&n&&trigger(e,`delete`,t,void 0,r),a}has(e,t){let n=Reflect.has(e,t);return isSymbol(t)&&builtInSymbols.has(t)||track(e,`has`,t),n}ownKeys(e){return track(e,`iterate`,isArray(e)?`length`:ITERATE_KEY),Reflect.ownKeys(e)}},ReadonlyReactiveHandler=class extends BaseReactiveHandler{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},mutableHandlers=new MutableReactiveHandler,readonlyHandlers=new ReadonlyReactiveHandler,shallowReactiveHandlers=new MutableReactiveHandler(!0),toShallow=e=>e,getProto=e=>Reflect.getPrototypeOf(e);function createIterableMethod(e,t,n){return function(...r){let a=this.__v_raw,o=toRaw(a),s=isMap(o),c=e===`entries`||e===Symbol.iterator&&s,l=e===`keys`&&s,u=a[e](...r),d=n?toShallow:t?toReadonly:toReactive;return!t&&track(o,`iterate`,l?MAP_KEY_ITERATE_KEY:ITERATE_KEY),extend(Object.create(u),{next(){let{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:c?[d(e[0]),d(e[1])]:d(e),done:t}}})}}function createReadonlyMethod(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function createInstrumentations(e,t){let n={get(n){let r=this.__v_raw,a=toRaw(r),o=toRaw(n);e||(hasChanged(n,o)&&track(a,`get`,n),track(a,`get`,o));let{has:s}=getProto(a),c=t?toShallow:e?toReadonly:toReactive;if(s.call(a,n))return c(r.get(n));if(s.call(a,o))return c(r.get(o));r!==a&&r.get(n)},get size(){let t=this.__v_raw;return!e&&track(toRaw(t),`iterate`,ITERATE_KEY),t.size},has(t){let n=this.__v_raw,r=toRaw(n),a=toRaw(t);return e||(hasChanged(t,a)&&track(r,`has`,t),track(r,`has`,a)),t===a?n.has(t):n.has(t)||n.has(a)},forEach(n,r){let a=this,o=a.__v_raw,s=toRaw(o),c=t?toShallow:e?toReadonly:toReactive;return!e&&track(s,`iterate`,ITERATE_KEY),o.forEach((e,t)=>n.call(r,c(e),c(t),a))}};return extend(n,e?{add:createReadonlyMethod(`add`),set:createReadonlyMethod(`set`),delete:createReadonlyMethod(`delete`),clear:createReadonlyMethod(`clear`)}:{add(e){let n=toRaw(this),r=getProto(n),a=toRaw(e),o=!t&&!isShallow(e)&&!isReadonly(e)?a:e;return r.has.call(n,o)||hasChanged(e,o)&&r.has.call(n,e)||hasChanged(a,o)&&r.has.call(n,a)||(n.add(o),trigger(n,`add`,o,o)),this},set(e,n){t||isShallow(n)||isReadonly(n)||(n=toRaw(n));let r=toRaw(this),{has:a,get:o}=getProto(r),s=a.call(r,e);s||=(e=toRaw(e),a.call(r,e));let c=o.call(r,e);return r.set(e,n),s?hasChanged(n,c)&&trigger(r,`set`,e,n,c):trigger(r,`add`,e,n),this},delete(e){let t=toRaw(this),{has:n,get:r}=getProto(t),a=n.call(t,e);a||=(e=toRaw(e),n.call(t,e));let o=r?r.call(t,e):void 0,s=t.delete(e);return a&&trigger(t,`delete`,e,void 0,o),s},clear(){let e=toRaw(this),t=e.size!==0,n,r=e.clear();return t&&trigger(e,`clear`,void 0,void 0,void 0),r}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=createIterableMethod(r,e,t)}),n}function createInstrumentationGetter(e,t){let n=createInstrumentations(e,t);return(t,r,a)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(hasOwn(n,r)&&r in t?n:t,r,a)}var mutableCollectionHandlers={get:createInstrumentationGetter(!1,!1)},shallowCollectionHandlers={get:createInstrumentationGetter(!1,!0)},readonlyCollectionHandlers={get:createInstrumentationGetter(!0,!1)},reactiveMap=new WeakMap,shallowReactiveMap=new WeakMap,readonlyMap=new WeakMap,shallowReadonlyMap=new WeakMap;function targetTypeMap(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function getTargetType(e){return e.__v_skip||!Object.isExtensible(e)?0:targetTypeMap(toRawType(e))}function reactive(e){return isReadonly(e)?e:createReactiveObject(e,!1,mutableHandlers,mutableCollectionHandlers,reactiveMap)}function shallowReactive(e){return createReactiveObject(e,!1,shallowReactiveHandlers,shallowCollectionHandlers,shallowReactiveMap)}function readonly(e){return createReactiveObject(e,!0,readonlyHandlers,readonlyCollectionHandlers,readonlyMap)}function createReactiveObject(e,t,n,r,a){if(!isObject(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let o=getTargetType(e);if(o===0)return e;let s=a.get(e);if(s)return s;let c=new Proxy(e,o===2?r:n);return a.set(e,c),c}function isReactive(e){return isReadonly(e)?isReactive(e.__v_raw):!!(e&&e.__v_isReactive)}function isReadonly(e){return!!(e&&e.__v_isReadonly)}function isShallow(e){return!!(e&&e.__v_isShallow)}function isProxy(e){return e?!!e.__v_raw:!1}function toRaw(e){let t=e&&e.__v_raw;return t?toRaw(t):e}function markRaw(e){return!hasOwn(e,`__v_skip`)&&Object.isExtensible(e)&&def(e,`__v_skip`,!0),e}var toReactive=e=>isObject(e)?reactive(e):e,toReadonly=e=>isObject(e)?readonly(e):e;function isRef(e){return e?e.__v_isRef===!0:!1}function ref(e){return createRef(e,!1)}function shallowRef(e){return createRef(e,!0)}function createRef(e,t){return isRef(e)?e:new RefImpl(e,t)}var RefImpl=class{constructor(e,t){this.dep=new Dep,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:toRaw(e),this._value=t?e:toReactive(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||isShallow(e)||isReadonly(e);e=n?e:toRaw(e),hasChanged(e,t)&&(this._rawValue=e,this._value=n?e:toReactive(e),this.dep.trigger())}};function triggerRef(e){e.dep&&e.dep.trigger()}function unref(e){return isRef(e)?e.value:e}var shallowUnwrapHandlers={get:(e,t,n)=>t===`__v_raw`?e:unref(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let a=e[t];return isRef(a)&&!isRef(n)?(a.value=n,!0):Reflect.set(e,t,n,r)}};function proxyRefs(e){return isReactive(e)?e:new Proxy(e,shallowUnwrapHandlers)}function toRefs(e){let t=isArray(e)?Array(e.length):{};for(let n in e)t[n]=propertyToRef(e,n);return t}var ObjectRefImpl=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=isSymbol(t)?t:String(t),this._raw=toRaw(e);let r=!0,a=e;if(!isArray(e)||isSymbol(this._key)||!isIntegerKey(this._key))do r=!isProxy(a)||isShallow(a);while(r&&(a=a.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=unref(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&isRef(this._raw[this._key])){let t=this._object[this._key];if(isRef(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return getDepFromReactive(this._raw,this._key)}};function propertyToRef(e,t,n){return new ObjectRefImpl(e,t,n)}var ComputedRefImpl=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Dep(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=globalVersion-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&activeSub!==this)return batch(this,!0),!0}get value(){let e=this.dep.track();return refreshComputed(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function computed$1(e,t,n=!1){let r,a;return isFunction(e)?r=e:(r=e.get,a=e.set),new ComputedRefImpl(r,a,n)}var INITIAL_WATCHER_VALUE={},cleanupMap=new WeakMap,activeWatcher=void 0;function onWatcherCleanup(e,t=!1,n=activeWatcher){if(n){let t=cleanupMap.get(n);t||cleanupMap.set(n,t=[]),t.push(e)}}function watch$1(e,t,n=EMPTY_OBJ){let{immediate:r,deep:a,once:o,scheduler:s,augmentJob:c,call:l}=n,u=e=>a?e:isShallow(e)||a===!1||a===0?traverse(e,1):traverse(e),d,f,m,g,_=!1,v=!1;if(isRef(e)?(f=()=>e.value,_=isShallow(e)):isReactive(e)?(f=()=>u(e),_=!0):isArray(e)?(v=!0,_=e.some(e=>isReactive(e)||isShallow(e)),f=()=>e.map(e=>{if(isRef(e))return e.value;if(isReactive(e))return u(e);if(isFunction(e))return l?l(e,2):e()})):f=isFunction(e)?t?l?()=>l(e,2):e:()=>{if(m){pauseTracking();try{m()}finally{resetTracking()}}let t=activeWatcher;activeWatcher=d;try{return l?l(e,3,[g]):e(g)}finally{activeWatcher=t}}:NOOP,t&&a){let e=f,t=a===!0?1/0:a;f=()=>traverse(e(),t)}let y=getCurrentScope(),b=()=>{d.stop(),y&&y.active&&remove$1(y.effects,d)};if(o&&t){let e=t;t=(...t)=>{e(...t),b()}}let x=v?Array(e.length).fill(INITIAL_WATCHER_VALUE):INITIAL_WATCHER_VALUE,S=e=>{if(d.flags&1&&(d.dirty||e)){if(t){let e=d.run();if(a||_||(v?e.some((e,t)=>hasChanged(e,x[t])):hasChanged(e,x))){m&&m();let n=activeWatcher;activeWatcher=d;try{let n=[e,x===INITIAL_WATCHER_VALUE?void 0:v&&x[0]===INITIAL_WATCHER_VALUE?[]:x,g];x=e,l?l(t,3,n):t(...n)}finally{activeWatcher=n}}}else d.run()}};return c&&c(S),d=new ReactiveEffect(f),d.scheduler=s?()=>s(S,!1):S,g=e=>onWatcherCleanup(e,!1,d),m=d.onStop=()=>{let e=cleanupMap.get(d);if(e){if(l)l(e,4);else for(let t of e)t();cleanupMap.delete(d)}},t?r?S(!0):x=d.run():s?s(S.bind(null,!0),!0):d.run(),b.pause=d.pause.bind(d),b.resume=d.resume.bind(d),b.stop=b,b}function traverse(e,t=1/0,n){if(t<=0||!isObject(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,isRef(e))traverse(e.value,t,n);else if(isArray(e))for(let r=0;r<e.length;r++)traverse(e[r],t,n);else if(isSet(e)||isMap(e))e.forEach(e=>{traverse(e,t,n)});else if(isPlainObject$2(e)){for(let r in e)traverse(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&traverse(e[r],t,n)}return e}function callWithErrorHandling(e,t,n,r){try{return r?e(...r):e()}catch(e){handleError$2(e,t,n)}}function callWithAsyncErrorHandling(e,t,n,r){if(isFunction(e)){let a=callWithErrorHandling(e,t,n,r);return a&&isPromise(a)&&a.catch(e=>{handleError$2(e,t,n)}),a}if(isArray(e)){let a=[];for(let o=0;o<e.length;o++)a.push(callWithAsyncErrorHandling(e[o],t,n,r));return a}}function handleError$2(e,t,n,r=!0){let a=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||EMPTY_OBJ;if(t){let r=t.parent,a=t.proxy,s=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,a,s)===!1)return}r=r.parent}if(o){pauseTracking(),callWithErrorHandling(o,null,10,[e,a,s]),resetTracking();return}}logError(e,n,a,r,s)}function logError(e,t,n,r=!0,a=!1){if(a)throw e;console.error(e)}var queue=[],flushIndex=-1,pendingPostFlushCbs=[],activePostFlushCbs=null,postFlushIndex=0,resolvedPromise=Promise.resolve(),currentFlushPromise=null;function nextTick(e){let t=currentFlushPromise||resolvedPromise;return e?t.then(this?e.bind(this):e):t}function findInsertionIndex(e){let t=flushIndex+1,n=queue.length;for(;t<n;){let r=t+n>>>1,a=queue[r],o=getId(a);o<e||o===e&&a.flags&2?t=r+1:n=r}return t}function queueJob(e){if(!(e.flags&1)){let t=getId(e),n=queue[queue.length-1];!n||!(e.flags&2)&&t>=getId(n)?queue.push(e):queue.splice(findInsertionIndex(t),0,e),e.flags|=1,queueFlush()}}function queueFlush(){currentFlushPromise||=resolvedPromise.then(flushJobs)}function queuePostFlushCb(e){isArray(e)?pendingPostFlushCbs.push(...e):activePostFlushCbs&&e.id===-1?activePostFlushCbs.splice(postFlushIndex+1,0,e):e.flags&1||(pendingPostFlushCbs.push(e),e.flags|=1),queueFlush()}function flushPreFlushCbs(e,t,n=flushIndex+1){for(;n<queue.length;n++){let t=queue[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;queue.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function flushPostFlushCbs(e){if(pendingPostFlushCbs.length){let e=[...new Set(pendingPostFlushCbs)].sort((e,t)=>getId(e)-getId(t));if(pendingPostFlushCbs.length=0,activePostFlushCbs){activePostFlushCbs.push(...e);return}for(activePostFlushCbs=e,postFlushIndex=0;postFlushIndex<activePostFlushCbs.length;postFlushIndex++){let e=activePostFlushCbs[postFlushIndex];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}activePostFlushCbs=null,postFlushIndex=0}}var getId=e=>e.id==null?e.flags&2?-1:1/0:e.id;function flushJobs(e){try{for(flushIndex=0;flushIndex<queue.length;flushIndex++){let e=queue[flushIndex];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),callWithErrorHandling(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;flushIndex<queue.length;flushIndex++){let e=queue[flushIndex];e&&(e.flags&=-2)}flushIndex=-1,queue.length=0,flushPostFlushCbs(e),currentFlushPromise=null,(queue.length||pendingPostFlushCbs.length)&&flushJobs(e)}}var currentRenderingInstance=null,currentScopeId=null;function setCurrentRenderingInstance(e){let t=currentRenderingInstance;return currentRenderingInstance=e,currentScopeId=e&&e.type.__scopeId||null,t}function withCtx(e,t=currentRenderingInstance,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&setBlockTracking(-1);let a=setCurrentRenderingInstance(t),o;try{o=e(...n)}finally{setCurrentRenderingInstance(a),r._d&&setBlockTracking(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function withDirectives(e,t){if(currentRenderingInstance===null)return e;let n=getComponentPublicInstance(currentRenderingInstance),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[a,o,s,c=EMPTY_OBJ]=t[e];a&&(isFunction(a)&&(a={mounted:a,updated:a}),a.deep&&traverse(o),r.push({dir:a,instance:n,value:o,oldValue:void 0,arg:s,modifiers:c}))}return e}function invokeDirectiveHook(e,t,n,r){let a=e.dirs,o=t&&t.dirs;for(let s=0;s<a.length;s++){let c=a[s];o&&(c.oldValue=o[s].value);let l=c.dir[r];l&&(pauseTracking(),callWithAsyncErrorHandling(l,n,8,[e.el,c,e,t]),resetTracking())}}function provide(e,t){if(currentInstance){let n=currentInstance.provides,r=currentInstance.parent&¤tInstance.parent.provides;r===n&&(n=currentInstance.provides=Object.create(r)),n[e]=t}}function inject(e,t,n=!1){let r=getCurrentInstance();if(r||currentApp){let a=currentApp?currentApp._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(a&&e in a)return a[e];if(arguments.length>1)return n&&isFunction(t)?t.call(r&&r.proxy):t}}function hasInjectionContext(){return!!(getCurrentInstance()||currentApp)}var ssrContextKey=Symbol.for(`v-scx`),useSSRContext=()=>inject(ssrContextKey);function watch(e,t,n){return doWatch(e,t,n)}function doWatch(e,t,n=EMPTY_OBJ){let{immediate:r,deep:a,flush:o,once:s}=n,c=extend({},n),l=t&&r||!t&&o!==`post`,u;if(isInSSRComponentSetup){if(o===`sync`){let e=useSSRContext();u=e.__watcherHandles||=[]}else if(!l){let e=()=>{};return e.stop=NOOP,e.resume=NOOP,e.pause=NOOP,e}}let d=currentInstance;c.call=(e,t,n)=>callWithAsyncErrorHandling(e,d,t,n);let f=!1;o===`post`?c.scheduler=e=>{queuePostRenderEffect(e,d&&d.suspense)}:o!==`sync`&&(f=!0,c.scheduler=(e,t)=>{t?e():queueJob(e)}),c.augmentJob=e=>{t&&(e.flags|=4),f&&(e.flags|=2,d&&(e.id=d.uid,e.i=d))};let m=watch$1(e,t,c);return isInSSRComponentSetup&&(u?u.push(m):l&&m()),m}function instanceWatch(e,t,n){let r=this.proxy,a=isString(e)?e.includes(`.`)?createPathGetter(r,e):()=>r[e]:e.bind(r,r),o;isFunction(t)?o=t:(o=t.handler,n=t);let s=setCurrentInstance(this),c=doWatch(a,o.bind(r),n);return s(),c}function createPathGetter(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var TeleportEndKey=Symbol(`_vte`),isTeleport=e=>e.__isTeleport,leaveCbKey=Symbol(`_leaveCb`),enterCbKey=Symbol(`_enterCb`);function useTransitionState(){let e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return onMounted(()=>{e.isMounted=!0}),onBeforeUnmount(()=>{e.isUnmounting=!0}),e}var TransitionHookValidator=[Function,Array],BaseTransitionPropsValidators={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:TransitionHookValidator,onEnter:TransitionHookValidator,onAfterEnter:TransitionHookValidator,onEnterCancelled:TransitionHookValidator,onBeforeLeave:TransitionHookValidator,onLeave:TransitionHookValidator,onAfterLeave:TransitionHookValidator,onLeaveCancelled:TransitionHookValidator,onBeforeAppear:TransitionHookValidator,onAppear:TransitionHookValidator,onAfterAppear:TransitionHookValidator,onAppearCancelled:TransitionHookValidator},recursiveGetSubtree=e=>{let t=e.subTree;return t.component?recursiveGetSubtree(t.component):t},BaseTransitionImpl={name:`BaseTransition`,props:BaseTransitionPropsValidators,setup(e,{slots:t}){let n=getCurrentInstance(),r=useTransitionState();return()=>{let a=t.default&&getTransitionRawChildren(t.default(),!0);if(!a||!a.length)return;let o=findNonCommentChild(a),s=toRaw(e),{mode:c}=s;if(r.isLeaving)return emptyPlaceholder(o);let l=getInnerChild$1(o);if(!l)return emptyPlaceholder(o);let u=resolveTransitionHooks(l,s,r,n,e=>u=e);l.type!==Comment&&setTransitionHooks(l,u);let d=n.subTree&&getInnerChild$1(n.subTree);if(d&&d.type!==Comment&&!isSameVNodeType(d,l)&&recursiveGetSubtree(n).type!==Comment){let e=resolveTransitionHooks(d,s,r,n);if(setTransitionHooks(d,e),c===`out-in`&&l.type!==Comment)return r.isLeaving=!0,e.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete e.afterLeave,d=void 0},emptyPlaceholder(o);c===`in-out`&&l.type!==Comment?e.delayLeave=(e,t,n)=>{let a=getLeavingNodesForType(r,d);a[String(d.key)]=d,e[leaveCbKey]=()=>{t(),e[leaveCbKey]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{n(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&=void 0;return o}}};function findNonCommentChild(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==Comment){t=n;break}}return t}var BaseTransition=BaseTransitionImpl;function getLeavingNodesForType(e,t){let{leavingVNodes:n}=e,r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function resolveTransitionHooks(e,t,n,r,a){let{appear:o,mode:s,persisted:c=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:d,onEnterCancelled:f,onBeforeLeave:m,onLeave:g,onAfterLeave:_,onLeaveCancelled:v,onBeforeAppear:y,onAppear:b,onAfterAppear:x,onAppearCancelled:S}=t,C=String(e.key),w=getLeavingNodesForType(n,e),T=(e,t)=>{e&&callWithAsyncErrorHandling(e,r,9,t)},E=(e,t)=>{let n=t[1];T(e,t),isArray(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},D={mode:s,persisted:c,beforeEnter(t){let r=l;if(!n.isMounted){if(o)r=y||l;else return}t[leaveCbKey]&&t[leaveCbKey](!0);let a=w[C];a&&isSameVNodeType(e,a)&&a.el[leaveCbKey]&&a.el[leaveCbKey](),T(r,[t])},enter(t){if(w[C]===e)return;let r=u,a=d,s=f;if(!n.isMounted){if(o)r=b||u,a=x||d,s=S||f;else return}let c=!1;t[enterCbKey]=e=>{c||(c=!0,T(e?s:a,[t]),D.delayedLeave&&D.delayedLeave(),t[enterCbKey]=void 0)};let l=t[enterCbKey].bind(null,!1);r?E(r,[t,l]):l()},leave(t,r){let a=String(e.key);if(t[enterCbKey]&&t[enterCbKey](!0),n.isUnmounting)return r();T(m,[t]);let o=!1;t[leaveCbKey]=n=>{o||(o=!0,r(),T(n?v:_,[t]),t[leaveCbKey]=void 0,w[a]===e&&delete w[a])};let s=t[leaveCbKey].bind(null,!1);w[a]=e,g?E(g,[t,s]):s()},clone(e){let o=resolveTransitionHooks(e,t,n,r,a);return a&&a(o),o}};return D}function emptyPlaceholder(e){if(isKeepAlive(e))return e=cloneVNode(e),e.children=null,e}function getInnerChild$1(e){if(!isKeepAlive(e))return isTeleport(e.type)&&e.children?findNonCommentChild(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&isFunction(n.default))return n.default()}}function setTransitionHooks(e,t){e.shapeFlag&6&&e.component?(e.transition=t,setTransitionHooks(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function getTransitionRawChildren(e,t=!1,n){let r=[],a=0;for(let o=0;o<e.length;o++){let s=e[o],c=n==null?s.key:String(n)+String(s.key==null?o:s.key);s.type===Fragment?(s.patchFlag&128&&a++,r=r.concat(getTransitionRawChildren(s.children,t,c))):(t||s.type!==Comment)&&r.push(c==null?s:cloneVNode(s,{key:c}))}if(a>1)for(let e=0;e<r.length;e++)r[e].patchFlag=-2;return r}function defineComponent(e,t){return isFunction(e)?extend({name:e.name},t,{setup:e}):e}function markAsyncBoundary(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function isTemplateRefKey(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var pendingSetRefMap=new WeakMap;function setRef(e,t,n,r,a=!1){if(isArray(e)){e.forEach((e,o)=>setRef(e,t&&(isArray(t)?t[o]:t),n,r,a));return}if(isAsyncWrapper(r)&&!a){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&setRef(e,t,n,r.component.subTree);return}let o=r.shapeFlag&4?getComponentPublicInstance(r.component):r.el,s=a?null:o,{i:c,r:l}=e,u=t&&t.r,d=c.refs===EMPTY_OBJ?c.refs={}:c.refs,f=c.setupState,m=toRaw(f),g=f===EMPTY_OBJ?NO:e=>!isTemplateRefKey(d,e)&&hasOwn(m,e),_=(e,t)=>!(t&&isTemplateRefKey(d,t));if(u!=null&&u!==l){if(invalidatePendingSetRef(t),isString(u))d[u]=null,g(u)&&(f[u]=null);else if(isRef(u)){let e=t;_(u,e.k)&&(u.value=null),e.k&&(d[e.k]=null)}}if(isFunction(l))callWithErrorHandling(l,c,12,[s,d]);else{let t=isString(l),r=isRef(l);if(t||r){let c=()=>{if(e.f){let n=t?g(l)?f[l]:d[l]:_(l)||!e.k?l.value:d[e.k];if(a)isArray(n)&&remove$1(n,o);else if(isArray(n))n.includes(o)||n.push(o);else if(t)d[l]=[o],g(l)&&(f[l]=d[l]);else{let t=[o];_(l,e.k)&&(l.value=t),e.k&&(d[e.k]=t)}}else t?(d[l]=s,g(l)&&(f[l]=s)):r&&(_(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){let t=()=>{c(),pendingSetRefMap.delete(e)};t.id=-1,pendingSetRefMap.set(e,t),queuePostRenderEffect(t,n)}else invalidatePendingSetRef(e),c()}}}function invalidatePendingSetRef(e){let t=pendingSetRefMap.get(e);t&&(t.flags|=8,pendingSetRefMap.delete(e))}var isComment=e=>e.nodeType===8,requestIdleCallback=getGlobalThis().requestIdleCallback||(e=>setTimeout(e,1)),cancelIdleCallback=getGlobalThis().cancelIdleCallback||(e=>clearTimeout(e));function forEachElement(e,t){if(isComment(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(isComment(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var isAsyncWrapper=e=>!!e.type.__asyncLoader;function defineAsyncComponent(e){isFunction(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:a=200,hydrate:o,timeout:s,suspensible:c=!0,onError:l}=e,u=null,d,f=0,m=()=>(f++,u=null,g()),g=()=>{let e;return u||(e=u=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),l)return new Promise((t,n)=>{l(e,()=>t(m()),()=>n(e),f+1)});throw e}).then(t=>e!==u&&u?u:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),d=t,t)))};return defineComponent({name:`AsyncComponentWrapper`,__asyncLoader:g,__asyncHydrate(e,t,n){let r=!1;(t.bu||=[]).push(()=>r=!0);let a=()=>{r||n()},s=o?()=>{let n=o(a,t=>forEachElement(e,t));n&&(t.bum||=[]).push(n)}:a;d?s():g().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return d},setup(){let e=currentInstance;if(markAsyncBoundary(e),d)return()=>createInnerComp(d,e);let t=t=>{u=null,handleError$2(t,e,13,!r)};if(c&&e.suspense||isInSSRComponentSetup)return g().then(t=>()=>createInnerComp(t,e)).catch(e=>(t(e),()=>r?createVNode(r,{error:e}):null));let o=ref(!1),l=ref(),f=ref(!!a);return a&&setTimeout(()=>{f.value=!1},a),s!=null&&setTimeout(()=>{if(!o.value&&!l.value){let e=Error(`Async component timed out after ${s}ms.`);t(e),l.value=e}},s),g().then(()=>{o.value=!0,e.parent&&isKeepAlive(e.parent.vnode)&&e.parent.update()}).catch(e=>{t(e),l.value=e}),()=>{if(o.value&&d)return createInnerComp(d,e);if(l.value&&r)return createVNode(r,{error:l.value});if(n&&!f.value)return createInnerComp(n,e)}}})}function createInnerComp(e,t){let{ref:n,props:r,children:a,ce:o}=t.vnode,s=createVNode(e,r,a);return s.ref=n,s.ce=o,delete t.vnode.ce,s}var isKeepAlive=e=>e.type.__isKeepAlive;function onActivated(e,t){registerKeepAliveHook(e,`a`,t)}function onDeactivated(e,t){registerKeepAliveHook(e,`da`,t)}function registerKeepAliveHook(e,t,n=currentInstance){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(injectHook(t,r,n),n){let e=n.parent;for(;e&&e.parent;)isKeepAlive(e.parent.vnode)&&injectToKeepAliveRoot(r,t,n,e),e=e.parent}}function injectToKeepAliveRoot(e,t,n,r){let a=injectHook(t,e,r,!0);onUnmounted(()=>{remove$1(r[t],a)},n)}function injectHook(e,t,n=currentInstance,r=!1){if(n){let a=n[e]||(n[e]=[]),o=t.__weh||=(...r)=>{pauseTracking();let a=setCurrentInstance(n),o=callWithAsyncErrorHandling(t,n,e,r);return a(),resetTracking(),o};return r?a.unshift(o):a.push(o),o}}var createHook=e=>(t,n=currentInstance)=>{isInSSRComponentSetup&&e!==`sp`||injectHook(e,(...e)=>t(...e),n)},onBeforeMount=createHook(`bm`),onMounted=createHook(`m`),onBeforeUpdate=createHook(`bu`),onUpdated=createHook(`u`),onBeforeUnmount=createHook(`bum`),onUnmounted=createHook(`um`),onServerPrefetch=createHook(`sp`),onRenderTriggered=createHook(`rtg`),onRenderTracked=createHook(`rtc`);function onErrorCaptured(e,t=currentInstance){injectHook(`ec`,e,t)}var NULL_DYNAMIC_COMPONENT=Symbol.for(`v-ndc`);function renderList(e,t,n,r){let a,o=n&&n[r],s=isArray(e);if(s||isString(e)){let n=s&&isReactive(e),r=!1,c=!1;n&&(r=!isShallow(e),c=isReadonly(e),e=shallowReadArray(e)),a=Array(e.length);for(let n=0,s=e.length;n<s;n++)a[n]=t(r?c?toReadonly(toReactive(e[n])):toReactive(e[n]):e[n],n,void 0,o&&o[n])}else if(typeof e==`number`){a=Array(e);for(let n=0;n<e;n++)a[n]=t(n+1,n,void 0,o&&o[n])}else if(isObject(e)){if(e[Symbol.iterator])a=Array.from(e,(e,n)=>t(e,n,void 0,o&&o[n]));else{let n=Object.keys(e);a=Array(n.length);for(let r=0,s=n.length;r<s;r++){let s=n[r];a[r]=t(e[s],s,r,o&&o[r])}}}else a=[];return n&&(n[r]=a),a}var getPublicInstance=e=>e?isStatefulComponent(e)?getComponentPublicInstance(e):getPublicInstance(e.parent):null,publicPropertiesMap=extend(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>getPublicInstance(e.parent),$root:e=>getPublicInstance(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>resolveMergedOptions(e),$forceUpdate:e=>e.f||=()=>{queueJob(e.update)},$nextTick:e=>e.n||=nextTick.bind(e.proxy),$watch:e=>instanceWatch.bind(e)}),hasSetupBinding=(e,t)=>e!==EMPTY_OBJ&&!e.__isScriptSetup&&hasOwn(e,t),PublicInstanceProxyHandlers={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:a,props:o,accessCache:s,type:c,appContext:l}=e;if(t[0]!==`$`){let e=s[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return a[t];case 4:return n[t];case 3:return o[t]}else if(hasSetupBinding(r,t))return s[t]=1,r[t];else if(a!==EMPTY_OBJ&&hasOwn(a,t))return s[t]=2,a[t];else if(hasOwn(o,t))return s[t]=3,o[t];else if(n!==EMPTY_OBJ&&hasOwn(n,t))return s[t]=4,n[t];else shouldCacheAccess&&(s[t]=0)}let u=publicPropertiesMap[t],d,f;if(u)return t===`$attrs`&&track(e.attrs,`get`,``),u(e);if((d=c.__cssModules)&&(d=d[t]))return d;if(n!==EMPTY_OBJ&&hasOwn(n,t))return s[t]=4,n[t];if(f=l.config.globalProperties,hasOwn(f,t))return f[t]},set({_:e},t,n){let{data:r,setupState:a,ctx:o}=e;return hasSetupBinding(a,t)?(a[t]=n,!0):r!==EMPTY_OBJ&&hasOwn(r,t)?(r[t]=n,!0):hasOwn(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:a,props:o,type:s}},c){let l;return!!(n[c]||e!==EMPTY_OBJ&&c[0]!==`$`&&hasOwn(e,c)||hasSetupBinding(t,c)||hasOwn(o,c)||hasOwn(r,c)||hasOwn(publicPropertiesMap,c)||hasOwn(a.config.globalProperties,c)||(l=s.__cssModules)&&l[c])},defineProperty(e,t,n){return n.get==null?hasOwn(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function normalizePropsOrEmits(e){return isArray(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}var shouldCacheAccess=!0;function applyOptions(e){let t=resolveMergedOptions(e),n=e.proxy,r=e.ctx;shouldCacheAccess=!1,t.beforeCreate&&callHook$1(t.beforeCreate,e,`bc`);let{data:a,computed:o,methods:s,watch:c,provide:l,inject:u,created:d,beforeMount:f,mounted:m,beforeUpdate:g,updated:_,activated:v,deactivated:y,beforeDestroy:b,beforeUnmount:x,destroyed:S,unmounted:C,render:w,renderTracked:T,renderTriggered:E,errorCaptured:D,serverPrefetch:O,expose:k,inheritAttrs:A,components:j,directives:M,filters:ee}=t,P=null;if(u&&resolveInjections(u,r,null),s)for(let e in s){let t=s[e];isFunction(t)&&(r[e]=t.bind(n))}if(a){let t=a.call(n,n);isObject(t)&&(e.data=reactive(t))}if(shouldCacheAccess=!0,o)for(let e in o){let t=o[e],a=computed({get:isFunction(t)?t.bind(n,n):isFunction(t.get)?t.get.bind(n,n):NOOP,set:!isFunction(t)&&isFunction(t.set)?t.set.bind(n):NOOP});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e})}if(c)for(let e in c)createWatcher(c[e],r,n,e);if(l){let e=isFunction(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{provide(t,e[t])})}d&&callHook$1(d,e,`c`);function F(e,t){isArray(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(F(onBeforeMount,f),F(onMounted,m),F(onBeforeUpdate,g),F(onUpdated,_),F(onActivated,v),F(onDeactivated,y),F(onErrorCaptured,D),F(onRenderTracked,T),F(onRenderTriggered,E),F(onBeforeUnmount,x),F(onUnmounted,C),F(onServerPrefetch,O),isArray(k)){if(k.length){let t=e.exposed||={};k.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={}}w&&e.render===NOOP&&(e.render=w),A!=null&&(e.inheritAttrs=A),j&&(e.components=j),M&&(e.directives=M),O&&markAsyncBoundary(e)}function resolveInjections(e,t,n=NOOP){isArray(e)&&(e=normalizeInject(e));for(let n in e){let r=e[n],a;a=isObject(r)?`default`in r?inject(r.from||n,r.default,!0):inject(r.from||n):inject(r),isRef(a)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e}):t[n]=a}}function callHook$1(e,t,n){callWithAsyncErrorHandling(isArray(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function createWatcher(e,t,n,r){let a=r.includes(`.`)?createPathGetter(n,r):()=>n[r];if(isString(e)){let n=t[e];isFunction(n)&&watch(a,n)}else if(isFunction(e))watch(a,e.bind(n));else if(isObject(e)){if(isArray(e))e.forEach(e=>createWatcher(e,t,n,r));else{let r=isFunction(e.handler)?e.handler.bind(n):t[e.handler];isFunction(r)&&watch(a,r,e)}}}function resolveMergedOptions(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:a,optionsCache:o,config:{optionMergeStrategies:s}}=e.appContext,c=o.get(t),l;return c?l=c:!a.length&&!n&&!r?l=t:(l={},a.length&&a.forEach(e=>mergeOptions(l,e,s,!0)),mergeOptions(l,t,s)),isObject(t)&&o.set(t,l),l}function mergeOptions(e,t,n,r=!1){let{mixins:a,extends:o}=t;o&&mergeOptions(e,o,n,!0),a&&a.forEach(t=>mergeOptions(e,t,n,!0));for(let a in t)if(!(r&&a===`expose`)){let r=internalOptionMergeStrats[a]||n&&n[a];e[a]=r?r(e[a],t[a]):t[a]}return e}var internalOptionMergeStrats={data:mergeDataFn,props:mergeEmitsOrPropsOptions,emits:mergeEmitsOrPropsOptions,methods:mergeObjectOptions,computed:mergeObjectOptions,beforeCreate:mergeAsArray,created:mergeAsArray,beforeMount:mergeAsArray,mounted:mergeAsArray,beforeUpdate:mergeAsArray,updated:mergeAsArray,beforeDestroy:mergeAsArray,beforeUnmount:mergeAsArray,destroyed:mergeAsArray,unmounted:mergeAsArray,activated:mergeAsArray,deactivated:mergeAsArray,errorCaptured:mergeAsArray,serverPrefetch:mergeAsArray,components:mergeObjectOptions,directives:mergeObjectOptions,watch:mergeWatchOptions,provide:mergeDataFn,inject:mergeInject};function mergeDataFn(e,t){return t?e?function(){return extend(isFunction(e)?e.call(this,this):e,isFunction(t)?t.call(this,this):t)}:t:e}function mergeInject(e,t){return mergeObjectOptions(normalizeInject(e),normalizeInject(t))}function normalizeInject(e){if(isArray(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function mergeAsArray(e,t){return e?[...new Set([].concat(e,t))]:t}function mergeObjectOptions(e,t){return e?extend(Object.create(null),e,t):t}function mergeEmitsOrPropsOptions(e,t){return e?isArray(e)&&isArray(t)?[...new Set([...e,...t])]:extend(Object.create(null),normalizePropsOrEmits(e),normalizePropsOrEmits(t??{})):t}function mergeWatchOptions(e,t){if(!e)return t;if(!t)return e;let n=extend(Object.create(null),e);for(let r in t)n[r]=mergeAsArray(e[r],t[r]);return n}function createAppContext(){return{app:null,config:{isNativeTag:NO,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var uid$1=0;function createAppAPI(e,t){return function(n,r=null){isFunction(n)||(n=extend({},n)),r!=null&&!isObject(r)&&(r=null);let a=createAppContext(),o=new WeakSet,s=[],c=!1,l=a.app={_uid:uid$1++,_component:n,_props:r,_container:null,_context:a,_instance:null,version:version$3,get config(){return a.config},set config(e){},use(e,...t){return o.has(e)||(e&&isFunction(e.install)?(o.add(e),e.install(l,...t)):isFunction(e)&&(o.add(e),e(l,...t))),l},mixin(e){return a.mixins.includes(e)||a.mixins.push(e),l},component(e,t){return t?(a.components[e]=t,l):a.components[e]},directive(e,t){return t?(a.directives[e]=t,l):a.directives[e]},mount(o,s,u){if(!c){let d=l._ceVNode||createVNode(n,r);return d.appContext=a,u===!0?u=`svg`:u===!1&&(u=void 0),s&&t?t(d,o):e(d,o,u),c=!0,l._container=o,o.__vue_app__=l,getComponentPublicInstance(d.component)}},onUnmount(e){s.push(e)},unmount(){c&&(callWithAsyncErrorHandling(s,l._instance,16),e(null,l._container),delete l._container.__vue_app__)},provide(e,t){return a.provides[e]=t,l},runWithContext(e){let t=currentApp;currentApp=l;try{return e()}finally{currentApp=t}}};return l}}var currentApp=null,getModelModifiers=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${camelize(t)}Modifiers`]||e[`${hyphenate(t)}Modifiers`];function emit(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||EMPTY_OBJ,a=n,o=t.startsWith(`update:`),s=o&&getModelModifiers(r,t.slice(7));s&&(s.trim&&(a=n.map(e=>isString(e)?e.trim():e)),s.number&&(a=n.map(looseToNumber)));let c,l=r[c=toHandlerKey(t)]||r[c=toHandlerKey(camelize(t))];!l&&o&&(l=r[c=toHandlerKey(hyphenate(t))]),l&&callWithAsyncErrorHandling(l,e,6,a);let u=r[c+`Once`];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[c])return;e.emitted[c]=!0,callWithAsyncErrorHandling(u,e,6,a)}}var mixinEmitsCache=new WeakMap;function normalizeEmitsOptions(e,t,n=!1){let r=n?mixinEmitsCache:t.emitsCache,a=r.get(e);if(a!==void 0)return a;let o=e.emits,s={},c=!1;if(!isFunction(e)){let r=e=>{let n=normalizeEmitsOptions(e,t,!0);n&&(c=!0,extend(s,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!o&&!c?(isObject(e)&&r.set(e,null),null):(isArray(o)?o.forEach(e=>s[e]=null):extend(s,o),isObject(e)&&r.set(e,s),s)}function isEmitListener(e,t){return!e||!isOn(t)?!1:(t=t.slice(2).replace(/Once$/,``),hasOwn(e,t[0].toLowerCase()+t.slice(1))||hasOwn(e,hyphenate(t))||hasOwn(e,t))}function renderComponentRoot(e){let{type:t,vnode:n,proxy:r,withProxy:a,propsOptions:[o],slots:s,attrs:c,emit:l,render:u,renderCache:d,props:f,data:m,setupState:g,ctx:_,inheritAttrs:v}=e,y=setCurrentRenderingInstance(e),b,x;try{if(n.shapeFlag&4){let e=a||r,t=e;b=normalizeVNode(u.call(t,e,d,f,g,m,_)),x=c}else{let e=t;b=normalizeVNode(e.length>1?e(f,{attrs:c,slots:s,emit:l}):e(f,null)),x=t.props?c:getFunctionalFallthrough(c)}}catch(t){blockStack.length=0,handleError$2(t,e,1),b=createVNode(Comment)}let S=b;if(x&&v!==!1){let e=Object.keys(x),{shapeFlag:t}=S;e.length&&t&7&&(o&&e.some(isModelListener)&&(x=filterModelListeners(x,o)),S=cloneVNode(S,x,!1,!0))}return n.dirs&&(S=cloneVNode(S,null,!1,!0),S.dirs=S.dirs?S.dirs.concat(n.dirs):n.dirs),n.transition&&setTransitionHooks(S,n.transition),b=S,setCurrentRenderingInstance(y),b}var getFunctionalFallthrough=e=>{let t;for(let n in e)(n===`class`||n===`style`||isOn(n))&&((t||={})[n]=e[n]);return t},filterModelListeners=(e,t)=>{let n={};for(let r in e)isModelListener(r)&&r.slice(9)in t||(n[r]=e[r]);return n};function shouldUpdateComponent(e,t,n){let{props:r,children:a,component:o}=e,{props:s,children:c,patchFlag:l}=t,u=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?hasPropsChanged(r,s,u):!!s;if(l&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(hasPropValueChanged(s,r,n)&&!isEmitListener(u,n))return!0}}}else return(a||c)&&(!c||!c.$stable)?!0:r===s?!1:r?!s||hasPropsChanged(r,s,u):!!s;return!1}function hasPropsChanged(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let a=0;a<r.length;a++){let o=r[a];if(hasPropValueChanged(t,e,o)&&!isEmitListener(n,o))return!0}return!1}function hasPropValueChanged(e,t,n){let r=e[n],a=t[n];return n===`style`&&isObject(r)&&isObject(a)?!looseEqual(r,a):r!==a}function updateHOCHostEl({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var internalObjectProto={},createInternalObject=()=>Object.create(internalObjectProto),isInternalObject=e=>Object.getPrototypeOf(e)===internalObjectProto;function initProps(e,t,n,r=!1){let a={},o=createInternalObject();e.propsDefaults=Object.create(null),setFullProps(e,t,a,o);for(let t in e.propsOptions[0])t in a||(a[t]=void 0);e.props=n?r?a:shallowReactive(a):e.type.props?a:o,e.attrs=o}function updateProps(e,t,n,r){let{props:a,attrs:o,vnode:{patchFlag:s}}=e,c=toRaw(a),[l]=e.propsOptions,u=!1;if((r||s>0)&&!(s&16)){if(s&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let s=n[r];if(isEmitListener(e.emitsOptions,s))continue;let d=t[s];if(l){if(hasOwn(o,s))d!==o[s]&&(o[s]=d,u=!0);else{let t=camelize(s);a[t]=resolvePropValue(l,c,t,d,e,!1)}}else d!==o[s]&&(o[s]=d,u=!0)}}}else{setFullProps(e,t,a,o)&&(u=!0);let r;for(let o in c)t&&(hasOwn(t,o)||(r=hyphenate(o))!==o&&hasOwn(t,r))||(l?n&&(n[o]!==void 0||n[r]!==void 0)&&(a[o]=resolvePropValue(l,c,o,void 0,e,!0)):delete a[o]);if(o!==c)for(let e in o)t&&hasOwn(t,e)||(delete o[e],u=!0)}u&&trigger(e.attrs,`set`,``)}function setFullProps(e,t,n,r){let[a,o]=e.propsOptions,s=!1,c;if(t)for(let l in t){if(isReservedProp(l))continue;let u=t[l],d;a&&hasOwn(a,d=camelize(l))?!o||!o.includes(d)?n[d]=u:(c||={})[d]=u:isEmitListener(e.emitsOptions,l)||l in r&&u===r[l]||(r[l]=u,s=!0)}if(o){let t=toRaw(n),r=c||EMPTY_OBJ;for(let s=0;s<o.length;s++){let c=o[s];n[c]=resolvePropValue(a,t,c,r[c],e,!hasOwn(r,c))}}return s}function resolvePropValue(e,t,n,r,a,o){let s=e[n];if(s!=null){let e=hasOwn(s,`default`);if(e&&r===void 0){let e=s.default;if(s.type!==Function&&!s.skipFactory&&isFunction(e)){let{propsDefaults:o}=a;if(n in o)r=o[n];else{let s=setCurrentInstance(a);r=o[n]=e.call(null,t),s()}}else r=e;a.ce&&a.ce._setProp(n,r)}s[0]&&(o&&!e?r=!1:s[1]&&(r===``||r===hyphenate(n))&&(r=!0))}return r}var mixinPropsCache=new WeakMap;function normalizePropsOptions(e,t,n=!1){let r=n?mixinPropsCache:t.propsCache,a=r.get(e);if(a)return a;let o=e.props,s={},c=[],l=!1;if(!isFunction(e)){let r=e=>{l=!0;let[n,r]=normalizePropsOptions(e,t,!0);extend(s,n),r&&c.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!o&&!l)return isObject(e)&&r.set(e,EMPTY_ARR),EMPTY_ARR;if(isArray(o))for(let e=0;e<o.length;e++){let t=camelize(o[e]);validatePropName(t)&&(s[t]=EMPTY_OBJ)}else if(o)for(let e in o){let t=camelize(e);if(validatePropName(t)){let n=o[e],r=s[t]=isArray(n)||isFunction(n)?{type:n}:extend({},n),a=r.type,l=!1,u=!0;if(isArray(a))for(let e=0;e<a.length;++e){let t=a[e],n=isFunction(t)&&t.name;if(n===`Boolean`){l=!0;break}n===`String`&&(u=!1)}else l=isFunction(a)&&a.name===`Boolean`;r[0]=l,r[1]=u,(l||hasOwn(r,`default`))&&c.push(t)}}let u=[s,c];return isObject(e)&&r.set(e,u),u}function validatePropName(e){return e[0]!==`$`&&!isReservedProp(e)}var isInternalKey=e=>e===`_`||e===`_ctx`||e===`$stable`,normalizeSlotValue=e=>isArray(e)?e.map(normalizeVNode):[normalizeVNode(e)],normalizeSlot=(e,t,n)=>{if(t._n)return t;let r=withCtx((...e)=>normalizeSlotValue(t(...e)),n);return r._c=!1,r},normalizeObjectSlots=(e,t,n)=>{let r=e._ctx;for(let n in e){if(isInternalKey(n))continue;let a=e[n];if(isFunction(a))t[n]=normalizeSlot(n,a,r);else if(a!=null){let e=normalizeSlotValue(a);t[n]=()=>e}}},normalizeVNodeSlots=(e,t)=>{let n=normalizeSlotValue(t);e.slots.default=()=>n},assignSlots=(e,t,n)=>{for(let r in t)(n||!isInternalKey(r))&&(e[r]=t[r])},initSlots=(e,t,n)=>{let r=e.slots=createInternalObject();if(e.vnode.shapeFlag&32){let e=t._;e?(assignSlots(r,t,n),n&&def(r,`_`,e,!0)):normalizeObjectSlots(t,r)}else t&&normalizeVNodeSlots(e,t)},updateSlots=(e,t,n)=>{let{vnode:r,slots:a}=e,o=!0,s=EMPTY_OBJ;if(r.shapeFlag&32){let e=t._;e?n&&e===1?o=!1:assignSlots(a,t,n):(o=!t.$stable,normalizeObjectSlots(t,a)),s=t}else t&&(normalizeVNodeSlots(e,t),s={default:1});if(o)for(let e in a)!isInternalKey(e)&&s[e]==null&&delete a[e]},queuePostRenderEffect=queueEffectWithSuspense;function createRenderer(e){return baseCreateRenderer(e)}function baseCreateRenderer(e,t){let n=getGlobalThis();n.__VUE__=!0;let{insert:r,remove:a,patchProp:o,createElement:s,createText:c,createComment:l,setText:u,setElementText:d,parentNode:f,nextSibling:m,setScopeId:g=NOOP,insertStaticContent:_}=e,v=(e,t,n,r=null,a=null,o=null,s=void 0,c=null,l=!!t.dynamicChildren)=>{if(e===t)return;e&&!isSameVNodeType(e,t)&&(r=G(e),B(e,a,o,!0),e=null),t.patchFlag===-2&&(l=!1,t.dynamicChildren=null);let{type:u,ref:d,shapeFlag:f}=t;switch(u){case Text:y(e,t,n,r);break;case Comment:b(e,t,n,r);break;case Static:e??x(t,n,r,s);break;case Fragment:j(e,t,n,r,a,o,s,c,l);break;default:f&1?w(e,t,n,r,a,o,s,c,l):f&6?M(e,t,n,r,a,o,s,c,l):(f&64||f&128)&&u.process(e,t,n,r,a,o,s,c,l,J)}d!=null&&a?setRef(d,e&&e.ref,o,t||e,!t):d==null&&e&&e.ref!=null&&setRef(e.ref,null,o,e,!0)},y=(e,t,n,a)=>{if(e==null)r(t.el=c(t.children),n,a);else{let n=t.el=e.el;t.children!==e.children&&u(n,t.children)}},b=(e,t,n,a)=>{e==null?r(t.el=l(t.children||``),n,a):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,a)=>{let o;for(;e&&e!==t;)o=m(e),r(e,n,a),e=o;r(t,n,a)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=m(e),a(e),e=n;a(t)},w=(e,t,n,r,a,o,s,c,l)=>{if(t.type===`svg`?s=`svg`:t.type===`math`&&(s=`mathml`),e==null)T(t,n,r,a,o,s,c,l);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),O(e,t,a,o,s,c,l)}finally{n&&n._endPatch()}}},T=(e,t,n,a,c,l,u,f)=>{let m,g,{props:_,shapeFlag:v,transition:y,dirs:b}=e;if(m=e.el=s(e.type,l,_&&_.is,_),v&8?d(m,e.children):v&16&&D(e.children,m,null,a,c,resolveChildrenNamespace(e,l),u,f),b&&invokeDirectiveHook(e,null,a,`created`),E(m,e,e.scopeId,u,a),_){for(let e in _)e!==`value`&&!isReservedProp(e)&&o(m,e,null,_[e],l,a);`value`in _&&o(m,`value`,null,_.value,l),(g=_.onVnodeBeforeMount)&&invokeVNodeHook(g,a,e)}b&&invokeDirectiveHook(e,null,a,`beforeMount`);let x=needTransition(c,y);x&&y.beforeEnter(m),r(m,t,n),((g=_&&_.onVnodeMounted)||x||b)&&queuePostRenderEffect(()=>{try{g&&invokeVNodeHook(g,a,e),x&&y.enter(m),b&&invokeDirectiveHook(e,null,a,`mounted`)}finally{}},c)},E=(e,t,n,r,a)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(a){let n=a.subTree;if(t===n||isSuspense(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=a.vnode;E(e,t,t.scopeId,t.slotScopeIds,a.parent)}}},D=(e,t,n,r,a,o,s,c,l=0)=>{for(let u=l;u<e.length;u++){let l=e[u]=c?cloneIfMounted(e[u]):normalizeVNode(e[u]);v(null,l,t,n,r,a,o,s,c)}},O=(e,t,n,r,a,s,c)=>{let l=t.el=e.el,{patchFlag:u,dynamicChildren:f,dirs:m}=t;u|=e.patchFlag&16;let g=e.props||EMPTY_OBJ,_=t.props||EMPTY_OBJ,v;if(n&&toggleRecurse(n,!1),(v=_.onVnodeBeforeUpdate)&&invokeVNodeHook(v,n,t,e),m&&invokeDirectiveHook(t,e,n,`beforeUpdate`),n&&toggleRecurse(n,!0),(g.innerHTML&&_.innerHTML==null||g.textContent&&_.textContent==null)&&d(l,``),f?k(e.dynamicChildren,f,l,n,r,resolveChildrenNamespace(t,a),s):c||te(e,t,l,null,n,r,resolveChildrenNamespace(t,a),s,!1),u>0){if(u&16)A(l,g,_,n,a);else if(u&2&&g.class!==_.class&&o(l,`class`,null,_.class,a),u&4&&o(l,`style`,g.style,_.style,a),u&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],s=g[r],c=_[r];(c!==s||r===`value`)&&o(l,r,s,c,a,n)}}u&1&&e.children!==t.children&&d(l,t.children)}else!c&&f==null&&A(l,g,_,n,a);((v=_.onVnodeUpdated)||m)&&queuePostRenderEffect(()=>{v&&invokeVNodeHook(v,n,t,e),m&&invokeDirectiveHook(t,e,n,`updated`)},r)},k=(e,t,n,r,a,o,s)=>{for(let c=0;c<t.length;c++){let l=e[c],u=t[c],d=l.el&&(l.type===Fragment||!isSameVNodeType(l,u)||l.shapeFlag&198)?f(l.el):n;v(l,u,d,null,r,a,o,s,!0)}},A=(e,t,n,r,a)=>{if(t!==n){if(t!==EMPTY_OBJ)for(let s in t)!isReservedProp(s)&&!(s in n)&&o(e,s,t[s],null,a,r);for(let s in n){if(isReservedProp(s))continue;let c=n[s],l=t[s];c!==l&&s!==`value`&&o(e,s,l,c,a,r)}`value`in n&&o(e,`value`,t.value,n.value,a)}},j=(e,t,n,a,o,s,l,u,d)=>{let f=t.el=e?e.el:c(``),m=t.anchor=e?e.anchor:c(``),{patchFlag:g,dynamicChildren:_,slotScopeIds:v}=t;v&&(u=u?u.concat(v):v),e==null?(r(f,n,a),r(m,n,a),D(t.children||[],n,m,o,s,l,u,d)):g>0&&g&64&&_&&e.dynamicChildren&&e.dynamicChildren.length===_.length?(k(e.dynamicChildren,_,n,o,s,l,u),(t.key!=null||o&&t===o.subTree)&&traverseStaticChildren(e,t,!0)):te(e,t,n,m,o,s,l,u,d)},M=(e,t,n,r,a,o,s,c,l)=>{t.slotScopeIds=c,e==null?t.shapeFlag&512?a.ctx.activate(t,n,r,s,l):ee(t,n,r,a,o,s,l):P(e,t,l)},ee=(e,t,n,r,a,o,s)=>{let c=e.component=createComponentInstance(e,r,a);if(isKeepAlive(e)&&(c.ctx.renderer=J),setupComponent(c,!1,s),c.asyncDep){if(a&&a.registerDep(c,F,s),!e.el){let r=c.subTree=createVNode(Comment);b(null,r,t,n),e.placeholder=r.el}}else F(c,e,t,n,a,o,s)},P=(e,t,n)=>{let r=t.component=e.component;if(shouldUpdateComponent(e,t,n)){if(r.asyncDep&&!r.asyncResolved){I(r,t,n);return}r.next=t,r.update()}else t.el=e.el,r.vnode=t},F=(e,t,n,r,a,o,s)=>{let c=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:c,vnode:l}=e;{let n=locateNonHydratedAsyncRoot(e);if(n){t&&(t.el=l.el,I(e,t,s)),n.asyncDep.then(()=>{queuePostRenderEffect(()=>{e.isUnmounted||u()},a)});return}}let d=t,m;toggleRecurse(e,!1),t?(t.el=l.el,I(e,t,s)):t=l,n&&invokeArrayFns(n),(m=t.props&&t.props.onVnodeBeforeUpdate)&&invokeVNodeHook(m,c,t,l),toggleRecurse(e,!0);let g=renderComponentRoot(e),_=e.subTree;e.subTree=g,v(_,g,f(_.el),G(_),e,a,o),t.el=g.el,d===null&&updateHOCHostEl(e,g.el),r&&queuePostRenderEffect(r,a),(m=t.props&&t.props.onVnodeUpdated)&&queuePostRenderEffect(()=>invokeVNodeHook(m,c,t,l),a)}else{let s,{el:c,props:l}=t,{bm:u,m:d,parent:f,root:m,type:g}=e,_=isAsyncWrapper(t);if(toggleRecurse(e,!1),u&&invokeArrayFns(u),!_&&(s=l&&l.onVnodeBeforeMount)&&invokeVNodeHook(s,f,t),toggleRecurse(e,!0),c&&ne){let t=()=>{e.subTree=renderComponentRoot(e),ne(c,e.subTree,e,a,null)};_&&g.__asyncHydrate?g.__asyncHydrate(c,e,t):t()}else{m.ce&&m.ce._hasShadowRoot()&&m.ce._injectChildStyle(g,e.parent?e.parent.type:void 0);let s=e.subTree=renderComponentRoot(e);v(null,s,n,r,e,a,o),t.el=s.el}if(d&&queuePostRenderEffect(d,a),!_&&(s=l&&l.onVnodeMounted)){let e=t;queuePostRenderEffect(()=>invokeVNodeHook(s,f,e),a)}(t.shapeFlag&256||f&&isAsyncWrapper(f.vnode)&&f.vnode.shapeFlag&256)&&e.a&&queuePostRenderEffect(e.a,a),e.isMounted=!0,t=n=r=null}};e.scope.on();let l=e.effect=new ReactiveEffect(c);e.scope.off();let u=e.update=l.run.bind(l),d=e.job=l.runIfDirty.bind(l);d.i=e,d.id=e.uid,l.scheduler=()=>queueJob(d),toggleRecurse(e,!0),u()},I=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,updateProps(e,t.props,r,n),updateSlots(e,t.children,n),pauseTracking(),flushPreFlushCbs(e),resetTracking()},te=(e,t,n,r,a,o,s,c,l=!1)=>{let u=e&&e.children,f=e?e.shapeFlag:0,m=t.children,{patchFlag:g,shapeFlag:_}=t;if(g>0){if(g&128){R(u,m,n,r,a,o,s,c,l);return}if(g&256){L(u,m,n,r,a,o,s,c,l);return}}_&8?(f&16&&W(u,a,o),m!==u&&d(n,m)):f&16?_&16?R(u,m,n,r,a,o,s,c,l):W(u,a,o,!0):(f&8&&d(n,``),_&16&&D(m,n,r,a,o,s,c,l))},L=(e,t,n,r,a,o,s,c,l)=>{e||=EMPTY_ARR,t||=EMPTY_ARR;let u=e.length,d=t.length,f=Math.min(u,d),m=0;for(;m<f;m++){let r=t[m]=l?cloneIfMounted(t[m]):normalizeVNode(t[m]);v(e[m],r,n,null,a,o,s,c,l)}u>d?W(e,a,o,!0,!1,f):D(t,n,r,a,o,s,c,l,f)},R=(e,t,n,r,a,o,s,c,l)=>{let u=0,d=t.length,f=e.length-1,m=d-1;for(;u<=f&&u<=m;){let r=e[u],d=t[u]=l?cloneIfMounted(t[u]):normalizeVNode(t[u]);if(isSameVNodeType(r,d))v(r,d,n,null,a,o,s,c,l);else break;u++}for(;u<=f&&u<=m;){let r=e[f],u=t[m]=l?cloneIfMounted(t[m]):normalizeVNode(t[m]);if(isSameVNodeType(r,u))v(r,u,n,null,a,o,s,c,l);else break;f--,m--}if(u>f){if(u<=m){let e=m+1,f=e<d?t[e].el:r;for(;u<=m;)v(null,t[u]=l?cloneIfMounted(t[u]):normalizeVNode(t[u]),n,f,a,o,s,c,l),u++}}else if(u>m)for(;u<=f;)B(e[u],a,o,!0),u++;else{let g=u,_=u,y=new Map;for(u=_;u<=m;u++){let e=t[u]=l?cloneIfMounted(t[u]):normalizeVNode(t[u]);e.key!=null&&y.set(e.key,u)}let b,x=0,S=m-_+1,C=!1,w=0,T=Array(S);for(u=0;u<S;u++)T[u]=0;for(u=g;u<=f;u++){let r=e[u];if(x>=S){B(r,a,o,!0);continue}let d;if(r.key!=null)d=y.get(r.key);else for(b=_;b<=m;b++)if(T[b-_]===0&&isSameVNodeType(r,t[b])){d=b;break}d===void 0?B(r,a,o,!0):(T[d-_]=u+1,d>=w?w=d:C=!0,v(r,t[d],n,null,a,o,s,c,l),x++)}let E=C?getSequence(T):EMPTY_ARR;for(b=E.length-1,u=S-1;u>=0;u--){let e=_+u,f=t[e],m=t[e+1],g=e+1<d?m.el||resolveAsyncComponentPlaceholder(m):r;T[u]===0?v(null,f,n,g,a,o,s,c,l):C&&(b<0||u!==E[b]?z(f,n,g,2):b--)}}},z=(e,t,n,o,s=null)=>{let{el:c,type:l,transition:u,children:d,shapeFlag:f}=e;if(f&6)z(e.component.subTree,t,n,o);else if(f&128)e.suspense.move(t,n,o);else if(f&64)l.move(e,t,n,J);else if(l===Fragment){r(c,t,n);for(let e=0;e<d.length;e++)z(d[e],t,n,o);r(e.anchor,t,n)}else if(l===Static)S(e,t,n);else if(o!==2&&f&1&&u){if(o===0)u.beforeEnter(c),r(c,t,n),queuePostRenderEffect(()=>u.enter(c),s);else{let{leave:o,delayLeave:s,afterLeave:l}=u,d=()=>{e.ctx.isUnmounted?a(c):r(c,t,n)},f=()=>{c._isLeaving&&c[leaveCbKey](!0),o(c,()=>{d(),l&&l()})};s?s(c,d,f):f()}}else r(c,t,n)},B=(e,t,n,r=!1,a=!1)=>{let{type:o,props:s,ref:c,children:l,dynamicChildren:u,shapeFlag:d,patchFlag:f,dirs:m,cacheIndex:g,memo:_}=e;if(f===-2&&(a=!1),c!=null&&(pauseTracking(),setRef(c,null,n,e,!0),resetTracking()),g!=null&&(t.renderCache[g]=void 0),d&256){t.ctx.deactivate(e);return}let v=d&1&&m,y=!isAsyncWrapper(e),b;if(y&&(b=s&&s.onVnodeBeforeUnmount)&&invokeVNodeHook(b,t,e),d&6)U(e.component,n,r);else{if(d&128){e.suspense.unmount(n,r);return}v&&invokeDirectiveHook(e,null,t,`beforeUnmount`),d&64?e.type.remove(e,t,n,J,r):u&&!u.hasOnce&&(o!==Fragment||f>0&&f&64)?W(u,t,n,!1,!0):(o===Fragment&&f&384||!a&&d&16)&&W(l,t,n),r&&V(e)}let x=_!=null&&g==null;(y&&(b=s&&s.onVnodeUnmounted)||v||x)&&queuePostRenderEffect(()=>{b&&invokeVNodeHook(b,t,e),v&&invokeDirectiveHook(e,null,t,`unmounted`),x&&(e.el=null)},n)},V=e=>{let{type:t,el:n,anchor:r,transition:o}=e;if(t===Fragment){H(n,r);return}if(t===Static){C(e);return}let s=()=>{a(n),o&&!o.persisted&&o.afterLeave&&o.afterLeave()};if(e.shapeFlag&1&&o&&!o.persisted){let{leave:t,delayLeave:r}=o,a=()=>t(n,s);r?r(e.el,s,a):a()}else s()},H=(e,t)=>{let n;for(;e!==t;)n=m(e),a(e),e=n;a(t)},U=(e,t,n)=>{let{bum:r,scope:a,job:o,subTree:s,um:c,m:l,a:u}=e;invalidateMount(l),invalidateMount(u),r&&invokeArrayFns(r),a.stop(),o&&(o.flags|=8,B(s,e,t,n)),c&&queuePostRenderEffect(c,t),queuePostRenderEffect(()=>{e.isUnmounted=!0},t)},W=(e,t,n,r=!1,a=!1,o=0)=>{for(let s=o;s<e.length;s++)B(e[s],t,n,r,a)},G=e=>{if(e.shapeFlag&6)return G(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=m(e.anchor||e.el),n=t&&t[TeleportEndKey];return n?m(n):t},K=!1,q=(e,t,n)=>{let r;e==null?t._vnode&&(B(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,K||=(K=!0,flushPreFlushCbs(r),flushPostFlushCbs(),!1)},J={p:v,um:B,m:z,r:V,mt:ee,mc:D,pc:te,pbc:k,n:G,o:e},Y,ne;return t&&([Y,ne]=t(J)),{render:q,hydrate:Y,createApp:createAppAPI(q,Y)}}function resolveChildrenNamespace({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function toggleRecurse({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function needTransition(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function traverseStaticChildren(e,t,n=!1){let r=e.children,a=t.children;if(isArray(r)&&isArray(a))for(let e=0;e<r.length;e++){let t=r[e],o=a[e];o.shapeFlag&1&&!o.dynamicChildren&&((o.patchFlag<=0||o.patchFlag===32)&&(o=a[e]=cloneIfMounted(a[e]),o.el=t.el),!n&&o.patchFlag!==-2&&traverseStaticChildren(t,o)),o.type===Text&&(o.patchFlag===-1&&(o=a[e]=cloneIfMounted(o)),o.el=t.el),o.type===Comment&&!o.el&&(o.el=t.el)}}function getSequence(e){let t=e.slice(),n=[0],r,a,o,s,c,l=e.length;for(r=0;r<l;r++){let l=e[r];if(l!==0){if(a=n[n.length-1],e[a]<l){t[r]=a,n.push(r);continue}for(o=0,s=n.length-1;o<s;)c=o+s>>1,e[n[c]]<l?o=c+1:s=c;l<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}for(o=n.length,s=n[o-1];o-->0;)n[o]=s,s=t[s];return n}function locateNonHydratedAsyncRoot(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:locateNonHydratedAsyncRoot(t)}function invalidateMount(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function resolveAsyncComponentPlaceholder(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?resolveAsyncComponentPlaceholder(t.subTree):null}var isSuspense=e=>e.__isSuspense;function queueEffectWithSuspense(e,t){t&&t.pendingBranch?isArray(e)?t.effects.push(...e):t.effects.push(e):queuePostFlushCb(e)}var Fragment=Symbol.for(`v-fgt`),Text=Symbol.for(`v-txt`),Comment=Symbol.for(`v-cmt`),Static=Symbol.for(`v-stc`),blockStack=[],currentBlock=null;function openBlock(e=!1){blockStack.push(currentBlock=e?null:[])}function closeBlock(){blockStack.pop(),currentBlock=blockStack[blockStack.length-1]||null}var isBlockTreeEnabled=1;function setBlockTracking(e,t=!1){isBlockTreeEnabled+=e,e<0&¤tBlock&&t&&(currentBlock.hasOnce=!0)}function setupBlock(e){return e.dynamicChildren=isBlockTreeEnabled>0?currentBlock||EMPTY_ARR:null,closeBlock(),isBlockTreeEnabled>0&¤tBlock&¤tBlock.push(e),e}function createElementBlock(e,t,n,r,a,o){return setupBlock(createBaseVNode(e,t,n,r,a,o,!0))}function createBlock(e,t,n,r,a){return setupBlock(createVNode(e,t,n,r,a,!0))}function isVNode(e){return e?e.__v_isVNode===!0:!1}function isSameVNodeType(e,t){return e.type===t.type&&e.key===t.key}var normalizeKey=({key:e})=>e??null,normalizeRef=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:isString(e)||isRef(e)||isFunction(e)?{i:currentRenderingInstance,r:e,k:t,f:!!n}:e);function createBaseVNode(e,t=null,n=null,r=0,a=null,o=e===Fragment?0:1,s=!1,c=!1){let l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&normalizeKey(t),ref:t&&normalizeRef(t),scopeId:currentScopeId,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:a,dynamicChildren:null,appContext:null,ctx:currentRenderingInstance};return c?(normalizeChildren(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=isString(n)?8:16),isBlockTreeEnabled>0&&!s&¤tBlock&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&¤tBlock.push(l),l}var createVNode=_createVNode;function _createVNode(e,t=null,n=null,r=0,a=null,o=!1){if(e&&e!==NULL_DYNAMIC_COMPONENT||(e=Comment),isVNode(e)){let r=cloneVNode(e,t,!0);return n&&normalizeChildren(r,n),isBlockTreeEnabled>0&&!o&¤tBlock&&(r.shapeFlag&6?currentBlock[currentBlock.indexOf(e)]=r:currentBlock.push(r)),r.patchFlag=-2,r}if(isClassComponent(e)&&(e=e.__vccOpts),t){t=guardReactiveProps(t);let{class:e,style:n}=t;e&&!isString(e)&&(t.class=normalizeClass(e)),isObject(n)&&(isProxy(n)&&!isArray(n)&&(n=extend({},n)),t.style=normalizeStyle(n))}let s=isString(e)?1:isSuspense(e)?128:isTeleport(e)?64:isObject(e)?4:isFunction(e)?2:0;return createBaseVNode(e,t,n,r,a,s,o,!0)}function guardReactiveProps(e){return e?isProxy(e)||isInternalObject(e)?extend({},e):e:null}function cloneVNode(e,t,n=!1,r=!1){let{props:a,ref:o,patchFlag:s,children:c,transition:l}=e,u=t?mergeProps(a||{},t):a,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&normalizeKey(u),ref:t&&t.ref?n&&o?isArray(o)?o.concat(normalizeRef(t)):[o,normalizeRef(t)]:normalizeRef(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:c,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Fragment?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&cloneVNode(e.ssContent),ssFallback:e.ssFallback&&cloneVNode(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&setTransitionHooks(d,l.clone(d)),d}function createTextVNode(e=` `,t=0){return createVNode(Text,null,e,t)}function createCommentVNode(e=``,t=!1){return t?(openBlock(),createBlock(Comment,null,e)):createVNode(Comment,null,e)}function normalizeVNode(e){return e==null||typeof e==`boolean`?createVNode(Comment):isArray(e)?createVNode(Fragment,null,e.slice()):isVNode(e)?cloneIfMounted(e):createVNode(Text,null,String(e))}function cloneIfMounted(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:cloneVNode(e)}function normalizeChildren(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(isArray(t))n=16;else if(typeof t==`object`){if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),normalizeChildren(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!isInternalObject(t)?t._ctx=currentRenderingInstance:r===3&¤tRenderingInstance&&(currentRenderingInstance.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else isFunction(t)?(t={default:t,_ctx:currentRenderingInstance},n=32):(t=String(t),r&64?(n=16,t=[createTextVNode(t)]):n=8);e.children=t,e.shapeFlag|=n}function mergeProps(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=normalizeClass([t.class,r.class]));else if(e===`style`)t.style=normalizeStyle([t.style,r.style]);else if(isOn(e)){let n=t[e],a=r[e];a&&n!==a&&!(isArray(n)&&n.includes(a))?t[e]=n?[].concat(n,a):a:a==null&&n==null&&!isModelListener(e)&&(t[e]=a)}else e!==``&&(t[e]=r[e])}return t}function invokeVNodeHook(e,t,n,r=null){callWithAsyncErrorHandling(e,t,7,[n,r])}var emptyAppContext=createAppContext(),uid=0;function createComponentInstance(e,t,n){let r=e.type,a=(t?t.appContext:e.appContext)||emptyAppContext,o={uid:uid++,vnode:e,type:r,parent:t,appContext:a,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new EffectScope(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(a.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:normalizePropsOptions(r,a),emitsOptions:normalizeEmitsOptions(r,a),emit:null,emitted:null,propsDefaults:EMPTY_OBJ,inheritAttrs:r.inheritAttrs,ctx:EMPTY_OBJ,data:EMPTY_OBJ,props:EMPTY_OBJ,attrs:EMPTY_OBJ,slots:EMPTY_OBJ,refs:EMPTY_OBJ,setupState:EMPTY_OBJ,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=t?t.root:o,o.emit=emit.bind(null,o),e.ce&&e.ce(o),o}var currentInstance=null,getCurrentInstance=()=>currentInstance||currentRenderingInstance,internalSetCurrentInstance,setInSSRSetupState;{let e=getGlobalThis(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};internalSetCurrentInstance=t(`__VUE_INSTANCE_SETTERS__`,e=>currentInstance=e),setInSSRSetupState=t(`__VUE_SSR_SETTERS__`,e=>isInSSRComponentSetup=e)}var setCurrentInstance=e=>{let t=currentInstance;return internalSetCurrentInstance(e),e.scope.on(),()=>{e.scope.off(),internalSetCurrentInstance(t)}},unsetCurrentInstance=()=>{currentInstance&¤tInstance.scope.off(),internalSetCurrentInstance(null)};function isStatefulComponent(e){return e.vnode.shapeFlag&4}var isInSSRComponentSetup=!1;function setupComponent(e,t=!1,n=!1){t&&setInSSRSetupState(t);let{props:r,children:a}=e.vnode,o=isStatefulComponent(e);initProps(e,r,o,t),initSlots(e,a,n||t);let s=o?setupStatefulComponent(e,t):void 0;return t&&setInSSRSetupState(!1),s}function setupStatefulComponent(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,PublicInstanceProxyHandlers);let{setup:r}=n;if(r){pauseTracking();let n=e.setupContext=r.length>1?createSetupContext(e):null,a=setCurrentInstance(e),o=callWithErrorHandling(r,e,0,[e.props,n]),s=isPromise(o);if(resetTracking(),a(),(s||e.sp)&&!isAsyncWrapper(e)&&markAsyncBoundary(e),s){if(o.then(unsetCurrentInstance,unsetCurrentInstance),t)return o.then(n=>{handleSetupResult(e,n,t)}).catch(t=>{handleError$2(t,e,0)});e.asyncDep=o}else handleSetupResult(e,o,t)}else finishComponentSetup(e,t)}function handleSetupResult(e,t,n){isFunction(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:isObject(t)&&(e.setupState=proxyRefs(t)),finishComponentSetup(e,n)}var compile,installWithProxy;function finishComponentSetup(e,t,n){let r=e.type;if(!e.render){if(!t&&compile&&!r.render){let t=r.template||resolveMergedOptions(e).template;if(t){let{isCustomElement:n,compilerOptions:a}=e.appContext.config,{delimiters:o,compilerOptions:s}=r;r.render=compile(t,extend(extend({isCustomElement:n,delimiters:o},a),s))}}e.render=r.render||NOOP,installWithProxy&&installWithProxy(e)}{let t=setCurrentInstance(e);pauseTracking();try{applyOptions(e)}finally{resetTracking(),t()}}}var attrsProxyHandlers={get(e,t){return track(e,`get`,``),e[t]}};function createSetupContext(e){return{attrs:new Proxy(e.attrs,attrsProxyHandlers),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function getComponentPublicInstance(e){return e.exposed?e.exposeProxy||=new Proxy(proxyRefs(markRaw(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in publicPropertiesMap)return publicPropertiesMap[n](e)},has(e,t){return t in e||t in publicPropertiesMap}}):e.proxy}function isClassComponent(e){return isFunction(e)&&`__vccOpts`in e}var computed=(e,t)=>computed$1(e,t,isInSSRComponentSetup);function h(e,t,n){try{setBlockTracking(-1);let r=arguments.length;return r===2?isObject(t)&&!isArray(t)?isVNode(t)?createVNode(e,null,[t]):createVNode(e,t):createVNode(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&isVNode(n)&&(n=[n]),createVNode(e,t,n))}finally{setBlockTracking(1)}}var version$3=`3.5.31`,policy=void 0,tt=typeof window<`u`&&window.trustedTypes;if(tt)try{policy=tt.createPolicy(`vue`,{createHTML:e=>e})}catch{}var unsafeToTrustedHTML=policy?e=>policy.createHTML(e):e=>e,svgNS=`http://www.w3.org/2000/svg`,mathmlNS=`http://www.w3.org/1998/Math/MathML`,doc=typeof document<`u`?document:null,templateContainer=doc&&doc.createElement(`template`),nodeOps={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let a=t===`svg`?doc.createElementNS(svgNS,e):t===`mathml`?doc.createElementNS(mathmlNS,e):n?doc.createElement(e,{is:n}):doc.createElement(e);return e===`select`&&r&&r.multiple!=null&&a.setAttribute(`multiple`,r.multiple),a},createText:e=>doc.createTextNode(e),createComment:e=>doc.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>doc.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,a,o){let s=n?n.previousSibling:t.lastChild;if(a&&(a===o||a.nextSibling))for(;t.insertBefore(a.cloneNode(!0),n),a!==o&&(a=a.nextSibling););else{templateContainer.innerHTML=unsafeToTrustedHTML(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let a=templateContainer.content;if(r===`svg`||r===`mathml`){let e=a.firstChild;for(;e.firstChild;)a.appendChild(e.firstChild);a.removeChild(e)}t.insertBefore(a,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},TRANSITION=`transition`,ANIMATION=`animation`,vtcKey=Symbol(`_vtc`),DOMTransitionPropsValidators={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},TransitionPropsValidators=extend({},BaseTransitionPropsValidators,DOMTransitionPropsValidators),decorate$1=e=>(e.displayName=`Transition`,e.props=TransitionPropsValidators,e),Transition=decorate$1((e,{slots:t})=>h(BaseTransition,resolveTransitionProps(e),t)),callHook=(e,t=[])=>{isArray(e)?e.forEach(e=>e(...t)):e&&e(...t)},hasExplicitCallback=e=>e?isArray(e)?e.some(e=>e.length>1):e.length>1:!1;function resolveTransitionProps(e){let t={};for(let n in e)n in DOMTransitionPropsValidators||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:a,enterFromClass:o=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:c=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:u=s,appearToClass:d=c,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:m=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,_=normalizeDuration(a),v=_&&_[0],y=_&&_[1],{onBeforeEnter:b,onEnter:x,onEnterCancelled:S,onLeave:C,onLeaveCancelled:w,onBeforeAppear:T=b,onAppear:E=x,onAppearCancelled:D=S}=t,O=(e,t,n,r)=>{e._enterCancelled=r,removeTransitionClass(e,t?d:c),removeTransitionClass(e,t?u:s),n&&n()},k=(e,t)=>{e._isLeaving=!1,removeTransitionClass(e,f),removeTransitionClass(e,g),removeTransitionClass(e,m),t&&t()},A=e=>(t,n)=>{let a=e?E:x,s=()=>O(t,e,n);callHook(a,[t,s]),nextFrame(()=>{removeTransitionClass(t,e?l:o),addTransitionClass(t,e?d:c),hasExplicitCallback(a)||whenTransitionEnds(t,r,v,s)})};return extend(t,{onBeforeEnter(e){callHook(b,[e]),addTransitionClass(e,o),addTransitionClass(e,s)},onBeforeAppear(e){callHook(T,[e]),addTransitionClass(e,l),addTransitionClass(e,u)},onEnter:A(!1),onAppear:A(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>k(e,t);addTransitionClass(e,f),e._enterCancelled?(addTransitionClass(e,m),forceReflow(e)):(forceReflow(e),addTransitionClass(e,m)),nextFrame(()=>{e._isLeaving&&(removeTransitionClass(e,f),addTransitionClass(e,g),hasExplicitCallback(C)||whenTransitionEnds(e,r,y,n))}),callHook(C,[e,n])},onEnterCancelled(e){O(e,!1,void 0,!0),callHook(S,[e])},onAppearCancelled(e){O(e,!0,void 0,!0),callHook(D,[e])},onLeaveCancelled(e){k(e),callHook(w,[e])}})}function normalizeDuration(e){if(e==null)return null;if(isObject(e))return[NumberOf(e.enter),NumberOf(e.leave)];{let t=NumberOf(e);return[t,t]}}function NumberOf(e){return toNumber$1(e)}function addTransitionClass(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[vtcKey]||(e[vtcKey]=new Set)).add(t)}function removeTransitionClass(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[vtcKey];n&&(n.delete(t),n.size||(e[vtcKey]=void 0))}function nextFrame(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var endId=0;function whenTransitionEnds(e,t,n,r){let a=e._endId=++endId,o=()=>{a===e._endId&&r()};if(n!=null)return setTimeout(o,n);let{type:s,timeout:c,propCount:l}=getTransitionInfo(e,t);if(!s)return r();let u=s+`end`,d=0,f=()=>{e.removeEventListener(u,m),o()},m=t=>{t.target===e&&++d>=l&&f()};setTimeout(()=>{d<l&&f()},c+1),e.addEventListener(u,m)}function getTransitionInfo(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),a=r(`${TRANSITION}Delay`),o=r(`${TRANSITION}Duration`),s=getTimeout(a,o),c=r(`${ANIMATION}Delay`),l=r(`${ANIMATION}Duration`),u=getTimeout(c,l),d=null,f=0,m=0;t===TRANSITION?s>0&&(d=TRANSITION,f=s,m=o.length):t===ANIMATION?u>0&&(d=ANIMATION,f=u,m=l.length):(f=Math.max(s,u),d=f>0?s>u?TRANSITION:ANIMATION:null,m=d?d===TRANSITION?o.length:l.length:0);let g=d===TRANSITION&&/\b(?:transform|all)(?:,|$)/.test(r(`${TRANSITION}Property`).toString());return{type:d,timeout:f,propCount:m,hasTransform:g}}function getTimeout(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>toMs(t)+toMs(e[n])))}function toMs(e){return e===`auto`?0:Number(e.slice(0,-1).replace(`,`,`.`))*1e3}function forceReflow(e){return(e?e.ownerDocument:document).body.offsetHeight}function patchClass(e,t,n){let r=e[vtcKey];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var vShowOriginalDisplay=Symbol(`_vod`),vShowHidden=Symbol(`_vsh`),CSS_VAR_TEXT=Symbol(``),displayRE=/(?:^|;)\s*display\s*:/;function patchStyle(e,t,n){let r=e.style,a=isString(n),o=!1;if(n&&!a){if(t){if(isString(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??setStyle(r,t,``)}else for(let e in t)n[e]??setStyle(r,e,``)}for(let e in n)e===`display`&&(o=!0),setStyle(r,e,n[e])}else if(a){if(t!==n){let e=r[CSS_VAR_TEXT];e&&(n+=`;`+e),r.cssText=n,o=displayRE.test(n)}}else t&&e.removeAttribute(`style`);vShowOriginalDisplay in e&&(e[vShowOriginalDisplay]=o?r.display:``,e[vShowHidden]&&(r.display=`none`))}var importantRE=/\s*!important$/;function setStyle(e,t,n){if(isArray(n))n.forEach(n=>setStyle(e,t,n));else if(n??=``,t.startsWith(`--`))e.setProperty(t,n);else{let r=autoPrefix(e,t);importantRE.test(n)?e.setProperty(hyphenate(r),n.replace(importantRE,``),`important`):e[r]=n}}var prefixes=[`Webkit`,`Moz`,`ms`],prefixCache={};function autoPrefix(e,t){let n=prefixCache[t];if(n)return n;let r=camelize(t);if(r!==`filter`&&r in e)return prefixCache[t]=r;r=capitalize(r);for(let n=0;n<prefixes.length;n++){let a=prefixes[n]+r;if(a in e)return prefixCache[t]=a}return t}var xlinkNS=`http://www.w3.org/1999/xlink`;function patchAttr(e,t,n,r,a,o=isSpecialBooleanAttr(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(xlinkNS,t.slice(6,t.length)):e.setAttributeNS(xlinkNS,t,n):n==null||o&&!includeBooleanAttr(n)?e.removeAttribute(t):e.setAttribute(t,o?``:isSymbol(n)?String(n):n)}function patchDOMProp(e,t,n,r,a){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?unsafeToTrustedHTML(n):n);return}let o=e.tagName;if(t===`value`&&o!==`PROGRESS`&&!o.includes(`-`)){let r=o===`OPTION`?e.getAttribute(`value`)||``:e.value,a=n==null?e.type===`checkbox`?`on`:``:String(n);r===a&&`_value`in e||(e.value=a),n??e.removeAttribute(t),e._value=n;return}let s=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=includeBooleanAttr(n):n==null&&r===`string`?(n=``,s=!0):r===`number`&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(a||t)}function addEventListener(e,t,n,r){e.addEventListener(t,n,r)}function removeEventListener(e,t,n,r){e.removeEventListener(t,n,r)}var veiKey=Symbol(`_vei`);function patchEvent(e,t,n,r,a=null){let o=e[veiKey]||(e[veiKey]={}),s=o[t];if(r&&s)s.value=r;else{let[n,c]=parseName(t);r?addEventListener(e,n,o[t]=createInvoker(r,a),c):s&&(removeEventListener(e,n,s,c),o[t]=void 0)}}var optionsModifierRE=/(?:Once|Passive|Capture)$/;function parseName(e){let t;if(optionsModifierRE.test(e)){t={};let n;for(;n=e.match(optionsModifierRE);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===`:`?e.slice(3):hyphenate(e.slice(2)),t]}var cachedNow=0,p=Promise.resolve(),getNow=()=>cachedNow||=(p.then(()=>cachedNow=0),Date.now());function createInvoker(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;callWithAsyncErrorHandling(patchStopImmediatePropagation(e,n.value),t,5,[e])};return n.value=e,n.attached=getNow(),n}function patchStopImmediatePropagation(e,t){if(isArray(t)){let n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}return t}var isNativeOn=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,patchProp=(e,t,n,r,a,o)=>{let s=a===`svg`;t===`class`?patchClass(e,r,s):t===`style`?patchStyle(e,n,r):isOn(t)?isModelListener(t)||patchEvent(e,t,n,r,o):(t[0]===`.`?(t=t.slice(1),1):t[0]===`^`?(t=t.slice(1),0):shouldSetAsProp(e,t,r,s))?(patchDOMProp(e,t,r),e.tagName.includes(`-`)||t!==`value`&&t!==`checked`&&t!==`selected`||patchAttr(e,t,r,s,o,t!==`value`)):e._isVueCE&&(shouldSetAsPropForVueCE(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!isString(r)))?patchDOMProp(e,camelize(t),r,o,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),patchAttr(e,t,r,s))};function shouldSetAsProp(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&isNativeOn(t)&&isFunction(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return isNativeOn(t)&&isString(n)?!1:t in e}function shouldSetAsPropForVueCE(e,t){let n=e._def.props;if(!n)return!1;let r=camelize(t);return Array.isArray(n)?n.some(e=>camelize(e)===r):Object.keys(n).some(e=>camelize(e)===r)}var getModelAssigner=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return isArray(t)?e=>invokeArrayFns(t,e):t};function onCompositionStart(e){e.target.composing=!0}function onCompositionEnd(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var assignKey=Symbol(`_assign`);function castValue(e,t,n){return t&&(e=e.trim()),n&&(e=looseToNumber(e)),e}var vModelText={created(e,{modifiers:{lazy:t,trim:n,number:r}},a){e[assignKey]=getModelAssigner(a);let o=r||a.props&&a.props.type===`number`;addEventListener(e,t?`change`:`input`,t=>{t.target.composing||e[assignKey](castValue(e.value,n,o))}),(n||o)&&addEventListener(e,`change`,()=>{e.value=castValue(e.value,n,o)}),t||(addEventListener(e,`compositionstart`,onCompositionStart),addEventListener(e,`compositionend`,onCompositionEnd),addEventListener(e,`change`,onCompositionEnd))},mounted(e,{value:t}){e.value=t??``},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:a,number:o}},s){if(e[assignKey]=getModelAssigner(s),e.composing)return;let c=(o||e.type===`number`)&&!/^0\d/.test(e.value)?looseToNumber(e.value):e.value,l=t??``;if(c===l)return;let u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!==`range`&&(r&&t===n||a&&e.value.trim()===l)||(e.value=l)}},vModelCheckbox={deep:!0,created(e,t,n){e[assignKey]=getModelAssigner(n),addEventListener(e,`change`,()=>{let t=e._modelValue,n=getValue(e),r=e.checked,a=e[assignKey];if(isArray(t)){let e=looseIndexOf(t,n),o=e!==-1;if(r&&!o)a(t.concat(n));else if(!r&&o){let n=[...t];n.splice(e,1),a(n)}}else if(isSet(t)){let e=new Set(t);r?e.add(n):e.delete(n),a(e)}else a(getCheckboxValue(e,r))})},mounted:setChecked,beforeUpdate(e,t,n){e[assignKey]=getModelAssigner(n),setChecked(e,t,n)}};function setChecked(e,{value:t,oldValue:n},r){e._modelValue=t;let a;if(isArray(t))a=looseIndexOf(t,r.props.value)>-1;else if(isSet(t))a=t.has(r.props.value);else{if(t===n)return;a=looseEqual(t,getCheckboxValue(e,!0))}e.checked!==a&&(e.checked=a)}var vModelSelect={deep:!0,created(e,{value:t,modifiers:{number:n}},r){let a=isSet(t);addEventListener(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?looseToNumber(getValue(e)):getValue(e));e[assignKey](e.multiple?a?new Set(t):t:t[0]),e._assigning=!0,nextTick(()=>{e._assigning=!1})}),e[assignKey]=getModelAssigner(r)},mounted(e,{value:t}){setSelected(e,t)},beforeUpdate(e,t,n){e[assignKey]=getModelAssigner(n)},updated(e,{value:t}){e._assigning||setSelected(e,t)}};function setSelected(e,t){let n=e.multiple,r=isArray(t);if(!n||r||isSet(t)){for(let a=0,o=e.options.length;a<o;a++){let o=e.options[a],s=getValue(o);if(n){if(r){let e=typeof s;o.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(s)):looseIndexOf(t,s)>-1}else o.selected=t.has(s)}else if(looseEqual(getValue(o),t)){e.selectedIndex!==a&&(e.selectedIndex=a);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function getValue(e){return`_value`in e?e._value:e.value}function getCheckboxValue(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var systemModifiers=[`ctrl`,`shift`,`alt`,`meta`],modifierGuards={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>systemModifiers.some(n=>e[`${n}Key`]&&!t.includes(n))},withModifiers=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=modifierGuards[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},rendererOptions=extend({patchProp},nodeOps),renderer;function ensureRenderer(){return renderer||=createRenderer(rendererOptions)}var createApp=((...e)=>{let t=ensureRenderer().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=normalizeContainer(e);if(!r)return;let a=t._component;isFunction(a)||a.render||a.template||(a.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let o=n(r,!1,resolveRootNamespace(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),o},t});function resolveRootNamespace(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function normalizeContainer(e){return isString(e)?document.querySelector(e):e}function getLens(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function byteLength(e){var t=getLens(e),n=t[0],r=t[1];return(n+r)*3/4-r}function _byteLength(e,t,n){return(t+n)*3/4-n}function toByteArray(e){for(var t,n=getLens(e),r=n[0],a=n[1],o=new Arr(_byteLength(e,r,a)),s=0,c=a>0?r-4:r,l=0;l<c;l+=4)t=revLookup[e.charCodeAt(l)]<<18|revLookup[e.charCodeAt(l+1)]<<12|revLookup[e.charCodeAt(l+2)]<<6|revLookup[e.charCodeAt(l+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return a===2&&(t=revLookup[e.charCodeAt(l)]<<2|revLookup[e.charCodeAt(l+1)]>>4,o[s++]=t&255),a===1&&(t=revLookup[e.charCodeAt(l)]<<10|revLookup[e.charCodeAt(l+1)]<<4|revLookup[e.charCodeAt(l+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function tripletToBase64(e){return lookup[e>>18&63]+lookup[e>>12&63]+lookup[e>>6&63]+lookup[e&63]}function encodeChunk(e,t,n){for(var r,a=[],o=t;o<n;o+=3)r=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(e[o+2]&255),a.push(tripletToBase64(r));return a.join(``)}function fromByteArray(e){for(var t,n=e.length,r=n%3,a=[],o=16383,s=0,c=n-r;s<c;s+=o)a.push(encodeChunk(e,s,s+o>c?c:s+o));return r===1?(t=e[n-1],a.push(lookup[t>>2]+lookup[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],a.push(lookup[t>>10]+lookup[t>>4&63]+lookup[t<<2&63]+`=`)),a.join(``)}var buffer,base64Js,lookup,revLookup,Arr,code,i,len,ieee754,Buffer$2,Blob$1,BlobOptions,Buffer$1,File,FileOptions,INSPECT_MAX_BYTES,SlowBuffer,TranscodeEncoding,atob$1,btoa$1,constants,isAscii,isUtf8,kMaxLength,kStringMaxLength,resolveObjectURL,transcode,init_dist=__esmMin((()=>{for(buffer={},base64Js={},base64Js.byteLength=byteLength,base64Js.toByteArray=toByteArray,base64Js.fromByteArray=fromByteArray,lookup=[],revLookup=[],Arr=typeof Uint8Array<`u`?Uint8Array:Array,code=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;revLookup[45]=62,revLookup[95]=63,ieee754={},ieee754.read=function(e,t,n,r,a){var o,s,c=a*8-r-1,l=(1<<c)-1,u=l>>1,d=-7,f=n?a-1:0,m=n?-1:1,g=e[t+f];for(f+=m,o=g&(1<<-d)-1,g>>=-d,d+=c;d>0;o=o*256+e[t+f],f+=m,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=s*256+e[t+f],f+=m,d-=8);if(o===0)o=1-u;else if(o===l)return s?NaN:(g?-1:1)*(1/0);else s+=2**r,o-=u;return(g?-1:1)*s*2**(o-r)},ieee754.write=function(e,t,n,r,a,o){var s,c,l,u=o*8-a-1,d=(1<<u)-1,f=d>>1,m=a===23?2**-24-2**-77:0,g=r?0:o-1,_=r?1:-1,v=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(c=+!!isNaN(t),s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=2**-s)<1&&(s--,l*=2),s+f>=1?t+=m/l:t+=m*2**(1-f),t*l>=2&&(s++,l/=2),s+f>=d?(c=0,s=d):s+f>=1?(c=(t*l-1)*2**a,s+=f):(c=t*2**(f-1)*2**a,s=0));a>=8;e[n+g]=c&255,g+=_,c/=256,a-=8);for(s=s<<a|c,u+=a;u>0;e[n+g]=s&255,g+=_,s/=256,u-=8);e[n+g-_]|=v*128},(function(e){let t=base64Js,n=ieee754,r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=d,e.SlowBuffer=w,e.INSPECT_MAX_BYTES=50;let a=0x7fffffff;e.kMaxLength=a;let{Uint8Array:o,ArrayBuffer:s,SharedArrayBuffer:c}=globalThis;d.TYPED_ARRAY_SUPPORT=l(),!d.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{let e=new o(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,o.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function u(e){if(e>a)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new o(e);return Object.setPrototypeOf(t,d.prototype),t}function d(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return _(e)}return f(e,t,n)}d.poolSize=8192;function f(e,t,n){if(typeof e==`string`)return v(e,t);if(s.isView(e))return b(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Z(e,s)||e&&Z(e.buffer,s)||c!==void 0&&(Z(e,c)||e&&Z(e.buffer,c)))return x(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return d.from(r,t,n);let a=S(e);if(a)return a;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return d.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}d.from=function(e,t,n){return f(e,t,n)},Object.setPrototypeOf(d.prototype,o.prototype),Object.setPrototypeOf(d,o);function m(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function g(e,t,n){return m(e),e<=0||t===void 0?u(e):typeof n==`string`?u(e).fill(t,n):u(e).fill(t)}d.alloc=function(e,t,n){return g(e,t,n)};function _(e){return m(e),u(e<0?0:C(e)|0)}d.allocUnsafe=function(e){return _(e)},d.allocUnsafeSlow=function(e){return _(e)};function v(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!d.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=T(e,t)|0,r=u(n),a=r.write(e,t);return a!==n&&(r=r.slice(0,a)),r}function y(e){let t=e.length<0?0:C(e.length)|0,n=u(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function b(e){if(Z(e,o)){let t=new o(e);return x(t.buffer,t.byteOffset,t.byteLength)}return y(e)}function x(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new o(e):n===void 0?new o(e,t):new o(e,t,n),Object.setPrototypeOf(r,d.prototype),r}function S(e){if(d.isBuffer(e)){let t=C(e.length)|0,n=u(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||me(e.length)?u(0):y(e);if(e.type===`Buffer`&&Array.isArray(e.data))return y(e.data)}function C(e){if(e>=a)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+a.toString(16)+` bytes`);return e|0}function w(e){return+e!=e&&(e=0),d.alloc(+e)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype},d.compare=function(e,t){if(Z(e,o)&&(e=d.from(e,e.offset,e.byteLength)),Z(t,o)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let a=0,o=Math.min(n,r);a<o;++a)if(e[a]!==t[a]){n=e[a],r=t[a];break}return n<r?-1:+(r<n)},d.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},d.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return d.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=d.allocUnsafe(t),a=0;for(n=0;n<e.length;++n){let t=e[n];if(Z(t,o))a+t.length>r.length?(d.isBuffer(t)||(t=d.from(t)),t.copy(r,a)):o.prototype.set.call(r,t,a);else if(d.isBuffer(t))t.copy(r,a);else throw TypeError(`"list" argument must be an Array of Buffers`);a+=t.length}return r};function T(e,t){if(d.isBuffer(e))return e.length;if(s.isView(e)||Z(e,s))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let a=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return X(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return fe(e).length;default:if(a)return r?-1:X(e).length;t=(``+t).toLowerCase(),a=!0}}d.byteLength=T;function E(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return B(this,t,n);case`utf8`:case`utf-8`:return I(this,t,n);case`ascii`:return R(this,t,n);case`latin1`:case`binary`:return z(this,t,n);case`base64`:return F(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return V(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}d.prototype._isBuffer=!0;function D(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}d.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)D(this,t,t+1);return this},d.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)D(this,t,t+3),D(this,t+1,t+2);return this},d.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)D(this,t,t+7),D(this,t+1,t+6),D(this,t+2,t+5),D(this,t+3,t+4);return this},d.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?I(this,0,e):E.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(e){if(!d.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||d.compare(this,e)===0},d.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(d.prototype[r]=d.prototype.inspect),d.prototype.compare=function(e,t,n,r,a){if(Z(e,o)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),a===void 0&&(a=this.length),t<0||n>e.length||r<0||a>this.length)throw RangeError(`out of range index`);if(r>=a&&t>=n)return 0;if(r>=a)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,a>>>=0,this===e)return 0;let s=a-r,c=n-t,l=Math.min(s,c),u=this.slice(r,a),f=e.slice(t,n);for(let e=0;e<l;++e)if(u[e]!==f[e]){s=u[e],c=f[e];break}return s<c?-1:+(c<s)};function O(e,t,n,r,a){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>0x7fffffff?n=0x7fffffff:n<-0x80000000&&(n=-0x80000000),n=+n,me(n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(a)n=0;else return-1}if(typeof t==`string`&&(t=d.from(t,r)),d.isBuffer(t))return t.length===0?-1:k(e,t,n,r,a);if(typeof t==`number`)return t&=255,typeof o.prototype.indexOf==`function`?a?o.prototype.indexOf.call(e,t,n):o.prototype.lastIndexOf.call(e,t,n):k(e,[t],n,r,a);throw TypeError(`val must be string, number or Buffer`)}function k(e,t,n,r,a){let o=1,s=e.length,c=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,n/=2}function l(e,t){return o===1?e[t]:e.readUInt16BE(t*o)}let u;if(a){let r=-1;for(u=n;u<s;u++)if(l(e,u)===l(t,r===-1?0:u-r)){if(r===-1&&(r=u),u-r+1===c)return r*o}else r!==-1&&(u-=u-r),r=-1}else for(n+c>s&&(n=s-c),u=n;u>=0;u--){let n=!0;for(let r=0;r<c;r++)if(l(e,u+r)!==l(t,r)){n=!1;break}if(n)return u}return-1}d.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},d.prototype.indexOf=function(e,t,n){return O(this,e,t,n,!0)},d.prototype.lastIndexOf=function(e,t,n){return O(this,e,t,n,!1)};function A(e,t,n,r){n=Number(n)||0;let a=e.length-n;r?(r=Number(r),r>a&&(r=a)):r=a;let o=t.length;r>o/2&&(r=o/2);let s=0;for(;s<r;++s){let r=parseInt(t.substr(s*2,2),16);if(me(r))return s;e[n+s]=r}return s}function j(e,t,n,r){return pe(X(t,e.length-n),e,n,r)}function M(e,t,n,r){return pe(ue(t),e,n,r)}function ee(e,t,n,r){return pe(fe(t),e,n,r)}function P(e,t,n,r){return pe(de(t,e.length-n),e,n,r)}d.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let a=this.length-t;if((n===void 0||n>a)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let o=!1;for(;;)switch(r){case`hex`:return A(this,e,t,n);case`utf8`:case`utf-8`:return j(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return M(this,e,t,n);case`base64`:return ee(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return P(this,e,t,n);default:if(o)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),o=!0}},d.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function F(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function I(e,t,n){n=Math.min(e.length,n);let r=[],a=t;for(;a<n;){let t=e[a],o=null,s=t>239?4:t>223?3:t>191?2:1;if(a+s<=n){let n,r,c,l;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[a+1],(n&192)==128&&(l=(t&31)<<6|n&63,l>127&&(o=l));break;case 3:n=e[a+1],r=e[a+2],(n&192)==128&&(r&192)==128&&(l=(t&15)<<12|(n&63)<<6|r&63,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:n=e[a+1],r=e[a+2],c=e[a+3],(n&192)==128&&(r&192)==128&&(c&192)==128&&(l=(t&15)<<18|(n&63)<<12|(r&63)<<6|c&63,l>65535&&l<1114112&&(o=l))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),a+=s}return L(r)}let te=4096;function L(e){let t=e.length;if(t<=te)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=te));return n}function R(e,t,n){let r=``;n=Math.min(e.length,n);for(let a=t;a<n;++a)r+=String.fromCharCode(e[a]&127);return r}function z(e,t,n){let r=``;n=Math.min(e.length,n);for(let a=t;a<n;++a)r+=String.fromCharCode(e[a]);return r}function B(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let a=``;for(let r=t;r<n;++r)a+=Q[e[r]];return a}function V(e,t,n){let r=e.slice(t,n),a=``;for(let e=0;e<r.length-1;e+=2)a+=String.fromCharCode(r[e]+r[e+1]*256);return a}d.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,d.prototype),r};function H(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=this[e],a=1,o=0;for(;++o<t&&(a*=256);)r+=this[e+o]*a;return r},d.prototype.readUintBE=d.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=this[e+--t],a=1;for(;t>0&&(a*=256);)r+=this[e+--t]*a;return r},d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e>>>=0,t||H(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||H(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||H(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||H(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||H(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=$(function(e){e>>>=0,oe(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&se(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,a=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(a)<<BigInt(32))}),d.prototype.readBigUInt64BE=$(function(e){e>>>=0,oe(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&se(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],a=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(a)}),d.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=this[e],a=1,o=0;for(;++o<t&&(a*=256);)r+=this[e+o]*a;return a*=128,r>=a&&(r-=2**(8*t)),r},d.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=t,a=1,o=this[e+--r];for(;r>0&&(a*=256);)o+=this[e+--r]*a;return a*=128,o>=a&&(o-=2**(8*t)),o},d.prototype.readInt8=function(e,t){return e>>>=0,t||H(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||H(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|0xffff0000:n},d.prototype.readInt16BE=function(e,t){e>>>=0,t||H(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|0xffff0000:n},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||H(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||H(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=$(function(e){e>>>=0,oe(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&se(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),d.prototype.readBigInt64BE=$(function(e){e>>>=0,oe(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&se(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),d.prototype.readFloatLE=function(e,t){return e>>>=0,t||H(e,4,this.length),n.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||H(e,4,this.length),n.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||H(e,8,this.length),n.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||H(e,8,this.length),n.read(this,e,!1,52,8)};function U(e,t,n,r,a,o){if(!d.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>a||t<o)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;U(this,e,t,n,r,0)}let a=1,o=0;for(this[t]=e&255;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;U(this,e,t,n,r,0)}let a=n-1,o=1;for(this[t+a]=e&255;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,1,255,0),this[t]=e&255,t+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function W(e,t,n,r,a){ae(t,r,a,e,n,7);let o=Number(t&BigInt(0xffffffff));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function G(e,t,n,r,a){ae(t,r,a,e,n,7);let o=Number(t&BigInt(0xffffffff));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}d.prototype.writeBigUInt64LE=$(function(e,t=0){return W(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeBigUInt64BE=$(function(e,t=0){return G(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);U(this,e,t,n,r-1,-r)}let a=0,o=1,s=0;for(this[t]=e&255;++a<n&&(o*=256);)e<0&&s===0&&this[t+a-1]!==0&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},d.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);U(this,e,t,n,r-1,-r)}let a=n-1,o=1,s=0;for(this[t+a]=e&255;--a>=0&&(o*=256);)e<0&&s===0&&this[t+a+1]!==0&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},d.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},d.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,0x7fffffff,-0x80000000),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},d.prototype.writeBigInt64LE=$(function(e,t=0){return W(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),d.prototype.writeBigInt64BE=$(function(e,t=0){return G(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function K(e,t,n,r,a,o){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function q(e,t,r,a,o){return t=+t,r>>>=0,o||K(e,t,r,4),n.write(e,t,r,a,23,4),r+4}d.prototype.writeFloatLE=function(e,t,n){return q(this,e,t,!0,n)},d.prototype.writeFloatBE=function(e,t,n){return q(this,e,t,!1,n)};function J(e,t,r,a,o){return t=+t,r>>>=0,o||K(e,t,r,8),n.write(e,t,r,a,52,8),r+8}d.prototype.writeDoubleLE=function(e,t,n){return J(this,e,t,!0,n)},d.prototype.writeDoubleBE=function(e,t,n){return J(this,e,t,!1,n)},d.prototype.copy=function(e,t,n,r){if(!d.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let a=r-n;return this===e&&typeof o.prototype.copyWithin==`function`?this.copyWithin(t,n,r):o.prototype.set.call(e,this.subarray(n,r),t),a},d.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!d.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let a;if(typeof e==`number`)for(a=t;a<n;++a)this[a]=e;else{let o=d.isBuffer(e)?e:d.from(e,r),s=o.length;if(s===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};let Y={};function ne(e,t,n){Y[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}ne(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),ne(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),ne(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,a=n;return Number.isInteger(n)&&Math.abs(n)>2**32?a=re(String(n)):typeof n==`bigint`&&(a=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(a=re(a)),a+=`n`),r+=` It must be ${t}. Received ${a}`,r},RangeError);function re(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function ie(e,t,n){oe(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&se(t,e.length-(n+1))}function ae(e,t,n,r,a,o){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,a;throw a=o>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(o+1)*8}${r}`:`>= -(2${r} ** ${(o+1)*8-1}${r}) and < 2 ** ${(o+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new Y.ERR_OUT_OF_RANGE(`value`,a,e)}ie(r,a,o)}function oe(e,t){if(typeof e!=`number`)throw new Y.ERR_INVALID_ARG_TYPE(t,`number`,e)}function se(e,t,n){throw Math.floor(e)===e?t<0?new Y.ERR_BUFFER_OUT_OF_BOUNDS:new Y.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(oe(e,n),new Y.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ce=/[^+/0-9A-Za-z-_]/g;function le(e){if(e=e.split(`=`)[0],e=e.trim().replace(ce,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function X(e,t){t||=1/0;let n,r=e.length,a=null,o=[];for(let s=0;s<r;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!a){if(n>56319||s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}a=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),a=n;continue}n=(a-55296<<10|n-56320)+65536}else a&&(t-=3)>-1&&o.push(239,191,189);if(a=null,n<128){if(--t<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return o}function ue(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function de(e,t){let n,r,a,o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,a=n%256,o.push(a),o.push(r);return o}function fe(e){return t.toByteArray(le(e))}function pe(e,t,n,r){let a=0;for(;a<r&&!(a+n>=t.length||a>=e.length);++a)t[a+n]=e[a];return a}function Z(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function me(e){return e!==e}let Q=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let a=0;a<16;++a)t[r+a]=e[n]+e[a]}return t})();function $(e){return typeof BigInt>`u`?he:e}function he(){throw Error(`BigInt not supported`)}})(buffer),Buffer$2=buffer.Buffer,Blob$1=buffer.Blob,BlobOptions=buffer.BlobOptions,Buffer$1=buffer.Buffer,File=buffer.File,FileOptions=buffer.FileOptions,INSPECT_MAX_BYTES=buffer.INSPECT_MAX_BYTES,SlowBuffer=buffer.SlowBuffer,TranscodeEncoding=buffer.TranscodeEncoding,atob$1=buffer.atob,btoa$1=buffer.btoa,constants=buffer.constants,isAscii=buffer.isAscii,isUtf8=buffer.isUtf8,kMaxLength=buffer.kMaxLength,kStringMaxLength=buffer.kStringMaxLength,resolveObjectURL=buffer.resolveObjectURL,transcode=buffer.transcode})),IS_CLIENT=typeof window<`u`,activePinia,setActivePinia=e=>activePinia=e,piniaSymbol=Symbol();function isPlainObject$1(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var _global=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global$1==`object`&&global$1.global===global$1?global$1:typeof globalThis==`object`?globalThis:{HTMLElement:null};function bom(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function download(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){saveAs(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function corsEnabled(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function click(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var _navigator=typeof navigator==`object`?navigator:{userAgent:``},isMacOSWebView=/Macintosh/.test(_navigator.userAgent)&&/AppleWebKit/.test(_navigator.userAgent)&&!/Safari/.test(_navigator.userAgent),saveAs=IS_CLIENT?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!isMacOSWebView?downloadSaveAs:`msSaveOrOpenBlob`in _navigator?msSaveAs:fileSaverSaveAs:()=>{};function downloadSaveAs(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?click(r):corsEnabled(r.href)?download(e,t,n):(r.target=`_blank`,click(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){click(r)},0))}function msSaveAs(e,t=`download`,n){if(typeof e==`string`){if(corsEnabled(e))download(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){click(t)})}}else navigator.msSaveOrOpenBlob(bom(e,n),t)}function fileSaverSaveAs(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return download(e,t,n);let a=e.type===`application/octet-stream`,o=/constructor/i.test(String(_global.HTMLElement))||`safari`in _global,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||a&&o||isMacOSWebView)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=s?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:assign$1}=Object;function createPinia(){let e=effectScope(!0),t=e.run(()=>ref({})),n=[],r=[],a=markRaw({install(e){setActivePinia(a),a._a=e,e.provide(piniaSymbol,a),e.config.globalProperties.$pinia=a,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return a}var noop$1=()=>{};function addSubscription(e,t,n,r=noop$1){e.add(t);let a=()=>{e.delete(t)&&r()};return!n&&getCurrentScope()&&onScopeDispose(a),a}function triggerSubscriptions(e,...t){e.forEach(e=>{e(...t)})}var fallbackRunWithContext=e=>e(),ACTION_MARKER=Symbol(),ACTION_NAME=Symbol();function mergeReactiveObjects(e,t){e instanceof Map&&t instanceof Map?t.forEach((t,n)=>e.set(n,t)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(let n in t){if(!Object.hasOwn(t,n))continue;let r=t[n],a=e[n];if(isPlainObject$1(a)&&isPlainObject$1(r)&&Object.hasOwn(e,n)&&!isRef(r)&&!isReactive(r)){e[n]=mergeReactiveObjects(a,r);let t=toRaw(e)[n];isRef(t)&&isShallow(t)&&triggerRef(t)}else e[n]=r}return e}var skipHydrateSymbol=Symbol();function shouldHydrate(e){return!e||typeof e!=`object`||!Object.hasOwn(e,skipHydrateSymbol)}var{assign}=Object;function isComputed(e){return!!(isRef(e)&&e.effect)}function createOptionsStore(e,t,n,r){let{state:a,actions:o,getters:s}=t,c=n.state.value[e],l;function u(){return c||(n.state.value[e]=a?a():{}),assign(toRefs(n.state.value[e]),o,Object.keys(s||{}).reduce((t,r)=>(t[r]=markRaw(computed(()=>{setActivePinia(n);let t=n._s.get(e);return s[r].call(t,t)})),t),{}))}return l=createSetupStore(e,u,t,n,r,!0),l}function createSetupStore(e,t,n={},r,a,o){let s,c=assign({actions:{}},n),l={deep:!0},u,d,f=new Set,m=new Set,g,_=r.state.value[e];!o&&!_&&(r.state.value[e]={});let v;function y(t){let n;u=d=!1,typeof t==`function`?(t(r.state.value[e]),n={type:`patch function`,storeId:e,events:g}):(mergeReactiveObjects(r.state.value[e],t),n={type:`patch object`,payload:t,storeId:e,events:g});let a=v=Symbol();nextTick().then(()=>{v===a&&(u=!0)}),d=!0,triggerSubscriptions(f,n,r.state.value[e])}let b=o?function(){let{state:e}=n,t=e?e():{};this.$patch(e=>{assign(e,t)})}:noop$1;function x(){s.stop(),f.clear(),m.clear(),r._s.delete(e)}let S=(t,n=``)=>{if(ACTION_MARKER in t)return t[ACTION_NAME]=n,t;let a=function(){setActivePinia(r);let n=Array.from(arguments),o=new Set,s=new Set;function c(e){o.add(e)}function l(e){s.add(e)}triggerSubscriptions(m,{args:n,name:a[ACTION_NAME],store:C,after:c,onError:l});let u;try{u=t.apply(this&&this.$id===e?this:C,n)}catch(e){throw triggerSubscriptions(s,e),e}return u instanceof Promise?u.then(e=>(triggerSubscriptions(o,e),e)).catch(e=>(triggerSubscriptions(s,e),Promise.reject(e))):(triggerSubscriptions(o,u),u)};return a[ACTION_MARKER]=!0,a[ACTION_NAME]=n,a},C=reactive({_p:r,$id:e,$onAction:addSubscription.bind(null,m),$patch:y,$reset:b,$subscribe(t,n={}){if(f.has(t))return noop$1;let a=addSubscription(f,t,n.detached,()=>o()),o=s.run(()=>watch(()=>r.state.value[e],r=>{(n.flush===`sync`?d:u)&&t({storeId:e,type:`direct`,events:g},r)},assign({},l,n)));return a},$dispose:x});r._s.set(e,C);let w=(r._a&&r._a.runWithContext||fallbackRunWithContext)(()=>r._e.run(()=>(s=effectScope()).run(()=>t({action:S}))));for(let t in w){let n=w[t];isRef(n)&&!isComputed(n)||isReactive(n)?o||(_&&shouldHydrate(n)&&(isRef(n)?n.value=_[t]:((n instanceof Set||n instanceof Map)&&n.clear(),mergeReactiveObjects(n,_[t]))),r.state.value[e][t]=n):typeof n==`function`&&(w[t]=S(n,t),c.actions[t]=n)}return assign(C,w),assign(toRaw(C),w),Object.defineProperty(C,"$state",{get:()=>r.state.value[e],set:e=>{y(t=>{assign(t,e)})}}),r._p.forEach(e=>{let t=s.run(()=>e({store:C,app:r._a,pinia:r,options:c}));assign(C,t)}),_&&o&&n.hydrate&&n.hydrate(C.$state,_),u=!0,d=!0,C}function defineStore(e,t,n){let r,a=typeof t==`function`;r=a?n:t;function o(n,o){let s=hasInjectionContext();return n||=s?inject(piniaSymbol,null):null,n&&setActivePinia(n),n=activePinia,n._s.has(e)||(a?createSetupStore(e,t,r,n):createOptionsStore(e,r,n)),n._s.get(e)}return o.$id=e,o}function num(e,t){let n=e.trim();if(n===``)return t;let r=Number(n);return Number.isFinite(r)?r:t}function parseFxTheme(e){let t=t=>(e(t)??``).trim();return{dot:t(`--hq-fx-dot`),text:t(`--hq-text`),muted:t(`--hq-text-muted`),accent:t(`--hq-accent`),ok:t(`--hq-correct`),ko:t(`--hq-wrong`),choices:[t(`--hq-choice-a`),t(`--hq-choice-b`),t(`--hq-choice-c`),t(`--hq-choice-d`)],lineOpacity:num(t(`--hq-fx-line-opacity`),.2),glow:num(t(`--hq-fx-glow`),.3),dustDensity:num(t(`--hq-fx-dust-density`),1),dustAlpha:num(t(`--hq-fx-dust-alpha`),1),speed:num(t(`--hq-fx-speed`),1),pixel:num(t(`--hq-fx-pixel`),0)>0,fontLabel:t(`--hq-font-label`),fontDisplay:t(`--hq-font-display`),labelSpacing:t(`--hq-label-spacing`)}}function readFxTheme(e){let t=getComputedStyle(e);return parseFxTheme(e=>t.getPropertyValue(e))}var MAX_DT=.05,REDUCED_QUERY=`(prefers-reduced-motion: reduce)`;function mountScene(e,t,n){let r=e.getContext(`2d`);if(!r)throw Error(`mountScene: 2D canvas context unavailable`);let a=typeof matchMedia==`function`?matchMedia(REDUCED_QUERY):null,o={ctx:r,w:0,h:0,t:0,dt:0,theme:readFxTheme(e),reduced:a?.matches??!1},s,c=0,l=0,u=0,d=!1,f=!1;function m(){let t=e.clientWidth,n=e.clientHeight,a=window.devicePixelRatio||1;return t===o.w&&n===o.h&&a===u?!1:(o.w=t,o.h=n,u=a,e.width=Math.round(t*a),e.height=Math.round(n*a),r.setTransform(a,0,0,a,0,0),!0)}function g(){o.t=0,o.dt=0,s=t.init(o,n())}function _(e){c=0,o.dt=Math.min(Math.max((e-l)/1e3,0),MAX_DT)*o.theme.speed,l=e,o.t+=o.dt,r.clearRect(0,0,o.w,o.h);try{t.draw(o,s,n())}catch(e){f||console.error(`fx scene draw failed`,e),f=!0}v()}function v(){d||c||document.visibilityState===`hidden`||(c=requestAnimationFrame(_))}function y(){c&&cancelAnimationFrame(c),c=0}function b(){document.visibilityState===`hidden`?y():(l=performance.now(),v())}function x(e){o.reduced=e.matches}let S=new ResizeObserver(()=>{let e=o.w===0||o.h===0;m()&&e&&g()});return m(),g(),l=performance.now(),S.observe(e),document.addEventListener(`visibilitychange`,b),a?.addEventListener(`change`,x),v(),{restart(){d||(m(),g())},refreshTheme(){d||(o.theme=readFxTheme(e))},destroy(){d||(d=!0,y(),S.disconnect(),document.removeEventListener(`visibilitychange`,b),a?.removeEventListener(`change`,x))}}}var MAX_DOTS=30,DANGER_SECONDS=4;function countdownState(e,t){let n=Math.max(0,Math.min(Math.floor(t),MAX_DOTS)),r=t>0?e/t:0,a=Math.min(Math.max(r,0),1);return{dots:n,lit:Math.ceil(a*n),danger:e>0&&e<=DANGER_SECONDS,fraction:a,seconds:Math.max(0,Math.ceil(e))}}var GOLDEN_ANGLE=2.39996,SPIRAL_X=1.35,SPIRAL_Y=.75,spiralRadius=(e,t)=>t*1.3*Math.sqrt(e+.6);function spiralSlot(e,t,n,r){let a=e*GOLDEN_ANGLE+.5,o=spiralRadius(e,r);return{x:t+Math.cos(a)*o*SPIRAL_X,y:n+Math.sin(a)*o*SPIRAL_Y}}function spiralUnit(e,t,n,r=.05){let a=r*Math.max(Math.min(t,n),0),o=spiralRadius(Math.max(e-1,0),1),s=.45*Math.max(t,0)/(o*SPIRAL_X),c=.45*Math.max(n,0)/(o*SPIRAL_Y);return Math.min(a,s,c)}var CHECK_SHAPE=[[-.5,0],[-.15,.35],[.5,-.4]];function checkPoints(e,t,n,r){let a=[],o=0;for(let e=0;e<CHECK_SHAPE.length-1;e++){let[t,n]=CHECK_SHAPE[e],[r,s]=CHECK_SHAPE[e+1],c=Math.hypot(r-t,s-n);a.push(c),o+=c}return Array.from({length:Math.max(e,0)},(s,c)=>{let l=(e<=1?0:c/(e-1))*o,u=0;for(;u<a.length-1&&l>a[u];)l-=a[u],u++;let d=a[u]>0?l/a[u]:0,[f,m]=CHECK_SHAPE[u],[g,_]=CHECK_SHAPE[u+1];return{x:t+(f+(g-f)*d)*r,y:n+(m+(_-m)*d)*r}})}function crossPoints(e,t,n,r){let a=Math.max(e,0),o=Math.ceil(a/2),s=r/2,c=(e,r,a)=>Array.from({length:e},(o,c)=>{let l=e<=1?0:c/(e-1);return{x:t+r+(a-r)*l,y:n-s+2*s*l}});return[...c(o,-s,s),...c(a-o,s,-s)]}function verdictLinks(e,t){let n=Math.max(t,0),r=(e,t)=>Array.from({length:Math.max(t-e-1,0)},(t,n)=>[e+n,e+n+1]);if(e===`check`)return r(0,n);let a=Math.ceil(n/2);return[...r(0,a),...r(a,n)]}function hourglassHalfWidth(e){return .06+.74*Math.min(Math.abs(e),1)}function hourglassSlots(e){let t=.15,n=[];for(let r=0;n.length<Math.max(e,0)&&r<40;r++){let a=.92-r*t*.9;if(a<=.08)break;let o=hourglassHalfWidth(a)-.07,s=Math.max(Math.floor(2*o/t)+1,1);for(let r=0;r<s&&n.length<e;r++)n.push({x:(r-(s-1)/2)*t,y:a})}return n}var PODIUM_SLOTS=[.5,.3,.7];function podiumDots(e,t=45,n=6){let r=e[0]??0;return e.slice(0,3).map(e=>r>0?Math.max(Math.round(t*e/r),n):n)}var TAU$1=Math.PI*2,clamp01=e=>Math.min(Math.max(e,0),1),rand$4=(e,t)=>e+Math.random()*(t-e);function dot(e,t,n,r,a,o){let{ctx:s}=e;if(s.globalAlpha=clamp01(a),s.fillStyle=o??e.theme.dot,e.theme.pixel){let e=Math.max(Math.round(r*2),1);s.fillRect(Math.round(t-e/2),Math.round(n-e/2),e,e)}else s.beginPath(),s.arc(t,n,Math.max(r,0),0,TAU$1),s.fill();s.globalAlpha=1}function glow(e,t,n,r,a,o){if(r<=0)return;let{ctx:s}=e,c=s.createRadialGradient(t,n,0,t,n,r);c.addColorStop(0,o),c.addColorStop(1,`transparent`),s.globalAlpha=clamp01(a*e.theme.glow),s.fillStyle=c,s.fillRect(t-r,n-r,r*2,r*2),s.globalAlpha=1}function line(e,t,n,r,a,o,s=.6,c){let{ctx:l}=e;l.globalAlpha=clamp01(o*e.theme.lineOpacity),l.strokeStyle=c??e.theme.dot,l.lineWidth=s,l.beginPath(),l.moveTo(t,n),l.lineTo(r,a),l.stroke(),l.globalAlpha=1}function spacingPx(e,t){let n=parseFloat(e);return Number.isFinite(n)?e.endsWith(`em`)&&!e.endsWith(`rem`)?n*t:n:0}function spacedText(e,t,n,r,a){let{ctx:o}=e;o.font=`${a}px ${e.theme.fontLabel}`;let s=spacingPx(e.theme.labelSpacing,a),c=[...t],l=c.map(e=>o.measureText(e).width),u=l.reduce((e,t)=>e+t,0)+s*Math.max(c.length-1,0),d=o.textAlign;o.textAlign=`left`;let f=n-u/2;c.forEach((e,t)=>{o.fillText(e,f,r),f+=l[t]+s}),o.textAlign=d}function makeDust(e,t,n){return Array.from({length:Math.max(0,Math.round(e))},()=>({x:rand$4(0,t),y:rand$4(0,n),vx:rand$4(-6,6),vy:rand$4(-6,6),r:rand$4(.4,1),a:rand$4(.06,.25)}))}var dustScale=(e,t)=>Math.min(Math.max(Math.min(e,t)/480,1),2.2);function drawDust(e,t){let{w:n,h:r,dt:a}=e,o=dustScale(n,r),s=e.theme.dustAlpha;for(let c of t)!e.reduced&&n>0&&r>0&&(c.x=((c.x+c.vx*a)%n+n)%n,c.y=((c.y+c.vy*a)%r+r)%r),dot(e,c.x,c.y,c.r*o,c.a*s)}var TAU=Math.PI*2,TOP=-Math.PI/2,rand$3=(e,t)=>e+Math.random()*(t-e);function newSparks(e){return Array.from({length:e},()=>({off:!1,x:0,y:0,vx:0,vy:0,a:1}))}var countdownScene={init(e,t){let{dots:n}=countdownState(t.remaining,t.total);return{sparks:newSparks(n)}},draw(e,t,n){let{ctx:r,theme:a,dt:o}=e,s=countdownState(n.remaining,n.total);t.sparks.length!==s.dots&&(t.sparks=newSparks(s.dots));let c=e.w/2,l=e.h/2,u=Math.min(e.w,e.h)*.42,d=u/100,f=Math.min(Math.max(s.seconds-n.remaining,0),1),m=u*(s.danger&&!e.reduced?1+.035*(1-f)**4:1),g=s.danger?a.ko:a.dot;s.danger&&glow(e,c,l,m*1.5,.2*(1-(e.reduced?0:f))**2,a.ko),r.lineWidth=1,r.strokeStyle=a.dot,r.globalAlpha=Math.min(a.lineOpacity*.4,1),r.beginPath(),r.arc(c,l,m,0,TAU),r.stroke(),s.fraction>0&&(r.strokeStyle=g,r.lineWidth=1.4,r.globalAlpha=s.danger?.65:Math.min(a.lineOpacity*2,1),r.beginPath(),r.arc(c,l,m,TOP,TOP+TAU*s.fraction),r.stroke()),r.globalAlpha=1;for(let n=0;n<s.dots;n++){let r=t.sparks[n],a=TOP+n/s.dots*TAU,u=c+Math.cos(a)*m,f=l+Math.sin(a)*m;if(n<s.lit)r.off=!1,r.a=1,glow(e,u,f,Math.max(7,10*d),.8,g),dot(e,u,f,Math.max(1.8,2.6*d),1,g);else{if(!r.off){r.off=!0,r.x=u,r.y=f;let e=rand$3(25,45)*d;r.vx=Math.cos(a)*e+rand$3(-8,8)*d,r.vy=Math.sin(a)*e+rand$3(-8,8)*d}e.reduced?(r.a=Math.max(0,r.a-o*1.5),dot(e,u,f,Math.max(1.8,2.6*d),r.a,g)):(r.x+=r.vx*o,r.y+=r.vy*o,r.vx*=.985,r.vy*=.985,r.a=Math.max(0,r.a-o*.45),dot(e,r.x,r.y,Math.max(1,1.4*d),r.a*.6,g))}}}},_hoisted_1$14=[`aria-label`],_hoisted_2$13={class:`fx-countdown__num`,"aria-hidden":`true`},FxCountdown_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxCountdown`,props:{total:{},remaining:{},size:{}},setup(e){let t=e,n=ref(null),r=computed(()=>countdownState(t.remaining,t.total)),a=null;return onMounted(()=>{n.value&&(a=mountScene(n.value,countdownScene,()=>({total:t.total,remaining:t.remaining})))}),watch(()=>t.total,()=>a?.restart()),onBeforeUnmount(()=>a?.destroy()),(t,a)=>(openBlock(),createElementBlock(`div`,{class:normalizeClass([`fx-countdown`,[`fx-countdown--${e.size??`compact`}`,{"fx-countdown--danger":r.value.danger}]]),role:`timer`,"aria-live":`off`,"aria-label":`${e.remaining.toFixed(1)} seconds remaining`},[createBaseVNode(`canvas`,{ref_key:`canvas`,ref:n,class:`fx-countdown__canvas`,"aria-hidden":`true`},null,512),createBaseVNode(`span`,_hoisted_2$13,toDisplayString(r.value.seconds),1)],10,_hoisted_1$14))}}),_plugin_vue_export_helper_default=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},FxCountdown_default=_plugin_vue_export_helper_default(FxCountdown_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-80535576`]]),BrandLogo_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`BrandLogo`,props:{centered:{type:Boolean},inline:{type:Boolean}},setup(e){return(t,n)=>(openBlock(),createElementBlock(`svg`,{class:normalizeClass([`hq-logo`,{"hq-logo--center":e.centered,"hq-logo--inline":e.inline}]),viewBox:`0 0 1952 832`,role:`img`,"aria-label":`HashQuiz`},[...n[0]||=[createBaseVNode(`path`,{class:`hq-logo__hash-back`,d:`M544 407 517 532 645 532 672 407ZM27 407 0 532 129 533 102 659 230 659 285 406ZM82 154 55 279 183 279 210 154ZM497 27 470 153 597 154 570 280 700 279 727 154 598 153 625 27ZM239 27 212 153 340 153 367 27Z`},null,-1),createBaseVNode(`path`,{class:`hq-logo__hash-front`,d:`M1840 419 1816 526 1927 526 1951 419ZM212 154 157 405 285 405 313 280 438 280 412 406 286 407 258 532 386 532 360 659 480 659 464 741 581 741 562 830 691 830 718 705 601 705 619 615 498 614 596 154Z`},null,-1),createBaseVNode(`path`,{class:`hq-logo__text`,d:`M1400 149 1399 248 1597 248 1598 280 1552 281 1551 315 1510 315 1508 351 1469 351 1467 386 1434 387 1432 420 1398 421 1399 525 1741 526 1765 418 1597 417 1596 390 1598 387 1642 387 1644 350 1684 349 1687 314 1725 314 1727 279 1762 279 1762 149ZM1234 149 1231 153 1231 526 1346 526 1349 524 1350 500 1349 150ZM782 149 781 458 817 459 818 492 850 493 850 526 1109 526 1109 494 1141 492 1141 460 1177 458 1177 149 1059 149 1058 414 901 414 900 150ZM1231 1 1233 108 1349 109 1349 1Z`},null,-1)]],2))}}),BrandLogo_default=_plugin_vue_export_helper_default(BrandLogo_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-0397f988`]]),seed=e=>makeDust(70*Math.min(Math.max(e.w*e.h/921600,.3),1.6)*e.theme.dustDensity,e.w,e.h),backdropScene={init(e){return{dust:seed(e),w:e.w,h:e.h}},draw(e,t){(e.w!==t.w||e.h!==t.h)&&(t.dust=seed(e),t.w=e.w,t.h=e.h),drawDust(e,t.dust)}},FxBackdrop_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxBackdrop`,setup(e){let t=ref(null),n=null;return onMounted(()=>{t.value&&(n=mountScene(t.value,backdropScene,()=>({})))}),onBeforeUnmount(()=>n?.destroy()),(e,n)=>(openBlock(),createElementBlock(`canvas`,{ref_key:`canvas`,ref:t,class:`fx-backdrop`,"aria-hidden":`true`},null,512))}}),FxBackdrop_default=_plugin_vue_export_helper_default(FxBackdrop_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-b3f1f5c8`]]),N$1=18,RELEASE_S=3.4,FALL_S=.9,FLIP_AT=4.9,FLIP_S=.8,PERIOD=5.8,ease$4=e=>1-(1-clamp01(e))**3,easeIn=e=>clamp01(e)*clamp01(e),OUTLINE=[[-.8,-1],[.8,-1],[.06,0],[.8,1],[-.8,1],[-.06,0]],hourglassScene={init(){return null},draw(e){let{w:t,h:n,theme:r,reduced:a}=e,o=Math.min(t*.5,n*.5)*.92,s=t/2,c=n/2,l=a?0:e.t%PERIOD,u=a?0:Math.PI*ease$4((l-FLIP_AT)/FLIP_S),d=Math.cos(u),f=Math.sin(u),m=(e,t)=>[s+(e*d-t*f)*o,c+(e*f+t*d)*o],g=OUTLINE.map(([e,t])=>m(e,t));for(let t=0;t<g.length;t++){let n=g[t],r=g[(t+1)%g.length];line(e,n[0],n[1],r[0],r[1],2.5,1)}for(let t of g)dot(e,t[0],t[1],1.6,.7);let _=hourglassSlots(N$1),v=Math.max(o*.07,1.2);for(let t=0;t<N$1;t++){let n=_[t],o=_[17-t],s,c;if(a){let e=t<N$1/2;s=e?n.x:-o.x,c=e?n.y:-o.y}else{let e=(l-t/17*RELEASE_S)/FALL_S;if(e<=0)s=-o.x,c=-o.y;else if(e>=1)s=n.x,c=n.y;else if(e<.3){let t=easeIn(e/.3);s=-o.x*(1-t),c=-o.y*(1-t)}else{let t=easeIn((e-.3)/.7);s=n.x*t,c=n.y*t}}let[u,d]=m(s,c);glow(e,u,d,v*3,.5,r.dot),dot(e,u,d,v,.95)}}},FxHourglass_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxHourglass`,setup(e){let t=ref(null),n=null;return onMounted(()=>{t.value&&(n=mountScene(t.value,hourglassScene,()=>({})))}),onBeforeUnmount(()=>n?.destroy()),(e,n)=>(openBlock(),createElementBlock(`canvas`,{ref_key:`canvas`,ref:t,class:`fx-hourglass`,"aria-hidden":`true`},null,512))}}),FxHourglass_default=_plugin_vue_export_helper_default(FxHourglass_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-faf42b14`]]),LAND_DIST=2,APPROACH_RATE=3.2,RIPPLE_S=1.1,LINK_FADE_S=.8,LEAVE_S=.8,APPEAR_S=.6,LABEL_RATE=4,rand$2=(e,t)=>e+Math.random()*(t-e),ease$3=e=>1-(1-clamp01(e))**3,scaleOf=e=>Math.min(Math.max(Math.min(e.w,e.h)/370,.8),2.6);function freeSlot(e){let t=new Set;for(let n of e.values())n.leaving===null&&t.add(n.slot);let n=0;for(;t.has(n);)n++;return n}function unitFor(e,t,n){let r=0;for(let e of t.values())r=Math.max(r,e.slot+1);return spiralUnit(Math.max(r,1),e.w,e.h,n)}function target(e,t,n){return spiralSlot(t.slot,e.w/2,e.h/2,n)}function addDot(e,t,n,r){let a=freeSlot(t.dots),o={id:n.id,pseudo:n.pseudo,slot:a,seq:t.seq++,x:0,y:0,link:null,born:e.t,landed:null,leaving:null,label:0};t.dots.set(n.id,o);let s=unitFor(e,t.dots,t.spread),c=target(e,o,s),l=1/0;for(let n of t.dots.values()){if(n===o||n.leaving!==null)continue;let t=target(e,n,s),r=(t.x-c.x)**2+(t.y-c.y)**2;r<l&&(l=r,o.link=n.id)}if(r&&!e.reduced){let t=rand$2(0,Math.PI*2),n=Math.max(e.w,e.h)*.7;o.x=e.w/2+Math.cos(t)*n,o.y=e.h/2+Math.sin(t)*n}else o.x=c.x,o.y=c.y,o.landed=r?e.t:e.t-RIPPLE_S}var lobbyScene={init(e,t){let n={dots:new Map,seq:0,spread:t.spread};for(let r of t.players)addDot(e,n,r,r.id===t.highlightId);return n},draw(e,t,n){let{ctx:r,theme:a,t:o,dt:s}=e,c=new Set;for(let r of n.players){c.add(r.id);let n=t.dots.get(r.id);n?(n.pseudo=r.pseudo,n.leaving!==null&&(n.leaving=null)):addDot(e,t,r,!0)}for(let e of t.dots.values())!c.has(e.id)&&e.leaving===null&&(e.leaving=o),e.leaving!==null&&o-e.leaving>LEAVE_S&&t.dots.delete(e.id);let l=scaleOf(e);t.spread=n.spread;let u=unitFor(e,t.dots,t.spread),d=Math.round(Math.min(Math.max(e.h*.024,11),28)),f=[...t.dots.values()].filter(e=>e.leaving===null).sort((e,t)=>t.seq-e.seq),m=f[0],g=new Set(f.slice(0,Math.max(n.labels,0)).map(e=>e.id)),_=t=>{let n=t.leaving===null?1:1-(o-t.leaving)/LEAVE_S,r=e.reduced?(o-t.born)/APPEAR_S:1;return clamp01(n)*clamp01(r)},v=1-Math.exp(-s*APPROACH_RATE),y=new Map;for(let n of t.dots.values()){let t=target(e,n,u),r=e.reduced?t.x:t.x+Math.sin(o*.7+n.slot)*1.5,a=e.reduced?t.y:t.y+Math.cos(o*.6+n.slot*1.3)*1.5;y.set(n.id,{x:n.x,y:n.y}),e.reduced?(n.x=r,n.y=a):(n.x+=(r-n.x)*v,n.y+=(a-n.y)*v),n.landed===null&&Math.hypot(r-n.x,a-n.y)<LAND_DIST&&(n.landed=o)}for(let n of t.dots.values()){if(!n.link||n.landed===null)continue;let r=t.dots.get(n.link);if(!r||r.landed===null)continue;let a=ease$3((o-n.landed)/LINK_FADE_S)*Math.min(_(n),_(r));line(e,n.x,n.y,r.x,r.y,a,.6*l)}r.textAlign=`center`,r.textBaseline=`top`,r.font=`${d}px ${a.fontLabel}`;for(let c of t.dots.values()){let t=_(c);if(t<=0)continue;let f=c.id===n.highlightId,v=f?a.accent:a.dot;if(c.landed===null){let n=y.get(c.id),a=c.x-n.x,o=c.y-n.y,s=Math.hypot(a,o)||1,d=target(e,c,u),f=Math.min(Math.hypot(d.x-c.x,d.y-c.y)*.25,60*l),m=c.x-a/s*f,g=c.y-o/s*f,_=r.createLinearGradient(c.x,c.y,m,g);_.addColorStop(0,v),_.addColorStop(1,`transparent`),r.globalAlpha=.6*t,r.strokeStyle=_,r.lineWidth=1.2*l,r.beginPath(),r.moveTo(c.x,c.y),r.lineTo(m,g),r.stroke(),r.globalAlpha=1}else if(!e.reduced){let e=(o-c.landed)/RIPPLE_S;e<1&&(r.globalAlpha=clamp01((1-e)*.5*t),r.strokeStyle=v,r.lineWidth=l,r.beginPath(),r.arc(c.x,c.y,(4+ease$3(e)*26)*l,0,Math.PI*2),r.stroke(),r.globalAlpha=1)}f?(glow(e,c.x,c.y,36*l,t,v),glow(e,c.x,c.y,14*l,t,v)):c===m&&c.landed!==null&&glow(e,c.x,c.y,18*l,t,v),dot(e,c.x,c.y,(f?3.8:c===m?2.8:2.1)*l,t,v);let b=c.landed!==null&&c.pseudo&&g.has(c.id)?c===m?.95:.4:0;c.label+=(b-c.label)*(1-Math.exp(-s*LABEL_RATE)),c.pseudo&&c.label>.01&&(r.globalAlpha=clamp01(c.label*t),r.fillStyle=f?a.accent:a.text,r.fillText(c.pseudo,c.x,c.y+5*l+d*.3),r.globalAlpha=1)}}},_hoisted_1$13={class:`fx-lobby`},FxLobby_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxLobby`,props:{players:{},highlightId:{},labels:{default:8},spread:{}},setup(e){let t=e,n=ref(null),r=null;return onMounted(()=>{n.value&&(r=mountScene(n.value,lobbyScene,()=>({players:t.players,highlightId:t.highlightId,labels:t.labels,spread:t.spread})))}),onBeforeUnmount(()=>r?.destroy()),(e,t)=>(openBlock(),createElementBlock(`div`,_hoisted_1$13,[createBaseVNode(`canvas`,{ref_key:`canvas`,ref:n,class:`fx-lobby__canvas`,"aria-hidden":`true`},null,512)]))}}),FxLobby_default=_plugin_vue_export_helper_default(FxLobby_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-b52d79da`]]),FIREWORK_GAP=[.8,1.6],MAX_SPARKS=250,RING_DURATION=1.4,rand$1=(e,t)=>e+Math.random()*(t-e),ease$2=e=>1-(1-clamp01(e))**3,liveSparks=e=>e.reduce((e,t)=>e+t.sparks.length,0);function fireBurst(e,t,n,r,a,o,s){let c=Math.min(Math.round(s),250-liveSparks(t));if(c<=0)return;let l=Array.from({length:c},()=>{let t=rand$1(0,Math.PI*2),o=rand$1(60,200)*Math.max(e.h/1080,.5)*1.6*a;return{x:n,y:r,vx:Math.cos(t)*o,vy:Math.sin(t)*o-40*a,a:1}});t.push({x:n,y:r,at:e.t,scale:a,color:o,sparks:l})}function drawBursts(e,t,n){let{t:r,dt:a,h:o}=e;for(let s of t){let t=(r-s.at)/RING_DURATION;if(t<1){let n=ease$2(t)*o*(s.scale<1?.28:.4)*s.scale,r=48;for(let r=0;r<48;r++){let a=r/48*Math.PI*2,o=(r+1)/48*Math.PI*2;line(e,s.x+Math.cos(a)*n,s.y+Math.sin(a)*n,s.x+Math.cos(o)*n,s.y+Math.sin(o)*n,2.5*(1-t),1.5,s.color)}}for(let t of s.sparks)t.x+=t.vx*a,t.y+=t.vy*a,t.vx*=.97,t.vy=t.vy*.97+30*a,t.a-=a*.4,t.a>0&&dot(e,t.x,t.y,n*.9*Math.max(s.scale,.7),t.a,s.color);s.sparks=s.sparks.filter(e=>e.a>0)}return t.filter(e=>e.sparks.length>0||r-e.at<RING_DURATION)}var FIRST_AT=.4,fireworksScene={init(){return{bursts:[],fired:!1,nextAt:0}},draw(e,t,n){let{w:r,h:a,t:o,theme:s,reduced:c}=e;if(c)return;let l=Math.max(Math.min(a*.04,r*.045)*.16,1.8);if(!t.fired&&o>=.4&&(fireBurst(e,t.bursts,r*.5,a*.22,1,s.accent,70),t.fired=!0,t.nextAt=o+rand$1(...FIREWORK_GAP)),t.fired&&o>=t.nextAt&&o<n.duration){let n=rand$1(.45,.85),c=Math.random()<.25?s.accent:s.dot;fireBurst(e,t.bursts,rand$1(r*.15,r*.85),rand$1(a*.1,a*.4),n,c,70*n*.8),t.nextAt=o+rand$1(...FIREWORK_GAP)}t.bursts=drawBursts(e,t.bursts,l)}},FxFireworks_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxFireworks`,props:{duration:{default:10}},setup(e){let t=e,n=ref(null),r=null;return onMounted(()=>{n.value&&(r=mountScene(n.value,fireworksScene,()=>({duration:t.duration})))}),onBeforeUnmount(()=>r?.destroy()),(e,t)=>(openBlock(),createElementBlock(`canvas`,{ref_key:`canvas`,ref:n,class:`fx-fireworks`,"aria-hidden":`true`},null,512))}}),FxFireworks_default=_plugin_vue_export_helper_default(FxFireworks_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-c367274d`]]);function ordinalFr(e){return e===1?`1er`:`${e}e`}var FORM_AT=[5,3.3,1.6],LABEL_DELAY=.9,BURST_DELAY=1.2,COLS=5,BASE_Y=.74,ease$1=e=>1-(1-clamp01(e))**3,spacingOf=(e,t)=>Math.min(t*.04,e*.045);function swarmDot(e,t,n,r){return{rank:t,k:n,x:rand$1(0,e.w),y:rand$1(0,e.h),vx:rand$1(-12,12),vy:rand$1(-12,12),r}}var podiumScene={init(e,t){let n=podiumDots(t.scores),r=[];return n.forEach((t,n)=>{for(let a=0;a<t;a++)r.push(swarmDot(e,n,a,rand$1(1.1,1.9)))}),{dots:r,counts:n,me:t.outsideRank===null?null:swarmDot(e,-1,0,3),bursts:[],fired:!1,nextAt:0,shown:[]}},draw(e,t,n){let{w:r,h:a,t:o,dt:s,theme:c,reduced:l}=e,u=spacingOf(r,a),d=a*BASE_Y,f=e=>d-Math.ceil((t.counts[e]??0)/COLS)*u,m=e=>r*PODIUM_SLOTS[e],g=e=>l?0:FORM_AT[e],_=l?clamp01(o/.6):1,v=Math.max(u*.16,1.8),y=t.counts.length>0;y&&o>g(0)+1.2&&glow(e,m(0),(f(0)+d)/2,a*.35,(.2+.08*Math.sin(o*2))*_,c.accent);for(let f of t.dots){let t=g(f.rank)+f.k*.015,y=f.rank===0?1:.8;if(o<t){l||(f.x=(f.x+f.vx*s+r)%r,f.y=(f.y+f.vy*s+a)%a,dot(e,f.x,f.y,f.r*.7,.35));continue}let b=m(f.rank)+(f.k%COLS-2)*u,x=d-Math.floor(f.k/COLS)*u;if(l)f.x=b,f.y=x;else{let e=1-Math.exp(-4.5*s);f.x+=(b-f.x)*e,f.y+=(x-f.y)*e}dot(e,f.x,f.y,v,y*_,n.highlight===f.rank?c.accent:void 0)}if(t.me&&(l?(t.me.x=r*.5,t.me.y=a*.3):(t.me.x=(t.me.x+t.me.vx*s+r)%r,t.me.y=(t.me.y+t.me.vy*s+a)%a),glow(e,t.me.x,t.me.y,u*1.8,.5*_,c.accent),dot(e,t.me.x,t.me.y,Math.max(v*1.5,3),_,c.accent)),y&&!l){let n=(n,r,a,o,s)=>fireBurst(e,t.bursts,n,r,a,o,s);if(!t.fired&&o>g(0)+1.2&&(n(m(0),f(0)-a*.02,1,c.accent,70),t.fired=!0,t.nextAt=o+rand$1(...FIREWORK_GAP)),t.fired&&o>=t.nextAt){let e=Math.min(f(0),f(1),f(2))-a*.08,s=rand$1(.45,.85),l=Math.random()<.25?c.accent:c.dot;n(rand$1(r*.15,r*.85),rand$1(a*.2,Math.max(a*.22,e)),s,l,70*s*.8),t.nextAt=o+rand$1(...FIREWORK_GAP)}t.bursts=drawBursts(e,t.bursts,v)}e.ctx.fillStyle=c.muted;for(let n=0;n<t.counts.length;n++){let t=l?_:ease$1((o-g(n)-LABEL_DELAY)/.6);t<=0||(e.ctx.globalAlpha=t,spacedText(e,`0${n+1}`,m(n),f(n)-Math.max(a*.03,8),Math.max(a*.026,10)),e.ctx.globalAlpha=1)}let b=[0,1,2].map(e=>e<t.counts.length&&o>=g(e)+.9);b.push(t.me!==null),(b.length!==t.shown.length||b.some((e,n)=>e!==t.shown[n]))&&(t.shown=b,n.onShown?.(b))}},_hoisted_1$12=[`aria-label`],_hoisted_2$12={class:`fx-podium__name`},_hoisted_3$9={class:`fx-podium__score`},FxPodium_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxPodium`,props:{podium:{},highlightId:{}},setup(e){let t=e,n=ref(null),r=ref([]),a=null,o=computed(()=>t.podium.slice(0,3)),s=computed(()=>{let e=o.value.findIndex(e=>e.playerId===t.highlightId);return e>=0?e:null}),c=computed(()=>!t.highlightId||s.value!==null?null:t.podium.find(e=>e.playerId===t.highlightId)?.rank??null),l=computed(()=>o.value.map(e=>`${e.rank}. ${e.pseudo} ${e.score}`).join(`, `));return onMounted(()=>{n.value&&(a=mountScene(n.value,podiumScene,()=>({scores:o.value.map(e=>e.score),highlight:s.value,outsideRank:c.value,onShown:e=>{r.value=e}})))}),watch(()=>t.podium.map(e=>`${e.playerId}:${e.score}`).join(`|`),()=>a?.restart()),onBeforeUnmount(()=>a?.destroy()),(t,a)=>(openBlock(),createElementBlock(`div`,{class:`fx-podium`,role:`img`,"aria-label":l.value},[createBaseVNode(`canvas`,{ref_key:`canvas`,ref:n,class:`fx-podium__canvas`,"aria-hidden":`true`},null,512),(openBlock(!0),createElementBlock(Fragment,null,renderList(o.value,(t,n)=>(openBlock(),createElementBlock(`div`,{key:t.playerId,class:normalizeClass([`fx-podium__label`,{"fx-podium__label--on":r.value[n],"fx-podium__label--me":t.playerId===e.highlightId,"fx-podium__label--first":n===0}]),style:normalizeStyle({left:`${unref(PODIUM_SLOTS)[n]*100}%`})},[createBaseVNode(`span`,_hoisted_2$12,toDisplayString(t.pseudo),1),createBaseVNode(`span`,_hoisted_3$9,toDisplayString(t.score.toLocaleString())+` pts`,1)],6))),128)),c.value===null?createCommentVNode(``,!0):(openBlock(),createElementBlock(`p`,{key:0,class:normalizeClass([`fx-podium__outside`,{"fx-podium__outside--on":r.value[3]}])},toDisplayString(unref(ordinalFr)(c.value))+` / `+toDisplayString(e.podium.length),3))],8,_hoisted_1$12))}}),FxPodium_default=_plugin_vue_export_helper_default(FxPodium_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-d5e3b296`]]),N=13,DURATION=1.1,MAX_DELAY=.35,HOLD=1.2,FADE=.5,OK_FORMED=1.4500000000000002,OK_PERIOD=3.45,KO_RISE=1,KO_BREAK=1.8,KO_PERIOD=3.6000000000000005,ease=e=>1-(1-clamp01(e))**3,rand=(e,t)=>e+Math.random()*(t-e);function newMotes(){return Array.from({length:N},(e,t)=>({ang:t/N*Math.PI*2+Math.random()*.6,dist:.55+Math.random()*.5,delay:Math.random()*MAX_DELAY,x:0,y:0,vx:0,vy:0,rest:!1,sx:0,sy:0}))}var verdictScene={init(e,t){let n=newMotes();if(!t.correct){let t=2.2,r=Math.min(e.w,e.h*1.5)*.5*.7*1.4-t;n.forEach((n,a)=>{n.x=e.w/2+((a+.5)/N-.5)*2*r*.9,n.y=e.h-t-2-a%2*t*1.8,n.sx=n.x,n.sy=n.y,n.rest=!0})}return{motes:n,cycle:0,broken:!1,piles:new Map}},draw(e,t,n){let{theme:r,reduced:a,dt:o}=e,s=n.correct?OK_PERIOD:KO_PERIOD,c=a?0:Math.floor(e.t/s);if(c!==t.cycle){if(n.correct)t.motes=newMotes();else for(let e of t.motes)e.sx=e.x,e.sy=e.y,e.rest=!1;t.cycle=c,t.broken=!1,t.piles.clear()}let l=a?e.t:e.t-c*s,u=e.w/2,d=Math.min(e.w,e.h*1.5)*.5,f=n.correct?r.ok:r.ko,m=clamp01(e.t/.6),g=(t,n)=>{let r=d*t.dist*1.3;return{x:u+Math.cos(t.ang)*r,y:n+Math.sin(t.ang)*r*Math.min(1,e.h*.42/(d*1.4))}},_=(t,n,r,a,o)=>{for(let[s,c]of verdictLinks(t,N))line(e,n[s],r[s],n[c],r[c],Math.min(a[s],a[c])*o,1,f)};if(n.correct){let n=e.h/2,r=checkPoints(N,u,n,d),o=a?1:1-clamp01((l-OK_FORMED-HOLD)/FADE),s=a?m:ease(l/DURATION);glow(e,u,n,d*(a?.9:.6+.4*s),.35*s*o,f);let c=[],v=[],y=[];for(let e=0;e<N;e++){let s=t.motes[e],u=a?1:ease((l-s.delay)/DURATION),d=g(s,n);c.push(d.x+(r[e].x-d.x)*u),v.push(d.y+(r[e].y-d.y)*u),y.push(a?m:(.25+.75*u)*o)}_(`check`,c,v,y.map((e,n)=>a?e:e*ease((l-t.motes[n].delay)/DURATION)**2),4);for(let t=0;t<N;t++)glow(e,c[t],v[t],9,y[t]*.8,f),dot(e,c[t],v[t],2.4,y[t],f);return}let v=2.2,y=d*.7,b=e.h*.4,x=e.h-v-2,S=crossPoints(N,u,b,y);if(a){let t=S.map(e=>e.x),n=S.map(e=>e.y);_(`cross`,t,n,t.map(()=>m*.9),4);for(let r=0;r<N;r++)glow(e,t[r],n[r],8,m*.7,f),dot(e,t[r],n[r],v,m*.9,f);return}if(l<KO_BREAK){let n=l>1.6?.8:0,r=t.cycle===0?clamp01(e.t/.4):1,a=[],o=[],s=[],c=[];for(let e=0;e<N;e++){let u=t.motes[e],d=ease((l-u.delay)/KO_RISE);u.x=u.sx+(S[e].x-u.sx)*d,u.y=u.sy+(S[e].y-u.sy)*d,a.push(u.x+rand(-n,n)),o.push(u.y+rand(-n,n)),s.push((.65+.25*d)*r),c.push(d*d*r)}_(`cross`,a,o,c,4);for(let t=0;t<N;t++)glow(e,a[t],o[t],8,s[t]*.7*c[t],f),dot(e,a[t],o[t],v,s[t],f);return}let C=Math.max(e.h,60)*9;t.broken||=(t.motes.forEach((t,n)=>{let r=S[n];t.x=r.x,t.y=r.y,t.vx=(r.x-u)*rand(1,2.6)+rand(-20,20),t.vy=rand(-e.h*.9,-e.h*.1),t.rest=!1}),!0);let w=v*2.2,T=y*1.4-v;for(let n of t.motes){if(!n.rest){n.vy+=C*o,n.x=Math.min(Math.max(n.x+n.vx*o,u-T),u+T),n.y+=n.vy*o,n.vx*=1-1.5*o;let r=Math.round((n.x-u)/w),a=t.piles.get(r)??0,s=x-a*v*1.8;n.y>=s&&(n.y=s,Math.abs(n.vy)<e.h*.6?(n.x=u+(r+a%2*.5)*w,n.vy=0,n.rest=!0,t.piles.set(r,a+1)):(n.vy=-n.vy*.3,n.vx*=.5))}dot(e,n.x,n.y,v,n.rest?.65:.85,f)}}},FxVerdict_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxVerdict`,props:{correct:{type:Boolean},delta:{},answered:{type:Boolean}},setup(e){let t=e,n=ref(null),r=null;return onMounted(()=>{n.value&&(r=mountScene(n.value,verdictScene,()=>({correct:t.correct,delta:t.delta,answered:t.answered})))}),watch(()=>t.correct,()=>r?.restart()),onBeforeUnmount(()=>r?.destroy()),(e,t)=>(openBlock(),createElementBlock(`canvas`,{ref_key:`canvas`,ref:n,class:`fx-verdict`,"aria-hidden":`true`},null,512))}}),FxVerdict_default=_plugin_vue_export_helper_default(FxVerdict_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-0e882c37`]]),_hoisted_1$11=[`disabled`],_hoisted_2$11={class:`hq-btn__badge`},_hoisted_3$8={class:`hq-btn__text`},AnswerButton_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`AnswerButton`,props:{id:{},text:{},state:{},colorId:{}},emits:[`select`],setup(e,{emit:t}){let n=t;return(t,r)=>(openBlock(),createElementBlock(`button`,{class:normalizeClass([`hq-btn`,`hq-btn--${e.colorId}`,`hq-btn--${e.state}`]),disabled:e.state!==`idle`&&e.state!==`selected`,onClick:r[0]||=t=>n(`select`,e.id)},[createBaseVNode(`span`,_hoisted_2$11,toDisplayString(e.id.toUpperCase()),1),createBaseVNode(`span`,_hoisted_3$8,toDisplayString(e.text),1)],10,_hoisted_1$11))}}),AnswerButton_default=_plugin_vue_export_helper_default(AnswerButton_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-ce737272`]]),_hoisted_1$10={class:`hq-podium`},_hoisted_2$10={class:`hq-podium__rank`},_hoisted_3$7={class:`hq-podium__name`},_hoisted_4$5={class:`hq-podium__score`},Podium_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`Podium`,props:{podium:{}},setup(e){function t(e){return e===1?`🥇`:e===2?`🥈`:e===3?`🥉`:`#${e}`}function n(e){return e<=3?`hq-podium__row--top${e}`:``}return(r,a)=>(openBlock(),createElementBlock(`ol`,_hoisted_1$10,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.podium,e=>(openBlock(),createElementBlock(`li`,{key:e.rank,class:normalizeClass([`hq-podium__row`,n(e.rank)])},[createBaseVNode(`span`,_hoisted_2$10,toDisplayString(t(e.rank)),1),createBaseVNode(`span`,_hoisted_3$7,toDisplayString(e.pseudo),1),createBaseVNode(`span`,_hoisted_4$5,toDisplayString(e.score.toLocaleString())+` pts`,1)],2))),128))]))}}),Podium_default=_plugin_vue_export_helper_default(Podium_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-8d79b015`]]),require_can_promise=__commonJSMin(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),require_utils$2=__commonJSMin((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),require_error_correction_level=__commonJSMin((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),require_bit_buffer=__commonJSMin(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),require_bit_matrix=__commonJSMin(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let a=e*this.size+t;this.data[a]=n,r&&(this.reservedBit[a]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),require_alignment_pattern=__commonJSMin((e=>{var t=require_utils$2().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),a=r===145?26:Math.ceil((r-13)/(2*n-2))*2,o=[r-7];for(let e=1;e<n-1;e++)o[e]=o[e-1]-a;return o.push(6),o.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),a=r.length;for(let e=0;e<a;e++)for(let t=0;t<a;t++)e===0&&t===0||e===0&&t===a-1||e===a-1&&t===0||n.push([r[e],r[t]]);return n}})),require_finder_pattern=__commonJSMin((e=>{var t=require_utils$2().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),require_mask_pattern=__commonJSMin((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,a=0,o=0,s=null,c=null;for(let l=0;l<n;l++){a=o=0,s=c=null;for(let u=0;u<n;u++){let n=e.get(l,u);n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1),n=e.get(u,l),n===c?o++:(o>=5&&(r+=t.N1+(o-5)),c=n,o=1)}a>=5&&(r+=t.N1+(a-5)),o>=5&&(r+=t.N1+(o-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let a=0;a<n-1;a++){let n=e.get(t,a)+e.get(t,a+1)+e.get(t+1,a)+e.get(t+1,a+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,a=0,o=0;for(let t=0;t<n;t++){a=o=0;for(let s=0;s<n;s++)a=a<<1&2047|e.get(t,s),s>=10&&(a===1488||a===93)&&r++,o=o<<1&2047|e.get(s,t),s>=10&&(o===1488||o===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let a=0;a<r;a++)for(let o=0;o<r;o++)t.isReserved(o,a)||t.xor(o,a,n(e,o,a))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,a=0,o=1/0;for(let s=0;s<r;s++){n(s),e.applyMask(s,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),r<o&&(o=r,a=s)}return a}})),require_error_correction_code=__commonJSMin((e=>{var t=require_error_correction_level(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),require_galois_field=__commonJSMin((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),require_polynomial=__commonJSMin((e=>{var t=require_galois_field();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let a=0;a<e.length;a++)for(let o=0;o<n.length;o++)r[a+o]^=t.mul(e[a],n[o]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let a=0;a<n.length;a++)r[a]^=t.mul(n[a],e);let a=0;for(;a<r.length&&r[a]===0;)a++;r=r.slice(a)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let a=0;a<n;a++)r=e.mul(r,new Uint8Array([1,t.exp(a)]));return r}})),require_reed_solomon_encoder=__commonJSMin(((e,t)=>{var n=require_polynomial();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),a=this.degree-r.length;if(a>0){let e=new Uint8Array(this.degree);return e.set(r,a),e}return r},t.exports=r})),require_version_check=__commonJSMin((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),require_regex=__commonJSMin((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var a=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/deps-CxwVlDwg.js","assets/solo-backend-C3QJkkz_.js","assets/SoloCatalog-Z6TlUytv.js","assets/CreateQuizCard-xKw4VRLN.js","assets/CreateQuizCard-BbPt21cH.css","assets/solo-8S92cge3.css","assets/SoloCatalog-CU8R7j8B.css","assets/SoloIntroView-C-yZ2RJO.js","assets/SoloLeaderboard-D1uDfizB.js","assets/format-5Txm-oDf.js","assets/SoloLeaderboard-CZv7b2Vs.css","assets/SoloIntroView-tHv4f8e_.css","assets/SoloQuestionView-D-PR4AaF.js","assets/SoloQuestionView-Cf0mhxPN.css","assets/SoloEndView-Cr_3rclv.js","assets/SoloEndView-C5wzMB0_.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__esmMin=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},__commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),__copyProps=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let a of __getOwnPropNames(t))!__hasOwnProp.call(e,a)&&a!==n&&(r=__getOwnPropDesc(t,a),__defProp(e,a,{get:r&&r.get&&!r.configurable?r.get:()=>t[a],enumerable:!r||r.enumerable}));return e},__toESM=(e,t,n)=>(n=e==null?{}:__create(__getProtoOf(e)),__copyProps(t||!e||!e.__esModule||!__hasOwnProp.call(e,`default`)?__defProp(n,`default`,{value:e,enumerable:!0}):n,e));(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),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var global$1=globalThis||self;function makeMap(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var EMPTY_OBJ={},EMPTY_ARR=[],NOOP=()=>{},NO=()=>!1,isOn=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),isModelListener=e=>e.startsWith(`onUpdate:`),extend=Object.assign,remove$1=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},hasOwnProperty$1=Object.prototype.hasOwnProperty,hasOwn=(e,t)=>hasOwnProperty$1.call(e,t),isArray=Array.isArray,isMap=e=>toTypeString(e)===`[object Map]`,isSet=e=>toTypeString(e)===`[object Set]`,isDate=e=>toTypeString(e)===`[object Date]`,isFunction=e=>typeof e==`function`,isString=e=>typeof e==`string`,isSymbol=e=>typeof e==`symbol`,isObject=e=>typeof e==`object`&&!!e,isPromise=e=>(isObject(e)||isFunction(e))&&isFunction(e.then)&&isFunction(e.catch),objectToString=Object.prototype.toString,toTypeString=e=>objectToString.call(e),toRawType=e=>toTypeString(e).slice(8,-1),isPlainObject$2=e=>toTypeString(e)===`[object Object]`,isIntegerKey=e=>isString(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,isReservedProp=makeMap(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),cacheStringFunction=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},camelizeRE=/-\w/g,camelize=cacheStringFunction(e=>e.replace(camelizeRE,e=>e.slice(1).toUpperCase())),hyphenateRE=/\B([A-Z])/g,hyphenate=cacheStringFunction(e=>e.replace(hyphenateRE,`-$1`).toLowerCase()),capitalize=cacheStringFunction(e=>e.charAt(0).toUpperCase()+e.slice(1)),toHandlerKey=cacheStringFunction(e=>e?`on${capitalize(e)}`:``),hasChanged=(e,t)=>!Object.is(e,t),invokeArrayFns=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},def=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},looseToNumber=e=>{let t=parseFloat(e);return isNaN(t)?e:t},toNumber$1=e=>{let t=isString(e)?Number(e):NaN;return isNaN(t)?e:t},_globalThis,getGlobalThis=()=>_globalThis||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global$1===void 0?{}:global$1;function normalizeStyle(e){if(isArray(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],a=isString(r)?parseStringStyle(r):normalizeStyle(r);if(a)for(let e in a)t[e]=a[e]}return t}if(isString(e)||isObject(e))return e}var listDelimiterRE=/;(?![^(]*\))/g,propertyDelimiterRE=/:([^]+)/,styleCommentRE=/\/\*[^]*?\*\//g;function parseStringStyle(e){let t={};return e.replace(styleCommentRE,``).split(listDelimiterRE).forEach(e=>{if(e){let n=e.split(propertyDelimiterRE);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function normalizeClass(e){let t=``;if(isString(e))t=e;else if(isArray(e))for(let n=0;n<e.length;n++){let r=normalizeClass(e[n]);r&&(t+=r+` `)}else if(isObject(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var specialBooleanAttrs=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,isSpecialBooleanAttr=makeMap(specialBooleanAttrs),isBooleanAttr=makeMap(specialBooleanAttrs+`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);function includeBooleanAttr(e){return!!e||e===``}function looseCompareArrays(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=looseEqual(e[r],t[r]);return n}function looseEqual(e,t){if(e===t)return!0;let n=isDate(e),r=isDate(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=isSymbol(e),r=isSymbol(t),n||r)return e===t;if(n=isArray(e),r=isArray(t),n||r)return n&&r?looseCompareArrays(e,t):!1;if(n=isObject(e),r=isObject(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e){let r=e.hasOwnProperty(n),a=t.hasOwnProperty(n);if(r&&!a||!r&&a||!looseEqual(e[n],t[n]))return!1}}return String(e)===String(t)}function looseIndexOf(e,t){return e.findIndex(e=>looseEqual(e,t))}var isRef$1=e=>!!(e&&e.__v_isRef===!0),toDisplayString=e=>isString(e)?e:e==null?``:isArray(e)||isObject(e)&&(e.toString===objectToString||!isFunction(e.toString))?isRef$1(e)?toDisplayString(e.value):JSON.stringify(e,replacer,2):String(e),replacer=(e,t)=>isRef$1(t)?replacer(e,t.value):isMap(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[stringifySymbol(t,r)+` =>`]=n,e),{})}:isSet(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>stringifySymbol(e))}:isSymbol(t)?stringifySymbol(t):isObject(t)&&!isArray(t)&&!isPlainObject$2(t)?String(t):t,stringifySymbol=(e,t=``)=>{var n;return isSymbol(e)?`Symbol(${e.description??t})`:e},activeEffectScope,EffectScope=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=activeEffectScope,!e&&activeEffectScope&&(this.index=(activeEffectScope.scopes||(activeEffectScope.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){let t=activeEffectScope;try{return activeEffectScope=this,e()}finally{activeEffectScope=t}}}on(){++this._on===1&&(this.prevScope=activeEffectScope,activeEffectScope=this)}off(){this._on>0&&--this._on===0&&(activeEffectScope=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function effectScope(e){return new EffectScope(e)}function getCurrentScope(){return activeEffectScope}function onScopeDispose(e,t=!1){activeEffectScope&&activeEffectScope.cleanups.push(e)}var activeSub,pausedQueueEffects=new WeakSet,ReactiveEffect=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,activeEffectScope&&activeEffectScope.active&&activeEffectScope.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,pausedQueueEffects.has(this)&&(pausedQueueEffects.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||batch(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,cleanupEffect(this),prepareDeps(this);let e=activeSub,t=shouldTrack;activeSub=this,shouldTrack=!0;try{return this.fn()}finally{cleanupDeps(this),activeSub=e,shouldTrack=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)removeSub(e);this.deps=this.depsTail=void 0,cleanupEffect(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?pausedQueueEffects.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){isDirty(this)&&this.run()}get dirty(){return isDirty(this)}},batchDepth=0,batchedSub,batchedComputed;function batch(e,t=!1){e.flags|=8,t?(e.next=batchedComputed,batchedComputed=e):(e.next=batchedSub,batchedSub=e)}function startBatch(){batchDepth++}function endBatch(){if(--batchDepth>0)return;if(batchedComputed){let e=batchedComputed;for(batchedComputed=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;batchedSub;){let t=batchedSub;for(batchedSub=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function prepareDeps(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function cleanupDeps(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),removeSub(r),removeDep(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function isDirty(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(refreshComputed(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function refreshComputed(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===globalVersion)||(e.globalVersion=globalVersion,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!isDirty(e))))return;e.flags|=2;let t=e.dep,n=activeSub,r=shouldTrack;activeSub=e,shouldTrack=!0;try{prepareDeps(e);let n=e.fn(e._value);(t.version===0||hasChanged(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{activeSub=n,shouldTrack=r,cleanupDeps(e),e.flags&=-3}}function removeSub(e,t=!1){let{dep:n,prevSub:r,nextSub:a}=e;if(r&&(r.nextSub=a,e.prevSub=void 0),a&&(a.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)removeSub(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function removeDep(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var shouldTrack=!0,trackStack=[];function pauseTracking(){trackStack.push(shouldTrack),shouldTrack=!1}function resetTracking(){let e=trackStack.pop();shouldTrack=e===void 0||e}function cleanupEffect(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=activeSub;activeSub=void 0;try{t()}finally{activeSub=e}}}var globalVersion=0,Link=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},Dep=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!activeSub||!shouldTrack||activeSub===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==activeSub)t=this.activeLink=new Link(activeSub,this),activeSub.deps?(t.prevDep=activeSub.depsTail,activeSub.depsTail.nextDep=t,activeSub.depsTail=t):activeSub.deps=activeSub.depsTail=t,addSub(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=activeSub.depsTail,t.nextDep=void 0,activeSub.depsTail.nextDep=t,activeSub.depsTail=t,activeSub.deps===t&&(activeSub.deps=e)}return t}trigger(e){this.version++,globalVersion++,this.notify(e)}notify(e){startBatch();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{endBatch()}}};function addSub(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)addSub(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var targetMap=new WeakMap,ITERATE_KEY=Symbol(``),MAP_KEY_ITERATE_KEY=Symbol(``),ARRAY_ITERATE_KEY=Symbol(``);function track(e,t,n){if(shouldTrack&&activeSub){let t=targetMap.get(e);t||targetMap.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new Dep),r.map=t,r.key=n),r.track()}}function trigger(e,t,n,r,a,o){let s=targetMap.get(e);if(!s){globalVersion++;return}let c=e=>{e&&e.trigger()};if(startBatch(),t===`clear`)s.forEach(c);else{let a=isArray(e),o=a&&isIntegerKey(n);if(a&&n===`length`){let e=Number(r);s.forEach((t,n)=>{(n===`length`||n===ARRAY_ITERATE_KEY||!isSymbol(n)&&n>=e)&&c(t)})}else switch((n!==void 0||s.has(void 0))&&c(s.get(n)),o&&c(s.get(ARRAY_ITERATE_KEY)),t){case`add`:a?o&&c(s.get(`length`)):(c(s.get(ITERATE_KEY)),isMap(e)&&c(s.get(MAP_KEY_ITERATE_KEY)));break;case`delete`:a||(c(s.get(ITERATE_KEY)),isMap(e)&&c(s.get(MAP_KEY_ITERATE_KEY)));break;case`set`:isMap(e)&&c(s.get(ITERATE_KEY))}}endBatch()}function getDepFromReactive(e,t){let n=targetMap.get(e);return n&&n.get(t)}function reactiveReadArray(e){let t=toRaw(e);return t===e?t:(track(t,`iterate`,ARRAY_ITERATE_KEY),isShallow(e)?t:t.map(toReactive))}function shallowReadArray(e){return track(e=toRaw(e),`iterate`,ARRAY_ITERATE_KEY),e}function toWrapped(e,t){return isReadonly(e)?toReadonly(isReactive(e)?toReactive(t):t):toReactive(t)}var arrayInstrumentations={__proto__:null,[Symbol.iterator](){return iterator(this,Symbol.iterator,e=>toWrapped(this,e))},concat(...e){return reactiveReadArray(this).concat(...e.map(e=>isArray(e)?reactiveReadArray(e):e))},entries(){return iterator(this,`entries`,e=>(e[1]=toWrapped(this,e[1]),e))},every(e,t){return apply(this,`every`,e,t,void 0,arguments)},filter(e,t){return apply(this,`filter`,e,t,e=>e.map(e=>toWrapped(this,e)),arguments)},find(e,t){return apply(this,`find`,e,t,e=>toWrapped(this,e),arguments)},findIndex(e,t){return apply(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return apply(this,`findLast`,e,t,e=>toWrapped(this,e),arguments)},findLastIndex(e,t){return apply(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return apply(this,`forEach`,e,t,void 0,arguments)},includes(...e){return searchProxy(this,`includes`,e)},indexOf(...e){return searchProxy(this,`indexOf`,e)},join(e){return reactiveReadArray(this).join(e)},lastIndexOf(...e){return searchProxy(this,`lastIndexOf`,e)},map(e,t){return apply(this,`map`,e,t,void 0,arguments)},pop(){return noTracking(this,`pop`)},push(...e){return noTracking(this,`push`,e)},reduce(e,...t){return reduce(this,`reduce`,e,t)},reduceRight(e,...t){return reduce(this,`reduceRight`,e,t)},shift(){return noTracking(this,`shift`)},some(e,t){return apply(this,`some`,e,t,void 0,arguments)},splice(...e){return noTracking(this,`splice`,e)},toReversed(){return reactiveReadArray(this).toReversed()},toSorted(e){return reactiveReadArray(this).toSorted(e)},toSpliced(...e){return reactiveReadArray(this).toSpliced(...e)},unshift(...e){return noTracking(this,`unshift`,e)},values(){return iterator(this,`values`,e=>toWrapped(this,e))}};function iterator(e,t,n){let r=shallowReadArray(e),a=r[t]();return r!==e&&!isShallow(e)&&(a._next=a.next,a.next=()=>{let e=a._next();return e.done||(e.value=n(e.value)),e}),a}var arrayProto=Array.prototype;function apply(e,t,n,r,a,o){let s=shallowReadArray(e),c=s!==e&&!isShallow(e),l=s[t];if(l!==arrayProto[t]){let t=l.apply(e,o);return c?toReactive(t):t}let u=n;s!==e&&(c?u=function(t,r){return n.call(this,toWrapped(e,t),r,e)}:n.length>2&&(u=function(t,r){return n.call(this,t,r,e)}));let d=l.call(s,u,r);return c&&a?a(d):d}function reduce(e,t,n,r){let a=shallowReadArray(e),o=a!==e&&!isShallow(e),s=n,c=!1;a!==e&&(o?(c=r.length===0,s=function(t,r,a){return c&&(c=!1,t=toWrapped(e,t)),n.call(this,t,toWrapped(e,r),a,e)}):n.length>3&&(s=function(t,r,a){return n.call(this,t,r,a,e)}));let l=a[t](s,...r);return c?toWrapped(e,l):l}function searchProxy(e,t,n){let r=toRaw(e);track(r,`iterate`,ARRAY_ITERATE_KEY);let a=r[t](...n);return(a===-1||a===!1)&&isProxy(n[0])?(n[0]=toRaw(n[0]),r[t](...n)):a}function noTracking(e,t,n=[]){pauseTracking(),startBatch();let r=toRaw(e)[t].apply(e,n);return endBatch(),resetTracking(),r}var isNonTrackableKeys=makeMap(`__proto__,__v_isRef,__isVue`),builtInSymbols=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(isSymbol));function hasOwnProperty(e){isSymbol(e)||(e=String(e));let t=toRaw(this);return track(t,`has`,e),t.hasOwnProperty(e)}var BaseReactiveHandler=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,a=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return a;if(t===`__v_raw`)return n===(r?a?shallowReadonlyMap:readonlyMap:a?shallowReactiveMap:reactiveMap).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let o=isArray(e);if(!r){let e;if(o&&(e=arrayInstrumentations[t]))return e;if(t===`hasOwnProperty`)return hasOwnProperty}let s=Reflect.get(e,t,isRef(e)?e:n);if((isSymbol(t)?builtInSymbols.has(t):isNonTrackableKeys(t))||(r||track(e,`get`,t),a))return s;if(isRef(s)){let e=o&&isIntegerKey(t)?s:s.value;return r&&isObject(e)?readonly(e):e}return isObject(s)?r?readonly(s):reactive(s):s}},MutableReactiveHandler=class extends BaseReactiveHandler{constructor(e=!1){super(!1,e)}set(e,t,n,r){let a=e[t],o=isArray(e)&&isIntegerKey(t);if(!this._isShallow){let e=isReadonly(a);if(!isShallow(n)&&!isReadonly(n)&&(a=toRaw(a),n=toRaw(n)),!o&&isRef(a)&&!isRef(n))return e||(a.value=n),!0}let s=o?Number(t)<e.length:hasOwn(e,t),c=Reflect.set(e,t,n,isRef(e)?e:r);return e===toRaw(r)&&(s?hasChanged(n,a)&&trigger(e,`set`,t,n,a):trigger(e,`add`,t,n)),c}deleteProperty(e,t){let n=hasOwn(e,t),r=e[t],a=Reflect.deleteProperty(e,t);return a&&n&&trigger(e,`delete`,t,void 0,r),a}has(e,t){let n=Reflect.has(e,t);return isSymbol(t)&&builtInSymbols.has(t)||track(e,`has`,t),n}ownKeys(e){return track(e,`iterate`,isArray(e)?`length`:ITERATE_KEY),Reflect.ownKeys(e)}},ReadonlyReactiveHandler=class extends BaseReactiveHandler{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},mutableHandlers=new MutableReactiveHandler,readonlyHandlers=new ReadonlyReactiveHandler,shallowReactiveHandlers=new MutableReactiveHandler(!0),toShallow=e=>e,getProto=e=>Reflect.getPrototypeOf(e);function createIterableMethod(e,t,n){return function(...r){let a=this.__v_raw,o=toRaw(a),s=isMap(o),c=e===`entries`||e===Symbol.iterator&&s,l=e===`keys`&&s,u=a[e](...r),d=n?toShallow:t?toReadonly:toReactive;return!t&&track(o,`iterate`,l?MAP_KEY_ITERATE_KEY:ITERATE_KEY),extend(Object.create(u),{next(){let{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:c?[d(e[0]),d(e[1])]:d(e),done:t}}})}}function createReadonlyMethod(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function createInstrumentations(e,t){let n={get(n){let r=this.__v_raw,a=toRaw(r),o=toRaw(n);e||(hasChanged(n,o)&&track(a,`get`,n),track(a,`get`,o));let{has:s}=getProto(a),c=t?toShallow:e?toReadonly:toReactive;if(s.call(a,n))return c(r.get(n));if(s.call(a,o))return c(r.get(o));r!==a&&r.get(n)},get size(){let t=this.__v_raw;return!e&&track(toRaw(t),`iterate`,ITERATE_KEY),t.size},has(t){let n=this.__v_raw,r=toRaw(n),a=toRaw(t);return e||(hasChanged(t,a)&&track(r,`has`,t),track(r,`has`,a)),t===a?n.has(t):n.has(t)||n.has(a)},forEach(n,r){let a=this,o=a.__v_raw,s=toRaw(o),c=t?toShallow:e?toReadonly:toReactive;return!e&&track(s,`iterate`,ITERATE_KEY),o.forEach((e,t)=>n.call(r,c(e),c(t),a))}};return extend(n,e?{add:createReadonlyMethod(`add`),set:createReadonlyMethod(`set`),delete:createReadonlyMethod(`delete`),clear:createReadonlyMethod(`clear`)}:{add(e){let n=toRaw(this),r=getProto(n),a=toRaw(e),o=!t&&!isShallow(e)&&!isReadonly(e)?a:e;return r.has.call(n,o)||hasChanged(e,o)&&r.has.call(n,e)||hasChanged(a,o)&&r.has.call(n,a)||(n.add(o),trigger(n,`add`,o,o)),this},set(e,n){t||isShallow(n)||isReadonly(n)||(n=toRaw(n));let r=toRaw(this),{has:a,get:o}=getProto(r),s=a.call(r,e);s||=(e=toRaw(e),a.call(r,e));let c=o.call(r,e);return r.set(e,n),s?hasChanged(n,c)&&trigger(r,`set`,e,n,c):trigger(r,`add`,e,n),this},delete(e){let t=toRaw(this),{has:n,get:r}=getProto(t),a=n.call(t,e);a||=(e=toRaw(e),n.call(t,e));let o=r?r.call(t,e):void 0,s=t.delete(e);return a&&trigger(t,`delete`,e,void 0,o),s},clear(){let e=toRaw(this),t=e.size!==0,n,r=e.clear();return t&&trigger(e,`clear`,void 0,void 0,void 0),r}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=createIterableMethod(r,e,t)}),n}function createInstrumentationGetter(e,t){let n=createInstrumentations(e,t);return(t,r,a)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(hasOwn(n,r)&&r in t?n:t,r,a)}var mutableCollectionHandlers={get:createInstrumentationGetter(!1,!1)},shallowCollectionHandlers={get:createInstrumentationGetter(!1,!0)},readonlyCollectionHandlers={get:createInstrumentationGetter(!0,!1)},reactiveMap=new WeakMap,shallowReactiveMap=new WeakMap,readonlyMap=new WeakMap,shallowReadonlyMap=new WeakMap;function targetTypeMap(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function getTargetType(e){return e.__v_skip||!Object.isExtensible(e)?0:targetTypeMap(toRawType(e))}function reactive(e){return isReadonly(e)?e:createReactiveObject(e,!1,mutableHandlers,mutableCollectionHandlers,reactiveMap)}function shallowReactive(e){return createReactiveObject(e,!1,shallowReactiveHandlers,shallowCollectionHandlers,shallowReactiveMap)}function readonly(e){return createReactiveObject(e,!0,readonlyHandlers,readonlyCollectionHandlers,readonlyMap)}function createReactiveObject(e,t,n,r,a){if(!isObject(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let o=getTargetType(e);if(o===0)return e;let s=a.get(e);if(s)return s;let c=new Proxy(e,o===2?r:n);return a.set(e,c),c}function isReactive(e){return isReadonly(e)?isReactive(e.__v_raw):!!(e&&e.__v_isReactive)}function isReadonly(e){return!!(e&&e.__v_isReadonly)}function isShallow(e){return!!(e&&e.__v_isShallow)}function isProxy(e){return e?!!e.__v_raw:!1}function toRaw(e){let t=e&&e.__v_raw;return t?toRaw(t):e}function markRaw(e){return!hasOwn(e,`__v_skip`)&&Object.isExtensible(e)&&def(e,`__v_skip`,!0),e}var toReactive=e=>isObject(e)?reactive(e):e,toReadonly=e=>isObject(e)?readonly(e):e;function isRef(e){return e?e.__v_isRef===!0:!1}function ref(e){return createRef(e,!1)}function shallowRef(e){return createRef(e,!0)}function createRef(e,t){return isRef(e)?e:new RefImpl(e,t)}var RefImpl=class{constructor(e,t){this.dep=new Dep,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:toRaw(e),this._value=t?e:toReactive(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||isShallow(e)||isReadonly(e);e=n?e:toRaw(e),hasChanged(e,t)&&(this._rawValue=e,this._value=n?e:toReactive(e),this.dep.trigger())}};function triggerRef(e){e.dep&&e.dep.trigger()}function unref(e){return isRef(e)?e.value:e}var shallowUnwrapHandlers={get:(e,t,n)=>t===`__v_raw`?e:unref(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let a=e[t];return isRef(a)&&!isRef(n)?(a.value=n,!0):Reflect.set(e,t,n,r)}};function proxyRefs(e){return isReactive(e)?e:new Proxy(e,shallowUnwrapHandlers)}function toRefs(e){let t=isArray(e)?Array(e.length):{};for(let n in e)t[n]=propertyToRef(e,n);return t}var ObjectRefImpl=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=isSymbol(t)?t:String(t),this._raw=toRaw(e);let r=!0,a=e;if(!isArray(e)||isSymbol(this._key)||!isIntegerKey(this._key))do r=!isProxy(a)||isShallow(a);while(r&&(a=a.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=unref(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&isRef(this._raw[this._key])){let t=this._object[this._key];if(isRef(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return getDepFromReactive(this._raw,this._key)}};function propertyToRef(e,t,n){return new ObjectRefImpl(e,t,n)}var ComputedRefImpl=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Dep(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=globalVersion-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&activeSub!==this)return batch(this,!0),!0}get value(){let e=this.dep.track();return refreshComputed(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function computed$1(e,t,n=!1){let r,a;return isFunction(e)?r=e:(r=e.get,a=e.set),new ComputedRefImpl(r,a,n)}var INITIAL_WATCHER_VALUE={},cleanupMap=new WeakMap,activeWatcher=void 0;function onWatcherCleanup(e,t=!1,n=activeWatcher){if(n){let t=cleanupMap.get(n);t||cleanupMap.set(n,t=[]),t.push(e)}}function watch$1(e,t,n=EMPTY_OBJ){let{immediate:r,deep:a,once:o,scheduler:s,augmentJob:c,call:l}=n,u=e=>a?e:isShallow(e)||a===!1||a===0?traverse(e,1):traverse(e),d,f,m,g,_=!1,v=!1;if(isRef(e)?(f=()=>e.value,_=isShallow(e)):isReactive(e)?(f=()=>u(e),_=!0):isArray(e)?(v=!0,_=e.some(e=>isReactive(e)||isShallow(e)),f=()=>e.map(e=>{if(isRef(e))return e.value;if(isReactive(e))return u(e);if(isFunction(e))return l?l(e,2):e()})):f=isFunction(e)?t?l?()=>l(e,2):e:()=>{if(m){pauseTracking();try{m()}finally{resetTracking()}}let t=activeWatcher;activeWatcher=d;try{return l?l(e,3,[g]):e(g)}finally{activeWatcher=t}}:NOOP,t&&a){let e=f,t=a===!0?1/0:a;f=()=>traverse(e(),t)}let y=getCurrentScope(),b=()=>{d.stop(),y&&y.active&&remove$1(y.effects,d)};if(o&&t){let e=t;t=(...t)=>{e(...t),b()}}let x=v?Array(e.length).fill(INITIAL_WATCHER_VALUE):INITIAL_WATCHER_VALUE,S=e=>{if(d.flags&1&&(d.dirty||e)){if(t){let e=d.run();if(a||_||(v?e.some((e,t)=>hasChanged(e,x[t])):hasChanged(e,x))){m&&m();let n=activeWatcher;activeWatcher=d;try{let n=[e,x===INITIAL_WATCHER_VALUE?void 0:v&&x[0]===INITIAL_WATCHER_VALUE?[]:x,g];x=e,l?l(t,3,n):t(...n)}finally{activeWatcher=n}}}else d.run()}};return c&&c(S),d=new ReactiveEffect(f),d.scheduler=s?()=>s(S,!1):S,g=e=>onWatcherCleanup(e,!1,d),m=d.onStop=()=>{let e=cleanupMap.get(d);if(e){if(l)l(e,4);else for(let t of e)t();cleanupMap.delete(d)}},t?r?S(!0):x=d.run():s?s(S.bind(null,!0),!0):d.run(),b.pause=d.pause.bind(d),b.resume=d.resume.bind(d),b.stop=b,b}function traverse(e,t=1/0,n){if(t<=0||!isObject(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,isRef(e))traverse(e.value,t,n);else if(isArray(e))for(let r=0;r<e.length;r++)traverse(e[r],t,n);else if(isSet(e)||isMap(e))e.forEach(e=>{traverse(e,t,n)});else if(isPlainObject$2(e)){for(let r in e)traverse(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&traverse(e[r],t,n)}return e}function callWithErrorHandling(e,t,n,r){try{return r?e(...r):e()}catch(e){handleError$2(e,t,n)}}function callWithAsyncErrorHandling(e,t,n,r){if(isFunction(e)){let a=callWithErrorHandling(e,t,n,r);return a&&isPromise(a)&&a.catch(e=>{handleError$2(e,t,n)}),a}if(isArray(e)){let a=[];for(let o=0;o<e.length;o++)a.push(callWithAsyncErrorHandling(e[o],t,n,r));return a}}function handleError$2(e,t,n,r=!0){let a=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||EMPTY_OBJ;if(t){let r=t.parent,a=t.proxy,s=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,a,s)===!1)return}r=r.parent}if(o){pauseTracking(),callWithErrorHandling(o,null,10,[e,a,s]),resetTracking();return}}logError(e,n,a,r,s)}function logError(e,t,n,r=!0,a=!1){if(a)throw e;console.error(e)}var queue=[],flushIndex=-1,pendingPostFlushCbs=[],activePostFlushCbs=null,postFlushIndex=0,resolvedPromise=Promise.resolve(),currentFlushPromise=null;function nextTick(e){let t=currentFlushPromise||resolvedPromise;return e?t.then(this?e.bind(this):e):t}function findInsertionIndex(e){let t=flushIndex+1,n=queue.length;for(;t<n;){let r=t+n>>>1,a=queue[r],o=getId(a);o<e||o===e&&a.flags&2?t=r+1:n=r}return t}function queueJob(e){if(!(e.flags&1)){let t=getId(e),n=queue[queue.length-1];!n||!(e.flags&2)&&t>=getId(n)?queue.push(e):queue.splice(findInsertionIndex(t),0,e),e.flags|=1,queueFlush()}}function queueFlush(){currentFlushPromise||=resolvedPromise.then(flushJobs)}function queuePostFlushCb(e){isArray(e)?pendingPostFlushCbs.push(...e):activePostFlushCbs&&e.id===-1?activePostFlushCbs.splice(postFlushIndex+1,0,e):e.flags&1||(pendingPostFlushCbs.push(e),e.flags|=1),queueFlush()}function flushPreFlushCbs(e,t,n=flushIndex+1){for(;n<queue.length;n++){let t=queue[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;queue.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function flushPostFlushCbs(e){if(pendingPostFlushCbs.length){let e=[...new Set(pendingPostFlushCbs)].sort((e,t)=>getId(e)-getId(t));if(pendingPostFlushCbs.length=0,activePostFlushCbs){activePostFlushCbs.push(...e);return}for(activePostFlushCbs=e,postFlushIndex=0;postFlushIndex<activePostFlushCbs.length;postFlushIndex++){let e=activePostFlushCbs[postFlushIndex];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}activePostFlushCbs=null,postFlushIndex=0}}var getId=e=>e.id==null?e.flags&2?-1:1/0:e.id;function flushJobs(e){try{for(flushIndex=0;flushIndex<queue.length;flushIndex++){let e=queue[flushIndex];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),callWithErrorHandling(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;flushIndex<queue.length;flushIndex++){let e=queue[flushIndex];e&&(e.flags&=-2)}flushIndex=-1,queue.length=0,flushPostFlushCbs(e),currentFlushPromise=null,(queue.length||pendingPostFlushCbs.length)&&flushJobs(e)}}var currentRenderingInstance=null,currentScopeId=null;function setCurrentRenderingInstance(e){let t=currentRenderingInstance;return currentRenderingInstance=e,currentScopeId=e&&e.type.__scopeId||null,t}function withCtx(e,t=currentRenderingInstance,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&setBlockTracking(-1);let a=setCurrentRenderingInstance(t),o;try{o=e(...n)}finally{setCurrentRenderingInstance(a),r._d&&setBlockTracking(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function withDirectives(e,t){if(currentRenderingInstance===null)return e;let n=getComponentPublicInstance(currentRenderingInstance),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[a,o,s,c=EMPTY_OBJ]=t[e];a&&(isFunction(a)&&(a={mounted:a,updated:a}),a.deep&&traverse(o),r.push({dir:a,instance:n,value:o,oldValue:void 0,arg:s,modifiers:c}))}return e}function invokeDirectiveHook(e,t,n,r){let a=e.dirs,o=t&&t.dirs;for(let s=0;s<a.length;s++){let c=a[s];o&&(c.oldValue=o[s].value);let l=c.dir[r];l&&(pauseTracking(),callWithAsyncErrorHandling(l,n,8,[e.el,c,e,t]),resetTracking())}}function provide(e,t){if(currentInstance){let n=currentInstance.provides,r=currentInstance.parent&¤tInstance.parent.provides;r===n&&(n=currentInstance.provides=Object.create(r)),n[e]=t}}function inject(e,t,n=!1){let r=getCurrentInstance();if(r||currentApp){let a=currentApp?currentApp._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(a&&e in a)return a[e];if(arguments.length>1)return n&&isFunction(t)?t.call(r&&r.proxy):t}}function hasInjectionContext(){return!!(getCurrentInstance()||currentApp)}var ssrContextKey=Symbol.for(`v-scx`),useSSRContext=()=>inject(ssrContextKey);function watch(e,t,n){return doWatch(e,t,n)}function doWatch(e,t,n=EMPTY_OBJ){let{immediate:r,deep:a,flush:o,once:s}=n,c=extend({},n),l=t&&r||!t&&o!==`post`,u;if(isInSSRComponentSetup){if(o===`sync`){let e=useSSRContext();u=e.__watcherHandles||=[]}else if(!l){let e=()=>{};return e.stop=NOOP,e.resume=NOOP,e.pause=NOOP,e}}let d=currentInstance;c.call=(e,t,n)=>callWithAsyncErrorHandling(e,d,t,n);let f=!1;o===`post`?c.scheduler=e=>{queuePostRenderEffect(e,d&&d.suspense)}:o!==`sync`&&(f=!0,c.scheduler=(e,t)=>{t?e():queueJob(e)}),c.augmentJob=e=>{t&&(e.flags|=4),f&&(e.flags|=2,d&&(e.id=d.uid,e.i=d))};let m=watch$1(e,t,c);return isInSSRComponentSetup&&(u?u.push(m):l&&m()),m}function instanceWatch(e,t,n){let r=this.proxy,a=isString(e)?e.includes(`.`)?createPathGetter(r,e):()=>r[e]:e.bind(r,r),o;isFunction(t)?o=t:(o=t.handler,n=t);let s=setCurrentInstance(this),c=doWatch(a,o.bind(r),n);return s(),c}function createPathGetter(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var TeleportEndKey=Symbol(`_vte`),isTeleport=e=>e.__isTeleport,leaveCbKey=Symbol(`_leaveCb`),enterCbKey=Symbol(`_enterCb`);function useTransitionState(){let e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return onMounted(()=>{e.isMounted=!0}),onBeforeUnmount(()=>{e.isUnmounting=!0}),e}var TransitionHookValidator=[Function,Array],BaseTransitionPropsValidators={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:TransitionHookValidator,onEnter:TransitionHookValidator,onAfterEnter:TransitionHookValidator,onEnterCancelled:TransitionHookValidator,onBeforeLeave:TransitionHookValidator,onLeave:TransitionHookValidator,onAfterLeave:TransitionHookValidator,onLeaveCancelled:TransitionHookValidator,onBeforeAppear:TransitionHookValidator,onAppear:TransitionHookValidator,onAfterAppear:TransitionHookValidator,onAppearCancelled:TransitionHookValidator},recursiveGetSubtree=e=>{let t=e.subTree;return t.component?recursiveGetSubtree(t.component):t},BaseTransitionImpl={name:`BaseTransition`,props:BaseTransitionPropsValidators,setup(e,{slots:t}){let n=getCurrentInstance(),r=useTransitionState();return()=>{let a=t.default&&getTransitionRawChildren(t.default(),!0);if(!a||!a.length)return;let o=findNonCommentChild(a),s=toRaw(e),{mode:c}=s;if(r.isLeaving)return emptyPlaceholder(o);let l=getInnerChild$1(o);if(!l)return emptyPlaceholder(o);let u=resolveTransitionHooks(l,s,r,n,e=>u=e);l.type!==Comment&&setTransitionHooks(l,u);let d=n.subTree&&getInnerChild$1(n.subTree);if(d&&d.type!==Comment&&!isSameVNodeType(d,l)&&recursiveGetSubtree(n).type!==Comment){let e=resolveTransitionHooks(d,s,r,n);if(setTransitionHooks(d,e),c===`out-in`&&l.type!==Comment)return r.isLeaving=!0,e.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete e.afterLeave,d=void 0},emptyPlaceholder(o);c===`in-out`&&l.type!==Comment?e.delayLeave=(e,t,n)=>{let a=getLeavingNodesForType(r,d);a[String(d.key)]=d,e[leaveCbKey]=()=>{t(),e[leaveCbKey]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{n(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&=void 0;return o}}};function findNonCommentChild(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==Comment){t=n;break}}return t}var BaseTransition=BaseTransitionImpl;function getLeavingNodesForType(e,t){let{leavingVNodes:n}=e,r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function resolveTransitionHooks(e,t,n,r,a){let{appear:o,mode:s,persisted:c=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:d,onEnterCancelled:f,onBeforeLeave:m,onLeave:g,onAfterLeave:_,onLeaveCancelled:v,onBeforeAppear:y,onAppear:b,onAfterAppear:x,onAppearCancelled:S}=t,C=String(e.key),w=getLeavingNodesForType(n,e),T=(e,t)=>{e&&callWithAsyncErrorHandling(e,r,9,t)},E=(e,t)=>{let n=t[1];T(e,t),isArray(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},D={mode:s,persisted:c,beforeEnter(t){let r=l;if(!n.isMounted){if(o)r=y||l;else return}t[leaveCbKey]&&t[leaveCbKey](!0);let a=w[C];a&&isSameVNodeType(e,a)&&a.el[leaveCbKey]&&a.el[leaveCbKey](),T(r,[t])},enter(t){if(w[C]===e)return;let r=u,a=d,s=f;if(!n.isMounted){if(o)r=b||u,a=x||d,s=S||f;else return}let c=!1;t[enterCbKey]=e=>{c||(c=!0,T(e?s:a,[t]),D.delayedLeave&&D.delayedLeave(),t[enterCbKey]=void 0)};let l=t[enterCbKey].bind(null,!1);r?E(r,[t,l]):l()},leave(t,r){let a=String(e.key);if(t[enterCbKey]&&t[enterCbKey](!0),n.isUnmounting)return r();T(m,[t]);let o=!1;t[leaveCbKey]=n=>{o||(o=!0,r(),T(n?v:_,[t]),t[leaveCbKey]=void 0,w[a]===e&&delete w[a])};let s=t[leaveCbKey].bind(null,!1);w[a]=e,g?E(g,[t,s]):s()},clone(e){let o=resolveTransitionHooks(e,t,n,r,a);return a&&a(o),o}};return D}function emptyPlaceholder(e){if(isKeepAlive(e))return e=cloneVNode(e),e.children=null,e}function getInnerChild$1(e){if(!isKeepAlive(e))return isTeleport(e.type)&&e.children?findNonCommentChild(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&isFunction(n.default))return n.default()}}function setTransitionHooks(e,t){e.shapeFlag&6&&e.component?(e.transition=t,setTransitionHooks(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function getTransitionRawChildren(e,t=!1,n){let r=[],a=0;for(let o=0;o<e.length;o++){let s=e[o],c=n==null?s.key:String(n)+String(s.key==null?o:s.key);s.type===Fragment?(s.patchFlag&128&&a++,r=r.concat(getTransitionRawChildren(s.children,t,c))):(t||s.type!==Comment)&&r.push(c==null?s:cloneVNode(s,{key:c}))}if(a>1)for(let e=0;e<r.length;e++)r[e].patchFlag=-2;return r}function defineComponent(e,t){return isFunction(e)?extend({name:e.name},t,{setup:e}):e}function markAsyncBoundary(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function isTemplateRefKey(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var pendingSetRefMap=new WeakMap;function setRef(e,t,n,r,a=!1){if(isArray(e)){e.forEach((e,o)=>setRef(e,t&&(isArray(t)?t[o]:t),n,r,a));return}if(isAsyncWrapper(r)&&!a){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&setRef(e,t,n,r.component.subTree);return}let o=r.shapeFlag&4?getComponentPublicInstance(r.component):r.el,s=a?null:o,{i:c,r:l}=e,u=t&&t.r,d=c.refs===EMPTY_OBJ?c.refs={}:c.refs,f=c.setupState,m=toRaw(f),g=f===EMPTY_OBJ?NO:e=>!isTemplateRefKey(d,e)&&hasOwn(m,e),_=(e,t)=>!(t&&isTemplateRefKey(d,t));if(u!=null&&u!==l){if(invalidatePendingSetRef(t),isString(u))d[u]=null,g(u)&&(f[u]=null);else if(isRef(u)){let e=t;_(u,e.k)&&(u.value=null),e.k&&(d[e.k]=null)}}if(isFunction(l))callWithErrorHandling(l,c,12,[s,d]);else{let t=isString(l),r=isRef(l);if(t||r){let c=()=>{if(e.f){let n=t?g(l)?f[l]:d[l]:_(l)||!e.k?l.value:d[e.k];if(a)isArray(n)&&remove$1(n,o);else if(isArray(n))n.includes(o)||n.push(o);else if(t)d[l]=[o],g(l)&&(f[l]=d[l]);else{let t=[o];_(l,e.k)&&(l.value=t),e.k&&(d[e.k]=t)}}else t?(d[l]=s,g(l)&&(f[l]=s)):r&&(_(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){let t=()=>{c(),pendingSetRefMap.delete(e)};t.id=-1,pendingSetRefMap.set(e,t),queuePostRenderEffect(t,n)}else invalidatePendingSetRef(e),c()}}}function invalidatePendingSetRef(e){let t=pendingSetRefMap.get(e);t&&(t.flags|=8,pendingSetRefMap.delete(e))}var isComment=e=>e.nodeType===8,requestIdleCallback=getGlobalThis().requestIdleCallback||(e=>setTimeout(e,1)),cancelIdleCallback=getGlobalThis().cancelIdleCallback||(e=>clearTimeout(e));function forEachElement(e,t){if(isComment(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(isComment(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var isAsyncWrapper=e=>!!e.type.__asyncLoader;function defineAsyncComponent(e){isFunction(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:a=200,hydrate:o,timeout:s,suspensible:c=!0,onError:l}=e,u=null,d,f=0,m=()=>(f++,u=null,g()),g=()=>{let e;return u||(e=u=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),l)return new Promise((t,n)=>{l(e,()=>t(m()),()=>n(e),f+1)});throw e}).then(t=>e!==u&&u?u:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),d=t,t)))};return defineComponent({name:`AsyncComponentWrapper`,__asyncLoader:g,__asyncHydrate(e,t,n){let r=!1;(t.bu||=[]).push(()=>r=!0);let a=()=>{r||n()},s=o?()=>{let n=o(a,t=>forEachElement(e,t));n&&(t.bum||=[]).push(n)}:a;d?s():g().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return d},setup(){let e=currentInstance;if(markAsyncBoundary(e),d)return()=>createInnerComp(d,e);let t=t=>{u=null,handleError$2(t,e,13,!r)};if(c&&e.suspense||isInSSRComponentSetup)return g().then(t=>()=>createInnerComp(t,e)).catch(e=>(t(e),()=>r?createVNode(r,{error:e}):null));let o=ref(!1),l=ref(),f=ref(!!a);return a&&setTimeout(()=>{f.value=!1},a),s!=null&&setTimeout(()=>{if(!o.value&&!l.value){let e=Error(`Async component timed out after ${s}ms.`);t(e),l.value=e}},s),g().then(()=>{o.value=!0,e.parent&&isKeepAlive(e.parent.vnode)&&e.parent.update()}).catch(e=>{t(e),l.value=e}),()=>{if(o.value&&d)return createInnerComp(d,e);if(l.value&&r)return createVNode(r,{error:l.value});if(n&&!f.value)return createInnerComp(n,e)}}})}function createInnerComp(e,t){let{ref:n,props:r,children:a,ce:o}=t.vnode,s=createVNode(e,r,a);return s.ref=n,s.ce=o,delete t.vnode.ce,s}var isKeepAlive=e=>e.type.__isKeepAlive;function onActivated(e,t){registerKeepAliveHook(e,`a`,t)}function onDeactivated(e,t){registerKeepAliveHook(e,`da`,t)}function registerKeepAliveHook(e,t,n=currentInstance){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(injectHook(t,r,n),n){let e=n.parent;for(;e&&e.parent;)isKeepAlive(e.parent.vnode)&&injectToKeepAliveRoot(r,t,n,e),e=e.parent}}function injectToKeepAliveRoot(e,t,n,r){let a=injectHook(t,e,r,!0);onUnmounted(()=>{remove$1(r[t],a)},n)}function injectHook(e,t,n=currentInstance,r=!1){if(n){let a=n[e]||(n[e]=[]),o=t.__weh||=(...r)=>{pauseTracking();let a=setCurrentInstance(n),o=callWithAsyncErrorHandling(t,n,e,r);return a(),resetTracking(),o};return r?a.unshift(o):a.push(o),o}}var createHook=e=>(t,n=currentInstance)=>{isInSSRComponentSetup&&e!==`sp`||injectHook(e,(...e)=>t(...e),n)},onBeforeMount=createHook(`bm`),onMounted=createHook(`m`),onBeforeUpdate=createHook(`bu`),onUpdated=createHook(`u`),onBeforeUnmount=createHook(`bum`),onUnmounted=createHook(`um`),onServerPrefetch=createHook(`sp`),onRenderTriggered=createHook(`rtg`),onRenderTracked=createHook(`rtc`);function onErrorCaptured(e,t=currentInstance){injectHook(`ec`,e,t)}var NULL_DYNAMIC_COMPONENT=Symbol.for(`v-ndc`);function renderList(e,t,n,r){let a,o=n&&n[r],s=isArray(e);if(s||isString(e)){let n=s&&isReactive(e),r=!1,c=!1;n&&(r=!isShallow(e),c=isReadonly(e),e=shallowReadArray(e)),a=Array(e.length);for(let n=0,s=e.length;n<s;n++)a[n]=t(r?c?toReadonly(toReactive(e[n])):toReactive(e[n]):e[n],n,void 0,o&&o[n])}else if(typeof e==`number`){a=Array(e);for(let n=0;n<e;n++)a[n]=t(n+1,n,void 0,o&&o[n])}else if(isObject(e)){if(e[Symbol.iterator])a=Array.from(e,(e,n)=>t(e,n,void 0,o&&o[n]));else{let n=Object.keys(e);a=Array(n.length);for(let r=0,s=n.length;r<s;r++){let s=n[r];a[r]=t(e[s],s,r,o&&o[r])}}}else a=[];return n&&(n[r]=a),a}var getPublicInstance=e=>e?isStatefulComponent(e)?getComponentPublicInstance(e):getPublicInstance(e.parent):null,publicPropertiesMap=extend(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>getPublicInstance(e.parent),$root:e=>getPublicInstance(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>resolveMergedOptions(e),$forceUpdate:e=>e.f||=()=>{queueJob(e.update)},$nextTick:e=>e.n||=nextTick.bind(e.proxy),$watch:e=>instanceWatch.bind(e)}),hasSetupBinding=(e,t)=>e!==EMPTY_OBJ&&!e.__isScriptSetup&&hasOwn(e,t),PublicInstanceProxyHandlers={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:a,props:o,accessCache:s,type:c,appContext:l}=e;if(t[0]!==`$`){let e=s[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return a[t];case 4:return n[t];case 3:return o[t]}else if(hasSetupBinding(r,t))return s[t]=1,r[t];else if(a!==EMPTY_OBJ&&hasOwn(a,t))return s[t]=2,a[t];else if(hasOwn(o,t))return s[t]=3,o[t];else if(n!==EMPTY_OBJ&&hasOwn(n,t))return s[t]=4,n[t];else shouldCacheAccess&&(s[t]=0)}let u=publicPropertiesMap[t],d,f;if(u)return t===`$attrs`&&track(e.attrs,`get`,``),u(e);if((d=c.__cssModules)&&(d=d[t]))return d;if(n!==EMPTY_OBJ&&hasOwn(n,t))return s[t]=4,n[t];if(f=l.config.globalProperties,hasOwn(f,t))return f[t]},set({_:e},t,n){let{data:r,setupState:a,ctx:o}=e;return hasSetupBinding(a,t)?(a[t]=n,!0):r!==EMPTY_OBJ&&hasOwn(r,t)?(r[t]=n,!0):hasOwn(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:a,props:o,type:s}},c){let l;return!!(n[c]||e!==EMPTY_OBJ&&c[0]!==`$`&&hasOwn(e,c)||hasSetupBinding(t,c)||hasOwn(o,c)||hasOwn(r,c)||hasOwn(publicPropertiesMap,c)||hasOwn(a.config.globalProperties,c)||(l=s.__cssModules)&&l[c])},defineProperty(e,t,n){return n.get==null?hasOwn(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function normalizePropsOrEmits(e){return isArray(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}var shouldCacheAccess=!0;function applyOptions(e){let t=resolveMergedOptions(e),n=e.proxy,r=e.ctx;shouldCacheAccess=!1,t.beforeCreate&&callHook$1(t.beforeCreate,e,`bc`);let{data:a,computed:o,methods:s,watch:c,provide:l,inject:u,created:d,beforeMount:f,mounted:m,beforeUpdate:g,updated:_,activated:v,deactivated:y,beforeDestroy:b,beforeUnmount:x,destroyed:S,unmounted:C,render:w,renderTracked:T,renderTriggered:E,errorCaptured:D,serverPrefetch:O,expose:k,inheritAttrs:A,components:j,directives:M,filters:ee}=t,P=null;if(u&&resolveInjections(u,r,null),s)for(let e in s){let t=s[e];isFunction(t)&&(r[e]=t.bind(n))}if(a){let t=a.call(n,n);isObject(t)&&(e.data=reactive(t))}if(shouldCacheAccess=!0,o)for(let e in o){let t=o[e],a=computed({get:isFunction(t)?t.bind(n,n):isFunction(t.get)?t.get.bind(n,n):NOOP,set:!isFunction(t)&&isFunction(t.set)?t.set.bind(n):NOOP});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e})}if(c)for(let e in c)createWatcher(c[e],r,n,e);if(l){let e=isFunction(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{provide(t,e[t])})}d&&callHook$1(d,e,`c`);function F(e,t){isArray(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(F(onBeforeMount,f),F(onMounted,m),F(onBeforeUpdate,g),F(onUpdated,_),F(onActivated,v),F(onDeactivated,y),F(onErrorCaptured,D),F(onRenderTracked,T),F(onRenderTriggered,E),F(onBeforeUnmount,x),F(onUnmounted,C),F(onServerPrefetch,O),isArray(k)){if(k.length){let t=e.exposed||={};k.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={}}w&&e.render===NOOP&&(e.render=w),A!=null&&(e.inheritAttrs=A),j&&(e.components=j),M&&(e.directives=M),O&&markAsyncBoundary(e)}function resolveInjections(e,t,n=NOOP){isArray(e)&&(e=normalizeInject(e));for(let n in e){let r=e[n],a;a=isObject(r)?`default`in r?inject(r.from||n,r.default,!0):inject(r.from||n):inject(r),isRef(a)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e}):t[n]=a}}function callHook$1(e,t,n){callWithAsyncErrorHandling(isArray(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function createWatcher(e,t,n,r){let a=r.includes(`.`)?createPathGetter(n,r):()=>n[r];if(isString(e)){let n=t[e];isFunction(n)&&watch(a,n)}else if(isFunction(e))watch(a,e.bind(n));else if(isObject(e)){if(isArray(e))e.forEach(e=>createWatcher(e,t,n,r));else{let r=isFunction(e.handler)?e.handler.bind(n):t[e.handler];isFunction(r)&&watch(a,r,e)}}}function resolveMergedOptions(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:a,optionsCache:o,config:{optionMergeStrategies:s}}=e.appContext,c=o.get(t),l;return c?l=c:!a.length&&!n&&!r?l=t:(l={},a.length&&a.forEach(e=>mergeOptions(l,e,s,!0)),mergeOptions(l,t,s)),isObject(t)&&o.set(t,l),l}function mergeOptions(e,t,n,r=!1){let{mixins:a,extends:o}=t;o&&mergeOptions(e,o,n,!0),a&&a.forEach(t=>mergeOptions(e,t,n,!0));for(let a in t)if(!(r&&a===`expose`)){let r=internalOptionMergeStrats[a]||n&&n[a];e[a]=r?r(e[a],t[a]):t[a]}return e}var internalOptionMergeStrats={data:mergeDataFn,props:mergeEmitsOrPropsOptions,emits:mergeEmitsOrPropsOptions,methods:mergeObjectOptions,computed:mergeObjectOptions,beforeCreate:mergeAsArray,created:mergeAsArray,beforeMount:mergeAsArray,mounted:mergeAsArray,beforeUpdate:mergeAsArray,updated:mergeAsArray,beforeDestroy:mergeAsArray,beforeUnmount:mergeAsArray,destroyed:mergeAsArray,unmounted:mergeAsArray,activated:mergeAsArray,deactivated:mergeAsArray,errorCaptured:mergeAsArray,serverPrefetch:mergeAsArray,components:mergeObjectOptions,directives:mergeObjectOptions,watch:mergeWatchOptions,provide:mergeDataFn,inject:mergeInject};function mergeDataFn(e,t){return t?e?function(){return extend(isFunction(e)?e.call(this,this):e,isFunction(t)?t.call(this,this):t)}:t:e}function mergeInject(e,t){return mergeObjectOptions(normalizeInject(e),normalizeInject(t))}function normalizeInject(e){if(isArray(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function mergeAsArray(e,t){return e?[...new Set([].concat(e,t))]:t}function mergeObjectOptions(e,t){return e?extend(Object.create(null),e,t):t}function mergeEmitsOrPropsOptions(e,t){return e?isArray(e)&&isArray(t)?[...new Set([...e,...t])]:extend(Object.create(null),normalizePropsOrEmits(e),normalizePropsOrEmits(t??{})):t}function mergeWatchOptions(e,t){if(!e)return t;if(!t)return e;let n=extend(Object.create(null),e);for(let r in t)n[r]=mergeAsArray(e[r],t[r]);return n}function createAppContext(){return{app:null,config:{isNativeTag:NO,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var uid$1=0;function createAppAPI(e,t){return function(n,r=null){isFunction(n)||(n=extend({},n)),r!=null&&!isObject(r)&&(r=null);let a=createAppContext(),o=new WeakSet,s=[],c=!1,l=a.app={_uid:uid$1++,_component:n,_props:r,_container:null,_context:a,_instance:null,version:version$3,get config(){return a.config},set config(e){},use(e,...t){return o.has(e)||(e&&isFunction(e.install)?(o.add(e),e.install(l,...t)):isFunction(e)&&(o.add(e),e(l,...t))),l},mixin(e){return a.mixins.includes(e)||a.mixins.push(e),l},component(e,t){return t?(a.components[e]=t,l):a.components[e]},directive(e,t){return t?(a.directives[e]=t,l):a.directives[e]},mount(o,s,u){if(!c){let d=l._ceVNode||createVNode(n,r);return d.appContext=a,u===!0?u=`svg`:u===!1&&(u=void 0),s&&t?t(d,o):e(d,o,u),c=!0,l._container=o,o.__vue_app__=l,getComponentPublicInstance(d.component)}},onUnmount(e){s.push(e)},unmount(){c&&(callWithAsyncErrorHandling(s,l._instance,16),e(null,l._container),delete l._container.__vue_app__)},provide(e,t){return a.provides[e]=t,l},runWithContext(e){let t=currentApp;currentApp=l;try{return e()}finally{currentApp=t}}};return l}}var currentApp=null,getModelModifiers=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${camelize(t)}Modifiers`]||e[`${hyphenate(t)}Modifiers`];function emit(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||EMPTY_OBJ,a=n,o=t.startsWith(`update:`),s=o&&getModelModifiers(r,t.slice(7));s&&(s.trim&&(a=n.map(e=>isString(e)?e.trim():e)),s.number&&(a=n.map(looseToNumber)));let c,l=r[c=toHandlerKey(t)]||r[c=toHandlerKey(camelize(t))];!l&&o&&(l=r[c=toHandlerKey(hyphenate(t))]),l&&callWithAsyncErrorHandling(l,e,6,a);let u=r[c+`Once`];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[c])return;e.emitted[c]=!0,callWithAsyncErrorHandling(u,e,6,a)}}var mixinEmitsCache=new WeakMap;function normalizeEmitsOptions(e,t,n=!1){let r=n?mixinEmitsCache:t.emitsCache,a=r.get(e);if(a!==void 0)return a;let o=e.emits,s={},c=!1;if(!isFunction(e)){let r=e=>{let n=normalizeEmitsOptions(e,t,!0);n&&(c=!0,extend(s,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!o&&!c?(isObject(e)&&r.set(e,null),null):(isArray(o)?o.forEach(e=>s[e]=null):extend(s,o),isObject(e)&&r.set(e,s),s)}function isEmitListener(e,t){return!e||!isOn(t)?!1:(t=t.slice(2).replace(/Once$/,``),hasOwn(e,t[0].toLowerCase()+t.slice(1))||hasOwn(e,hyphenate(t))||hasOwn(e,t))}function renderComponentRoot(e){let{type:t,vnode:n,proxy:r,withProxy:a,propsOptions:[o],slots:s,attrs:c,emit:l,render:u,renderCache:d,props:f,data:m,setupState:g,ctx:_,inheritAttrs:v}=e,y=setCurrentRenderingInstance(e),b,x;try{if(n.shapeFlag&4){let e=a||r,t=e;b=normalizeVNode(u.call(t,e,d,f,g,m,_)),x=c}else{let e=t;b=normalizeVNode(e.length>1?e(f,{attrs:c,slots:s,emit:l}):e(f,null)),x=t.props?c:getFunctionalFallthrough(c)}}catch(t){blockStack.length=0,handleError$2(t,e,1),b=createVNode(Comment)}let S=b;if(x&&v!==!1){let e=Object.keys(x),{shapeFlag:t}=S;e.length&&t&7&&(o&&e.some(isModelListener)&&(x=filterModelListeners(x,o)),S=cloneVNode(S,x,!1,!0))}return n.dirs&&(S=cloneVNode(S,null,!1,!0),S.dirs=S.dirs?S.dirs.concat(n.dirs):n.dirs),n.transition&&setTransitionHooks(S,n.transition),b=S,setCurrentRenderingInstance(y),b}var getFunctionalFallthrough=e=>{let t;for(let n in e)(n===`class`||n===`style`||isOn(n))&&((t||={})[n]=e[n]);return t},filterModelListeners=(e,t)=>{let n={};for(let r in e)isModelListener(r)&&r.slice(9)in t||(n[r]=e[r]);return n};function shouldUpdateComponent(e,t,n){let{props:r,children:a,component:o}=e,{props:s,children:c,patchFlag:l}=t,u=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?hasPropsChanged(r,s,u):!!s;if(l&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(hasPropValueChanged(s,r,n)&&!isEmitListener(u,n))return!0}}}else return(a||c)&&(!c||!c.$stable)?!0:r===s?!1:r?!s||hasPropsChanged(r,s,u):!!s;return!1}function hasPropsChanged(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let a=0;a<r.length;a++){let o=r[a];if(hasPropValueChanged(t,e,o)&&!isEmitListener(n,o))return!0}return!1}function hasPropValueChanged(e,t,n){let r=e[n],a=t[n];return n===`style`&&isObject(r)&&isObject(a)?!looseEqual(r,a):r!==a}function updateHOCHostEl({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var internalObjectProto={},createInternalObject=()=>Object.create(internalObjectProto),isInternalObject=e=>Object.getPrototypeOf(e)===internalObjectProto;function initProps(e,t,n,r=!1){let a={},o=createInternalObject();e.propsDefaults=Object.create(null),setFullProps(e,t,a,o);for(let t in e.propsOptions[0])t in a||(a[t]=void 0);e.props=n?r?a:shallowReactive(a):e.type.props?a:o,e.attrs=o}function updateProps(e,t,n,r){let{props:a,attrs:o,vnode:{patchFlag:s}}=e,c=toRaw(a),[l]=e.propsOptions,u=!1;if((r||s>0)&&!(s&16)){if(s&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let s=n[r];if(isEmitListener(e.emitsOptions,s))continue;let d=t[s];if(l){if(hasOwn(o,s))d!==o[s]&&(o[s]=d,u=!0);else{let t=camelize(s);a[t]=resolvePropValue(l,c,t,d,e,!1)}}else d!==o[s]&&(o[s]=d,u=!0)}}}else{setFullProps(e,t,a,o)&&(u=!0);let r;for(let o in c)t&&(hasOwn(t,o)||(r=hyphenate(o))!==o&&hasOwn(t,r))||(l?n&&(n[o]!==void 0||n[r]!==void 0)&&(a[o]=resolvePropValue(l,c,o,void 0,e,!0)):delete a[o]);if(o!==c)for(let e in o)t&&hasOwn(t,e)||(delete o[e],u=!0)}u&&trigger(e.attrs,`set`,``)}function setFullProps(e,t,n,r){let[a,o]=e.propsOptions,s=!1,c;if(t)for(let l in t){if(isReservedProp(l))continue;let u=t[l],d;a&&hasOwn(a,d=camelize(l))?!o||!o.includes(d)?n[d]=u:(c||={})[d]=u:isEmitListener(e.emitsOptions,l)||l in r&&u===r[l]||(r[l]=u,s=!0)}if(o){let t=toRaw(n),r=c||EMPTY_OBJ;for(let s=0;s<o.length;s++){let c=o[s];n[c]=resolvePropValue(a,t,c,r[c],e,!hasOwn(r,c))}}return s}function resolvePropValue(e,t,n,r,a,o){let s=e[n];if(s!=null){let e=hasOwn(s,`default`);if(e&&r===void 0){let e=s.default;if(s.type!==Function&&!s.skipFactory&&isFunction(e)){let{propsDefaults:o}=a;if(n in o)r=o[n];else{let s=setCurrentInstance(a);r=o[n]=e.call(null,t),s()}}else r=e;a.ce&&a.ce._setProp(n,r)}s[0]&&(o&&!e?r=!1:s[1]&&(r===``||r===hyphenate(n))&&(r=!0))}return r}var mixinPropsCache=new WeakMap;function normalizePropsOptions(e,t,n=!1){let r=n?mixinPropsCache:t.propsCache,a=r.get(e);if(a)return a;let o=e.props,s={},c=[],l=!1;if(!isFunction(e)){let r=e=>{l=!0;let[n,r]=normalizePropsOptions(e,t,!0);extend(s,n),r&&c.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!o&&!l)return isObject(e)&&r.set(e,EMPTY_ARR),EMPTY_ARR;if(isArray(o))for(let e=0;e<o.length;e++){let t=camelize(o[e]);validatePropName(t)&&(s[t]=EMPTY_OBJ)}else if(o)for(let e in o){let t=camelize(e);if(validatePropName(t)){let n=o[e],r=s[t]=isArray(n)||isFunction(n)?{type:n}:extend({},n),a=r.type,l=!1,u=!0;if(isArray(a))for(let e=0;e<a.length;++e){let t=a[e],n=isFunction(t)&&t.name;if(n===`Boolean`){l=!0;break}n===`String`&&(u=!1)}else l=isFunction(a)&&a.name===`Boolean`;r[0]=l,r[1]=u,(l||hasOwn(r,`default`))&&c.push(t)}}let u=[s,c];return isObject(e)&&r.set(e,u),u}function validatePropName(e){return e[0]!==`$`&&!isReservedProp(e)}var isInternalKey=e=>e===`_`||e===`_ctx`||e===`$stable`,normalizeSlotValue=e=>isArray(e)?e.map(normalizeVNode):[normalizeVNode(e)],normalizeSlot=(e,t,n)=>{if(t._n)return t;let r=withCtx((...e)=>normalizeSlotValue(t(...e)),n);return r._c=!1,r},normalizeObjectSlots=(e,t,n)=>{let r=e._ctx;for(let n in e){if(isInternalKey(n))continue;let a=e[n];if(isFunction(a))t[n]=normalizeSlot(n,a,r);else if(a!=null){let e=normalizeSlotValue(a);t[n]=()=>e}}},normalizeVNodeSlots=(e,t)=>{let n=normalizeSlotValue(t);e.slots.default=()=>n},assignSlots=(e,t,n)=>{for(let r in t)(n||!isInternalKey(r))&&(e[r]=t[r])},initSlots=(e,t,n)=>{let r=e.slots=createInternalObject();if(e.vnode.shapeFlag&32){let e=t._;e?(assignSlots(r,t,n),n&&def(r,`_`,e,!0)):normalizeObjectSlots(t,r)}else t&&normalizeVNodeSlots(e,t)},updateSlots=(e,t,n)=>{let{vnode:r,slots:a}=e,o=!0,s=EMPTY_OBJ;if(r.shapeFlag&32){let e=t._;e?n&&e===1?o=!1:assignSlots(a,t,n):(o=!t.$stable,normalizeObjectSlots(t,a)),s=t}else t&&(normalizeVNodeSlots(e,t),s={default:1});if(o)for(let e in a)!isInternalKey(e)&&s[e]==null&&delete a[e]},queuePostRenderEffect=queueEffectWithSuspense;function createRenderer(e){return baseCreateRenderer(e)}function baseCreateRenderer(e,t){let n=getGlobalThis();n.__VUE__=!0;let{insert:r,remove:a,patchProp:o,createElement:s,createText:c,createComment:l,setText:u,setElementText:d,parentNode:f,nextSibling:m,setScopeId:g=NOOP,insertStaticContent:_}=e,v=(e,t,n,r=null,a=null,o=null,s=void 0,c=null,l=!!t.dynamicChildren)=>{if(e===t)return;e&&!isSameVNodeType(e,t)&&(r=G(e),B(e,a,o,!0),e=null),t.patchFlag===-2&&(l=!1,t.dynamicChildren=null);let{type:u,ref:d,shapeFlag:f}=t;switch(u){case Text:y(e,t,n,r);break;case Comment:b(e,t,n,r);break;case Static:e??x(t,n,r,s);break;case Fragment:j(e,t,n,r,a,o,s,c,l);break;default:f&1?w(e,t,n,r,a,o,s,c,l):f&6?M(e,t,n,r,a,o,s,c,l):(f&64||f&128)&&u.process(e,t,n,r,a,o,s,c,l,J)}d!=null&&a?setRef(d,e&&e.ref,o,t||e,!t):d==null&&e&&e.ref!=null&&setRef(e.ref,null,o,e,!0)},y=(e,t,n,a)=>{if(e==null)r(t.el=c(t.children),n,a);else{let n=t.el=e.el;t.children!==e.children&&u(n,t.children)}},b=(e,t,n,a)=>{e==null?r(t.el=l(t.children||``),n,a):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,a)=>{let o;for(;e&&e!==t;)o=m(e),r(e,n,a),e=o;r(t,n,a)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=m(e),a(e),e=n;a(t)},w=(e,t,n,r,a,o,s,c,l)=>{if(t.type===`svg`?s=`svg`:t.type===`math`&&(s=`mathml`),e==null)T(t,n,r,a,o,s,c,l);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),O(e,t,a,o,s,c,l)}finally{n&&n._endPatch()}}},T=(e,t,n,a,c,l,u,f)=>{let m,g,{props:_,shapeFlag:v,transition:y,dirs:b}=e;if(m=e.el=s(e.type,l,_&&_.is,_),v&8?d(m,e.children):v&16&&D(e.children,m,null,a,c,resolveChildrenNamespace(e,l),u,f),b&&invokeDirectiveHook(e,null,a,`created`),E(m,e,e.scopeId,u,a),_){for(let e in _)e!==`value`&&!isReservedProp(e)&&o(m,e,null,_[e],l,a);`value`in _&&o(m,`value`,null,_.value,l),(g=_.onVnodeBeforeMount)&&invokeVNodeHook(g,a,e)}b&&invokeDirectiveHook(e,null,a,`beforeMount`);let x=needTransition(c,y);x&&y.beforeEnter(m),r(m,t,n),((g=_&&_.onVnodeMounted)||x||b)&&queuePostRenderEffect(()=>{try{g&&invokeVNodeHook(g,a,e),x&&y.enter(m),b&&invokeDirectiveHook(e,null,a,`mounted`)}finally{}},c)},E=(e,t,n,r,a)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(a){let n=a.subTree;if(t===n||isSuspense(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=a.vnode;E(e,t,t.scopeId,t.slotScopeIds,a.parent)}}},D=(e,t,n,r,a,o,s,c,l=0)=>{for(let u=l;u<e.length;u++){let l=e[u]=c?cloneIfMounted(e[u]):normalizeVNode(e[u]);v(null,l,t,n,r,a,o,s,c)}},O=(e,t,n,r,a,s,c)=>{let l=t.el=e.el,{patchFlag:u,dynamicChildren:f,dirs:m}=t;u|=e.patchFlag&16;let g=e.props||EMPTY_OBJ,_=t.props||EMPTY_OBJ,v;if(n&&toggleRecurse(n,!1),(v=_.onVnodeBeforeUpdate)&&invokeVNodeHook(v,n,t,e),m&&invokeDirectiveHook(t,e,n,`beforeUpdate`),n&&toggleRecurse(n,!0),(g.innerHTML&&_.innerHTML==null||g.textContent&&_.textContent==null)&&d(l,``),f?k(e.dynamicChildren,f,l,n,r,resolveChildrenNamespace(t,a),s):c||te(e,t,l,null,n,r,resolveChildrenNamespace(t,a),s,!1),u>0){if(u&16)A(l,g,_,n,a);else if(u&2&&g.class!==_.class&&o(l,`class`,null,_.class,a),u&4&&o(l,`style`,g.style,_.style,a),u&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],s=g[r],c=_[r];(c!==s||r===`value`)&&o(l,r,s,c,a,n)}}u&1&&e.children!==t.children&&d(l,t.children)}else!c&&f==null&&A(l,g,_,n,a);((v=_.onVnodeUpdated)||m)&&queuePostRenderEffect(()=>{v&&invokeVNodeHook(v,n,t,e),m&&invokeDirectiveHook(t,e,n,`updated`)},r)},k=(e,t,n,r,a,o,s)=>{for(let c=0;c<t.length;c++){let l=e[c],u=t[c],d=l.el&&(l.type===Fragment||!isSameVNodeType(l,u)||l.shapeFlag&198)?f(l.el):n;v(l,u,d,null,r,a,o,s,!0)}},A=(e,t,n,r,a)=>{if(t!==n){if(t!==EMPTY_OBJ)for(let s in t)!isReservedProp(s)&&!(s in n)&&o(e,s,t[s],null,a,r);for(let s in n){if(isReservedProp(s))continue;let c=n[s],l=t[s];c!==l&&s!==`value`&&o(e,s,l,c,a,r)}`value`in n&&o(e,`value`,t.value,n.value,a)}},j=(e,t,n,a,o,s,l,u,d)=>{let f=t.el=e?e.el:c(``),m=t.anchor=e?e.anchor:c(``),{patchFlag:g,dynamicChildren:_,slotScopeIds:v}=t;v&&(u=u?u.concat(v):v),e==null?(r(f,n,a),r(m,n,a),D(t.children||[],n,m,o,s,l,u,d)):g>0&&g&64&&_&&e.dynamicChildren&&e.dynamicChildren.length===_.length?(k(e.dynamicChildren,_,n,o,s,l,u),(t.key!=null||o&&t===o.subTree)&&traverseStaticChildren(e,t,!0)):te(e,t,n,m,o,s,l,u,d)},M=(e,t,n,r,a,o,s,c,l)=>{t.slotScopeIds=c,e==null?t.shapeFlag&512?a.ctx.activate(t,n,r,s,l):ee(t,n,r,a,o,s,l):P(e,t,l)},ee=(e,t,n,r,a,o,s)=>{let c=e.component=createComponentInstance(e,r,a);if(isKeepAlive(e)&&(c.ctx.renderer=J),setupComponent(c,!1,s),c.asyncDep){if(a&&a.registerDep(c,F,s),!e.el){let r=c.subTree=createVNode(Comment);b(null,r,t,n),e.placeholder=r.el}}else F(c,e,t,n,a,o,s)},P=(e,t,n)=>{let r=t.component=e.component;if(shouldUpdateComponent(e,t,n)){if(r.asyncDep&&!r.asyncResolved){I(r,t,n);return}r.next=t,r.update()}else t.el=e.el,r.vnode=t},F=(e,t,n,r,a,o,s)=>{let c=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:c,vnode:l}=e;{let n=locateNonHydratedAsyncRoot(e);if(n){t&&(t.el=l.el,I(e,t,s)),n.asyncDep.then(()=>{queuePostRenderEffect(()=>{e.isUnmounted||u()},a)});return}}let d=t,m;toggleRecurse(e,!1),t?(t.el=l.el,I(e,t,s)):t=l,n&&invokeArrayFns(n),(m=t.props&&t.props.onVnodeBeforeUpdate)&&invokeVNodeHook(m,c,t,l),toggleRecurse(e,!0);let g=renderComponentRoot(e),_=e.subTree;e.subTree=g,v(_,g,f(_.el),G(_),e,a,o),t.el=g.el,d===null&&updateHOCHostEl(e,g.el),r&&queuePostRenderEffect(r,a),(m=t.props&&t.props.onVnodeUpdated)&&queuePostRenderEffect(()=>invokeVNodeHook(m,c,t,l),a)}else{let s,{el:c,props:l}=t,{bm:u,m:d,parent:f,root:m,type:g}=e,_=isAsyncWrapper(t);if(toggleRecurse(e,!1),u&&invokeArrayFns(u),!_&&(s=l&&l.onVnodeBeforeMount)&&invokeVNodeHook(s,f,t),toggleRecurse(e,!0),c&&ne){let t=()=>{e.subTree=renderComponentRoot(e),ne(c,e.subTree,e,a,null)};_&&g.__asyncHydrate?g.__asyncHydrate(c,e,t):t()}else{m.ce&&m.ce._hasShadowRoot()&&m.ce._injectChildStyle(g,e.parent?e.parent.type:void 0);let s=e.subTree=renderComponentRoot(e);v(null,s,n,r,e,a,o),t.el=s.el}if(d&&queuePostRenderEffect(d,a),!_&&(s=l&&l.onVnodeMounted)){let e=t;queuePostRenderEffect(()=>invokeVNodeHook(s,f,e),a)}(t.shapeFlag&256||f&&isAsyncWrapper(f.vnode)&&f.vnode.shapeFlag&256)&&e.a&&queuePostRenderEffect(e.a,a),e.isMounted=!0,t=n=r=null}};e.scope.on();let l=e.effect=new ReactiveEffect(c);e.scope.off();let u=e.update=l.run.bind(l),d=e.job=l.runIfDirty.bind(l);d.i=e,d.id=e.uid,l.scheduler=()=>queueJob(d),toggleRecurse(e,!0),u()},I=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,updateProps(e,t.props,r,n),updateSlots(e,t.children,n),pauseTracking(),flushPreFlushCbs(e),resetTracking()},te=(e,t,n,r,a,o,s,c,l=!1)=>{let u=e&&e.children,f=e?e.shapeFlag:0,m=t.children,{patchFlag:g,shapeFlag:_}=t;if(g>0){if(g&128){R(u,m,n,r,a,o,s,c,l);return}if(g&256){L(u,m,n,r,a,o,s,c,l);return}}_&8?(f&16&&W(u,a,o),m!==u&&d(n,m)):f&16?_&16?R(u,m,n,r,a,o,s,c,l):W(u,a,o,!0):(f&8&&d(n,``),_&16&&D(m,n,r,a,o,s,c,l))},L=(e,t,n,r,a,o,s,c,l)=>{e||=EMPTY_ARR,t||=EMPTY_ARR;let u=e.length,d=t.length,f=Math.min(u,d),m=0;for(;m<f;m++){let r=t[m]=l?cloneIfMounted(t[m]):normalizeVNode(t[m]);v(e[m],r,n,null,a,o,s,c,l)}u>d?W(e,a,o,!0,!1,f):D(t,n,r,a,o,s,c,l,f)},R=(e,t,n,r,a,o,s,c,l)=>{let u=0,d=t.length,f=e.length-1,m=d-1;for(;u<=f&&u<=m;){let r=e[u],d=t[u]=l?cloneIfMounted(t[u]):normalizeVNode(t[u]);if(isSameVNodeType(r,d))v(r,d,n,null,a,o,s,c,l);else break;u++}for(;u<=f&&u<=m;){let r=e[f],u=t[m]=l?cloneIfMounted(t[m]):normalizeVNode(t[m]);if(isSameVNodeType(r,u))v(r,u,n,null,a,o,s,c,l);else break;f--,m--}if(u>f){if(u<=m){let e=m+1,f=e<d?t[e].el:r;for(;u<=m;)v(null,t[u]=l?cloneIfMounted(t[u]):normalizeVNode(t[u]),n,f,a,o,s,c,l),u++}}else if(u>m)for(;u<=f;)B(e[u],a,o,!0),u++;else{let g=u,_=u,y=new Map;for(u=_;u<=m;u++){let e=t[u]=l?cloneIfMounted(t[u]):normalizeVNode(t[u]);e.key!=null&&y.set(e.key,u)}let b,x=0,S=m-_+1,C=!1,w=0,T=Array(S);for(u=0;u<S;u++)T[u]=0;for(u=g;u<=f;u++){let r=e[u];if(x>=S){B(r,a,o,!0);continue}let d;if(r.key!=null)d=y.get(r.key);else for(b=_;b<=m;b++)if(T[b-_]===0&&isSameVNodeType(r,t[b])){d=b;break}d===void 0?B(r,a,o,!0):(T[d-_]=u+1,d>=w?w=d:C=!0,v(r,t[d],n,null,a,o,s,c,l),x++)}let E=C?getSequence(T):EMPTY_ARR;for(b=E.length-1,u=S-1;u>=0;u--){let e=_+u,f=t[e],m=t[e+1],g=e+1<d?m.el||resolveAsyncComponentPlaceholder(m):r;T[u]===0?v(null,f,n,g,a,o,s,c,l):C&&(b<0||u!==E[b]?z(f,n,g,2):b--)}}},z=(e,t,n,o,s=null)=>{let{el:c,type:l,transition:u,children:d,shapeFlag:f}=e;if(f&6)z(e.component.subTree,t,n,o);else if(f&128)e.suspense.move(t,n,o);else if(f&64)l.move(e,t,n,J);else if(l===Fragment){r(c,t,n);for(let e=0;e<d.length;e++)z(d[e],t,n,o);r(e.anchor,t,n)}else if(l===Static)S(e,t,n);else if(o!==2&&f&1&&u){if(o===0)u.beforeEnter(c),r(c,t,n),queuePostRenderEffect(()=>u.enter(c),s);else{let{leave:o,delayLeave:s,afterLeave:l}=u,d=()=>{e.ctx.isUnmounted?a(c):r(c,t,n)},f=()=>{c._isLeaving&&c[leaveCbKey](!0),o(c,()=>{d(),l&&l()})};s?s(c,d,f):f()}}else r(c,t,n)},B=(e,t,n,r=!1,a=!1)=>{let{type:o,props:s,ref:c,children:l,dynamicChildren:u,shapeFlag:d,patchFlag:f,dirs:m,cacheIndex:g,memo:_}=e;if(f===-2&&(a=!1),c!=null&&(pauseTracking(),setRef(c,null,n,e,!0),resetTracking()),g!=null&&(t.renderCache[g]=void 0),d&256){t.ctx.deactivate(e);return}let v=d&1&&m,y=!isAsyncWrapper(e),b;if(y&&(b=s&&s.onVnodeBeforeUnmount)&&invokeVNodeHook(b,t,e),d&6)U(e.component,n,r);else{if(d&128){e.suspense.unmount(n,r);return}v&&invokeDirectiveHook(e,null,t,`beforeUnmount`),d&64?e.type.remove(e,t,n,J,r):u&&!u.hasOnce&&(o!==Fragment||f>0&&f&64)?W(u,t,n,!1,!0):(o===Fragment&&f&384||!a&&d&16)&&W(l,t,n),r&&V(e)}let x=_!=null&&g==null;(y&&(b=s&&s.onVnodeUnmounted)||v||x)&&queuePostRenderEffect(()=>{b&&invokeVNodeHook(b,t,e),v&&invokeDirectiveHook(e,null,t,`unmounted`),x&&(e.el=null)},n)},V=e=>{let{type:t,el:n,anchor:r,transition:o}=e;if(t===Fragment){H(n,r);return}if(t===Static){C(e);return}let s=()=>{a(n),o&&!o.persisted&&o.afterLeave&&o.afterLeave()};if(e.shapeFlag&1&&o&&!o.persisted){let{leave:t,delayLeave:r}=o,a=()=>t(n,s);r?r(e.el,s,a):a()}else s()},H=(e,t)=>{let n;for(;e!==t;)n=m(e),a(e),e=n;a(t)},U=(e,t,n)=>{let{bum:r,scope:a,job:o,subTree:s,um:c,m:l,a:u}=e;invalidateMount(l),invalidateMount(u),r&&invokeArrayFns(r),a.stop(),o&&(o.flags|=8,B(s,e,t,n)),c&&queuePostRenderEffect(c,t),queuePostRenderEffect(()=>{e.isUnmounted=!0},t)},W=(e,t,n,r=!1,a=!1,o=0)=>{for(let s=o;s<e.length;s++)B(e[s],t,n,r,a)},G=e=>{if(e.shapeFlag&6)return G(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=m(e.anchor||e.el),n=t&&t[TeleportEndKey];return n?m(n):t},K=!1,q=(e,t,n)=>{let r;e==null?t._vnode&&(B(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,K||=(K=!0,flushPreFlushCbs(r),flushPostFlushCbs(),!1)},J={p:v,um:B,m:z,r:V,mt:ee,mc:D,pc:te,pbc:k,n:G,o:e},Y,ne;return t&&([Y,ne]=t(J)),{render:q,hydrate:Y,createApp:createAppAPI(q,Y)}}function resolveChildrenNamespace({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function toggleRecurse({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function needTransition(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function traverseStaticChildren(e,t,n=!1){let r=e.children,a=t.children;if(isArray(r)&&isArray(a))for(let e=0;e<r.length;e++){let t=r[e],o=a[e];o.shapeFlag&1&&!o.dynamicChildren&&((o.patchFlag<=0||o.patchFlag===32)&&(o=a[e]=cloneIfMounted(a[e]),o.el=t.el),!n&&o.patchFlag!==-2&&traverseStaticChildren(t,o)),o.type===Text&&(o.patchFlag===-1&&(o=a[e]=cloneIfMounted(o)),o.el=t.el),o.type===Comment&&!o.el&&(o.el=t.el)}}function getSequence(e){let t=e.slice(),n=[0],r,a,o,s,c,l=e.length;for(r=0;r<l;r++){let l=e[r];if(l!==0){if(a=n[n.length-1],e[a]<l){t[r]=a,n.push(r);continue}for(o=0,s=n.length-1;o<s;)c=o+s>>1,e[n[c]]<l?o=c+1:s=c;l<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}for(o=n.length,s=n[o-1];o-->0;)n[o]=s,s=t[s];return n}function locateNonHydratedAsyncRoot(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:locateNonHydratedAsyncRoot(t)}function invalidateMount(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function resolveAsyncComponentPlaceholder(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?resolveAsyncComponentPlaceholder(t.subTree):null}var isSuspense=e=>e.__isSuspense;function queueEffectWithSuspense(e,t){t&&t.pendingBranch?isArray(e)?t.effects.push(...e):t.effects.push(e):queuePostFlushCb(e)}var Fragment=Symbol.for(`v-fgt`),Text=Symbol.for(`v-txt`),Comment=Symbol.for(`v-cmt`),Static=Symbol.for(`v-stc`),blockStack=[],currentBlock=null;function openBlock(e=!1){blockStack.push(currentBlock=e?null:[])}function closeBlock(){blockStack.pop(),currentBlock=blockStack[blockStack.length-1]||null}var isBlockTreeEnabled=1;function setBlockTracking(e,t=!1){isBlockTreeEnabled+=e,e<0&¤tBlock&&t&&(currentBlock.hasOnce=!0)}function setupBlock(e){return e.dynamicChildren=isBlockTreeEnabled>0?currentBlock||EMPTY_ARR:null,closeBlock(),isBlockTreeEnabled>0&¤tBlock&¤tBlock.push(e),e}function createElementBlock(e,t,n,r,a,o){return setupBlock(createBaseVNode(e,t,n,r,a,o,!0))}function createBlock(e,t,n,r,a){return setupBlock(createVNode(e,t,n,r,a,!0))}function isVNode(e){return e?e.__v_isVNode===!0:!1}function isSameVNodeType(e,t){return e.type===t.type&&e.key===t.key}var normalizeKey=({key:e})=>e??null,normalizeRef=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:isString(e)||isRef(e)||isFunction(e)?{i:currentRenderingInstance,r:e,k:t,f:!!n}:e);function createBaseVNode(e,t=null,n=null,r=0,a=null,o=e===Fragment?0:1,s=!1,c=!1){let l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&normalizeKey(t),ref:t&&normalizeRef(t),scopeId:currentScopeId,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:a,dynamicChildren:null,appContext:null,ctx:currentRenderingInstance};return c?(normalizeChildren(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=isString(n)?8:16),isBlockTreeEnabled>0&&!s&¤tBlock&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&¤tBlock.push(l),l}var createVNode=_createVNode;function _createVNode(e,t=null,n=null,r=0,a=null,o=!1){if(e&&e!==NULL_DYNAMIC_COMPONENT||(e=Comment),isVNode(e)){let r=cloneVNode(e,t,!0);return n&&normalizeChildren(r,n),isBlockTreeEnabled>0&&!o&¤tBlock&&(r.shapeFlag&6?currentBlock[currentBlock.indexOf(e)]=r:currentBlock.push(r)),r.patchFlag=-2,r}if(isClassComponent(e)&&(e=e.__vccOpts),t){t=guardReactiveProps(t);let{class:e,style:n}=t;e&&!isString(e)&&(t.class=normalizeClass(e)),isObject(n)&&(isProxy(n)&&!isArray(n)&&(n=extend({},n)),t.style=normalizeStyle(n))}let s=isString(e)?1:isSuspense(e)?128:isTeleport(e)?64:isObject(e)?4:isFunction(e)?2:0;return createBaseVNode(e,t,n,r,a,s,o,!0)}function guardReactiveProps(e){return e?isProxy(e)||isInternalObject(e)?extend({},e):e:null}function cloneVNode(e,t,n=!1,r=!1){let{props:a,ref:o,patchFlag:s,children:c,transition:l}=e,u=t?mergeProps(a||{},t):a,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&normalizeKey(u),ref:t&&t.ref?n&&o?isArray(o)?o.concat(normalizeRef(t)):[o,normalizeRef(t)]:normalizeRef(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:c,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Fragment?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&cloneVNode(e.ssContent),ssFallback:e.ssFallback&&cloneVNode(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&setTransitionHooks(d,l.clone(d)),d}function createTextVNode(e=` `,t=0){return createVNode(Text,null,e,t)}function createCommentVNode(e=``,t=!1){return t?(openBlock(),createBlock(Comment,null,e)):createVNode(Comment,null,e)}function normalizeVNode(e){return e==null||typeof e==`boolean`?createVNode(Comment):isArray(e)?createVNode(Fragment,null,e.slice()):isVNode(e)?cloneIfMounted(e):createVNode(Text,null,String(e))}function cloneIfMounted(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:cloneVNode(e)}function normalizeChildren(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(isArray(t))n=16;else if(typeof t==`object`){if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),normalizeChildren(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!isInternalObject(t)?t._ctx=currentRenderingInstance:r===3&¤tRenderingInstance&&(currentRenderingInstance.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else isFunction(t)?(t={default:t,_ctx:currentRenderingInstance},n=32):(t=String(t),r&64?(n=16,t=[createTextVNode(t)]):n=8);e.children=t,e.shapeFlag|=n}function mergeProps(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=normalizeClass([t.class,r.class]));else if(e===`style`)t.style=normalizeStyle([t.style,r.style]);else if(isOn(e)){let n=t[e],a=r[e];a&&n!==a&&!(isArray(n)&&n.includes(a))?t[e]=n?[].concat(n,a):a:a==null&&n==null&&!isModelListener(e)&&(t[e]=a)}else e!==``&&(t[e]=r[e])}return t}function invokeVNodeHook(e,t,n,r=null){callWithAsyncErrorHandling(e,t,7,[n,r])}var emptyAppContext=createAppContext(),uid=0;function createComponentInstance(e,t,n){let r=e.type,a=(t?t.appContext:e.appContext)||emptyAppContext,o={uid:uid++,vnode:e,type:r,parent:t,appContext:a,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new EffectScope(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(a.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:normalizePropsOptions(r,a),emitsOptions:normalizeEmitsOptions(r,a),emit:null,emitted:null,propsDefaults:EMPTY_OBJ,inheritAttrs:r.inheritAttrs,ctx:EMPTY_OBJ,data:EMPTY_OBJ,props:EMPTY_OBJ,attrs:EMPTY_OBJ,slots:EMPTY_OBJ,refs:EMPTY_OBJ,setupState:EMPTY_OBJ,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=t?t.root:o,o.emit=emit.bind(null,o),e.ce&&e.ce(o),o}var currentInstance=null,getCurrentInstance=()=>currentInstance||currentRenderingInstance,internalSetCurrentInstance,setInSSRSetupState;{let e=getGlobalThis(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};internalSetCurrentInstance=t(`__VUE_INSTANCE_SETTERS__`,e=>currentInstance=e),setInSSRSetupState=t(`__VUE_SSR_SETTERS__`,e=>isInSSRComponentSetup=e)}var setCurrentInstance=e=>{let t=currentInstance;return internalSetCurrentInstance(e),e.scope.on(),()=>{e.scope.off(),internalSetCurrentInstance(t)}},unsetCurrentInstance=()=>{currentInstance&¤tInstance.scope.off(),internalSetCurrentInstance(null)};function isStatefulComponent(e){return e.vnode.shapeFlag&4}var isInSSRComponentSetup=!1;function setupComponent(e,t=!1,n=!1){t&&setInSSRSetupState(t);let{props:r,children:a}=e.vnode,o=isStatefulComponent(e);initProps(e,r,o,t),initSlots(e,a,n||t);let s=o?setupStatefulComponent(e,t):void 0;return t&&setInSSRSetupState(!1),s}function setupStatefulComponent(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,PublicInstanceProxyHandlers);let{setup:r}=n;if(r){pauseTracking();let n=e.setupContext=r.length>1?createSetupContext(e):null,a=setCurrentInstance(e),o=callWithErrorHandling(r,e,0,[e.props,n]),s=isPromise(o);if(resetTracking(),a(),(s||e.sp)&&!isAsyncWrapper(e)&&markAsyncBoundary(e),s){if(o.then(unsetCurrentInstance,unsetCurrentInstance),t)return o.then(n=>{handleSetupResult(e,n,t)}).catch(t=>{handleError$2(t,e,0)});e.asyncDep=o}else handleSetupResult(e,o,t)}else finishComponentSetup(e,t)}function handleSetupResult(e,t,n){isFunction(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:isObject(t)&&(e.setupState=proxyRefs(t)),finishComponentSetup(e,n)}var compile,installWithProxy;function finishComponentSetup(e,t,n){let r=e.type;if(!e.render){if(!t&&compile&&!r.render){let t=r.template||resolveMergedOptions(e).template;if(t){let{isCustomElement:n,compilerOptions:a}=e.appContext.config,{delimiters:o,compilerOptions:s}=r;r.render=compile(t,extend(extend({isCustomElement:n,delimiters:o},a),s))}}e.render=r.render||NOOP,installWithProxy&&installWithProxy(e)}{let t=setCurrentInstance(e);pauseTracking();try{applyOptions(e)}finally{resetTracking(),t()}}}var attrsProxyHandlers={get(e,t){return track(e,`get`,``),e[t]}};function createSetupContext(e){return{attrs:new Proxy(e.attrs,attrsProxyHandlers),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function getComponentPublicInstance(e){return e.exposed?e.exposeProxy||=new Proxy(proxyRefs(markRaw(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in publicPropertiesMap)return publicPropertiesMap[n](e)},has(e,t){return t in e||t in publicPropertiesMap}}):e.proxy}function isClassComponent(e){return isFunction(e)&&`__vccOpts`in e}var computed=(e,t)=>computed$1(e,t,isInSSRComponentSetup);function h(e,t,n){try{setBlockTracking(-1);let r=arguments.length;return r===2?isObject(t)&&!isArray(t)?isVNode(t)?createVNode(e,null,[t]):createVNode(e,t):createVNode(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&isVNode(n)&&(n=[n]),createVNode(e,t,n))}finally{setBlockTracking(1)}}var version$3=`3.5.31`,policy=void 0,tt=typeof window<`u`&&window.trustedTypes;if(tt)try{policy=tt.createPolicy(`vue`,{createHTML:e=>e})}catch{}var unsafeToTrustedHTML=policy?e=>policy.createHTML(e):e=>e,svgNS=`http://www.w3.org/2000/svg`,mathmlNS=`http://www.w3.org/1998/Math/MathML`,doc=typeof document<`u`?document:null,templateContainer=doc&&doc.createElement(`template`),nodeOps={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let a=t===`svg`?doc.createElementNS(svgNS,e):t===`mathml`?doc.createElementNS(mathmlNS,e):n?doc.createElement(e,{is:n}):doc.createElement(e);return e===`select`&&r&&r.multiple!=null&&a.setAttribute(`multiple`,r.multiple),a},createText:e=>doc.createTextNode(e),createComment:e=>doc.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>doc.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,a,o){let s=n?n.previousSibling:t.lastChild;if(a&&(a===o||a.nextSibling))for(;t.insertBefore(a.cloneNode(!0),n),a!==o&&(a=a.nextSibling););else{templateContainer.innerHTML=unsafeToTrustedHTML(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let a=templateContainer.content;if(r===`svg`||r===`mathml`){let e=a.firstChild;for(;e.firstChild;)a.appendChild(e.firstChild);a.removeChild(e)}t.insertBefore(a,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},TRANSITION=`transition`,ANIMATION=`animation`,vtcKey=Symbol(`_vtc`),DOMTransitionPropsValidators={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},TransitionPropsValidators=extend({},BaseTransitionPropsValidators,DOMTransitionPropsValidators),decorate$1=e=>(e.displayName=`Transition`,e.props=TransitionPropsValidators,e),Transition=decorate$1((e,{slots:t})=>h(BaseTransition,resolveTransitionProps(e),t)),callHook=(e,t=[])=>{isArray(e)?e.forEach(e=>e(...t)):e&&e(...t)},hasExplicitCallback=e=>e?isArray(e)?e.some(e=>e.length>1):e.length>1:!1;function resolveTransitionProps(e){let t={};for(let n in e)n in DOMTransitionPropsValidators||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:a,enterFromClass:o=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:c=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:u=s,appearToClass:d=c,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:m=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,_=normalizeDuration(a),v=_&&_[0],y=_&&_[1],{onBeforeEnter:b,onEnter:x,onEnterCancelled:S,onLeave:C,onLeaveCancelled:w,onBeforeAppear:T=b,onAppear:E=x,onAppearCancelled:D=S}=t,O=(e,t,n,r)=>{e._enterCancelled=r,removeTransitionClass(e,t?d:c),removeTransitionClass(e,t?u:s),n&&n()},k=(e,t)=>{e._isLeaving=!1,removeTransitionClass(e,f),removeTransitionClass(e,g),removeTransitionClass(e,m),t&&t()},A=e=>(t,n)=>{let a=e?E:x,s=()=>O(t,e,n);callHook(a,[t,s]),nextFrame(()=>{removeTransitionClass(t,e?l:o),addTransitionClass(t,e?d:c),hasExplicitCallback(a)||whenTransitionEnds(t,r,v,s)})};return extend(t,{onBeforeEnter(e){callHook(b,[e]),addTransitionClass(e,o),addTransitionClass(e,s)},onBeforeAppear(e){callHook(T,[e]),addTransitionClass(e,l),addTransitionClass(e,u)},onEnter:A(!1),onAppear:A(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>k(e,t);addTransitionClass(e,f),e._enterCancelled?(addTransitionClass(e,m),forceReflow(e)):(forceReflow(e),addTransitionClass(e,m)),nextFrame(()=>{e._isLeaving&&(removeTransitionClass(e,f),addTransitionClass(e,g),hasExplicitCallback(C)||whenTransitionEnds(e,r,y,n))}),callHook(C,[e,n])},onEnterCancelled(e){O(e,!1,void 0,!0),callHook(S,[e])},onAppearCancelled(e){O(e,!0,void 0,!0),callHook(D,[e])},onLeaveCancelled(e){k(e),callHook(w,[e])}})}function normalizeDuration(e){if(e==null)return null;if(isObject(e))return[NumberOf(e.enter),NumberOf(e.leave)];{let t=NumberOf(e);return[t,t]}}function NumberOf(e){return toNumber$1(e)}function addTransitionClass(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[vtcKey]||(e[vtcKey]=new Set)).add(t)}function removeTransitionClass(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[vtcKey];n&&(n.delete(t),n.size||(e[vtcKey]=void 0))}function nextFrame(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var endId=0;function whenTransitionEnds(e,t,n,r){let a=e._endId=++endId,o=()=>{a===e._endId&&r()};if(n!=null)return setTimeout(o,n);let{type:s,timeout:c,propCount:l}=getTransitionInfo(e,t);if(!s)return r();let u=s+`end`,d=0,f=()=>{e.removeEventListener(u,m),o()},m=t=>{t.target===e&&++d>=l&&f()};setTimeout(()=>{d<l&&f()},c+1),e.addEventListener(u,m)}function getTransitionInfo(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),a=r(`${TRANSITION}Delay`),o=r(`${TRANSITION}Duration`),s=getTimeout(a,o),c=r(`${ANIMATION}Delay`),l=r(`${ANIMATION}Duration`),u=getTimeout(c,l),d=null,f=0,m=0;t===TRANSITION?s>0&&(d=TRANSITION,f=s,m=o.length):t===ANIMATION?u>0&&(d=ANIMATION,f=u,m=l.length):(f=Math.max(s,u),d=f>0?s>u?TRANSITION:ANIMATION:null,m=d?d===TRANSITION?o.length:l.length:0);let g=d===TRANSITION&&/\b(?:transform|all)(?:,|$)/.test(r(`${TRANSITION}Property`).toString());return{type:d,timeout:f,propCount:m,hasTransform:g}}function getTimeout(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>toMs(t)+toMs(e[n])))}function toMs(e){return e===`auto`?0:Number(e.slice(0,-1).replace(`,`,`.`))*1e3}function forceReflow(e){return(e?e.ownerDocument:document).body.offsetHeight}function patchClass(e,t,n){let r=e[vtcKey];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var vShowOriginalDisplay=Symbol(`_vod`),vShowHidden=Symbol(`_vsh`),vShow={name:`show`,beforeMount(e,{value:t},{transition:n}){e[vShowOriginalDisplay]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):setDisplay(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),setDisplay(e,!0),r.enter(e)):r.leave(e,()=>{setDisplay(e,!1)}):setDisplay(e,t))},beforeUnmount(e,{value:t}){setDisplay(e,t)}};function setDisplay(e,t){e.style.display=t?e[vShowOriginalDisplay]:`none`,e[vShowHidden]=!t}var CSS_VAR_TEXT=Symbol(``),displayRE=/(?:^|;)\s*display\s*:/;function patchStyle(e,t,n){let r=e.style,a=isString(n),o=!1;if(n&&!a){if(t){if(isString(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??setStyle(r,t,``)}else for(let e in t)n[e]??setStyle(r,e,``)}for(let e in n)e===`display`&&(o=!0),setStyle(r,e,n[e])}else if(a){if(t!==n){let e=r[CSS_VAR_TEXT];e&&(n+=`;`+e),r.cssText=n,o=displayRE.test(n)}}else t&&e.removeAttribute(`style`);vShowOriginalDisplay in e&&(e[vShowOriginalDisplay]=o?r.display:``,e[vShowHidden]&&(r.display=`none`))}var importantRE=/\s*!important$/;function setStyle(e,t,n){if(isArray(n))n.forEach(n=>setStyle(e,t,n));else if(n??=``,t.startsWith(`--`))e.setProperty(t,n);else{let r=autoPrefix(e,t);importantRE.test(n)?e.setProperty(hyphenate(r),n.replace(importantRE,``),`important`):e[r]=n}}var prefixes=[`Webkit`,`Moz`,`ms`],prefixCache={};function autoPrefix(e,t){let n=prefixCache[t];if(n)return n;let r=camelize(t);if(r!==`filter`&&r in e)return prefixCache[t]=r;r=capitalize(r);for(let n=0;n<prefixes.length;n++){let a=prefixes[n]+r;if(a in e)return prefixCache[t]=a}return t}var xlinkNS=`http://www.w3.org/1999/xlink`;function patchAttr(e,t,n,r,a,o=isSpecialBooleanAttr(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(xlinkNS,t.slice(6,t.length)):e.setAttributeNS(xlinkNS,t,n):n==null||o&&!includeBooleanAttr(n)?e.removeAttribute(t):e.setAttribute(t,o?``:isSymbol(n)?String(n):n)}function patchDOMProp(e,t,n,r,a){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?unsafeToTrustedHTML(n):n);return}let o=e.tagName;if(t===`value`&&o!==`PROGRESS`&&!o.includes(`-`)){let r=o===`OPTION`?e.getAttribute(`value`)||``:e.value,a=n==null?e.type===`checkbox`?`on`:``:String(n);r===a&&`_value`in e||(e.value=a),n??e.removeAttribute(t),e._value=n;return}let s=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=includeBooleanAttr(n):n==null&&r===`string`?(n=``,s=!0):r===`number`&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(a||t)}function addEventListener(e,t,n,r){e.addEventListener(t,n,r)}function removeEventListener(e,t,n,r){e.removeEventListener(t,n,r)}var veiKey=Symbol(`_vei`);function patchEvent(e,t,n,r,a=null){let o=e[veiKey]||(e[veiKey]={}),s=o[t];if(r&&s)s.value=r;else{let[n,c]=parseName(t);r?addEventListener(e,n,o[t]=createInvoker(r,a),c):s&&(removeEventListener(e,n,s,c),o[t]=void 0)}}var optionsModifierRE=/(?:Once|Passive|Capture)$/;function parseName(e){let t;if(optionsModifierRE.test(e)){t={};let n;for(;n=e.match(optionsModifierRE);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===`:`?e.slice(3):hyphenate(e.slice(2)),t]}var cachedNow=0,p=Promise.resolve(),getNow=()=>cachedNow||=(p.then(()=>cachedNow=0),Date.now());function createInvoker(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;callWithAsyncErrorHandling(patchStopImmediatePropagation(e,n.value),t,5,[e])};return n.value=e,n.attached=getNow(),n}function patchStopImmediatePropagation(e,t){if(isArray(t)){let n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}return t}var isNativeOn=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,patchProp=(e,t,n,r,a,o)=>{let s=a===`svg`;t===`class`?patchClass(e,r,s):t===`style`?patchStyle(e,n,r):isOn(t)?isModelListener(t)||patchEvent(e,t,n,r,o):(t[0]===`.`?(t=t.slice(1),1):t[0]===`^`?(t=t.slice(1),0):shouldSetAsProp(e,t,r,s))?(patchDOMProp(e,t,r),e.tagName.includes(`-`)||t!==`value`&&t!==`checked`&&t!==`selected`||patchAttr(e,t,r,s,o,t!==`value`)):e._isVueCE&&(shouldSetAsPropForVueCE(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!isString(r)))?patchDOMProp(e,camelize(t),r,o,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),patchAttr(e,t,r,s))};function shouldSetAsProp(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&isNativeOn(t)&&isFunction(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return isNativeOn(t)&&isString(n)?!1:t in e}function shouldSetAsPropForVueCE(e,t){let n=e._def.props;if(!n)return!1;let r=camelize(t);return Array.isArray(n)?n.some(e=>camelize(e)===r):Object.keys(n).some(e=>camelize(e)===r)}var getModelAssigner=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return isArray(t)?e=>invokeArrayFns(t,e):t};function onCompositionStart(e){e.target.composing=!0}function onCompositionEnd(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var assignKey=Symbol(`_assign`);function castValue(e,t,n){return t&&(e=e.trim()),n&&(e=looseToNumber(e)),e}var vModelText={created(e,{modifiers:{lazy:t,trim:n,number:r}},a){e[assignKey]=getModelAssigner(a);let o=r||a.props&&a.props.type===`number`;addEventListener(e,t?`change`:`input`,t=>{t.target.composing||e[assignKey](castValue(e.value,n,o))}),(n||o)&&addEventListener(e,`change`,()=>{e.value=castValue(e.value,n,o)}),t||(addEventListener(e,`compositionstart`,onCompositionStart),addEventListener(e,`compositionend`,onCompositionEnd),addEventListener(e,`change`,onCompositionEnd))},mounted(e,{value:t}){e.value=t??``},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:a,number:o}},s){if(e[assignKey]=getModelAssigner(s),e.composing)return;let c=(o||e.type===`number`)&&!/^0\d/.test(e.value)?looseToNumber(e.value):e.value,l=t??``;if(c===l)return;let u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!==`range`&&(r&&t===n||a&&e.value.trim()===l)||(e.value=l)}},vModelCheckbox={deep:!0,created(e,t,n){e[assignKey]=getModelAssigner(n),addEventListener(e,`change`,()=>{let t=e._modelValue,n=getValue(e),r=e.checked,a=e[assignKey];if(isArray(t)){let e=looseIndexOf(t,n),o=e!==-1;if(r&&!o)a(t.concat(n));else if(!r&&o){let n=[...t];n.splice(e,1),a(n)}}else if(isSet(t)){let e=new Set(t);r?e.add(n):e.delete(n),a(e)}else a(getCheckboxValue(e,r))})},mounted:setChecked,beforeUpdate(e,t,n){e[assignKey]=getModelAssigner(n),setChecked(e,t,n)}};function setChecked(e,{value:t,oldValue:n},r){e._modelValue=t;let a;if(isArray(t))a=looseIndexOf(t,r.props.value)>-1;else if(isSet(t))a=t.has(r.props.value);else{if(t===n)return;a=looseEqual(t,getCheckboxValue(e,!0))}e.checked!==a&&(e.checked=a)}var vModelSelect={deep:!0,created(e,{value:t,modifiers:{number:n}},r){let a=isSet(t);addEventListener(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?looseToNumber(getValue(e)):getValue(e));e[assignKey](e.multiple?a?new Set(t):t:t[0]),e._assigning=!0,nextTick(()=>{e._assigning=!1})}),e[assignKey]=getModelAssigner(r)},mounted(e,{value:t}){setSelected(e,t)},beforeUpdate(e,t,n){e[assignKey]=getModelAssigner(n)},updated(e,{value:t}){e._assigning||setSelected(e,t)}};function setSelected(e,t){let n=e.multiple,r=isArray(t);if(!n||r||isSet(t)){for(let a=0,o=e.options.length;a<o;a++){let o=e.options[a],s=getValue(o);if(n){if(r){let e=typeof s;o.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(s)):looseIndexOf(t,s)>-1}else o.selected=t.has(s)}else if(looseEqual(getValue(o),t)){e.selectedIndex!==a&&(e.selectedIndex=a);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function getValue(e){return`_value`in e?e._value:e.value}function getCheckboxValue(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var systemModifiers=[`ctrl`,`shift`,`alt`,`meta`],modifierGuards={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>systemModifiers.some(n=>e[`${n}Key`]&&!t.includes(n))},withModifiers=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=modifierGuards[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},rendererOptions=extend({patchProp},nodeOps),renderer;function ensureRenderer(){return renderer||=createRenderer(rendererOptions)}var createApp=((...e)=>{let t=ensureRenderer().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=normalizeContainer(e);if(!r)return;let a=t._component;isFunction(a)||a.render||a.template||(a.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let o=n(r,!1,resolveRootNamespace(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),o},t});function resolveRootNamespace(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function normalizeContainer(e){return isString(e)?document.querySelector(e):e}function getLens(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function byteLength(e){var t=getLens(e),n=t[0],r=t[1];return(n+r)*3/4-r}function _byteLength(e,t,n){return(t+n)*3/4-n}function toByteArray(e){for(var t,n=getLens(e),r=n[0],a=n[1],o=new Arr(_byteLength(e,r,a)),s=0,c=a>0?r-4:r,l=0;l<c;l+=4)t=revLookup[e.charCodeAt(l)]<<18|revLookup[e.charCodeAt(l+1)]<<12|revLookup[e.charCodeAt(l+2)]<<6|revLookup[e.charCodeAt(l+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return a===2&&(t=revLookup[e.charCodeAt(l)]<<2|revLookup[e.charCodeAt(l+1)]>>4,o[s++]=t&255),a===1&&(t=revLookup[e.charCodeAt(l)]<<10|revLookup[e.charCodeAt(l+1)]<<4|revLookup[e.charCodeAt(l+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function tripletToBase64(e){return lookup[e>>18&63]+lookup[e>>12&63]+lookup[e>>6&63]+lookup[e&63]}function encodeChunk(e,t,n){for(var r,a=[],o=t;o<n;o+=3)r=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(e[o+2]&255),a.push(tripletToBase64(r));return a.join(``)}function fromByteArray(e){for(var t,n=e.length,r=n%3,a=[],o=16383,s=0,c=n-r;s<c;s+=o)a.push(encodeChunk(e,s,s+o>c?c:s+o));return r===1?(t=e[n-1],a.push(lookup[t>>2]+lookup[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],a.push(lookup[t>>10]+lookup[t>>4&63]+lookup[t<<2&63]+`=`)),a.join(``)}var buffer,base64Js,lookup,revLookup,Arr,code,i,len,ieee754,Buffer$2,Blob$1,BlobOptions,Buffer$1,File,FileOptions,INSPECT_MAX_BYTES,SlowBuffer,TranscodeEncoding,atob$1,btoa$1,constants,isAscii,isUtf8,kMaxLength,kStringMaxLength,resolveObjectURL,transcode,init_dist=__esmMin((()=>{for(buffer={},base64Js={},base64Js.byteLength=byteLength,base64Js.toByteArray=toByteArray,base64Js.fromByteArray=fromByteArray,lookup=[],revLookup=[],Arr=typeof Uint8Array<`u`?Uint8Array:Array,code=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;revLookup[45]=62,revLookup[95]=63,ieee754={},ieee754.read=function(e,t,n,r,a){var o,s,c=a*8-r-1,l=(1<<c)-1,u=l>>1,d=-7,f=n?a-1:0,m=n?-1:1,g=e[t+f];for(f+=m,o=g&(1<<-d)-1,g>>=-d,d+=c;d>0;o=o*256+e[t+f],f+=m,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=s*256+e[t+f],f+=m,d-=8);if(o===0)o=1-u;else if(o===l)return s?NaN:(g?-1:1)*(1/0);else s+=2**r,o-=u;return(g?-1:1)*s*2**(o-r)},ieee754.write=function(e,t,n,r,a,o){var s,c,l,u=o*8-a-1,d=(1<<u)-1,f=d>>1,m=a===23?2**-24-2**-77:0,g=r?0:o-1,_=r?1:-1,v=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(c=+!!isNaN(t),s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=2**-s)<1&&(s--,l*=2),s+f>=1?t+=m/l:t+=m*2**(1-f),t*l>=2&&(s++,l/=2),s+f>=d?(c=0,s=d):s+f>=1?(c=(t*l-1)*2**a,s+=f):(c=t*2**(f-1)*2**a,s=0));a>=8;e[n+g]=c&255,g+=_,c/=256,a-=8);for(s=s<<a|c,u+=a;u>0;e[n+g]=s&255,g+=_,s/=256,u-=8);e[n+g-_]|=v*128},(function(e){let t=base64Js,n=ieee754,r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=d,e.SlowBuffer=w,e.INSPECT_MAX_BYTES=50;let a=0x7fffffff;e.kMaxLength=a;let{Uint8Array:o,ArrayBuffer:s,SharedArrayBuffer:c}=globalThis;d.TYPED_ARRAY_SUPPORT=l(),!d.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{let e=new o(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,o.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function u(e){if(e>a)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new o(e);return Object.setPrototypeOf(t,d.prototype),t}function d(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return _(e)}return f(e,t,n)}d.poolSize=8192;function f(e,t,n){if(typeof e==`string`)return v(e,t);if(s.isView(e))return b(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Z(e,s)||e&&Z(e.buffer,s)||c!==void 0&&(Z(e,c)||e&&Z(e.buffer,c)))return x(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return d.from(r,t,n);let a=S(e);if(a)return a;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return d.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}d.from=function(e,t,n){return f(e,t,n)},Object.setPrototypeOf(d.prototype,o.prototype),Object.setPrototypeOf(d,o);function m(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function g(e,t,n){return m(e),e<=0||t===void 0?u(e):typeof n==`string`?u(e).fill(t,n):u(e).fill(t)}d.alloc=function(e,t,n){return g(e,t,n)};function _(e){return m(e),u(e<0?0:C(e)|0)}d.allocUnsafe=function(e){return _(e)},d.allocUnsafeSlow=function(e){return _(e)};function v(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!d.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=T(e,t)|0,r=u(n),a=r.write(e,t);return a!==n&&(r=r.slice(0,a)),r}function y(e){let t=e.length<0?0:C(e.length)|0,n=u(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function b(e){if(Z(e,o)){let t=new o(e);return x(t.buffer,t.byteOffset,t.byteLength)}return y(e)}function x(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new o(e):n===void 0?new o(e,t):new o(e,t,n),Object.setPrototypeOf(r,d.prototype),r}function S(e){if(d.isBuffer(e)){let t=C(e.length)|0,n=u(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||me(e.length)?u(0):y(e);if(e.type===`Buffer`&&Array.isArray(e.data))return y(e.data)}function C(e){if(e>=a)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+a.toString(16)+` bytes`);return e|0}function w(e){return+e!=e&&(e=0),d.alloc(+e)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype},d.compare=function(e,t){if(Z(e,o)&&(e=d.from(e,e.offset,e.byteLength)),Z(t,o)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let a=0,o=Math.min(n,r);a<o;++a)if(e[a]!==t[a]){n=e[a],r=t[a];break}return n<r?-1:+(r<n)},d.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},d.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return d.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=d.allocUnsafe(t),a=0;for(n=0;n<e.length;++n){let t=e[n];if(Z(t,o))a+t.length>r.length?(d.isBuffer(t)||(t=d.from(t)),t.copy(r,a)):o.prototype.set.call(r,t,a);else if(d.isBuffer(t))t.copy(r,a);else throw TypeError(`"list" argument must be an Array of Buffers`);a+=t.length}return r};function T(e,t){if(d.isBuffer(e))return e.length;if(s.isView(e)||Z(e,s))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let a=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return X(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return fe(e).length;default:if(a)return r?-1:X(e).length;t=(``+t).toLowerCase(),a=!0}}d.byteLength=T;function E(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return B(this,t,n);case`utf8`:case`utf-8`:return I(this,t,n);case`ascii`:return R(this,t,n);case`latin1`:case`binary`:return z(this,t,n);case`base64`:return F(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return V(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}d.prototype._isBuffer=!0;function D(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}d.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)D(this,t,t+1);return this},d.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)D(this,t,t+3),D(this,t+1,t+2);return this},d.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)D(this,t,t+7),D(this,t+1,t+6),D(this,t+2,t+5),D(this,t+3,t+4);return this},d.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?I(this,0,e):E.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(e){if(!d.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||d.compare(this,e)===0},d.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(d.prototype[r]=d.prototype.inspect),d.prototype.compare=function(e,t,n,r,a){if(Z(e,o)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),a===void 0&&(a=this.length),t<0||n>e.length||r<0||a>this.length)throw RangeError(`out of range index`);if(r>=a&&t>=n)return 0;if(r>=a)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,a>>>=0,this===e)return 0;let s=a-r,c=n-t,l=Math.min(s,c),u=this.slice(r,a),f=e.slice(t,n);for(let e=0;e<l;++e)if(u[e]!==f[e]){s=u[e],c=f[e];break}return s<c?-1:+(c<s)};function O(e,t,n,r,a){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>0x7fffffff?n=0x7fffffff:n<-0x80000000&&(n=-0x80000000),n=+n,me(n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(a)n=0;else return-1}if(typeof t==`string`&&(t=d.from(t,r)),d.isBuffer(t))return t.length===0?-1:k(e,t,n,r,a);if(typeof t==`number`)return t&=255,typeof o.prototype.indexOf==`function`?a?o.prototype.indexOf.call(e,t,n):o.prototype.lastIndexOf.call(e,t,n):k(e,[t],n,r,a);throw TypeError(`val must be string, number or Buffer`)}function k(e,t,n,r,a){let o=1,s=e.length,c=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,n/=2}function l(e,t){return o===1?e[t]:e.readUInt16BE(t*o)}let u;if(a){let r=-1;for(u=n;u<s;u++)if(l(e,u)===l(t,r===-1?0:u-r)){if(r===-1&&(r=u),u-r+1===c)return r*o}else r!==-1&&(u-=u-r),r=-1}else for(n+c>s&&(n=s-c),u=n;u>=0;u--){let n=!0;for(let r=0;r<c;r++)if(l(e,u+r)!==l(t,r)){n=!1;break}if(n)return u}return-1}d.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},d.prototype.indexOf=function(e,t,n){return O(this,e,t,n,!0)},d.prototype.lastIndexOf=function(e,t,n){return O(this,e,t,n,!1)};function A(e,t,n,r){n=Number(n)||0;let a=e.length-n;r?(r=Number(r),r>a&&(r=a)):r=a;let o=t.length;r>o/2&&(r=o/2);let s=0;for(;s<r;++s){let r=parseInt(t.substr(s*2,2),16);if(me(r))return s;e[n+s]=r}return s}function j(e,t,n,r){return pe(X(t,e.length-n),e,n,r)}function M(e,t,n,r){return pe(ue(t),e,n,r)}function ee(e,t,n,r){return pe(fe(t),e,n,r)}function P(e,t,n,r){return pe(de(t,e.length-n),e,n,r)}d.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let a=this.length-t;if((n===void 0||n>a)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let o=!1;for(;;)switch(r){case`hex`:return A(this,e,t,n);case`utf8`:case`utf-8`:return j(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return M(this,e,t,n);case`base64`:return ee(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return P(this,e,t,n);default:if(o)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),o=!0}},d.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function F(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function I(e,t,n){n=Math.min(e.length,n);let r=[],a=t;for(;a<n;){let t=e[a],o=null,s=t>239?4:t>223?3:t>191?2:1;if(a+s<=n){let n,r,c,l;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[a+1],(n&192)==128&&(l=(t&31)<<6|n&63,l>127&&(o=l));break;case 3:n=e[a+1],r=e[a+2],(n&192)==128&&(r&192)==128&&(l=(t&15)<<12|(n&63)<<6|r&63,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:n=e[a+1],r=e[a+2],c=e[a+3],(n&192)==128&&(r&192)==128&&(c&192)==128&&(l=(t&15)<<18|(n&63)<<12|(r&63)<<6|c&63,l>65535&&l<1114112&&(o=l))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),a+=s}return L(r)}let te=4096;function L(e){let t=e.length;if(t<=te)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=te));return n}function R(e,t,n){let r=``;n=Math.min(e.length,n);for(let a=t;a<n;++a)r+=String.fromCharCode(e[a]&127);return r}function z(e,t,n){let r=``;n=Math.min(e.length,n);for(let a=t;a<n;++a)r+=String.fromCharCode(e[a]);return r}function B(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let a=``;for(let r=t;r<n;++r)a+=Q[e[r]];return a}function V(e,t,n){let r=e.slice(t,n),a=``;for(let e=0;e<r.length-1;e+=2)a+=String.fromCharCode(r[e]+r[e+1]*256);return a}d.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,d.prototype),r};function H(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=this[e],a=1,o=0;for(;++o<t&&(a*=256);)r+=this[e+o]*a;return r},d.prototype.readUintBE=d.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=this[e+--t],a=1;for(;t>0&&(a*=256);)r+=this[e+--t]*a;return r},d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e>>>=0,t||H(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||H(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||H(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||H(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||H(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=$(function(e){e>>>=0,oe(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&se(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,a=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(a)<<BigInt(32))}),d.prototype.readBigUInt64BE=$(function(e){e>>>=0,oe(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&se(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],a=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(a)}),d.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=this[e],a=1,o=0;for(;++o<t&&(a*=256);)r+=this[e+o]*a;return a*=128,r>=a&&(r-=2**(8*t)),r},d.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=t,a=1,o=this[e+--r];for(;r>0&&(a*=256);)o+=this[e+--r]*a;return a*=128,o>=a&&(o-=2**(8*t)),o},d.prototype.readInt8=function(e,t){return e>>>=0,t||H(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||H(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|0xffff0000:n},d.prototype.readInt16BE=function(e,t){e>>>=0,t||H(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|0xffff0000:n},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||H(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||H(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=$(function(e){e>>>=0,oe(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&se(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),d.prototype.readBigInt64BE=$(function(e){e>>>=0,oe(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&se(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),d.prototype.readFloatLE=function(e,t){return e>>>=0,t||H(e,4,this.length),n.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||H(e,4,this.length),n.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||H(e,8,this.length),n.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||H(e,8,this.length),n.read(this,e,!1,52,8)};function U(e,t,n,r,a,o){if(!d.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>a||t<o)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;U(this,e,t,n,r,0)}let a=1,o=0;for(this[t]=e&255;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;U(this,e,t,n,r,0)}let a=n-1,o=1;for(this[t+a]=e&255;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,1,255,0),this[t]=e&255,t+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function W(e,t,n,r,a){ae(t,r,a,e,n,7);let o=Number(t&BigInt(0xffffffff));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function G(e,t,n,r,a){ae(t,r,a,e,n,7);let o=Number(t&BigInt(0xffffffff));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}d.prototype.writeBigUInt64LE=$(function(e,t=0){return W(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeBigUInt64BE=$(function(e,t=0){return G(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);U(this,e,t,n,r-1,-r)}let a=0,o=1,s=0;for(this[t]=e&255;++a<n&&(o*=256);)e<0&&s===0&&this[t+a-1]!==0&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},d.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);U(this,e,t,n,r-1,-r)}let a=n-1,o=1,s=0;for(this[t+a]=e&255;--a>=0&&(o*=256);)e<0&&s===0&&this[t+a+1]!==0&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},d.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},d.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,0x7fffffff,-0x80000000),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},d.prototype.writeBigInt64LE=$(function(e,t=0){return W(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),d.prototype.writeBigInt64BE=$(function(e,t=0){return G(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function K(e,t,n,r,a,o){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function q(e,t,r,a,o){return t=+t,r>>>=0,o||K(e,t,r,4),n.write(e,t,r,a,23,4),r+4}d.prototype.writeFloatLE=function(e,t,n){return q(this,e,t,!0,n)},d.prototype.writeFloatBE=function(e,t,n){return q(this,e,t,!1,n)};function J(e,t,r,a,o){return t=+t,r>>>=0,o||K(e,t,r,8),n.write(e,t,r,a,52,8),r+8}d.prototype.writeDoubleLE=function(e,t,n){return J(this,e,t,!0,n)},d.prototype.writeDoubleBE=function(e,t,n){return J(this,e,t,!1,n)},d.prototype.copy=function(e,t,n,r){if(!d.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let a=r-n;return this===e&&typeof o.prototype.copyWithin==`function`?this.copyWithin(t,n,r):o.prototype.set.call(e,this.subarray(n,r),t),a},d.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!d.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let a;if(typeof e==`number`)for(a=t;a<n;++a)this[a]=e;else{let o=d.isBuffer(e)?e:d.from(e,r),s=o.length;if(s===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};let Y={};function ne(e,t,n){Y[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}ne(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),ne(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),ne(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,a=n;return Number.isInteger(n)&&Math.abs(n)>2**32?a=re(String(n)):typeof n==`bigint`&&(a=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(a=re(a)),a+=`n`),r+=` It must be ${t}. Received ${a}`,r},RangeError);function re(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function ie(e,t,n){oe(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&se(t,e.length-(n+1))}function ae(e,t,n,r,a,o){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,a;throw a=o>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(o+1)*8}${r}`:`>= -(2${r} ** ${(o+1)*8-1}${r}) and < 2 ** ${(o+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new Y.ERR_OUT_OF_RANGE(`value`,a,e)}ie(r,a,o)}function oe(e,t){if(typeof e!=`number`)throw new Y.ERR_INVALID_ARG_TYPE(t,`number`,e)}function se(e,t,n){throw Math.floor(e)===e?t<0?new Y.ERR_BUFFER_OUT_OF_BOUNDS:new Y.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(oe(e,n),new Y.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ce=/[^+/0-9A-Za-z-_]/g;function le(e){if(e=e.split(`=`)[0],e=e.trim().replace(ce,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function X(e,t){t||=1/0;let n,r=e.length,a=null,o=[];for(let s=0;s<r;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!a){if(n>56319||s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}a=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),a=n;continue}n=(a-55296<<10|n-56320)+65536}else a&&(t-=3)>-1&&o.push(239,191,189);if(a=null,n<128){if(--t<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return o}function ue(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function de(e,t){let n,r,a,o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,a=n%256,o.push(a),o.push(r);return o}function fe(e){return t.toByteArray(le(e))}function pe(e,t,n,r){let a=0;for(;a<r&&!(a+n>=t.length||a>=e.length);++a)t[a+n]=e[a];return a}function Z(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function me(e){return e!==e}let Q=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let a=0;a<16;++a)t[r+a]=e[n]+e[a]}return t})();function $(e){return typeof BigInt>`u`?he:e}function he(){throw Error(`BigInt not supported`)}})(buffer),Buffer$2=buffer.Buffer,Blob$1=buffer.Blob,BlobOptions=buffer.BlobOptions,Buffer$1=buffer.Buffer,File=buffer.File,FileOptions=buffer.FileOptions,INSPECT_MAX_BYTES=buffer.INSPECT_MAX_BYTES,SlowBuffer=buffer.SlowBuffer,TranscodeEncoding=buffer.TranscodeEncoding,atob$1=buffer.atob,btoa$1=buffer.btoa,constants=buffer.constants,isAscii=buffer.isAscii,isUtf8=buffer.isUtf8,kMaxLength=buffer.kMaxLength,kStringMaxLength=buffer.kStringMaxLength,resolveObjectURL=buffer.resolveObjectURL,transcode=buffer.transcode})),IS_CLIENT=typeof window<`u`,activePinia,setActivePinia=e=>activePinia=e,piniaSymbol=Symbol();function isPlainObject$1(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var _global=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global$1==`object`&&global$1.global===global$1?global$1:typeof globalThis==`object`?globalThis:{HTMLElement:null};function bom(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function download(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){saveAs(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function corsEnabled(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function click(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var _navigator=typeof navigator==`object`?navigator:{userAgent:``},isMacOSWebView=/Macintosh/.test(_navigator.userAgent)&&/AppleWebKit/.test(_navigator.userAgent)&&!/Safari/.test(_navigator.userAgent),saveAs=IS_CLIENT?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!isMacOSWebView?downloadSaveAs:`msSaveOrOpenBlob`in _navigator?msSaveAs:fileSaverSaveAs:()=>{};function downloadSaveAs(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?click(r):corsEnabled(r.href)?download(e,t,n):(r.target=`_blank`,click(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){click(r)},0))}function msSaveAs(e,t=`download`,n){if(typeof e==`string`){if(corsEnabled(e))download(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){click(t)})}}else navigator.msSaveOrOpenBlob(bom(e,n),t)}function fileSaverSaveAs(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return download(e,t,n);let a=e.type===`application/octet-stream`,o=/constructor/i.test(String(_global.HTMLElement))||`safari`in _global,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||a&&o||isMacOSWebView)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=s?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:assign$1}=Object;function createPinia(){let e=effectScope(!0),t=e.run(()=>ref({})),n=[],r=[],a=markRaw({install(e){setActivePinia(a),a._a=e,e.provide(piniaSymbol,a),e.config.globalProperties.$pinia=a,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return a}var noop$1=()=>{};function addSubscription(e,t,n,r=noop$1){e.add(t);let a=()=>{e.delete(t)&&r()};return!n&&getCurrentScope()&&onScopeDispose(a),a}function triggerSubscriptions(e,...t){e.forEach(e=>{e(...t)})}var fallbackRunWithContext=e=>e(),ACTION_MARKER=Symbol(),ACTION_NAME=Symbol();function mergeReactiveObjects(e,t){e instanceof Map&&t instanceof Map?t.forEach((t,n)=>e.set(n,t)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(let n in t){if(!Object.hasOwn(t,n))continue;let r=t[n],a=e[n];if(isPlainObject$1(a)&&isPlainObject$1(r)&&Object.hasOwn(e,n)&&!isRef(r)&&!isReactive(r)){e[n]=mergeReactiveObjects(a,r);let t=toRaw(e)[n];isRef(t)&&isShallow(t)&&triggerRef(t)}else e[n]=r}return e}var skipHydrateSymbol=Symbol();function shouldHydrate(e){return!e||typeof e!=`object`||!Object.hasOwn(e,skipHydrateSymbol)}var{assign}=Object;function isComputed(e){return!!(isRef(e)&&e.effect)}function createOptionsStore(e,t,n,r){let{state:a,actions:o,getters:s}=t,c=n.state.value[e],l;function u(){return c||(n.state.value[e]=a?a():{}),assign(toRefs(n.state.value[e]),o,Object.keys(s||{}).reduce((t,r)=>(t[r]=markRaw(computed(()=>{setActivePinia(n);let t=n._s.get(e);return s[r].call(t,t)})),t),{}))}return l=createSetupStore(e,u,t,n,r,!0),l}function createSetupStore(e,t,n={},r,a,o){let s,c=assign({actions:{}},n),l={deep:!0},u,d,f=new Set,m=new Set,g,_=r.state.value[e];!o&&!_&&(r.state.value[e]={});let v;function y(t){let n;u=d=!1,typeof t==`function`?(t(r.state.value[e]),n={type:`patch function`,storeId:e,events:g}):(mergeReactiveObjects(r.state.value[e],t),n={type:`patch object`,payload:t,storeId:e,events:g});let a=v=Symbol();nextTick().then(()=>{v===a&&(u=!0)}),d=!0,triggerSubscriptions(f,n,r.state.value[e])}let b=o?function(){let{state:e}=n,t=e?e():{};this.$patch(e=>{assign(e,t)})}:noop$1;function x(){s.stop(),f.clear(),m.clear(),r._s.delete(e)}let S=(t,n=``)=>{if(ACTION_MARKER in t)return t[ACTION_NAME]=n,t;let a=function(){setActivePinia(r);let n=Array.from(arguments),o=new Set,s=new Set;function c(e){o.add(e)}function l(e){s.add(e)}triggerSubscriptions(m,{args:n,name:a[ACTION_NAME],store:C,after:c,onError:l});let u;try{u=t.apply(this&&this.$id===e?this:C,n)}catch(e){throw triggerSubscriptions(s,e),e}return u instanceof Promise?u.then(e=>(triggerSubscriptions(o,e),e)).catch(e=>(triggerSubscriptions(s,e),Promise.reject(e))):(triggerSubscriptions(o,u),u)};return a[ACTION_MARKER]=!0,a[ACTION_NAME]=n,a},C=reactive({_p:r,$id:e,$onAction:addSubscription.bind(null,m),$patch:y,$reset:b,$subscribe(t,n={}){if(f.has(t))return noop$1;let a=addSubscription(f,t,n.detached,()=>o()),o=s.run(()=>watch(()=>r.state.value[e],r=>{(n.flush===`sync`?d:u)&&t({storeId:e,type:`direct`,events:g},r)},assign({},l,n)));return a},$dispose:x});r._s.set(e,C);let w=(r._a&&r._a.runWithContext||fallbackRunWithContext)(()=>r._e.run(()=>(s=effectScope()).run(()=>t({action:S}))));for(let t in w){let n=w[t];isRef(n)&&!isComputed(n)||isReactive(n)?o||(_&&shouldHydrate(n)&&(isRef(n)?n.value=_[t]:((n instanceof Set||n instanceof Map)&&n.clear(),mergeReactiveObjects(n,_[t]))),r.state.value[e][t]=n):typeof n==`function`&&(w[t]=S(n,t),c.actions[t]=n)}return assign(C,w),assign(toRaw(C),w),Object.defineProperty(C,"$state",{get:()=>r.state.value[e],set:e=>{y(t=>{assign(t,e)})}}),r._p.forEach(e=>{let t=s.run(()=>e({store:C,app:r._a,pinia:r,options:c}));assign(C,t)}),_&&o&&n.hydrate&&n.hydrate(C.$state,_),u=!0,d=!0,C}function defineStore(e,t,n){let r,a=typeof t==`function`;r=a?n:t;function o(n,o){let s=hasInjectionContext();return n||=s?inject(piniaSymbol,null):null,n&&setActivePinia(n),n=activePinia,n._s.has(e)||(a?createSetupStore(e,t,r,n):createOptionsStore(e,r,n)),n._s.get(e)}return o.$id=e,o}function num(e,t){let n=e.trim();if(n===``)return t;let r=Number(n);return Number.isFinite(r)?r:t}function parseFxTheme(e){let t=t=>(e(t)??``).trim();return{dot:t(`--hq-fx-dot`),text:t(`--hq-text`),muted:t(`--hq-text-muted`),accent:t(`--hq-accent`),ok:t(`--hq-correct`),ko:t(`--hq-wrong`),choices:[t(`--hq-choice-a`),t(`--hq-choice-b`),t(`--hq-choice-c`),t(`--hq-choice-d`)],lineOpacity:num(t(`--hq-fx-line-opacity`),.2),glow:num(t(`--hq-fx-glow`),.3),dustDensity:num(t(`--hq-fx-dust-density`),1),dustAlpha:num(t(`--hq-fx-dust-alpha`),1),speed:num(t(`--hq-fx-speed`),1),pixel:num(t(`--hq-fx-pixel`),0)>0,fontLabel:t(`--hq-font-label`),fontDisplay:t(`--hq-font-display`),labelSpacing:t(`--hq-label-spacing`)}}function readFxTheme(e){let t=getComputedStyle(e);return parseFxTheme(e=>t.getPropertyValue(e))}var MAX_DT=.05,REDUCED_QUERY=`(prefers-reduced-motion: reduce)`;function mountScene(e,t,n){let r=e.getContext(`2d`);if(!r)throw Error(`mountScene: 2D canvas context unavailable`);let a=typeof matchMedia==`function`?matchMedia(REDUCED_QUERY):null,o={ctx:r,w:0,h:0,t:0,dt:0,theme:readFxTheme(e),reduced:a?.matches??!1},s,c=0,l=0,u=0,d=!1,f=!1;function m(){let t=e.clientWidth,n=e.clientHeight,a=window.devicePixelRatio||1;return t===o.w&&n===o.h&&a===u?!1:(o.w=t,o.h=n,u=a,e.width=Math.round(t*a),e.height=Math.round(n*a),r.setTransform(a,0,0,a,0,0),!0)}function g(){o.t=0,o.dt=0,s=t.init(o,n())}function _(e){c=0,o.dt=Math.min(Math.max((e-l)/1e3,0),MAX_DT)*o.theme.speed,l=e,o.t+=o.dt,r.clearRect(0,0,o.w,o.h);try{t.draw(o,s,n())}catch(e){f||console.error(`fx scene draw failed`,e),f=!0}v()}function v(){d||c||document.visibilityState===`hidden`||(c=requestAnimationFrame(_))}function y(){c&&cancelAnimationFrame(c),c=0}function b(){document.visibilityState===`hidden`?y():(l=performance.now(),v())}function x(e){o.reduced=e.matches}let S=new ResizeObserver(()=>{let e=o.w===0||o.h===0;m()&&e&&g()});return m(),g(),l=performance.now(),S.observe(e),document.addEventListener(`visibilitychange`,b),a?.addEventListener(`change`,x),v(),{restart(){d||(m(),g())},refreshTheme(){d||(o.theme=readFxTheme(e))},destroy(){d||(d=!0,y(),S.disconnect(),document.removeEventListener(`visibilitychange`,b),a?.removeEventListener(`change`,x))}}}var MAX_DOTS=30,DANGER_SECONDS=4;function countdownState(e,t){let n=Math.max(0,Math.min(Math.floor(t),MAX_DOTS)),r=t>0?e/t:0,a=Math.min(Math.max(r,0),1);return{dots:n,lit:Math.ceil(a*n),danger:e>0&&e<=DANGER_SECONDS,fraction:a,seconds:Math.max(0,Math.ceil(e))}}var GOLDEN_ANGLE=2.39996,SPIRAL_X=1.35,SPIRAL_Y=.75,spiralRadius=(e,t)=>t*1.3*Math.sqrt(e+.6);function spiralSlot(e,t,n,r){let a=e*GOLDEN_ANGLE+.5,o=spiralRadius(e,r);return{x:t+Math.cos(a)*o*SPIRAL_X,y:n+Math.sin(a)*o*SPIRAL_Y}}function spiralUnit(e,t,n,r=.05){let a=r*Math.max(Math.min(t,n),0),o=spiralRadius(Math.max(e-1,0),1),s=.45*Math.max(t,0)/(o*SPIRAL_X),c=.45*Math.max(n,0)/(o*SPIRAL_Y);return Math.min(a,s,c)}var CHECK_SHAPE=[[-.5,0],[-.15,.35],[.5,-.4]];function checkPoints(e,t,n,r){let a=[],o=0;for(let e=0;e<CHECK_SHAPE.length-1;e++){let[t,n]=CHECK_SHAPE[e],[r,s]=CHECK_SHAPE[e+1],c=Math.hypot(r-t,s-n);a.push(c),o+=c}return Array.from({length:Math.max(e,0)},(s,c)=>{let l=(e<=1?0:c/(e-1))*o,u=0;for(;u<a.length-1&&l>a[u];)l-=a[u],u++;let d=a[u]>0?l/a[u]:0,[f,m]=CHECK_SHAPE[u],[g,_]=CHECK_SHAPE[u+1];return{x:t+(f+(g-f)*d)*r,y:n+(m+(_-m)*d)*r}})}function crossPoints(e,t,n,r){let a=Math.max(e,0),o=Math.ceil(a/2),s=r/2,c=(e,r,a)=>Array.from({length:e},(o,c)=>{let l=e<=1?0:c/(e-1);return{x:t+r+(a-r)*l,y:n-s+2*s*l}});return[...c(o,-s,s),...c(a-o,s,-s)]}function verdictLinks(e,t){let n=Math.max(t,0),r=(e,t)=>Array.from({length:Math.max(t-e-1,0)},(t,n)=>[e+n,e+n+1]);if(e===`check`)return r(0,n);let a=Math.ceil(n/2);return[...r(0,a),...r(a,n)]}function hourglassHalfWidth(e){return .06+.74*Math.min(Math.abs(e),1)}function hourglassSlots(e){let t=.15,n=[];for(let r=0;n.length<Math.max(e,0)&&r<40;r++){let a=.92-r*t*.9;if(a<=.08)break;let o=hourglassHalfWidth(a)-.07,s=Math.max(Math.floor(2*o/t)+1,1);for(let r=0;r<s&&n.length<e;r++)n.push({x:(r-(s-1)/2)*t,y:a})}return n}var PODIUM_SLOTS=[.5,.3,.7];function podiumDots(e,t=45,n=6){let r=e[0]??0;return e.slice(0,3).map(e=>r>0?Math.max(Math.round(t*e/r),n):n)}var TAU$1=Math.PI*2,clamp01=e=>Math.min(Math.max(e,0),1),rand$4=(e,t)=>e+Math.random()*(t-e);function dot(e,t,n,r,a,o){let{ctx:s}=e;if(s.globalAlpha=clamp01(a),s.fillStyle=o??e.theme.dot,e.theme.pixel){let e=Math.max(Math.round(r*2),1);s.fillRect(Math.round(t-e/2),Math.round(n-e/2),e,e)}else s.beginPath(),s.arc(t,n,Math.max(r,0),0,TAU$1),s.fill();s.globalAlpha=1}function glow(e,t,n,r,a,o){if(r<=0)return;let{ctx:s}=e,c=s.createRadialGradient(t,n,0,t,n,r);c.addColorStop(0,o),c.addColorStop(1,`transparent`),s.globalAlpha=clamp01(a*e.theme.glow),s.fillStyle=c,s.fillRect(t-r,n-r,r*2,r*2),s.globalAlpha=1}function line(e,t,n,r,a,o,s=.6,c){let{ctx:l}=e;l.globalAlpha=clamp01(o*e.theme.lineOpacity),l.strokeStyle=c??e.theme.dot,l.lineWidth=s,l.beginPath(),l.moveTo(t,n),l.lineTo(r,a),l.stroke(),l.globalAlpha=1}function spacingPx(e,t){let n=parseFloat(e);return Number.isFinite(n)?e.endsWith(`em`)&&!e.endsWith(`rem`)?n*t:n:0}function spacedText(e,t,n,r,a){let{ctx:o}=e;o.font=`${a}px ${e.theme.fontLabel}`;let s=spacingPx(e.theme.labelSpacing,a),c=[...t],l=c.map(e=>o.measureText(e).width),u=l.reduce((e,t)=>e+t,0)+s*Math.max(c.length-1,0),d=o.textAlign;o.textAlign=`left`;let f=n-u/2;c.forEach((e,t)=>{o.fillText(e,f,r),f+=l[t]+s}),o.textAlign=d}function makeDust(e,t,n){return Array.from({length:Math.max(0,Math.round(e))},()=>({x:rand$4(0,t),y:rand$4(0,n),vx:rand$4(-6,6),vy:rand$4(-6,6),r:rand$4(.4,1),a:rand$4(.06,.25)}))}var dustScale=(e,t)=>Math.min(Math.max(Math.min(e,t)/480,1),2.2);function drawDust(e,t){let{w:n,h:r,dt:a}=e,o=dustScale(n,r),s=e.theme.dustAlpha;for(let c of t)!e.reduced&&n>0&&r>0&&(c.x=((c.x+c.vx*a)%n+n)%n,c.y=((c.y+c.vy*a)%r+r)%r),dot(e,c.x,c.y,c.r*o,c.a*s)}var TAU=Math.PI*2,TOP=-Math.PI/2,rand$3=(e,t)=>e+Math.random()*(t-e);function newSparks(e){return Array.from({length:e},()=>({off:!1,x:0,y:0,vx:0,vy:0,a:1}))}var countdownScene={init(e,t){let{dots:n}=countdownState(t.remaining,t.total);return{sparks:newSparks(n)}},draw(e,t,n){let{ctx:r,theme:a,dt:o}=e,s=countdownState(n.remaining,n.total);t.sparks.length!==s.dots&&(t.sparks=newSparks(s.dots));let c=e.w/2,l=e.h/2,u=Math.min(e.w,e.h)*.42,d=u/100,f=Math.min(Math.max(s.seconds-n.remaining,0),1),m=u*(s.danger&&!e.reduced?1+.035*(1-f)**4:1),g=s.danger?a.ko:a.dot;s.danger&&glow(e,c,l,m*1.5,.2*(1-(e.reduced?0:f))**2,a.ko),r.lineWidth=1,r.strokeStyle=a.dot,r.globalAlpha=Math.min(a.lineOpacity*.4,1),r.beginPath(),r.arc(c,l,m,0,TAU),r.stroke(),s.fraction>0&&(r.strokeStyle=g,r.lineWidth=1.4,r.globalAlpha=s.danger?.65:Math.min(a.lineOpacity*2,1),r.beginPath(),r.arc(c,l,m,TOP,TOP+TAU*s.fraction),r.stroke()),r.globalAlpha=1;for(let n=0;n<s.dots;n++){let r=t.sparks[n],a=TOP+n/s.dots*TAU,u=c+Math.cos(a)*m,f=l+Math.sin(a)*m;if(n<s.lit)r.off=!1,r.a=1,glow(e,u,f,Math.max(7,10*d),.8,g),dot(e,u,f,Math.max(1.8,2.6*d),1,g);else{if(!r.off){r.off=!0,r.x=u,r.y=f;let e=rand$3(25,45)*d;r.vx=Math.cos(a)*e+rand$3(-8,8)*d,r.vy=Math.sin(a)*e+rand$3(-8,8)*d}e.reduced?(r.a=Math.max(0,r.a-o*1.5),dot(e,u,f,Math.max(1.8,2.6*d),r.a,g)):(r.x+=r.vx*o,r.y+=r.vy*o,r.vx*=.985,r.vy*=.985,r.a=Math.max(0,r.a-o*.45),dot(e,r.x,r.y,Math.max(1,1.4*d),r.a*.6,g))}}}},_hoisted_1$14=[`aria-label`],_hoisted_2$13={class:`fx-countdown__num`,"aria-hidden":`true`},FxCountdown_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxCountdown`,props:{total:{},remaining:{},size:{}},setup(e){let t=e,n=ref(null),r=computed(()=>countdownState(t.remaining,t.total)),a=null;return onMounted(()=>{n.value&&(a=mountScene(n.value,countdownScene,()=>({total:t.total,remaining:t.remaining})))}),watch(()=>t.total,()=>a?.restart()),onBeforeUnmount(()=>a?.destroy()),(t,a)=>(openBlock(),createElementBlock(`div`,{class:normalizeClass([`fx-countdown`,[`fx-countdown--${e.size??`compact`}`,{"fx-countdown--danger":r.value.danger}]]),role:`timer`,"aria-live":`off`,"aria-label":`${e.remaining.toFixed(1)} seconds remaining`},[createBaseVNode(`canvas`,{ref_key:`canvas`,ref:n,class:`fx-countdown__canvas`,"aria-hidden":`true`},null,512),createBaseVNode(`span`,_hoisted_2$13,toDisplayString(r.value.seconds),1)],10,_hoisted_1$14))}}),_plugin_vue_export_helper_default=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},FxCountdown_default=_plugin_vue_export_helper_default(FxCountdown_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-80535576`]]),BrandLogo_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`BrandLogo`,props:{centered:{type:Boolean},inline:{type:Boolean}},setup(e){return(t,n)=>(openBlock(),createElementBlock(`svg`,{class:normalizeClass([`hq-logo`,{"hq-logo--center":e.centered,"hq-logo--inline":e.inline}]),viewBox:`0 0 1952 832`,role:`img`,"aria-label":`HashQuiz`},[...n[0]||=[createBaseVNode(`path`,{class:`hq-logo__hash-back`,d:`M544 407 517 532 645 532 672 407ZM27 407 0 532 129 533 102 659 230 659 285 406ZM82 154 55 279 183 279 210 154ZM497 27 470 153 597 154 570 280 700 279 727 154 598 153 625 27ZM239 27 212 153 340 153 367 27Z`},null,-1),createBaseVNode(`path`,{class:`hq-logo__hash-front`,d:`M1840 419 1816 526 1927 526 1951 419ZM212 154 157 405 285 405 313 280 438 280 412 406 286 407 258 532 386 532 360 659 480 659 464 741 581 741 562 830 691 830 718 705 601 705 619 615 498 614 596 154Z`},null,-1),createBaseVNode(`path`,{class:`hq-logo__text`,d:`M1400 149 1399 248 1597 248 1598 280 1552 281 1551 315 1510 315 1508 351 1469 351 1467 386 1434 387 1432 420 1398 421 1399 525 1741 526 1765 418 1597 417 1596 390 1598 387 1642 387 1644 350 1684 349 1687 314 1725 314 1727 279 1762 279 1762 149ZM1234 149 1231 153 1231 526 1346 526 1349 524 1350 500 1349 150ZM782 149 781 458 817 459 818 492 850 493 850 526 1109 526 1109 494 1141 492 1141 460 1177 458 1177 149 1059 149 1058 414 901 414 900 150ZM1231 1 1233 108 1349 109 1349 1Z`},null,-1)]],2))}}),BrandLogo_default=_plugin_vue_export_helper_default(BrandLogo_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-0397f988`]]),seed=e=>makeDust(70*Math.min(Math.max(e.w*e.h/921600,.3),1.6)*e.theme.dustDensity,e.w,e.h),backdropScene={init(e){return{dust:seed(e),w:e.w,h:e.h}},draw(e,t){(e.w!==t.w||e.h!==t.h)&&(t.dust=seed(e),t.w=e.w,t.h=e.h),drawDust(e,t.dust)}},FxBackdrop_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxBackdrop`,setup(e){let t=ref(null),n=null;return onMounted(()=>{t.value&&(n=mountScene(t.value,backdropScene,()=>({})))}),onBeforeUnmount(()=>n?.destroy()),(e,n)=>(openBlock(),createElementBlock(`canvas`,{ref_key:`canvas`,ref:t,class:`fx-backdrop`,"aria-hidden":`true`},null,512))}}),FxBackdrop_default=_plugin_vue_export_helper_default(FxBackdrop_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-b3f1f5c8`]]),N$1=18,RELEASE_S=3.4,FALL_S=.9,FLIP_AT=4.9,FLIP_S=.8,PERIOD=5.8,ease$4=e=>1-(1-clamp01(e))**3,easeIn=e=>clamp01(e)*clamp01(e),OUTLINE=[[-.8,-1],[.8,-1],[.06,0],[.8,1],[-.8,1],[-.06,0]],hourglassScene={init(){return null},draw(e){let{w:t,h:n,theme:r,reduced:a}=e,o=Math.min(t*.5,n*.5)*.92,s=t/2,c=n/2,l=a?0:e.t%PERIOD,u=a?0:Math.PI*ease$4((l-FLIP_AT)/FLIP_S),d=Math.cos(u),f=Math.sin(u),m=(e,t)=>[s+(e*d-t*f)*o,c+(e*f+t*d)*o],g=OUTLINE.map(([e,t])=>m(e,t));for(let t=0;t<g.length;t++){let n=g[t],r=g[(t+1)%g.length];line(e,n[0],n[1],r[0],r[1],2.5,1)}for(let t of g)dot(e,t[0],t[1],1.6,.7);let _=hourglassSlots(N$1),v=Math.max(o*.07,1.2);for(let t=0;t<N$1;t++){let n=_[t],o=_[17-t],s,c;if(a){let e=t<N$1/2;s=e?n.x:-o.x,c=e?n.y:-o.y}else{let e=(l-t/17*RELEASE_S)/FALL_S;if(e<=0)s=-o.x,c=-o.y;else if(e>=1)s=n.x,c=n.y;else if(e<.3){let t=easeIn(e/.3);s=-o.x*(1-t),c=-o.y*(1-t)}else{let t=easeIn((e-.3)/.7);s=n.x*t,c=n.y*t}}let[u,d]=m(s,c);glow(e,u,d,v*3,.5,r.dot),dot(e,u,d,v,.95)}}},FxHourglass_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxHourglass`,setup(e){let t=ref(null),n=null;return onMounted(()=>{t.value&&(n=mountScene(t.value,hourglassScene,()=>({})))}),onBeforeUnmount(()=>n?.destroy()),(e,n)=>(openBlock(),createElementBlock(`canvas`,{ref_key:`canvas`,ref:t,class:`fx-hourglass`,"aria-hidden":`true`},null,512))}}),FxHourglass_default=_plugin_vue_export_helper_default(FxHourglass_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-faf42b14`]]),LAND_DIST=2,APPROACH_RATE=3.2,RIPPLE_S=1.1,LINK_FADE_S=.8,LEAVE_S=.8,APPEAR_S=.6,LABEL_RATE=4,rand$2=(e,t)=>e+Math.random()*(t-e),ease$3=e=>1-(1-clamp01(e))**3,scaleOf=e=>Math.min(Math.max(Math.min(e.w,e.h)/370,.8),2.6);function freeSlot(e){let t=new Set;for(let n of e.values())n.leaving===null&&t.add(n.slot);let n=0;for(;t.has(n);)n++;return n}function unitFor(e,t,n){let r=0;for(let e of t.values())r=Math.max(r,e.slot+1);return spiralUnit(Math.max(r,1),e.w,e.h,n)}function target(e,t,n){return spiralSlot(t.slot,e.w/2,e.h/2,n)}function addDot(e,t,n,r){let a=freeSlot(t.dots),o={id:n.id,pseudo:n.pseudo,slot:a,seq:t.seq++,x:0,y:0,link:null,born:e.t,landed:null,leaving:null,label:0};t.dots.set(n.id,o);let s=unitFor(e,t.dots,t.spread),c=target(e,o,s),l=1/0;for(let n of t.dots.values()){if(n===o||n.leaving!==null)continue;let t=target(e,n,s),r=(t.x-c.x)**2+(t.y-c.y)**2;r<l&&(l=r,o.link=n.id)}if(r&&!e.reduced){let t=rand$2(0,Math.PI*2),n=Math.max(e.w,e.h)*.7;o.x=e.w/2+Math.cos(t)*n,o.y=e.h/2+Math.sin(t)*n}else o.x=c.x,o.y=c.y,o.landed=r?e.t:e.t-RIPPLE_S}var lobbyScene={init(e,t){let n={dots:new Map,seq:0,spread:t.spread};for(let r of t.players)addDot(e,n,r,r.id===t.highlightId);return n},draw(e,t,n){let{ctx:r,theme:a,t:o,dt:s}=e,c=new Set;for(let r of n.players){c.add(r.id);let n=t.dots.get(r.id);n?(n.pseudo=r.pseudo,n.leaving!==null&&(n.leaving=null)):addDot(e,t,r,!0)}for(let e of t.dots.values())!c.has(e.id)&&e.leaving===null&&(e.leaving=o),e.leaving!==null&&o-e.leaving>LEAVE_S&&t.dots.delete(e.id);let l=scaleOf(e);t.spread=n.spread;let u=unitFor(e,t.dots,t.spread),d=Math.round(Math.min(Math.max(e.h*.024,11),28)),f=[...t.dots.values()].filter(e=>e.leaving===null).sort((e,t)=>t.seq-e.seq),m=f[0],g=new Set(f.slice(0,Math.max(n.labels,0)).map(e=>e.id)),_=t=>{let n=t.leaving===null?1:1-(o-t.leaving)/LEAVE_S,r=e.reduced?(o-t.born)/APPEAR_S:1;return clamp01(n)*clamp01(r)},v=1-Math.exp(-s*APPROACH_RATE),y=new Map;for(let n of t.dots.values()){let t=target(e,n,u),r=e.reduced?t.x:t.x+Math.sin(o*.7+n.slot)*1.5,a=e.reduced?t.y:t.y+Math.cos(o*.6+n.slot*1.3)*1.5;y.set(n.id,{x:n.x,y:n.y}),e.reduced?(n.x=r,n.y=a):(n.x+=(r-n.x)*v,n.y+=(a-n.y)*v),n.landed===null&&Math.hypot(r-n.x,a-n.y)<LAND_DIST&&(n.landed=o)}for(let n of t.dots.values()){if(!n.link||n.landed===null)continue;let r=t.dots.get(n.link);if(!r||r.landed===null)continue;let a=ease$3((o-n.landed)/LINK_FADE_S)*Math.min(_(n),_(r));line(e,n.x,n.y,r.x,r.y,a,.6*l)}r.textAlign=`center`,r.textBaseline=`top`,r.font=`${d}px ${a.fontLabel}`;for(let c of t.dots.values()){let t=_(c);if(t<=0)continue;let f=c.id===n.highlightId,v=f?a.accent:a.dot;if(c.landed===null){let n=y.get(c.id),a=c.x-n.x,o=c.y-n.y,s=Math.hypot(a,o)||1,d=target(e,c,u),f=Math.min(Math.hypot(d.x-c.x,d.y-c.y)*.25,60*l),m=c.x-a/s*f,g=c.y-o/s*f,_=r.createLinearGradient(c.x,c.y,m,g);_.addColorStop(0,v),_.addColorStop(1,`transparent`),r.globalAlpha=.6*t,r.strokeStyle=_,r.lineWidth=1.2*l,r.beginPath(),r.moveTo(c.x,c.y),r.lineTo(m,g),r.stroke(),r.globalAlpha=1}else if(!e.reduced){let e=(o-c.landed)/RIPPLE_S;e<1&&(r.globalAlpha=clamp01((1-e)*.5*t),r.strokeStyle=v,r.lineWidth=l,r.beginPath(),r.arc(c.x,c.y,(4+ease$3(e)*26)*l,0,Math.PI*2),r.stroke(),r.globalAlpha=1)}f?(glow(e,c.x,c.y,36*l,t,v),glow(e,c.x,c.y,14*l,t,v)):c===m&&c.landed!==null&&glow(e,c.x,c.y,18*l,t,v),dot(e,c.x,c.y,(f?3.8:c===m?2.8:2.1)*l,t,v);let b=c.landed!==null&&c.pseudo&&g.has(c.id)?c===m?.95:.4:0;c.label+=(b-c.label)*(1-Math.exp(-s*LABEL_RATE)),c.pseudo&&c.label>.01&&(r.globalAlpha=clamp01(c.label*t),r.fillStyle=f?a.accent:a.text,r.fillText(c.pseudo,c.x,c.y+5*l+d*.3),r.globalAlpha=1)}}},_hoisted_1$13={class:`fx-lobby`},FxLobby_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxLobby`,props:{players:{},highlightId:{},labels:{default:8},spread:{}},setup(e){let t=e,n=ref(null),r=null;return onMounted(()=>{n.value&&(r=mountScene(n.value,lobbyScene,()=>({players:t.players,highlightId:t.highlightId,labels:t.labels,spread:t.spread})))}),onBeforeUnmount(()=>r?.destroy()),(e,t)=>(openBlock(),createElementBlock(`div`,_hoisted_1$13,[createBaseVNode(`canvas`,{ref_key:`canvas`,ref:n,class:`fx-lobby__canvas`,"aria-hidden":`true`},null,512)]))}}),FxLobby_default=_plugin_vue_export_helper_default(FxLobby_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-b52d79da`]]),FIREWORK_GAP=[.8,1.6],MAX_SPARKS=250,RING_DURATION=1.4,rand$1=(e,t)=>e+Math.random()*(t-e),ease$2=e=>1-(1-clamp01(e))**3,liveSparks=e=>e.reduce((e,t)=>e+t.sparks.length,0);function fireBurst(e,t,n,r,a,o,s){let c=Math.min(Math.round(s),250-liveSparks(t));if(c<=0)return;let l=Array.from({length:c},()=>{let t=rand$1(0,Math.PI*2),o=rand$1(60,200)*Math.max(e.h/1080,.5)*1.6*a;return{x:n,y:r,vx:Math.cos(t)*o,vy:Math.sin(t)*o-40*a,a:1}});t.push({x:n,y:r,at:e.t,scale:a,color:o,sparks:l})}function drawBursts(e,t,n){let{t:r,dt:a,h:o}=e;for(let s of t){let t=(r-s.at)/RING_DURATION;if(t<1){let n=ease$2(t)*o*(s.scale<1?.28:.4)*s.scale,r=48;for(let r=0;r<48;r++){let a=r/48*Math.PI*2,o=(r+1)/48*Math.PI*2;line(e,s.x+Math.cos(a)*n,s.y+Math.sin(a)*n,s.x+Math.cos(o)*n,s.y+Math.sin(o)*n,2.5*(1-t),1.5,s.color)}}for(let t of s.sparks)t.x+=t.vx*a,t.y+=t.vy*a,t.vx*=.97,t.vy=t.vy*.97+30*a,t.a-=a*.4,t.a>0&&dot(e,t.x,t.y,n*.9*Math.max(s.scale,.7),t.a,s.color);s.sparks=s.sparks.filter(e=>e.a>0)}return t.filter(e=>e.sparks.length>0||r-e.at<RING_DURATION)}var FIRST_AT=.4,fireworksScene={init(){return{bursts:[],fired:!1,nextAt:0}},draw(e,t,n){let{w:r,h:a,t:o,theme:s,reduced:c}=e;if(c)return;let l=Math.max(Math.min(a*.04,r*.045)*.16,1.8);if(!t.fired&&o>=.4&&(fireBurst(e,t.bursts,r*.5,a*.22,1,s.accent,70),t.fired=!0,t.nextAt=o+rand$1(...FIREWORK_GAP)),t.fired&&o>=t.nextAt&&o<n.duration){let n=rand$1(.45,.85),c=Math.random()<.25?s.accent:s.dot;fireBurst(e,t.bursts,rand$1(r*.15,r*.85),rand$1(a*.1,a*.4),n,c,70*n*.8),t.nextAt=o+rand$1(...FIREWORK_GAP)}t.bursts=drawBursts(e,t.bursts,l)}},FxFireworks_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxFireworks`,props:{duration:{default:10}},setup(e){let t=e,n=ref(null),r=null;return onMounted(()=>{n.value&&(r=mountScene(n.value,fireworksScene,()=>({duration:t.duration})))}),onBeforeUnmount(()=>r?.destroy()),(e,t)=>(openBlock(),createElementBlock(`canvas`,{ref_key:`canvas`,ref:n,class:`fx-fireworks`,"aria-hidden":`true`},null,512))}}),FxFireworks_default=_plugin_vue_export_helper_default(FxFireworks_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-c367274d`]]);function ordinalFr(e){return e===1?`1er`:`${e}e`}var FORM_AT=[5,3.3,1.6],LABEL_DELAY=.9,BURST_DELAY=1.2,COLS=5,BASE_Y=.74,ease$1=e=>1-(1-clamp01(e))**3,spacingOf=(e,t)=>Math.min(t*.04,e*.045);function swarmDot(e,t,n,r){return{rank:t,k:n,x:rand$1(0,e.w),y:rand$1(0,e.h),vx:rand$1(-12,12),vy:rand$1(-12,12),r}}var podiumScene={init(e,t){let n=podiumDots(t.scores),r=[];return n.forEach((t,n)=>{for(let a=0;a<t;a++)r.push(swarmDot(e,n,a,rand$1(1.1,1.9)))}),{dots:r,counts:n,me:t.outsideRank===null?null:swarmDot(e,-1,0,3),bursts:[],fired:!1,nextAt:0,shown:[]}},draw(e,t,n){let{w:r,h:a,t:o,dt:s,theme:c,reduced:l}=e,u=spacingOf(r,a),d=a*BASE_Y,f=e=>d-Math.ceil((t.counts[e]??0)/COLS)*u,m=e=>r*PODIUM_SLOTS[e],g=e=>l?0:FORM_AT[e],_=l?clamp01(o/.6):1,v=Math.max(u*.16,1.8),y=t.counts.length>0;y&&o>g(0)+1.2&&glow(e,m(0),(f(0)+d)/2,a*.35,(.2+.08*Math.sin(o*2))*_,c.accent);for(let f of t.dots){let t=g(f.rank)+f.k*.015,y=f.rank===0?1:.8;if(o<t){l||(f.x=(f.x+f.vx*s+r)%r,f.y=(f.y+f.vy*s+a)%a,dot(e,f.x,f.y,f.r*.7,.35));continue}let b=m(f.rank)+(f.k%COLS-2)*u,x=d-Math.floor(f.k/COLS)*u;if(l)f.x=b,f.y=x;else{let e=1-Math.exp(-4.5*s);f.x+=(b-f.x)*e,f.y+=(x-f.y)*e}dot(e,f.x,f.y,v,y*_,n.highlight===f.rank?c.accent:void 0)}if(t.me&&(l?(t.me.x=r*.5,t.me.y=a*.3):(t.me.x=(t.me.x+t.me.vx*s+r)%r,t.me.y=(t.me.y+t.me.vy*s+a)%a),glow(e,t.me.x,t.me.y,u*1.8,.5*_,c.accent),dot(e,t.me.x,t.me.y,Math.max(v*1.5,3),_,c.accent)),y&&!l){let n=(n,r,a,o,s)=>fireBurst(e,t.bursts,n,r,a,o,s);if(!t.fired&&o>g(0)+1.2&&(n(m(0),f(0)-a*.02,1,c.accent,70),t.fired=!0,t.nextAt=o+rand$1(...FIREWORK_GAP)),t.fired&&o>=t.nextAt){let e=Math.min(f(0),f(1),f(2))-a*.08,s=rand$1(.45,.85),l=Math.random()<.25?c.accent:c.dot;n(rand$1(r*.15,r*.85),rand$1(a*.2,Math.max(a*.22,e)),s,l,70*s*.8),t.nextAt=o+rand$1(...FIREWORK_GAP)}t.bursts=drawBursts(e,t.bursts,v)}e.ctx.fillStyle=c.muted;for(let n=0;n<t.counts.length;n++){let t=l?_:ease$1((o-g(n)-LABEL_DELAY)/.6);t<=0||(e.ctx.globalAlpha=t,spacedText(e,`0${n+1}`,m(n),f(n)-Math.max(a*.03,8),Math.max(a*.026,10)),e.ctx.globalAlpha=1)}let b=[0,1,2].map(e=>e<t.counts.length&&o>=g(e)+.9);b.push(t.me!==null),(b.length!==t.shown.length||b.some((e,n)=>e!==t.shown[n]))&&(t.shown=b,n.onShown?.(b))}},_hoisted_1$12=[`aria-label`],_hoisted_2$12={class:`fx-podium__name`},_hoisted_3$8={class:`fx-podium__score`},FxPodium_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxPodium`,props:{podium:{},highlightId:{}},setup(e){let t=e,n=ref(null),r=ref([]),a=null,o=computed(()=>t.podium.slice(0,3)),s=computed(()=>{let e=o.value.findIndex(e=>e.playerId===t.highlightId);return e>=0?e:null}),c=computed(()=>!t.highlightId||s.value!==null?null:t.podium.find(e=>e.playerId===t.highlightId)?.rank??null),l=computed(()=>o.value.map(e=>`${e.rank}. ${e.pseudo} ${e.score}`).join(`, `));return onMounted(()=>{n.value&&(a=mountScene(n.value,podiumScene,()=>({scores:o.value.map(e=>e.score),highlight:s.value,outsideRank:c.value,onShown:e=>{r.value=e}})))}),watch(()=>t.podium.map(e=>`${e.playerId}:${e.score}`).join(`|`),()=>a?.restart()),onBeforeUnmount(()=>a?.destroy()),(t,a)=>(openBlock(),createElementBlock(`div`,{class:`fx-podium`,role:`img`,"aria-label":l.value},[createBaseVNode(`canvas`,{ref_key:`canvas`,ref:n,class:`fx-podium__canvas`,"aria-hidden":`true`},null,512),(openBlock(!0),createElementBlock(Fragment,null,renderList(o.value,(t,n)=>(openBlock(),createElementBlock(`div`,{key:t.playerId,class:normalizeClass([`fx-podium__label`,{"fx-podium__label--on":r.value[n],"fx-podium__label--me":t.playerId===e.highlightId,"fx-podium__label--first":n===0}]),style:normalizeStyle({left:`${unref(PODIUM_SLOTS)[n]*100}%`})},[createBaseVNode(`span`,_hoisted_2$12,toDisplayString(t.pseudo),1),createBaseVNode(`span`,_hoisted_3$8,toDisplayString(t.score.toLocaleString())+` pts`,1)],6))),128)),c.value===null?createCommentVNode(``,!0):(openBlock(),createElementBlock(`p`,{key:0,class:normalizeClass([`fx-podium__outside`,{"fx-podium__outside--on":r.value[3]}])},toDisplayString(unref(ordinalFr)(c.value))+` / `+toDisplayString(e.podium.length),3))],8,_hoisted_1$12))}}),FxPodium_default=_plugin_vue_export_helper_default(FxPodium_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-d5e3b296`]]),N=13,DURATION=1.1,MAX_DELAY=.35,HOLD=1.2,FADE=.5,OK_FORMED=1.4500000000000002,OK_PERIOD=3.45,KO_RISE=1,KO_BREAK=1.8,KO_PERIOD=3.6000000000000005,ease=e=>1-(1-clamp01(e))**3,rand=(e,t)=>e+Math.random()*(t-e);function newMotes(){return Array.from({length:N},(e,t)=>({ang:t/N*Math.PI*2+Math.random()*.6,dist:.55+Math.random()*.5,delay:Math.random()*MAX_DELAY,x:0,y:0,vx:0,vy:0,rest:!1,sx:0,sy:0}))}var verdictScene={init(e,t){let n=newMotes();if(!t.correct){let t=2.2,r=Math.min(e.w,e.h*1.5)*.5*.7*1.4-t;n.forEach((n,a)=>{n.x=e.w/2+((a+.5)/N-.5)*2*r*.9,n.y=e.h-t-2-a%2*t*1.8,n.sx=n.x,n.sy=n.y,n.rest=!0})}return{motes:n,cycle:0,broken:!1,piles:new Map}},draw(e,t,n){let{theme:r,reduced:a,dt:o}=e,s=n.correct?OK_PERIOD:KO_PERIOD,c=a?0:Math.floor(e.t/s);if(c!==t.cycle){if(n.correct)t.motes=newMotes();else for(let e of t.motes)e.sx=e.x,e.sy=e.y,e.rest=!1;t.cycle=c,t.broken=!1,t.piles.clear()}let l=a?e.t:e.t-c*s,u=e.w/2,d=Math.min(e.w,e.h*1.5)*.5,f=n.correct?r.ok:r.ko,m=clamp01(e.t/.6),g=(t,n)=>{let r=d*t.dist*1.3;return{x:u+Math.cos(t.ang)*r,y:n+Math.sin(t.ang)*r*Math.min(1,e.h*.42/(d*1.4))}},_=(t,n,r,a,o)=>{for(let[s,c]of verdictLinks(t,N))line(e,n[s],r[s],n[c],r[c],Math.min(a[s],a[c])*o,1,f)};if(n.correct){let n=e.h/2,r=checkPoints(N,u,n,d),o=a?1:1-clamp01((l-OK_FORMED-HOLD)/FADE),s=a?m:ease(l/DURATION);glow(e,u,n,d*(a?.9:.6+.4*s),.35*s*o,f);let c=[],v=[],y=[];for(let e=0;e<N;e++){let s=t.motes[e],u=a?1:ease((l-s.delay)/DURATION),d=g(s,n);c.push(d.x+(r[e].x-d.x)*u),v.push(d.y+(r[e].y-d.y)*u),y.push(a?m:(.25+.75*u)*o)}_(`check`,c,v,y.map((e,n)=>a?e:e*ease((l-t.motes[n].delay)/DURATION)**2),4);for(let t=0;t<N;t++)glow(e,c[t],v[t],9,y[t]*.8,f),dot(e,c[t],v[t],2.4,y[t],f);return}let v=2.2,y=d*.7,b=e.h*.4,x=e.h-v-2,S=crossPoints(N,u,b,y);if(a){let t=S.map(e=>e.x),n=S.map(e=>e.y);_(`cross`,t,n,t.map(()=>m*.9),4);for(let r=0;r<N;r++)glow(e,t[r],n[r],8,m*.7,f),dot(e,t[r],n[r],v,m*.9,f);return}if(l<KO_BREAK){let n=l>1.6?.8:0,r=t.cycle===0?clamp01(e.t/.4):1,a=[],o=[],s=[],c=[];for(let e=0;e<N;e++){let u=t.motes[e],d=ease((l-u.delay)/KO_RISE);u.x=u.sx+(S[e].x-u.sx)*d,u.y=u.sy+(S[e].y-u.sy)*d,a.push(u.x+rand(-n,n)),o.push(u.y+rand(-n,n)),s.push((.65+.25*d)*r),c.push(d*d*r)}_(`cross`,a,o,c,4);for(let t=0;t<N;t++)glow(e,a[t],o[t],8,s[t]*.7*c[t],f),dot(e,a[t],o[t],v,s[t],f);return}let C=Math.max(e.h,60)*9;t.broken||=(t.motes.forEach((t,n)=>{let r=S[n];t.x=r.x,t.y=r.y,t.vx=(r.x-u)*rand(1,2.6)+rand(-20,20),t.vy=rand(-e.h*.9,-e.h*.1),t.rest=!1}),!0);let w=v*2.2,T=y*1.4-v;for(let n of t.motes){if(!n.rest){n.vy+=C*o,n.x=Math.min(Math.max(n.x+n.vx*o,u-T),u+T),n.y+=n.vy*o,n.vx*=1-1.5*o;let r=Math.round((n.x-u)/w),a=t.piles.get(r)??0,s=x-a*v*1.8;n.y>=s&&(n.y=s,Math.abs(n.vy)<e.h*.6?(n.x=u+(r+a%2*.5)*w,n.vy=0,n.rest=!0,t.piles.set(r,a+1)):(n.vy=-n.vy*.3,n.vx*=.5))}dot(e,n.x,n.y,v,n.rest?.65:.85,f)}}},FxVerdict_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`FxVerdict`,props:{correct:{type:Boolean},delta:{},answered:{type:Boolean}},setup(e){let t=e,n=ref(null),r=null;return onMounted(()=>{n.value&&(r=mountScene(n.value,verdictScene,()=>({correct:t.correct,delta:t.delta,answered:t.answered})))}),watch(()=>t.correct,()=>r?.restart()),onBeforeUnmount(()=>r?.destroy()),(e,t)=>(openBlock(),createElementBlock(`canvas`,{ref_key:`canvas`,ref:n,class:`fx-verdict`,"aria-hidden":`true`},null,512))}}),FxVerdict_default=_plugin_vue_export_helper_default(FxVerdict_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-0e882c37`]]),_hoisted_1$11=[`disabled`],_hoisted_2$11={class:`hq-btn__badge`},_hoisted_3$7={class:`hq-btn__text`},AnswerButton_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`AnswerButton`,props:{id:{},text:{},state:{},colorId:{}},emits:[`select`],setup(e,{emit:t}){let n=t;return(t,r)=>(openBlock(),createElementBlock(`button`,{class:normalizeClass([`hq-btn`,`hq-btn--${e.colorId}`,`hq-btn--${e.state}`]),disabled:e.state!==`idle`&&e.state!==`selected`,onClick:r[0]||=t=>n(`select`,e.id)},[createBaseVNode(`span`,_hoisted_2$11,toDisplayString(e.id.toUpperCase()),1),createBaseVNode(`span`,_hoisted_3$7,toDisplayString(e.text),1)],10,_hoisted_1$11))}}),AnswerButton_default=_plugin_vue_export_helper_default(AnswerButton_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-ce737272`]]),_hoisted_1$10={class:`hq-podium`},_hoisted_2$10={class:`hq-podium__rank`},_hoisted_3$6={class:`hq-podium__name`},_hoisted_4$5={class:`hq-podium__score`},Podium_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`Podium`,props:{podium:{}},setup(e){function t(e){return e===1?`🥇`:e===2?`🥈`:e===3?`🥉`:`#${e}`}function n(e){return e<=3?`hq-podium__row--top${e}`:``}return(r,a)=>(openBlock(),createElementBlock(`ol`,_hoisted_1$10,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.podium,e=>(openBlock(),createElementBlock(`li`,{key:e.rank,class:normalizeClass([`hq-podium__row`,n(e.rank)])},[createBaseVNode(`span`,_hoisted_2$10,toDisplayString(t(e.rank)),1),createBaseVNode(`span`,_hoisted_3$6,toDisplayString(e.pseudo),1),createBaseVNode(`span`,_hoisted_4$5,toDisplayString(e.score.toLocaleString())+` pts`,1)],2))),128))]))}}),Podium_default=_plugin_vue_export_helper_default(Podium_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-8d79b015`]]),require_can_promise=__commonJSMin(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),require_utils$2=__commonJSMin((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),require_error_correction_level=__commonJSMin((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),require_bit_buffer=__commonJSMin(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),require_bit_matrix=__commonJSMin(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let a=e*this.size+t;this.data[a]=n,r&&(this.reservedBit[a]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),require_alignment_pattern=__commonJSMin((e=>{var t=require_utils$2().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),a=r===145?26:Math.ceil((r-13)/(2*n-2))*2,o=[r-7];for(let e=1;e<n-1;e++)o[e]=o[e-1]-a;return o.push(6),o.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),a=r.length;for(let e=0;e<a;e++)for(let t=0;t<a;t++)e===0&&t===0||e===0&&t===a-1||e===a-1&&t===0||n.push([r[e],r[t]]);return n}})),require_finder_pattern=__commonJSMin((e=>{var t=require_utils$2().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),require_mask_pattern=__commonJSMin((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,a=0,o=0,s=null,c=null;for(let l=0;l<n;l++){a=o=0,s=c=null;for(let u=0;u<n;u++){let n=e.get(l,u);n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1),n=e.get(u,l),n===c?o++:(o>=5&&(r+=t.N1+(o-5)),c=n,o=1)}a>=5&&(r+=t.N1+(a-5)),o>=5&&(r+=t.N1+(o-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let a=0;a<n-1;a++){let n=e.get(t,a)+e.get(t,a+1)+e.get(t+1,a)+e.get(t+1,a+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,a=0,o=0;for(let t=0;t<n;t++){a=o=0;for(let s=0;s<n;s++)a=a<<1&2047|e.get(t,s),s>=10&&(a===1488||a===93)&&r++,o=o<<1&2047|e.get(s,t),s>=10&&(o===1488||o===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let a=0;a<r;a++)for(let o=0;o<r;o++)t.isReserved(o,a)||t.xor(o,a,n(e,o,a))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,a=0,o=1/0;for(let s=0;s<r;s++){n(s),e.applyMask(s,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),r<o&&(o=r,a=s)}return a}})),require_error_correction_code=__commonJSMin((e=>{var t=require_error_correction_level(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),require_galois_field=__commonJSMin((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),require_polynomial=__commonJSMin((e=>{var t=require_galois_field();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let a=0;a<e.length;a++)for(let o=0;o<n.length;o++)r[a+o]^=t.mul(e[a],n[o]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let a=0;a<n.length;a++)r[a]^=t.mul(n[a],e);let a=0;for(;a<r.length&&r[a]===0;)a++;r=r.slice(a)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let a=0;a<n;a++)r=e.mul(r,new Uint8Array([1,t.exp(a)]));return r}})),require_reed_solomon_encoder=__commonJSMin(((e,t)=>{var n=require_polynomial();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),a=this.degree-r.length;if(a>0){let e=new Uint8Array(this.degree);return e.set(r,a),e}return r},t.exports=r})),require_version_check=__commonJSMin((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),require_regex=__commonJSMin((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var a=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
3
3
|
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(a,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var o=RegExp(`^`+r+`$`),s=RegExp(`^[0-9]+$`),c=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return o.test(e)},e.testNumeric=function(e){return s.test(e)},e.testAlphanumeric=function(e){return c.test(e)}})),require_mode=__commonJSMin((e=>{var t=require_version_check(),n=require_regex();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),require_version=__commonJSMin((e=>{var t=require_utils$2(),n=require_error_correction_code(),r=require_error_correction_level(),a=require_mode(),o=require_version_check(),s=7973,c=t.getBCHDigit(s);function l(t,n,r){for(let a=1;a<=40;a++)if(n<=e.getCapacity(a,r,t))return a}function u(e,t){return a.getCharCountIndicator(e,t)+4}function d(e,t){let n=0;return e.forEach(function(e){let r=u(e.mode,t);n+=r+e.getBitsLength()}),n}function f(t,n){for(let r=1;r<=40;r++)if(d(t,r)<=e.getCapacity(r,n,a.MIXED))return r}e.from=function(e,t){return o.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,s){if(!o.isValid(e))throw Error(`Invalid QR Code version`);s===void 0&&(s=a.BYTE);let c=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(s===a.MIXED)return c;let l=c-u(s,e);switch(s){case a.NUMERIC:return Math.floor(l/10*3);case a.ALPHANUMERIC:return Math.floor(l/11*2);case a.KANJI:return Math.floor(l/13);case a.BYTE:default:return Math.floor(l/8)}},e.getBestVersionForData=function(e,t){let n,a=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return f(e,a);if(e.length===0)return 1;n=e[0]}else n=e;return l(n.mode,n.getLength(),a)},e.getEncodedBits=function(e){if(!o.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-c>=0;)n^=s<<t.getBCHDigit(n)-c;return e<<12|n}})),require_format_info=__commonJSMin((e=>{var t=require_utils$2(),n=1335,r=21522,a=t.getBCHDigit(n);e.getEncodedBits=function(e,o){let s=e.bit<<3|o,c=s<<10;for(;t.getBCHDigit(c)-a>=0;)c^=n<<t.getBCHDigit(c)-a;return(s<<10|c)^r}})),require_numeric_data=__commonJSMin(((e,t)=>{var n=require_mode();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let a=this.data.length-t;a>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,a*3+1))},t.exports=r})),require_alphanumeric_data=__commonJSMin(((e,t)=>{var n=require_mode(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function a(e){this.mode=n.ALPHANUMERIC,this.data=e}a.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t=0;for(;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=a})),require_byte_data=__commonJSMin(((e,t)=>{var n=require_mode();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),require_kanji_data=__commonJSMin(((e,t)=>{var n=require_mode(),r=require_utils$2();function a(e){this.mode=n.KANJI,this.data=e}a.getBitsLength=function(e){return e*13},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t=0;for(;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
4
4
|
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=a})),require_dijkstra=__commonJSMin(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var a={},o={};o[t]=0;var s=n.PriorityQueue.make();s.push(t,0);for(var c,l,u,d,f,m,g,_,v;!s.empty();)for(u in c=s.pop(),l=c.value,d=c.cost,f=e[l]||{},f)f.hasOwnProperty(u)&&(m=f[u],g=d+m,_=o[u],v=o[u]===void 0,(v||_>g)&&(o[u]=g,s.push(u,g),a[u]=l));if(r!==void 0&&o[r]===void 0){var y=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(y)}return a},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var a=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(a,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},a;for(a in e||={},t)t.hasOwnProperty(a)&&(r[a]=t[a]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),require_segments=__commonJSMin((e=>{var t=require_mode(),n=require_numeric_data(),r=require_alphanumeric_data(),a=require_byte_data(),o=require_kanji_data(),s=require_regex(),c=require_utils$2(),l=require_dijkstra();function u(e){return unescape(encodeURIComponent(e)).length}function d(e,t,n){let r=[],a;for(;(a=e.exec(n))!==null;)r.push({data:a[0],index:a.index,mode:t,length:a[0].length});return r}function f(e){let n=d(s.NUMERIC,t.NUMERIC,e),r=d(s.ALPHANUMERIC,t.ALPHANUMERIC,e),a,o;return c.isKanjiModeEnabled()?(a=d(s.BYTE,t.BYTE,e),o=d(s.KANJI,t.KANJI,e)):(a=d(s.BYTE_KANJI,t.BYTE,e),o=[]),n.concat(r,a,o).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function m(e,s){switch(s){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return o.getBitsLength(e);case t.BYTE:return a.getBitsLength(e)}}function g(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function _(e){let n=[];for(let r=0;r<e.length;r++){let a=e[r];switch(a.mode){case t.NUMERIC:n.push([a,{data:a.data,mode:t.ALPHANUMERIC,length:a.length},{data:a.data,mode:t.BYTE,length:a.length}]);break;case t.ALPHANUMERIC:n.push([a,{data:a.data,mode:t.BYTE,length:a.length}]);break;case t.KANJI:n.push([a,{data:a.data,mode:t.BYTE,length:u(a.data)}]);break;case t.BYTE:n.push([{data:a.data,mode:t.BYTE,length:u(a.data)}])}}return n}function v(e,n){let r={},a={start:{}},o=[`start`];for(let s=0;s<e.length;s++){let c=e[s],l=[];for(let e=0;e<c.length;e++){let u=c[e],d=``+s+e;l.push(d),r[d]={node:u,lastCount:0},a[d]={};for(let e=0;e<o.length;e++){let s=o[e];r[s]&&r[s].node.mode===u.mode?(a[s][d]=m(r[s].lastCount+u.length,u.mode)-m(r[s].lastCount,u.mode),r[s].lastCount+=u.length):(r[s]&&(r[s].lastCount=u.length),a[s][d]=m(u.length,u.mode)+4+t.getCharCountIndicator(u.mode,n))}}o=l}for(let e=0;e<o.length;e++)a[o[e]].end=0;return{map:a,table:r}}function y(e,s){let l,u=t.getBestModeForData(e);if(l=t.from(s,u),l!==t.BYTE&&l.bit<u.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(l)+`.
|
|
5
5
|
Suggested mode is: `+t.toString(u));switch(l===t.KANJI&&!c.isKanjiModeEnabled()&&(l=t.BYTE),l){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new o(e);case t.BYTE:return new a(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(y(t,null)):t.data&&e.push(y(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=v(_(f(t,c.isKanjiModeEnabled())),n),a=l.find_path(r.map,`start`,`end`),o=[];for(let e=1;e<a.length-1;e++)o.push(r.table[a[e]].node);return e.fromArray(g(o))},e.rawSplit=function(t){return e.fromArray(f(t,c.isKanjiModeEnabled()))}})),require_qrcode=__commonJSMin((e=>{var t=require_utils$2(),n=require_error_correction_level(),r=require_bit_buffer(),a=require_bit_matrix(),o=require_alignment_pattern(),s=require_finder_pattern(),c=require_mask_pattern(),l=require_error_correction_code(),u=require_reed_solomon_encoder(),d=require_version(),f=require_format_info(),m=require_mode(),g=require_segments();function _(e,t){let n=e.size,r=s.getPositions(t);for(let t=0;t<r.length;t++){let a=r[t][0],o=r[t][1];for(let t=-1;t<=7;t++)if(!(a+t<=-1||n<=a+t))for(let r=-1;r<=7;r++)o+r<=-1||n<=o+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(a+t,o+r,!0,!0):e.set(a+t,o+r,!1,!0))}}function v(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function y(e,t){let n=o.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],a=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,a+n,!0,!0):e.set(r+t,a+n,!1,!0)}}function b(e,t){let n=e.size,r=d.getEncodedBits(t),a,o,s;for(let t=0;t<18;t++)a=Math.floor(t/3),o=t%3+n-8-3,s=(r>>t&1)==1,e.set(a,o,s,!0),e.set(o,a,s,!0)}function x(e,t,n){let r=e.size,a=f.getEncodedBits(t,n),o,s;for(o=0;o<15;o++)s=(a>>o&1)==1,o<6?e.set(o,8,s,!0):o<8?e.set(o+1,8,s,!0):e.set(r-15+o,8,s,!0),o<8?e.set(8,r-o-1,s,!0):o<9?e.set(8,15-o-1+1,s,!0):e.set(8,15-o-1,s,!0);e.set(r-8,8,1,!0)}function S(e,t){let n=e.size,r=-1,a=n-1,o=7,s=0;for(let c=n-1;c>0;c-=2)for(c===6&&c--;;){for(let n=0;n<2;n++)if(!e.isReserved(a,c-n)){let r=!1;s<t.length&&(r=(t[s]>>>o&1)==1),e.set(a,c-n,r),o--,o===-1&&(s++,o=7)}if(a+=r,a<0||n<=a){a-=r,r=-r;break}}}function C(e,n,a){let o=new r;a.forEach(function(t){o.put(t.mode.bit,4),o.put(t.getLength(),m.getCharCountIndicator(t.mode,e)),t.write(o)});let s=(t.getSymbolTotalCodewords(e)-l.getTotalCodewordsCount(e,n))*8;for(o.getLengthInBits()+4<=s&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(0);let c=(s-o.getLengthInBits())/8;for(let e=0;e<c;e++)o.put(e%2?17:236,8);return w(o,e,n)}function w(e,n,r){let a=t.getSymbolTotalCodewords(n),o=a-l.getTotalCodewordsCount(n,r),s=l.getBlocksCount(n,r),c=s-a%s,d=Math.floor(a/s),f=Math.floor(o/s),m=f+1,g=d-f,_=new u(g),v=0,y=Array(s),b=Array(s),x=0,S=new Uint8Array(e.buffer);for(let e=0;e<s;e++){let t=e<c?f:m;y[e]=S.slice(v,v+t),b[e]=_.encode(y[e]),v+=t,x=Math.max(x,t)}let C=new Uint8Array(a),w=0,T,E;for(T=0;T<x;T++)for(E=0;E<s;E++)T<y[E].length&&(C[w++]=y[E][T]);for(T=0;T<g;T++)for(E=0;E<s;E++)C[w++]=b[E][T];return C}function T(e,n,r,o){let s;if(Array.isArray(e))s=g.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=g.rawSplit(e);t=d.getBestVersionForData(n,r)}s=g.fromString(e,t||40)}else throw Error(`Invalid data`);let l=d.getBestVersionForData(s,r);if(!l)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=l;else if(n<l)throw Error(`
|
|
6
6
|
The chosen QR Code version cannot contain this amount of data.
|
|
7
7
|
Minimum version required to store current data is: `+l+`.
|
|
8
8
|
`);let u=C(n,r,s),f=new a(t.getSymbolSize(n));return _(f,n),v(f),y(f,n),x(f,r,0),n>=7&&b(f,n),S(f,u),isNaN(o)&&(o=c.getBestMask(f,x.bind(null,f,r))),c.applyMask(o,f),x(f,r,o),{modules:f,version:n,errorCorrectionLevel:r,maskPattern:o,segments:s}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let a=n.M,o,s;return r!==void 0&&(a=n.from(r.errorCorrectionLevel,n.M),o=d.from(r.version),s=c.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),T(e,o,a,s)}})),require_utils$1=__commonJSMin((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,a=e.scale||4;return{width:r,scale:r?4:a,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let a=n.modules.size,o=n.modules.data,s=e.getScale(a,r),c=Math.floor((a+r.margin*2)*s),l=r.margin*s,u=[r.color.light,r.color.dark];for(let e=0;e<c;e++)for(let n=0;n<c;n++){let d=(e*c+n)*4,f=r.color.light;if(e>=l&&n>=l&&e<c-l&&n<c-l){let t=Math.floor((e-l)/s),r=Math.floor((n-l)/s);f=u[+!!o[t*a+r]]}t[d++]=f.r,t[d++]=f.g,t[d++]=f.b,t[d]=f.a}}})),require_canvas=__commonJSMin((e=>{var t=require_utils$1();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,a,o){let s=o,c=a;s!==void 0||a&&a.getContext||(s=a,a=void 0),a||(c=r()),s=t.getOptions(s);let l=t.getImageWidth(e.modules.size,s),u=c.getContext(`2d`),d=u.createImageData(l,l);return t.qrToImageData(d.data,e,s),n(u,c,l),u.putImageData(d,0,0),c},e.renderToDataURL=function(t,n,r){let a=r;a!==void 0||n&&n.getContext||(a=n,n=void 0),a||={};let o=e.render(t,n,a),s=a.type||`image/png`,c=a.rendererOpts||{};return o.toDataURL(s,c.quality)}})),require_svg_tag=__commonJSMin((e=>{var t=require_utils$1();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function a(e,t,n){let a=``,o=0,s=!1,c=0;for(let l=0;l<e.length;l++){let u=Math.floor(l%t),d=Math.floor(l/t);!u&&!s&&(s=!0),e[l]?(c++,l>0&&u>0&&e[l-1]||(a+=s?r(`M`,u+n,.5+d+n):r(`m`,o,0),o=0,s=!1),u+1<t&&e[l+1]||(a+=r(`h`,c),c=0)):o++}return a}e.render=function(e,r,o){let s=t.getOptions(r),c=e.modules.size,l=e.modules.data,u=c+s.margin*2,d=s.color.light.a?`<path `+n(s.color.light,`fill`)+` d="M0 0h`+u+`v`+u+`H0z"/>`:``,f=`<path `+n(s.color.dark,`stroke`)+` d="`+a(l,c,s.margin)+`"/>`,m=`viewBox="0 0 `+u+` `+u+`"`,g=`<svg xmlns="http://www.w3.org/2000/svg" `+(s.width?`width="`+s.width+`" height="`+s.width+`" `:``)+m+` shape-rendering="crispEdges">`+d+f+`</svg>
|
|
9
|
-
`;return typeof o==`function`&&o(null,g),g}})),require_browser=__commonJSMin((e=>{var t=require_can_promise(),n=require_qrcode(),r=require_canvas(),a=require_svg_tag();function o(e,r,a,o,s){let c=[].slice.call(arguments,1),l=c.length,u=typeof c[l-1]==`function`;if(!u&&!t())throw Error(`Callback required as last argument`);if(u){if(l<2)throw Error(`Too few arguments provided`);l===2?(s=a,a=r,r=o=void 0):l===3&&(r.getContext&&s===void 0?(s=o,o=void 0):(s=o,o=a,a=r,r=void 0))}else{if(l<1)throw Error(`Too few arguments provided`);return l===1?(a=r,r=o=void 0):l===2&&!r.getContext&&(o=a,a=r,r=void 0),new Promise(function(t,s){try{t(e(n.create(a,o),r,o))}catch(e){s(e)}})}try{let t=n.create(a,o);s(null,e(t,r,o))}catch(e){s(e)}}e.create=n.create,e.toCanvas=o.bind(null,r.render),e.toDataURL=o.bind(null,r.renderToDataURL),e.toString=o.bind(null,function(e,t,n){return a.render(e,n)})})),import_browser=__toESM(require_browser(),1),_hoisted_1$9={class:`diff-bar`},_hoisted_2$9={class:`diff-bar__track hq-steps`},_hoisted_3$6={class:`diff-bar__legend`},DifficultyBar_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`DifficultyBar`,props:{distribution:{}},setup(e){return(t,n)=>(openBlock(),createElementBlock(`div`,_hoisted_1$9,[createBaseVNode(`div`,_hoisted_2$9,[createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--easy`,style:normalizeStyle({width:e.distribution.easy+`%`})},null,4),createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--medium`,style:normalizeStyle({width:e.distribution.medium+`%`})},null,4),createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--hard`,style:normalizeStyle({width:e.distribution.hard+`%`})},null,4)]),createBaseVNode(`p`,_hoisted_3$6,[n[0]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--easy`},null,-1),createTextVNode(`facile `+toDisplayString(e.distribution.easy)+`% `,1),n[1]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--medium`},null,-1),createTextVNode(`moyen `+toDisplayString(e.distribution.medium)+`% `,1),n[2]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--hard`},null,-1),createTextVNode(`difficile `+toDisplayString(e.distribution.hard)+`% `,1)])]))}}),DifficultyBar_default=_plugin_vue_export_helper_default(DifficultyBar_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-a3903778`]]),_hoisted_1$8={key:0,class:`qip__labels`},_hoisted_2$8={key:0,class:`qip__badge`},_hoisted_3$5={key:1,class:`qip__label`},_hoisted_4$4={class:`qip__header`},_hoisted_5$2={class:`qip__title`},_hoisted_6$2={class:`qip__content`},_hoisted_7$1={key:0,class:`qip__tags`},_hoisted_8$1={key:1,class:`qip__description`},_hoisted_9$1={class:`qip__metrics`},_hoisted_10$1={class:`qip__metric`},_hoisted_11$1={key:0},_hoisted_12$1={key:0,class:`qip__metric`},_hoisted_13$1={key:1,class:`qip__metric`},_hoisted_14$1={key:2,class:`qip__metric`},QuizInfoPanel_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`QuizInfoPanel`,props:{quizInfo:{},playerCount:{},playCount:{},compact:{type:Boolean}},setup(e){let t=e,n={easy:`FACILE`,medium:`MOYEN`,hard:`DIFFICILE`},r=computed(()=>{let e=t.quizInfo.poolSize;return e!==void 0&&e>t.quizInfo.totalQuestions?e:null});return(t,a)=>(openBlock(),createElementBlock(`div`,{class:normalizeClass([`qip`,{"qip--compact":e.compact}])},[e.quizInfo.oneShoot!==void 0||e.quizInfo.randomDraw!==void 0?(openBlock(),createElementBlock(`div`,_hoisted_1$8,[e.quizInfo.oneShoot===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`span`,_hoisted_2$8,toDisplayString(e.quizInfo.oneShoot?`⚡ Réponse unique`:`✏️ Réponses modifiables`),1)),e.quizInfo.randomDraw===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`span`,_hoisted_3$5,toDisplayString(e.quizInfo.randomDraw?`🎲 Tirage aléatoire`:`📋 Liste fixe`),1))])):createCommentVNode(``,!0),createBaseVNode(`div`,_hoisted_4$4,[createBaseVNode(`h2`,_hoisted_5$2,toDisplayString(e.quizInfo.title),1),e.quizInfo.targetDifficulty?(openBlock(),createElementBlock(`span`,{key:0,class:normalizeClass([`qip__target-badge`,`qip__target-badge--${e.quizInfo.targetDifficulty}`])},`🎯 `+toDisplayString(n[e.quizInfo.targetDifficulty]),3)):createCommentVNode(``,!0)]),createBaseVNode(`div`,_hoisted_6$2,[e.quizInfo.tags.length?(openBlock(),createElementBlock(`div`,_hoisted_7$1,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.quizInfo.tags,e=>(openBlock(),createElementBlock(`span`,{key:e,class:`qip__tag`},toDisplayString(e),1))),128))])):createCommentVNode(``,!0),e.quizInfo.description?(openBlock(),createElementBlock(`p`,_hoisted_8$1,toDisplayString(e.quizInfo.description),1)):createCommentVNode(``,!0)]),createBaseVNode(`div`,_hoisted_9$1,[createBaseVNode(`div`,_hoisted_10$1,[createBaseVNode(`strong`,null,[createTextVNode(toDisplayString(e.quizInfo.totalQuestions),1),r.value?(openBlock(),createElementBlock(`small`,_hoisted_11$1,`/`+toDisplayString(r.value),1)):createCommentVNode(``,!0)]),a[0]||=createBaseVNode(`span`,null,`questions`,-1)]),e.quizInfo.tags.length?(openBlock(),createElementBlock(`div`,_hoisted_12$1,[createBaseVNode(`strong`,null,toDisplayString(e.quizInfo.tags.length),1),a[1]||=createBaseVNode(`span`,null,`tags`,-1)])):createCommentVNode(``,!0),e.playCount===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_13$1,[createBaseVNode(`strong`,null,toDisplayString(e.playCount),1),a[2]||=createBaseVNode(`span`,null,`parties`,-1)])),e.playerCount===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_14$1,[createBaseVNode(`strong`,null,toDisplayString(e.playerCount),1),a[3]||=createBaseVNode(`span`,null,`joueurs`,-1)]))]),createVNode(DifficultyBar_default,{distribution:e.quizInfo.difficultyDistribution},null,8,[`distribution`])],2))}}),QuizInfoPanel_default=_plugin_vue_export_helper_default(QuizInfoPanel_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-549d1637`]]),PREFIX=`/solo/`,LEGACY_PREFIX=`#/solo/`;function parseSoloPath(e){if(!e.startsWith(PREFIX))return null;let t=e.slice(6).replace(/\/+$/,``);try{t=decodeURIComponent(t)}catch{return null}return t?{slug:t}:null}function soloPath(e){return PREFIX+e}function parseLegacySoloHash(e){if(!e.startsWith(LEGACY_PREFIX))return null;try{return decodeURIComponent(e.slice(7))||null}catch{return null}}function navigate(e){(e!==location.pathname||location.hash)&&(history.pushState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`)))}function followLink(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.currentTarget?.getAttribute(`href`);t&&(e.preventDefault(),navigate(t))}var _hoisted_1$7={class:`app-header`},_hoisted_2$7={class:`app-header__inner`},_hoisted_3$4=[`href`],AppHeader_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`AppHeader`,setup(e){return(e,t)=>(openBlock(),createElementBlock(`header`,_hoisted_1$7,[createBaseVNode(`div`,_hoisted_2$7,[createBaseVNode(`a`,{class:`app-header__home`,href:unref(`/`),"aria-label":`HashQuiz, accueil`,onClick:t[0]||=(...e)=>unref(followLink)&&unref(followLink)(...e)},[createVNode(unref(BrandLogo_default),{inline:``})],8,_hoisted_3$4)])]))}}),AppHeader_default=_plugin_vue_export_helper_default(AppHeader_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-ee64765b`]]),_hoisted_1$6=[`viewBox`],_hoisted_2$6=[`d`],AppIcon_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`AppIcon`,props:{name:{}},setup(e){let t={replay:{box:`0 0 24 24`,paths:[`M4.5 12a7.5 7.5 0 1 0 2.2-5.3`,`M4 3v5h5`]},home:{box:`0 0 24 24`,paths:[`M3 11.5 12 4l9 7.5`,`M5.5 10v10h5v-6h3v6h5V10`]},share:{box:`0 0 24 24`,paths:[`M12 3v12`,`M7.5 7.5 12 3l4.5 4.5`,`M5 11v9h14v-9`]},github:{box:`0 0 16 16`,fill:!0,paths:[`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z`]},star:{box:`0 0 16 16`,fill:!0,paths:[`M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z`]}};return(n,r)=>(openBlock(),createElementBlock(`svg`,{class:`app-icon`,viewBox:t[e.name].box,"aria-hidden":`true`,focusable:`false`},[(openBlock(!0),createElementBlock(Fragment,null,renderList(t[e.name].paths,(n,r)=>(openBlock(),createElementBlock(`path`,{key:r,d:n,class:normalizeClass(t[e.name].fill?`app-icon__fill`:`app-icon__stroke`)},null,10,_hoisted_2$6))),128))],8,_hoisted_1$6))}}),AppIcon_default=_plugin_vue_export_helper_default(AppIcon_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-a64f61ab`]]),REPO_URL=`https://github.com/WhiteWoodTech/hashquiz`,SITE_URL=`https://hashquiz.dev`,REPO_API_URL=`https://api.github.com/repos/WhiteWoodTech/hashquiz`,_hoisted_1$5={class:`app-footer`},_hoisted_2$5={class:`app-footer__made`},_hoisted_3$3=[`href`],_hoisted_4$3=[`href`],AppFooter_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`AppFooter`,setup(e){return(e,t)=>(openBlock(),createElementBlock(`footer`,_hoisted_1$5,[createBaseVNode(`p`,_hoisted_2$5,[t[0]||=createTextVNode(` Made with `,-1),t[1]||=createBaseVNode(`span`,{role:`img`,"aria-label":`amour`},`❤️`,-1),t[2]||=createTextVNode(` and `,-1),createBaseVNode(`a`,{href:unref(SITE_URL),target:`_blank`,rel:`noopener`},`HashQuiz`,8,_hoisted_3$3)]),createBaseVNode(`a`,{class:`app-footer__github`,href:unref(REPO_URL),target:`_blank`,rel:`noopener`,"aria-label":`HashQuiz sur GitHub`,title:`HashQuiz sur GitHub`},[createVNode(AppIcon_default,{name:`github`})],8,_hoisted_4$3)]))}}),AppFooter_default=_plugin_vue_export_helper_default(AppFooter_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-0f390966`]]);init_dist();function quizFormat(e,t){return{poolSize:t,randomDraw:e.maxQuestions!==void 0||e.maxTimeSec!==void 0||e.targetDifficulty!==void 0,oneShoot:e.oneShoot??!0}}var GameEvents={playerJoined:e=>({type:`player_joined`,player:e}),playerRejoined:e=>({type:`player_rejoined`,playerId:e}),playerLeft:e=>({type:`player_left`,playerId:e}),gameStarted:()=>({type:`game_started`}),questionStarted:(e,t,n)=>({type:`question_started`,question:e,idx:t,deadlineMs:n}),timerTick:e=>({type:`timer_tick`,remaining:e}),answerSubmit:(e,t,n)=>({type:`answer_submit`,playerId:e,choiceIds:t,timeRemaining:n}),answerSubmitted:e=>({type:`answer_submitted`,playerId:e}),answerRevealed:(e,t,n,r)=>({type:`answer_revealed`,correct:e,explanation:t,scores:n,choiceCounts:r}),nextQuestion:e=>({type:`next_question`,idx:e}),gameEnded:e=>({type:`game_ended`,podium:e}),gameReset:()=>({type:`game_reset`}),stateRequest:e=>({type:`state_request`,playerId:e}),stateSnapshot:(e,t)=>({type:`state_snapshot`,playerId:e,snapshot:t})};function calcPoints(e,t){return t?e<0?10:Math.max(10,Math.round(50+e*5)):0}function rankOf(e,t){let n=[...e].sort((e,t)=>t.score-e.score).findIndex(e=>e.playerId===t);return n<0?null:{rank:n+1,total:e.length}}var POSITIONAL_IDS=[`a`,`b`,`c`,`d`];function shuffle(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}function selectQuestions(e){let{maxQuestions:t,maxTimeSec:n,targetDifficulty:r}=e.meta,a=e.questions;if(!t&&!n&&!r)return a;let o={easy:0,medium:1,hard:2};if(r){let e=o[r],s=new Set,c=[...new Set(a.flatMap(e=>e.tags))];for(let e of c){let t=shuffle(a.filter(t=>t.difficulty===`hard`&&t.tags.includes(e)));for(let e of t)if(!s.has(e)){s.add(e);break}}let l=[...s],u=a.filter(e=>!s.has(e)),d=shuffle(u.filter(e=>e.difficulty===r)),f=shuffle(u.filter(t=>o[t.difficulty]<e));shuffle(u.filter(t=>o[t.difficulty]>e));let m=t===void 0?a.length:Math.min(t,a.length),g=Math.max(0,m-l.length),_=Math.round(g*.6),v=g-_,y=d.slice(0,_),b=f.slice(0,v),x=new Set([...l,...y,...b]),S=g-y.length-b.length,C=shuffle([...d,...f].filter(e=>!x.has(e))).slice(0,Math.max(0,S)),w=[...l,...y,...b,...C];if(n!==void 0){w.sort((e,t)=>o[e.difficulty]-o[t.difficulty]);let e=0;w=w.filter(t=>e+t.timer<=n&&(e+=t.timer,!0))}return w.sort((e,t)=>o[e.difficulty]-o[t.difficulty]),w}let s=a.map((e,t)=>t);for(let e=s.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[s[e],s[t]]=[s[t],s[e]]}let c;if(t!==void 0)c=s.slice(0,t);else{c=[];let e=0;for(let t of s){let r=a[t].timer;e+r<=n&&(c.push(t),e+=r)}}return c.sort((e,t)=>e-t),c.map(e=>a[e])}function shuffleWithOrder(e){let t=e.choices.map((e,t)=>t);for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}let n=t.map((t,n)=>({...e.choices[t],id:POSITIONAL_IDS[n]??e.choices[t].id}));return{question:{...e,choices:n},order:t}}function serveQuestions(e){return selectQuestions(e).map(t=>{let{question:n,order:r}=shuffleWithOrder(t);return{...n,deckIndex:e.questions.indexOf(t),choiceOrder:r}})}function toPublic(e,t,n){return{idx:t,type:e.type,timer:e.timer,difficulty:e.difficulty,text:e.text,choices:e.choices.map(({id:e,text:t})=>({id:e,text:t})),oneShoot:n,tags:e.tags}}function soloAvailable(e,t=globalThis.location?.protocol){return e.transport===`local`?t!==`https:`:!!(e.supabaseUrl&&e.supabaseAnonKey)}function configFromEnv(e){let t=t=>e[`HASHQUIZ_${t}`]||e[`VITE_${t}`]||void 0,n=t(`GRACE_MS`),r=n===void 0?NaN:Number(n);return{transport:t(`TRANSPORT`)===`supabase`?`supabase`:`local`,supabaseUrl:t(`SUPABASE_URL`),supabaseAnonKey:t(`SUPABASE_ANON_KEY`),graceMs:Number.isFinite(r)&&r>=0?r:void 0,soloScoring:t(`SOLO_SCORING`)===`edge`?`edge`:`browser`,playerUrl:t(`PLAYER_URL`)}}function readRuntimeConfig(e={}){let t=globalThis.__HASHQUIZ_CONFIG__,n=configFromEnv(e);return t?{transport:t.transport===`supabase`||t.transport===`local`?t.transport:n.transport,supabaseUrl:t.supabaseUrl||n.supabaseUrl,supabaseAnonKey:t.supabaseAnonKey||n.supabaseAnonKey,graceMs:t.graceMs??n.graceMs,soloScoring:t.soloScoring===`edge`||t.soloScoring===`browser`?t.soloScoring:n.soloScoring,playerUrl:t.playerUrl||n.playerUrl}:n}var SoloSession=class{quiz;deckId;deckVersion;pseudo;now;served=[];_status=`idle`;_index=0;shownAt=0;_score=0;_correctCount=0;_totalTimeMs=0;_lastResult=null;answers=[];constructor(e){this.quiz=e.quiz,this.deckId=e.deckId,this.deckVersion=e.deckVersion,this.pseudo=e.pseudo,this.now=e.now??Date.now}get status(){return this._status}get index(){return this._index}get total(){return this.served.length}get score(){return this._score}get correctCount(){return this._correctCount}get totalTimeMs(){return this._totalTimeMs}get lastResult(){return this._lastResult}get question(){let e=this.served[this._index];return!e||this._status!==`question`&&this._status!==`revealed`?null:toPublic(e,this._index,this.quiz.meta.oneShoot)}get deadlineMs(){let e=this.served[this._index];return!e||this._status!==`question`?null:this.shownAt+e.timer*1e3}start(){this._status===`idle`&&(this.served=serveQuestions(this.quiz),this.served.length===0?this._status=`finished`:(this._index=0,this.show()))}answer(e){if(this._status!==`question`)return;let t=this.served[this._index],n=Math.round(t.timer*1e3),r=Math.round(Math.min(n,Math.max(0,this.now()-this.shownAt))),a=t.choices.filter(e=>e.isCorrect).map(e=>e.id),o=a.every(t=>e.includes(t))&&e.every(e=>a.includes(e)),s=t.choices.map((n,r)=>e.includes(n.id)?t.choiceOrder[r]:-1).filter(e=>e>=0).sort((e,t)=>e-t);this.reveal(t,{isCorrect:o,answered:!0,elapsed:r,correctIds:a,choices:s})}timeout(){if(this._status!==`question`)return;let e=this.served[this._index],t=e.choices.filter(e=>e.isCorrect).map(e=>e.id);this.reveal(e,{isCorrect:!1,answered:!1,elapsed:Math.round(e.timer*1e3),correctIds:t,choices:[]})}next(){this._status===`revealed`&&(this._index+1>=this.served.length?this._status=`finished`:(this._index++,this.show()))}toSubmission(){if(this._status!==`finished`)throw Error(`Solo run is not finished`);return{deckId:this.deckId,deckVersion:this.deckVersion,pseudo:this.pseudo,answers:this.answers.map(e=>({...e,choices:[...e.choices]}))}}show(){this.shownAt=this.now(),this._lastResult=null,this._status=`question`}reveal(e,t){let n=calcPoints(Math.max(0,e.timer-t.elapsed/1e3),t.isCorrect);this._score+=n,t.isCorrect&&this._correctCount++,this._totalTimeMs+=t.elapsed,this.answers.push({deckIndex:e.deckIndex,choices:t.choices,answerTimeMs:t.elapsed}),this._lastResult={isCorrect:t.isCorrect,points:n,correctIds:t.correctIds,...e.explanation===void 0?{}:{explanation:e.explanation},answered:t.answered,answerTimeMs:t.elapsed},this._status=`revealed`}},config=readRuntimeConfig({BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1});function __rest(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function __awaiter$1(e,t,n,r){function a(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?n(e.value):a(e.value).then(s,c)}l((r=r.apply(e,t||[])).next())})}var resolveFetch$3=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),FunctionsError=class extends Error{constructor(e,t=`FunctionsError`,n){super(e),this.name=t,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}},FunctionsFetchError=class extends FunctionsError{constructor(e){super(`Failed to send a request to the Edge Function`,`FunctionsFetchError`,e)}},FunctionsRelayError=class extends FunctionsError{constructor(e){super(`Relay Error invoking the Edge Function`,`FunctionsRelayError`,e)}},FunctionsHttpError=class extends FunctionsError{constructor(e){super(`Edge Function returned a non-2xx status code`,`FunctionsHttpError`,e)}},FunctionRegion;(function(e){e.Any=`any`,e.ApNortheast1=`ap-northeast-1`,e.ApNortheast2=`ap-northeast-2`,e.ApSouth1=`ap-south-1`,e.ApSoutheast1=`ap-southeast-1`,e.ApSoutheast2=`ap-southeast-2`,e.CaCentral1=`ca-central-1`,e.EuCentral1=`eu-central-1`,e.EuWest1=`eu-west-1`,e.EuWest2=`eu-west-2`,e.EuWest3=`eu-west-3`,e.SaEast1=`sa-east-1`,e.UsEast1=`us-east-1`,e.UsWest1=`us-west-1`,e.UsWest2=`us-west-2`})(FunctionRegion||={});var FunctionsClient=class{constructor(e,{headers:t={},customFetch:n,region:r=FunctionRegion.Any}={}){this.url=e,this.headers=t,this.region=r,this.fetch=resolveFetch$3(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return __awaiter$1(this,arguments,void 0,function*(e,t={}){var n;let r,a;try{let{headers:n,method:o,body:s,signal:c,timeout:l}=t,u={},{region:d}=t;d||=this.region;let f=new URL(`${this.url}/${e}`);d&&d!==`any`&&(u[`x-region`]=d,f.searchParams.set(`forceFunctionRegion`,d));let m;s&&(n&&!Object.prototype.hasOwnProperty.call(n,`Content-Type`)||!n)?typeof Blob<`u`&&s instanceof Blob||s instanceof ArrayBuffer?(u[`Content-Type`]=`application/octet-stream`,m=s):typeof s==`string`?(u[`Content-Type`]=`text/plain`,m=s):typeof FormData<`u`&&s instanceof FormData?m=s:(u[`Content-Type`]=`application/json`,m=JSON.stringify(s)):m=s&&typeof s!=`string`&&!(typeof Blob<`u`&&s instanceof Blob)&&!(s instanceof ArrayBuffer)&&!(typeof FormData<`u`&&s instanceof FormData)?JSON.stringify(s):s;let g=c;l&&(a=new AbortController,r=setTimeout(()=>a.abort(),l),c?(g=a.signal,c.addEventListener(`abort`,()=>a.abort())):g=a.signal);let _=yield this.fetch(f.toString(),{method:o||`POST`,headers:Object.assign(Object.assign(Object.assign({},u),this.headers),n),body:m,signal:g}).catch(e=>{throw new FunctionsFetchError(e)}),v=_.headers.get(`x-relay-error`);if(v&&v===`true`)throw new FunctionsRelayError(_);if(!_.ok)throw new FunctionsHttpError(_);let y=(_.headers.get(`Content-Type`)??`text/plain`).split(`;`)[0].trim(),b;return b=y===`application/json`?yield _.json():y===`application/octet-stream`||y===`application/pdf`?yield _.blob():y===`text/event-stream`?_:y===`multipart/form-data`?yield _.formData():yield _.text(),{data:b,error:null,response:_}}catch(e){return{data:null,error:e,response:e instanceof FunctionsHttpError||e instanceof FunctionsRelayError?e.context:void 0}}finally{r&&clearTimeout(r)}})}},DEFAULT_MAX_RETRIES=3,getRetryDelay=e=>Math.min(1e3*2**e,3e4),RETRYABLE_STATUS_CODES=[520,503],RETRYABLE_METHODS=[`GET`,`HEAD`,`OPTIONS`],PostgrestError=class extends Error{constructor(e){super(e.message),this.name=`PostgrestError`,this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function sleep$1(e,t){return new Promise(n=>{if(t?.aborted){n();return}let r=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e);function a(){clearTimeout(r),n()}t?.addEventListener(`abort`,a)})}function shouldRetry(e,t,n,r){return!(!r||n>=DEFAULT_MAX_RETRIES||!RETRYABLE_METHODS.includes(e)||!RETRYABLE_STATUS_CODES.includes(t))}var PostgrestBuilder=class{constructor(e){var t,n,r,a,o;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError??!1,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle??!1,this.shouldStripNulls=e.shouldStripNulls??!1,this.urlLengthLimit=e.urlLengthLimit??8e3,this.retryEnabled=e.retry??!0,this.fetch=e.fetch?e.fetch:fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get(`Accept`)===`text/csv`)throw Error(`stripNulls() cannot be used with csv()`);return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=this;if(this.schema===void 0||([`GET`,`HEAD`].includes(this.method)?this.headers.set(`Accept-Profile`,this.schema):this.headers.set(`Content-Profile`,this.schema)),this.method!==`GET`&&this.method!==`HEAD`&&this.headers.set(`Content-Type`,`application/json`),this.shouldStripNulls){let e=this.headers.get(`Accept`);e===`application/vnd.pgrst.object+json`?this.headers.set(`Accept`,`application/vnd.pgrst.object+json;nulls=stripped`):e&&e!==`application/json`||this.headers.set(`Accept`,`application/vnd.pgrst.array+json;nulls=stripped`)}let r=this.fetch,a=(async()=>{let e=0;for(;;){let o=new Headers(n.headers);e>0&&o.set(`X-Retry-Count`,String(e));let s;try{s=await r(n.url.toString(),{method:n.method,headers:o,body:JSON.stringify(n.body,(e,t)=>typeof t==`bigint`?t.toString():t),signal:n.signal})}catch(t){if(t?.name===`AbortError`||t?.code===`ABORT_ERR`||!RETRYABLE_METHODS.includes(n.method))throw t;if(n.retryEnabled&&e<DEFAULT_MAX_RETRIES){let t=getRetryDelay(e);e++,await sleep$1(t,n.signal);continue}throw t}if(shouldRetry(n.method,s.status,e,n.retryEnabled)){var t,a;let r=s.headers?.get(`Retry-After`)??null,o=r===null?getRetryDelay(e):Math.max(0,parseInt(r,10)||0)*1e3;await s.text(),e++,await sleep$1(o,n.signal)}else return await n.processResponse(s)}})();return this.shouldThrowOnError||(a=a.catch(e=>{var t;let n=``,r=``,a=``,o=e?.cause;if(o){var s,c,l,u;let t=o?.message??``,r=o?.code??``;n=`${e?.name??`FetchError`}: ${e?.message}`,n+=`\n\nCaused by: ${o?.name??`Error`}: ${t}`,r&&(n+=` (${r})`),o?.stack&&(n+=`\n${o.stack}`)}else{var d;n=e?.stack??``}let f=this.url.toString().length;return e?.name===`AbortError`||e?.code===`ABORT_ERR`?(a=``,r=`Request was aborted (timeout or manual cancellation)`,f>this.urlLengthLimit&&(r+=`. Note: Your request URL is ${f} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(o?.name===`HeadersOverflowError`||o?.code===`UND_ERR_HEADERS_OVERFLOW`)&&(a=``,r=`HTTP headers exceeded server limits (typically 16KB)`,f>this.urlLengthLimit&&(r+=`. Your request URL is ${f} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${e?.name??`FetchError`}: ${e?.message}`,details:n,hint:r,code:a},data:null,count:null,status:0,statusText:``}})),a.then(e,t)}async processResponse(e){var t=this;let n=null,r=null,a=null,o=e.status,s=e.statusText;if(e.ok){var c,l;if(t.method!==`HEAD`){var u;let n=await e.text();n===``||(r=t.headers.get(`Accept`)===`text/csv`||t.headers.get(`Accept`)&&t.headers.get(`Accept`)?.includes(`application/vnd.pgrst.plan+text`)?n:JSON.parse(n))}let d=t.headers.get(`Prefer`)?.match(/count=(exact|planned|estimated)/),f=e.headers.get(`content-range`)?.split(`/`);d&&f&&f.length>1&&(a=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:`PGRST116`,details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:`JSON object requested, multiple (or no) rows returned`},r=null,a=null,o=406,s=`Not Acceptable`):r=r.length===1?r[0]:null)}else{let a=await e.text();try{n=JSON.parse(a),Array.isArray(n)&&e.status===404&&(r=[],n=null,o=200,s=`OK`)}catch{e.status===404&&a===``?(o=204,s=`No Content`):n={message:a}}if(n&&t.shouldThrowOnError)throw new PostgrestError(n)}return{success:n===null,error:n,data:r,count:a,status:o,statusText:s}}returns(){return this}overrideTypes(){return this}},PostgrestTransformBuilder=class extends PostgrestBuilder{select(e){let t=!1,n=(e??`*`).split(``).map(e=>/\s/.test(e)&&!t?``:(e===`"`&&(t=!t),e)).join(``);return this.url.searchParams.set(`select`,n),this.headers.append(`Prefer`,`return=representation`),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:a=r}={}){let o=a?`${a}.order`:`order`,s=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${s?`${s},`:``}${e}.${t?`asc`:`desc`}${n===void 0?``:n?`.nullsfirst`:`.nullslast`}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){let r=n===void 0?`limit`:`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){let a=r===void 0?`offset`:`${r}.offset`,o=r===void 0?`limit`:`${r}.limit`;return this.url.searchParams.set(a,`${e}`),this.url.searchParams.set(o,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set(`Accept`,`application/vnd.pgrst.object+json`),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set(`Accept`,`text/csv`),this}geojson(){return this.headers.set(`Accept`,`application/geo+json`),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:a=!1,format:o=`text`}={}){var s;let c=[e?`analyze`:null,t?`verbose`:null,n?`settings`:null,r?`buffers`:null,a?`wal`:null].filter(Boolean).join(`|`),l=this.headers.get(`Accept`)??`application/json`;return this.headers.set(`Accept`,`application/vnd.pgrst.plan+${o}; for="${l}"; options=${c};`),this}rollback(){return this.headers.append(`Prefer`,`tx=rollback`),this}returns(){return this}maxAffected(e){return this.headers.append(`Prefer`,`handling=strict`),this.headers.append(`Prefer`,`max-affected=${e}`),this}},PostgrestReservedCharsRegexp=RegExp(`[,()]`),PostgrestFilterBuilder=class extends PostgrestTransformBuilder{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(`,`)}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(`,`)}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(`,`)}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(`,`)}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){let n=Array.from(new Set(t)).map(e=>typeof e==`string`&&PostgrestReservedCharsRegexp.test(e)?`"${e}"`:`${e}`).join(`,`);return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){let n=Array.from(new Set(t)).map(e=>typeof e==`string`&&PostgrestReservedCharsRegexp.test(e)?`"${e}"`:`${e}`).join(`,`);return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t==`string`?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(`,`)}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t==`string`?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(`,`)}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t==`string`?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(`,`)}}`),this}textSearch(e,t,{config:n,type:r}={}){let a=``;r===`plain`?a=`pl`:r===`phrase`?a=`ph`:r===`websearch`&&(a=`w`);let o=n===void 0?``:`(${n})`;return this.url.searchParams.append(e,`${a}fts${o}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>t!==void 0).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){let r=n?`${n}.or`:`or`;return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},PostgrestQueryBuilder=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:a=8e3,retry:o}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=a,this.retry=o}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){let{head:n=!1,count:r}=t??{},a=n?`HEAD`:`GET`,o=!1,s=(e??`*`).split(``).map(e=>/\s/.test(e)&&!o?``:(e===`"`&&(o=!o),e)).join(``),{url:c,headers:l}=this.cloneRequestState();return c.searchParams.set(`select`,s),r&&l.append(`Prefer`,`count=${r}`),new PostgrestFilterBuilder({method:a,url:c,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;let a=`POST`,{url:o,headers:s}=this.cloneRequestState();if(t&&s.append(`Prefer`,`count=${t}`),n||s.append(`Prefer`,`missing=default`),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);o.searchParams.set(`columns`,e.join(`,`))}}return new PostgrestFilterBuilder({method:`POST`,url:o,headers:s,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:a=!0}={}){var o;let s=`POST`,{url:c,headers:l}=this.cloneRequestState();if(l.append(`Prefer`,`resolution=${n?`ignore`:`merge`}-duplicates`),t!==void 0&&c.searchParams.set(`on_conflict`,t),r&&l.append(`Prefer`,`count=${r}`),a||l.append(`Prefer`,`missing=default`),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);c.searchParams.set(`columns`,e.join(`,`))}}return new PostgrestFilterBuilder({method:`POST`,url:c,headers:l,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var n;let r=`PATCH`,{url:a,headers:o}=this.cloneRequestState();return t&&o.append(`Prefer`,`count=${t}`),new PostgrestFilterBuilder({method:`PATCH`,url:a,headers:o,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;let n=`DELETE`,{url:r,headers:a}=this.cloneRequestState();return e&&a.append(`Prefer`,`count=${e}`),new PostgrestFilterBuilder({method:`DELETE`,url:r,headers:a,schema:this.schema,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function _typeof$2(e){"@babel/helpers - typeof";return _typeof$2=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},_typeof$2(e)}function toPrimitive$2(e,t){if(_typeof$2(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_typeof$2(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function toPropertyKey$2(e){var t=toPrimitive$2(e,`string`);return _typeof$2(t)==`symbol`?t:t+``}function _defineProperty$2(e,t,n){return(t=toPropertyKey$2(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys$2(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 _objectSpread2$2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ownKeys$2(Object(n),!0).forEach(function(t){_defineProperty$2(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys$2(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var PostgrestClient=class e{constructor(e,{headers:t={},schema:n,fetch:r,timeout:a,urlLengthLimit:o=8e3,retry:s}={}){this.url=e,this.headers=new Headers(t),this.schemaName=n,this.urlLengthLimit=o;let c=r??globalThis.fetch;this.fetch=a!==void 0&&a>0?(e,t)=>{let n=new AbortController,r=setTimeout(()=>n.abort(),a),o=t?.signal;if(o){if(o.aborted)return clearTimeout(r),c(e,t);let a=()=>{clearTimeout(r),n.abort()};return o.addEventListener(`abort`,a,{once:!0}),c(e,_objectSpread2$2(_objectSpread2$2({},t),{},{signal:n.signal})).finally(()=>{clearTimeout(r),o.removeEventListener(`abort`,a)})}return c(e,_objectSpread2$2(_objectSpread2$2({},t),{},{signal:n.signal})).finally(()=>clearTimeout(r))}:c,this.retry=s}from(e){if(!e||typeof e!=`string`||e.trim()===``)throw Error(`Invalid relation name: relation must be a non-empty string.`);return new PostgrestQueryBuilder(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:n=!1,get:r=!1,count:a}={}){var o;let s,c=new URL(`${this.url}/rpc/${e}`),l,u=e=>typeof e==`object`&&!!e&&(!Array.isArray(e)||e.some(u)),d=n&&Object.values(t).some(u);d?(s=`POST`,l=t):n||r?(s=n?`HEAD`:`GET`,Object.entries(t).filter(([e,t])=>t!==void 0).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(`,`)}}`:`${t}`]).forEach(([e,t])=>{c.searchParams.append(e,t)})):(s=`POST`,l=t);let f=new Headers(this.headers);return d?f.set(`Prefer`,a?`count=${a},return=minimal`:`return=minimal`):a&&f.set(`Prefer`,`count=${a}`),new PostgrestFilterBuilder({method:s,url:c,headers:f,schema:this.schemaName,body:l,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},WebSocketFactory=class{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<`u`)return{type:`native`,wsConstructor:WebSocket};let t=globalThis;if(typeof globalThis<`u`&&t.WebSocket!==void 0)return{type:`native`,wsConstructor:t.WebSocket};let n=global$1===void 0?void 0:global$1;if(n&&n.WebSocket!==void 0)return{type:`native`,wsConstructor:n.WebSocket};if(typeof globalThis<`u`&&t.WebSocketPair!==void 0&&globalThis.WebSocket===void 0)return{type:`cloudflare`,error:`Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.`,workaround:`Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.`};if(typeof globalThis<`u`&&t.EdgeRuntime||typeof navigator<`u`&&navigator.userAgent?.includes(`Vercel-Edge`))return{type:`unsupported`,error:`Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.`,workaround:`Use serverless functions or a different deployment target for WebSocket functionality.`};let r=globalThis.process;if(r){let e=r.versions;if(e&&e.node){let t=e.node,n=parseInt(t.replace(/^v/,``).split(`.`)[0]);return n>=22?globalThis.WebSocket===void 0?{type:`unsupported`,error:`Node.js ${n} detected but native WebSocket not found.`,workaround:`Provide a WebSocket implementation via the transport option.`}:{type:`native`,wsConstructor:globalThis.WebSocket}:{type:`unsupported`,error:`Node.js ${n} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
9
|
+
`;return typeof o==`function`&&o(null,g),g}})),require_browser=__commonJSMin((e=>{var t=require_can_promise(),n=require_qrcode(),r=require_canvas(),a=require_svg_tag();function o(e,r,a,o,s){let c=[].slice.call(arguments,1),l=c.length,u=typeof c[l-1]==`function`;if(!u&&!t())throw Error(`Callback required as last argument`);if(u){if(l<2)throw Error(`Too few arguments provided`);l===2?(s=a,a=r,r=o=void 0):l===3&&(r.getContext&&s===void 0?(s=o,o=void 0):(s=o,o=a,a=r,r=void 0))}else{if(l<1)throw Error(`Too few arguments provided`);return l===1?(a=r,r=o=void 0):l===2&&!r.getContext&&(o=a,a=r,r=void 0),new Promise(function(t,s){try{t(e(n.create(a,o),r,o))}catch(e){s(e)}})}try{let t=n.create(a,o);s(null,e(t,r,o))}catch(e){s(e)}}e.create=n.create,e.toCanvas=o.bind(null,r.render),e.toDataURL=o.bind(null,r.renderToDataURL),e.toString=o.bind(null,function(e,t,n){return a.render(e,n)})})),import_browser=__toESM(require_browser(),1),_hoisted_1$9={class:`diff-bar`},_hoisted_2$9={class:`diff-bar__track hq-steps`},_hoisted_3$5={class:`diff-bar__legend`},DifficultyBar_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`DifficultyBar`,props:{distribution:{}},setup(e){return(t,n)=>(openBlock(),createElementBlock(`div`,_hoisted_1$9,[createBaseVNode(`div`,_hoisted_2$9,[createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--easy`,style:normalizeStyle({width:e.distribution.easy+`%`})},null,4),createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--medium`,style:normalizeStyle({width:e.distribution.medium+`%`})},null,4),createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--hard`,style:normalizeStyle({width:e.distribution.hard+`%`})},null,4)]),createBaseVNode(`p`,_hoisted_3$5,[n[0]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--easy`},null,-1),createTextVNode(`facile `+toDisplayString(e.distribution.easy)+`% `,1),n[1]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--medium`},null,-1),createTextVNode(`moyen `+toDisplayString(e.distribution.medium)+`% `,1),n[2]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--hard`},null,-1),createTextVNode(`difficile `+toDisplayString(e.distribution.hard)+`% `,1)])]))}}),DifficultyBar_default=_plugin_vue_export_helper_default(DifficultyBar_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-a3903778`]]),_hoisted_1$8={key:0,class:`qip__labels`},_hoisted_2$8={key:0,class:`qip__badge`},_hoisted_3$4={key:1,class:`qip__label`},_hoisted_4$4={class:`qip__header`},_hoisted_5$4={class:`qip__title`},_hoisted_6$4={class:`qip__content`},_hoisted_7$2={key:0,class:`qip__tags`},_hoisted_8$2={key:1,class:`qip__description`},_hoisted_9$2={class:`qip__metrics`},_hoisted_10$2={class:`qip__metric`},_hoisted_11$1={key:0},_hoisted_12$1={key:0,class:`qip__metric`},_hoisted_13$1={key:1,class:`qip__metric`},_hoisted_14$1={key:2,class:`qip__metric`},QuizInfoPanel_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`QuizInfoPanel`,props:{quizInfo:{},playerCount:{},playCount:{},compact:{type:Boolean}},setup(e){let t=e,n={easy:`FACILE`,medium:`MOYEN`,hard:`DIFFICILE`},r=computed(()=>{let e=t.quizInfo.poolSize;return e!==void 0&&e>t.quizInfo.totalQuestions?e:null});return(t,a)=>(openBlock(),createElementBlock(`div`,{class:normalizeClass([`qip`,{"qip--compact":e.compact}])},[e.quizInfo.oneShoot!==void 0||e.quizInfo.randomDraw!==void 0?(openBlock(),createElementBlock(`div`,_hoisted_1$8,[e.quizInfo.oneShoot===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`span`,_hoisted_2$8,toDisplayString(e.quizInfo.oneShoot?`⚡ Réponse unique`:`✏️ Réponses modifiables`),1)),e.quizInfo.randomDraw===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`span`,_hoisted_3$4,toDisplayString(e.quizInfo.randomDraw?`🎲 Tirage aléatoire`:`📋 Liste fixe`),1))])):createCommentVNode(``,!0),createBaseVNode(`div`,_hoisted_4$4,[createBaseVNode(`h2`,_hoisted_5$4,toDisplayString(e.quizInfo.title),1),e.quizInfo.targetDifficulty?(openBlock(),createElementBlock(`span`,{key:0,class:normalizeClass([`qip__target-badge`,`qip__target-badge--${e.quizInfo.targetDifficulty}`])},`🎯 `+toDisplayString(n[e.quizInfo.targetDifficulty]),3)):createCommentVNode(``,!0)]),createBaseVNode(`div`,_hoisted_6$4,[e.quizInfo.tags.length?(openBlock(),createElementBlock(`div`,_hoisted_7$2,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.quizInfo.tags,e=>(openBlock(),createElementBlock(`span`,{key:e,class:`qip__tag`},toDisplayString(e),1))),128))])):createCommentVNode(``,!0),e.quizInfo.description?(openBlock(),createElementBlock(`p`,_hoisted_8$2,toDisplayString(e.quizInfo.description),1)):createCommentVNode(``,!0)]),createBaseVNode(`div`,_hoisted_9$2,[createBaseVNode(`div`,_hoisted_10$2,[createBaseVNode(`strong`,null,[createTextVNode(toDisplayString(e.quizInfo.totalQuestions),1),r.value?(openBlock(),createElementBlock(`small`,_hoisted_11$1,`/`+toDisplayString(r.value),1)):createCommentVNode(``,!0)]),a[0]||=createBaseVNode(`span`,null,`questions`,-1)]),e.quizInfo.tags.length?(openBlock(),createElementBlock(`div`,_hoisted_12$1,[createBaseVNode(`strong`,null,toDisplayString(e.quizInfo.tags.length),1),a[1]||=createBaseVNode(`span`,null,`tags`,-1)])):createCommentVNode(``,!0),e.playCount===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_13$1,[createBaseVNode(`strong`,null,toDisplayString(e.playCount),1),a[2]||=createBaseVNode(`span`,null,`parties`,-1)])),e.playerCount===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_14$1,[createBaseVNode(`strong`,null,toDisplayString(e.playerCount),1),a[3]||=createBaseVNode(`span`,null,`joueurs`,-1)]))]),createVNode(DifficultyBar_default,{distribution:e.quizInfo.difficultyDistribution},null,8,[`distribution`])],2))}}),QuizInfoPanel_default=_plugin_vue_export_helper_default(QuizInfoPanel_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-549d1637`]]),PREFIX=`/solo/`,LEGACY_PREFIX=`#/solo/`;function parseSoloPath(e){if(!e.startsWith(PREFIX))return null;let t=e.slice(6).replace(/\/+$/,``);try{t=decodeURIComponent(t)}catch{return null}return t?{slug:t}:null}function soloPath(e){return PREFIX+e}function parseLegacySoloHash(e){if(!e.startsWith(LEGACY_PREFIX))return null;try{return decodeURIComponent(e.slice(7))||null}catch{return null}}function navigate(e){(e!==location.pathname||location.hash)&&(history.pushState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`)))}function followLink(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.currentTarget?.getAttribute(`href`);t&&(e.preventDefault(),navigate(t))}var _hoisted_1$7={class:`app-header`},_hoisted_2$7=[`href`],AppHeader_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`AppHeader`,setup(e){return(e,t)=>(openBlock(),createElementBlock(`header`,_hoisted_1$7,[createBaseVNode(`a`,{class:`app-header__home`,href:unref(`/`),"aria-label":`HashQuiz, accueil`,onClick:t[0]||=(...e)=>unref(followLink)&&unref(followLink)(...e)},[createVNode(unref(BrandLogo_default),{inline:``})],8,_hoisted_2$7)]))}}),AppHeader_default=_plugin_vue_export_helper_default(AppHeader_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-dcf147cd`]]),_hoisted_1$6=[`viewBox`],_hoisted_2$6=[`d`],AppIcon_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`AppIcon`,props:{name:{}},setup(e){let t={replay:{box:`0 0 24 24`,paths:[`M4.5 12a7.5 7.5 0 1 0 2.2-5.3`,`M4 3v5h5`]},home:{box:`0 0 24 24`,paths:[`M3 11.5 12 4l9 7.5`,`M5.5 10v10h5v-6h3v6h5V10`]},share:{box:`0 0 24 24`,paths:[`M12 3v12`,`M7.5 7.5 12 3l4.5 4.5`,`M5 11v9h14v-9`]},github:{box:`0 0 16 16`,fill:!0,paths:[`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z`]},star:{box:`0 0 16 16`,fill:!0,paths:[`M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z`]}};return(n,r)=>(openBlock(),createElementBlock(`svg`,{class:`app-icon`,viewBox:t[e.name].box,"aria-hidden":`true`,focusable:`false`},[(openBlock(!0),createElementBlock(Fragment,null,renderList(t[e.name].paths,(n,r)=>(openBlock(),createElementBlock(`path`,{key:r,d:n,class:normalizeClass(t[e.name].fill?`app-icon__fill`:`app-icon__stroke`)},null,10,_hoisted_2$6))),128))],8,_hoisted_1$6))}}),AppIcon_default=_plugin_vue_export_helper_default(AppIcon_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-a64f61ab`]]),REPO_URL=`https://github.com/WhiteWoodTech/hashquiz`,SITE_URL=`https://hashquiz.dev`,REPO_API_URL=`https://api.github.com/repos/WhiteWoodTech/hashquiz`,_hoisted_1$5={class:`app-footer`},_hoisted_2$5=[`href`],_hoisted_3$3={class:`app-footer__line`},_hoisted_4$3={class:`app-footer__made`},_hoisted_5$3=[`href`],_hoisted_6$3=[`href`],AppFooter_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`AppFooter`,setup(e){return(e,t)=>(openBlock(),createElementBlock(`footer`,_hoisted_1$5,[createBaseVNode(`a`,{class:`app-footer__home`,href:unref(`/`),"aria-label":`HashQuiz, accueil`,onClick:t[0]||=(...e)=>unref(followLink)&&unref(followLink)(...e)},[createVNode(unref(BrandLogo_default),{inline:``})],8,_hoisted_2$5),createBaseVNode(`div`,_hoisted_3$3,[createBaseVNode(`p`,_hoisted_4$3,[t[1]||=createTextVNode(` Made with `,-1),t[2]||=createBaseVNode(`span`,{class:`app-footer__heart`,role:`img`,"aria-label":`amour`},`♥`,-1),t[3]||=createTextVNode(` and `,-1),createBaseVNode(`a`,{href:unref(SITE_URL),target:`_blank`,rel:`noopener`},`HashQuiz`,8,_hoisted_5$3)]),createBaseVNode(`a`,{class:`app-footer__github`,href:unref(REPO_URL),target:`_blank`,rel:`noopener`,"aria-label":`HashQuiz sur GitHub`,title:`HashQuiz sur GitHub`},[createVNode(AppIcon_default,{name:`github`})],8,_hoisted_6$3)])]))}}),AppFooter_default=_plugin_vue_export_helper_default(AppFooter_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-fc1a41c7`]]);init_dist();function quizFormat(e,t){return{poolSize:t,randomDraw:e.maxQuestions!==void 0||e.maxTimeSec!==void 0||e.targetDifficulty!==void 0,oneShoot:e.oneShoot??!0}}var GameEvents={playerJoined:e=>({type:`player_joined`,player:e}),playerRejoined:e=>({type:`player_rejoined`,playerId:e}),playerLeft:e=>({type:`player_left`,playerId:e}),gameStarted:()=>({type:`game_started`}),questionStarted:(e,t,n)=>({type:`question_started`,question:e,idx:t,deadlineMs:n}),timerTick:e=>({type:`timer_tick`,remaining:e}),answerSubmit:(e,t,n)=>({type:`answer_submit`,playerId:e,choiceIds:t,timeRemaining:n}),answerSubmitted:e=>({type:`answer_submitted`,playerId:e}),answerRevealed:(e,t,n,r)=>({type:`answer_revealed`,correct:e,explanation:t,scores:n,choiceCounts:r}),nextQuestion:e=>({type:`next_question`,idx:e}),gameEnded:e=>({type:`game_ended`,podium:e}),gameReset:()=>({type:`game_reset`}),stateRequest:e=>({type:`state_request`,playerId:e}),stateSnapshot:(e,t)=>({type:`state_snapshot`,playerId:e,snapshot:t})};function calcPoints(e,t){return t?e<0?10:Math.max(10,Math.round(50+e*5)):0}function rankOf(e,t){let n=[...e].sort((e,t)=>t.score-e.score).findIndex(e=>e.playerId===t);return n<0?null:{rank:n+1,total:e.length}}var POSITIONAL_IDS=[`a`,`b`,`c`,`d`];function shuffle(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}function selectQuestions(e){let{maxQuestions:t,maxTimeSec:n,targetDifficulty:r}=e.meta,a=e.questions;if(!t&&!n&&!r)return a;let o={easy:0,medium:1,hard:2};if(r){let e=o[r],s=new Set,c=[...new Set(a.flatMap(e=>e.tags))];for(let e of c){let t=shuffle(a.filter(t=>t.difficulty===`hard`&&t.tags.includes(e)));for(let e of t)if(!s.has(e)){s.add(e);break}}let l=[...s],u=a.filter(e=>!s.has(e)),d=shuffle(u.filter(e=>e.difficulty===r)),f=shuffle(u.filter(t=>o[t.difficulty]<e));shuffle(u.filter(t=>o[t.difficulty]>e));let m=t===void 0?a.length:Math.min(t,a.length),g=Math.max(0,m-l.length),_=Math.round(g*.6),v=g-_,y=d.slice(0,_),b=f.slice(0,v),x=new Set([...l,...y,...b]),S=g-y.length-b.length,C=shuffle([...d,...f].filter(e=>!x.has(e))).slice(0,Math.max(0,S)),w=[...l,...y,...b,...C];if(n!==void 0){w.sort((e,t)=>o[e.difficulty]-o[t.difficulty]);let e=0;w=w.filter(t=>e+t.timer<=n&&(e+=t.timer,!0))}return w.sort((e,t)=>o[e.difficulty]-o[t.difficulty]),w}let s=a.map((e,t)=>t);for(let e=s.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[s[e],s[t]]=[s[t],s[e]]}let c;if(t!==void 0)c=s.slice(0,t);else{c=[];let e=0;for(let t of s){let r=a[t].timer;e+r<=n&&(c.push(t),e+=r)}}return c.sort((e,t)=>e-t),c.map(e=>a[e])}function shuffleWithOrder(e){let t=e.choices.map((e,t)=>t);for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}let n=t.map((t,n)=>({...e.choices[t],id:POSITIONAL_IDS[n]??e.choices[t].id}));return{question:{...e,choices:n},order:t}}function serveQuestions(e){return selectQuestions(e).map(t=>{let{question:n,order:r}=shuffleWithOrder(t);return{...n,deckIndex:e.questions.indexOf(t),choiceOrder:r}})}function toPublic(e,t,n){return{idx:t,type:e.type,timer:e.timer,difficulty:e.difficulty,text:e.text,choices:e.choices.map(({id:e,text:t})=>({id:e,text:t})),oneShoot:n,tags:e.tags}}function soloAvailable(e,t=globalThis.location?.protocol){return e.transport===`local`?t!==`https:`:!!(e.supabaseUrl&&e.supabaseAnonKey)}function configFromEnv(e){let t=t=>e[`HASHQUIZ_${t}`]||e[`VITE_${t}`]||void 0,n=t(`GRACE_MS`),r=n===void 0?NaN:Number(n);return{transport:t(`TRANSPORT`)===`supabase`?`supabase`:`local`,supabaseUrl:t(`SUPABASE_URL`),supabaseAnonKey:t(`SUPABASE_ANON_KEY`),graceMs:Number.isFinite(r)&&r>=0?r:void 0,soloScoring:t(`SOLO_SCORING`)===`edge`?`edge`:`browser`,playerUrl:t(`PLAYER_URL`)}}function readRuntimeConfig(e={}){let t=globalThis.__HASHQUIZ_CONFIG__,n=configFromEnv(e);return t?{transport:t.transport===`supabase`||t.transport===`local`?t.transport:n.transport,supabaseUrl:t.supabaseUrl||n.supabaseUrl,supabaseAnonKey:t.supabaseAnonKey||n.supabaseAnonKey,graceMs:t.graceMs??n.graceMs,soloScoring:t.soloScoring===`edge`||t.soloScoring===`browser`?t.soloScoring:n.soloScoring,playerUrl:t.playerUrl||n.playerUrl}:n}var SoloSession=class{quiz;deckId;deckVersion;pseudo;now;served=[];_status=`idle`;_index=0;shownAt=0;_score=0;_correctCount=0;_totalTimeMs=0;_lastResult=null;answers=[];constructor(e){this.quiz=e.quiz,this.deckId=e.deckId,this.deckVersion=e.deckVersion,this.pseudo=e.pseudo,this.now=e.now??Date.now}get status(){return this._status}get index(){return this._index}get total(){return this.served.length}get score(){return this._score}get correctCount(){return this._correctCount}get totalTimeMs(){return this._totalTimeMs}get lastResult(){return this._lastResult}get question(){let e=this.served[this._index];return!e||this._status!==`question`&&this._status!==`revealed`?null:toPublic(e,this._index,this.quiz.meta.oneShoot)}get deadlineMs(){let e=this.served[this._index];return!e||this._status!==`question`?null:this.shownAt+e.timer*1e3}start(){this._status===`idle`&&(this.served=serveQuestions(this.quiz),this.served.length===0?this._status=`finished`:(this._index=0,this.show()))}answer(e){if(this._status!==`question`)return;let t=this.served[this._index],n=Math.round(t.timer*1e3),r=Math.round(Math.min(n,Math.max(0,this.now()-this.shownAt))),a=t.choices.filter(e=>e.isCorrect).map(e=>e.id),o=a.every(t=>e.includes(t))&&e.every(e=>a.includes(e)),s=t.choices.map((n,r)=>e.includes(n.id)?t.choiceOrder[r]:-1).filter(e=>e>=0).sort((e,t)=>e-t);this.reveal(t,{isCorrect:o,answered:!0,elapsed:r,correctIds:a,choices:s})}timeout(){if(this._status!==`question`)return;let e=this.served[this._index],t=e.choices.filter(e=>e.isCorrect).map(e=>e.id);this.reveal(e,{isCorrect:!1,answered:!1,elapsed:Math.round(e.timer*1e3),correctIds:t,choices:[]})}next(){this._status===`revealed`&&(this._index+1>=this.served.length?this._status=`finished`:(this._index++,this.show()))}toSubmission(){if(this._status!==`finished`)throw Error(`Solo run is not finished`);return{deckId:this.deckId,deckVersion:this.deckVersion,pseudo:this.pseudo,answers:this.answers.map(e=>({...e,choices:[...e.choices]}))}}show(){this.shownAt=this.now(),this._lastResult=null,this._status=`question`}reveal(e,t){let n=calcPoints(Math.max(0,e.timer-t.elapsed/1e3),t.isCorrect);this._score+=n,t.isCorrect&&this._correctCount++,this._totalTimeMs+=t.elapsed,this.answers.push({deckIndex:e.deckIndex,choices:t.choices,answerTimeMs:t.elapsed}),this._lastResult={isCorrect:t.isCorrect,points:n,correctIds:t.correctIds,...e.explanation===void 0?{}:{explanation:e.explanation},answered:t.answered,answerTimeMs:t.elapsed},this._status=`revealed`}},config=readRuntimeConfig({BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1});function __rest(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function __awaiter$1(e,t,n,r){function a(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?n(e.value):a(e.value).then(s,c)}l((r=r.apply(e,t||[])).next())})}var resolveFetch$3=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),FunctionsError=class extends Error{constructor(e,t=`FunctionsError`,n){super(e),this.name=t,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}},FunctionsFetchError=class extends FunctionsError{constructor(e){super(`Failed to send a request to the Edge Function`,`FunctionsFetchError`,e)}},FunctionsRelayError=class extends FunctionsError{constructor(e){super(`Relay Error invoking the Edge Function`,`FunctionsRelayError`,e)}},FunctionsHttpError=class extends FunctionsError{constructor(e){super(`Edge Function returned a non-2xx status code`,`FunctionsHttpError`,e)}},FunctionRegion;(function(e){e.Any=`any`,e.ApNortheast1=`ap-northeast-1`,e.ApNortheast2=`ap-northeast-2`,e.ApSouth1=`ap-south-1`,e.ApSoutheast1=`ap-southeast-1`,e.ApSoutheast2=`ap-southeast-2`,e.CaCentral1=`ca-central-1`,e.EuCentral1=`eu-central-1`,e.EuWest1=`eu-west-1`,e.EuWest2=`eu-west-2`,e.EuWest3=`eu-west-3`,e.SaEast1=`sa-east-1`,e.UsEast1=`us-east-1`,e.UsWest1=`us-west-1`,e.UsWest2=`us-west-2`})(FunctionRegion||={});var FunctionsClient=class{constructor(e,{headers:t={},customFetch:n,region:r=FunctionRegion.Any}={}){this.url=e,this.headers=t,this.region=r,this.fetch=resolveFetch$3(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return __awaiter$1(this,arguments,void 0,function*(e,t={}){var n;let r,a;try{let{headers:n,method:o,body:s,signal:c,timeout:l}=t,u={},{region:d}=t;d||=this.region;let f=new URL(`${this.url}/${e}`);d&&d!==`any`&&(u[`x-region`]=d,f.searchParams.set(`forceFunctionRegion`,d));let m;s&&(n&&!Object.prototype.hasOwnProperty.call(n,`Content-Type`)||!n)?typeof Blob<`u`&&s instanceof Blob||s instanceof ArrayBuffer?(u[`Content-Type`]=`application/octet-stream`,m=s):typeof s==`string`?(u[`Content-Type`]=`text/plain`,m=s):typeof FormData<`u`&&s instanceof FormData?m=s:(u[`Content-Type`]=`application/json`,m=JSON.stringify(s)):m=s&&typeof s!=`string`&&!(typeof Blob<`u`&&s instanceof Blob)&&!(s instanceof ArrayBuffer)&&!(typeof FormData<`u`&&s instanceof FormData)?JSON.stringify(s):s;let g=c;l&&(a=new AbortController,r=setTimeout(()=>a.abort(),l),c?(g=a.signal,c.addEventListener(`abort`,()=>a.abort())):g=a.signal);let _=yield this.fetch(f.toString(),{method:o||`POST`,headers:Object.assign(Object.assign(Object.assign({},u),this.headers),n),body:m,signal:g}).catch(e=>{throw new FunctionsFetchError(e)}),v=_.headers.get(`x-relay-error`);if(v&&v===`true`)throw new FunctionsRelayError(_);if(!_.ok)throw new FunctionsHttpError(_);let y=(_.headers.get(`Content-Type`)??`text/plain`).split(`;`)[0].trim(),b;return b=y===`application/json`?yield _.json():y===`application/octet-stream`||y===`application/pdf`?yield _.blob():y===`text/event-stream`?_:y===`multipart/form-data`?yield _.formData():yield _.text(),{data:b,error:null,response:_}}catch(e){return{data:null,error:e,response:e instanceof FunctionsHttpError||e instanceof FunctionsRelayError?e.context:void 0}}finally{r&&clearTimeout(r)}})}},DEFAULT_MAX_RETRIES=3,getRetryDelay=e=>Math.min(1e3*2**e,3e4),RETRYABLE_STATUS_CODES=[520,503],RETRYABLE_METHODS=[`GET`,`HEAD`,`OPTIONS`],PostgrestError=class extends Error{constructor(e){super(e.message),this.name=`PostgrestError`,this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function sleep$1(e,t){return new Promise(n=>{if(t?.aborted){n();return}let r=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e);function a(){clearTimeout(r),n()}t?.addEventListener(`abort`,a)})}function shouldRetry(e,t,n,r){return!(!r||n>=DEFAULT_MAX_RETRIES||!RETRYABLE_METHODS.includes(e)||!RETRYABLE_STATUS_CODES.includes(t))}var PostgrestBuilder=class{constructor(e){var t,n,r,a,o;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError??!1,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle??!1,this.shouldStripNulls=e.shouldStripNulls??!1,this.urlLengthLimit=e.urlLengthLimit??8e3,this.retryEnabled=e.retry??!0,this.fetch=e.fetch?e.fetch:fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get(`Accept`)===`text/csv`)throw Error(`stripNulls() cannot be used with csv()`);return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=this;if(this.schema===void 0||([`GET`,`HEAD`].includes(this.method)?this.headers.set(`Accept-Profile`,this.schema):this.headers.set(`Content-Profile`,this.schema)),this.method!==`GET`&&this.method!==`HEAD`&&this.headers.set(`Content-Type`,`application/json`),this.shouldStripNulls){let e=this.headers.get(`Accept`);e===`application/vnd.pgrst.object+json`?this.headers.set(`Accept`,`application/vnd.pgrst.object+json;nulls=stripped`):e&&e!==`application/json`||this.headers.set(`Accept`,`application/vnd.pgrst.array+json;nulls=stripped`)}let r=this.fetch,a=(async()=>{let e=0;for(;;){let o=new Headers(n.headers);e>0&&o.set(`X-Retry-Count`,String(e));let s;try{s=await r(n.url.toString(),{method:n.method,headers:o,body:JSON.stringify(n.body,(e,t)=>typeof t==`bigint`?t.toString():t),signal:n.signal})}catch(t){if(t?.name===`AbortError`||t?.code===`ABORT_ERR`||!RETRYABLE_METHODS.includes(n.method))throw t;if(n.retryEnabled&&e<DEFAULT_MAX_RETRIES){let t=getRetryDelay(e);e++,await sleep$1(t,n.signal);continue}throw t}if(shouldRetry(n.method,s.status,e,n.retryEnabled)){var t,a;let r=s.headers?.get(`Retry-After`)??null,o=r===null?getRetryDelay(e):Math.max(0,parseInt(r,10)||0)*1e3;await s.text(),e++,await sleep$1(o,n.signal)}else return await n.processResponse(s)}})();return this.shouldThrowOnError||(a=a.catch(e=>{var t;let n=``,r=``,a=``,o=e?.cause;if(o){var s,c,l,u;let t=o?.message??``,r=o?.code??``;n=`${e?.name??`FetchError`}: ${e?.message}`,n+=`\n\nCaused by: ${o?.name??`Error`}: ${t}`,r&&(n+=` (${r})`),o?.stack&&(n+=`\n${o.stack}`)}else{var d;n=e?.stack??``}let f=this.url.toString().length;return e?.name===`AbortError`||e?.code===`ABORT_ERR`?(a=``,r=`Request was aborted (timeout or manual cancellation)`,f>this.urlLengthLimit&&(r+=`. Note: Your request URL is ${f} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(o?.name===`HeadersOverflowError`||o?.code===`UND_ERR_HEADERS_OVERFLOW`)&&(a=``,r=`HTTP headers exceeded server limits (typically 16KB)`,f>this.urlLengthLimit&&(r+=`. Your request URL is ${f} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${e?.name??`FetchError`}: ${e?.message}`,details:n,hint:r,code:a},data:null,count:null,status:0,statusText:``}})),a.then(e,t)}async processResponse(e){var t=this;let n=null,r=null,a=null,o=e.status,s=e.statusText;if(e.ok){var c,l;if(t.method!==`HEAD`){var u;let n=await e.text();n===``||(r=t.headers.get(`Accept`)===`text/csv`||t.headers.get(`Accept`)&&t.headers.get(`Accept`)?.includes(`application/vnd.pgrst.plan+text`)?n:JSON.parse(n))}let d=t.headers.get(`Prefer`)?.match(/count=(exact|planned|estimated)/),f=e.headers.get(`content-range`)?.split(`/`);d&&f&&f.length>1&&(a=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:`PGRST116`,details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:`JSON object requested, multiple (or no) rows returned`},r=null,a=null,o=406,s=`Not Acceptable`):r=r.length===1?r[0]:null)}else{let a=await e.text();try{n=JSON.parse(a),Array.isArray(n)&&e.status===404&&(r=[],n=null,o=200,s=`OK`)}catch{e.status===404&&a===``?(o=204,s=`No Content`):n={message:a}}if(n&&t.shouldThrowOnError)throw new PostgrestError(n)}return{success:n===null,error:n,data:r,count:a,status:o,statusText:s}}returns(){return this}overrideTypes(){return this}},PostgrestTransformBuilder=class extends PostgrestBuilder{select(e){let t=!1,n=(e??`*`).split(``).map(e=>/\s/.test(e)&&!t?``:(e===`"`&&(t=!t),e)).join(``);return this.url.searchParams.set(`select`,n),this.headers.append(`Prefer`,`return=representation`),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:a=r}={}){let o=a?`${a}.order`:`order`,s=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${s?`${s},`:``}${e}.${t?`asc`:`desc`}${n===void 0?``:n?`.nullsfirst`:`.nullslast`}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){let r=n===void 0?`limit`:`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){let a=r===void 0?`offset`:`${r}.offset`,o=r===void 0?`limit`:`${r}.limit`;return this.url.searchParams.set(a,`${e}`),this.url.searchParams.set(o,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set(`Accept`,`application/vnd.pgrst.object+json`),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set(`Accept`,`text/csv`),this}geojson(){return this.headers.set(`Accept`,`application/geo+json`),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:a=!1,format:o=`text`}={}){var s;let c=[e?`analyze`:null,t?`verbose`:null,n?`settings`:null,r?`buffers`:null,a?`wal`:null].filter(Boolean).join(`|`),l=this.headers.get(`Accept`)??`application/json`;return this.headers.set(`Accept`,`application/vnd.pgrst.plan+${o}; for="${l}"; options=${c};`),this}rollback(){return this.headers.append(`Prefer`,`tx=rollback`),this}returns(){return this}maxAffected(e){return this.headers.append(`Prefer`,`handling=strict`),this.headers.append(`Prefer`,`max-affected=${e}`),this}},PostgrestReservedCharsRegexp=RegExp(`[,()]`),PostgrestFilterBuilder=class extends PostgrestTransformBuilder{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(`,`)}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(`,`)}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(`,`)}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(`,`)}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){let n=Array.from(new Set(t)).map(e=>typeof e==`string`&&PostgrestReservedCharsRegexp.test(e)?`"${e}"`:`${e}`).join(`,`);return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){let n=Array.from(new Set(t)).map(e=>typeof e==`string`&&PostgrestReservedCharsRegexp.test(e)?`"${e}"`:`${e}`).join(`,`);return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t==`string`?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(`,`)}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t==`string`?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(`,`)}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t==`string`?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(`,`)}}`),this}textSearch(e,t,{config:n,type:r}={}){let a=``;r===`plain`?a=`pl`:r===`phrase`?a=`ph`:r===`websearch`&&(a=`w`);let o=n===void 0?``:`(${n})`;return this.url.searchParams.append(e,`${a}fts${o}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>t!==void 0).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){let r=n?`${n}.or`:`or`;return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},PostgrestQueryBuilder=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:a=8e3,retry:o}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=a,this.retry=o}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){let{head:n=!1,count:r}=t??{},a=n?`HEAD`:`GET`,o=!1,s=(e??`*`).split(``).map(e=>/\s/.test(e)&&!o?``:(e===`"`&&(o=!o),e)).join(``),{url:c,headers:l}=this.cloneRequestState();return c.searchParams.set(`select`,s),r&&l.append(`Prefer`,`count=${r}`),new PostgrestFilterBuilder({method:a,url:c,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;let a=`POST`,{url:o,headers:s}=this.cloneRequestState();if(t&&s.append(`Prefer`,`count=${t}`),n||s.append(`Prefer`,`missing=default`),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);o.searchParams.set(`columns`,e.join(`,`))}}return new PostgrestFilterBuilder({method:`POST`,url:o,headers:s,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:a=!0}={}){var o;let s=`POST`,{url:c,headers:l}=this.cloneRequestState();if(l.append(`Prefer`,`resolution=${n?`ignore`:`merge`}-duplicates`),t!==void 0&&c.searchParams.set(`on_conflict`,t),r&&l.append(`Prefer`,`count=${r}`),a||l.append(`Prefer`,`missing=default`),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);c.searchParams.set(`columns`,e.join(`,`))}}return new PostgrestFilterBuilder({method:`POST`,url:c,headers:l,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var n;let r=`PATCH`,{url:a,headers:o}=this.cloneRequestState();return t&&o.append(`Prefer`,`count=${t}`),new PostgrestFilterBuilder({method:`PATCH`,url:a,headers:o,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;let n=`DELETE`,{url:r,headers:a}=this.cloneRequestState();return e&&a.append(`Prefer`,`count=${e}`),new PostgrestFilterBuilder({method:`DELETE`,url:r,headers:a,schema:this.schema,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function _typeof$2(e){"@babel/helpers - typeof";return _typeof$2=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},_typeof$2(e)}function toPrimitive$2(e,t){if(_typeof$2(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_typeof$2(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function toPropertyKey$2(e){var t=toPrimitive$2(e,`string`);return _typeof$2(t)==`symbol`?t:t+``}function _defineProperty$2(e,t,n){return(t=toPropertyKey$2(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys$2(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 _objectSpread2$2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ownKeys$2(Object(n),!0).forEach(function(t){_defineProperty$2(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys$2(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var PostgrestClient=class e{constructor(e,{headers:t={},schema:n,fetch:r,timeout:a,urlLengthLimit:o=8e3,retry:s}={}){this.url=e,this.headers=new Headers(t),this.schemaName=n,this.urlLengthLimit=o;let c=r??globalThis.fetch;this.fetch=a!==void 0&&a>0?(e,t)=>{let n=new AbortController,r=setTimeout(()=>n.abort(),a),o=t?.signal;if(o){if(o.aborted)return clearTimeout(r),c(e,t);let a=()=>{clearTimeout(r),n.abort()};return o.addEventListener(`abort`,a,{once:!0}),c(e,_objectSpread2$2(_objectSpread2$2({},t),{},{signal:n.signal})).finally(()=>{clearTimeout(r),o.removeEventListener(`abort`,a)})}return c(e,_objectSpread2$2(_objectSpread2$2({},t),{},{signal:n.signal})).finally(()=>clearTimeout(r))}:c,this.retry=s}from(e){if(!e||typeof e!=`string`||e.trim()===``)throw Error(`Invalid relation name: relation must be a non-empty string.`);return new PostgrestQueryBuilder(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:n=!1,get:r=!1,count:a}={}){var o;let s,c=new URL(`${this.url}/rpc/${e}`),l,u=e=>typeof e==`object`&&!!e&&(!Array.isArray(e)||e.some(u)),d=n&&Object.values(t).some(u);d?(s=`POST`,l=t):n||r?(s=n?`HEAD`:`GET`,Object.entries(t).filter(([e,t])=>t!==void 0).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(`,`)}}`:`${t}`]).forEach(([e,t])=>{c.searchParams.append(e,t)})):(s=`POST`,l=t);let f=new Headers(this.headers);return d?f.set(`Prefer`,a?`count=${a},return=minimal`:`return=minimal`):a&&f.set(`Prefer`,`count=${a}`),new PostgrestFilterBuilder({method:s,url:c,headers:f,schema:this.schemaName,body:l,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},WebSocketFactory=class{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<`u`)return{type:`native`,wsConstructor:WebSocket};let t=globalThis;if(typeof globalThis<`u`&&t.WebSocket!==void 0)return{type:`native`,wsConstructor:t.WebSocket};let n=global$1===void 0?void 0:global$1;if(n&&n.WebSocket!==void 0)return{type:`native`,wsConstructor:n.WebSocket};if(typeof globalThis<`u`&&t.WebSocketPair!==void 0&&globalThis.WebSocket===void 0)return{type:`cloudflare`,error:`Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.`,workaround:`Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.`};if(typeof globalThis<`u`&&t.EdgeRuntime||typeof navigator<`u`&&navigator.userAgent?.includes(`Vercel-Edge`))return{type:`unsupported`,error:`Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.`,workaround:`Use serverless functions or a different deployment target for WebSocket functionality.`};let r=globalThis.process;if(r){let e=r.versions;if(e&&e.node){let t=e.node,n=parseInt(t.replace(/^v/,``).split(`.`)[0]);return n>=22?globalThis.WebSocket===void 0?{type:`unsupported`,error:`Node.js ${n} detected but native WebSocket not found.`,workaround:`Provide a WebSocket implementation via the transport option.`}:{type:`native`,wsConstructor:globalThis.WebSocket}:{type:`unsupported`,error:`Node.js ${n} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
10
10
|
import ws from "ws"
|
|
11
11
|
new RealtimeClient(url, { transport: ws })`}}}return{type:`unsupported`,error:`Unknown JavaScript runtime without WebSocket support.`,workaround:`Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation.`}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let t=e.error||`WebSocket not supported in this environment.`;throw e.workaround&&(t+=`\n\nSuggested solution: ${e.workaround}`),Error(t)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return e.type===`native`||e.type===`ws`}catch{return!1}}},version$2=`2.106.1`,DEFAULT_VERSION=`realtime-js/${version$2}`,VSN_1_0_0=`1.0.0`,VSN_2_0_0=`2.0.0`,DEFAULT_VSN$1=VSN_2_0_0,DEFAULT_TIMEOUT$1=1e4,CHANNEL_STATES$1={closed:`closed`,errored:`errored`,joined:`joined`,joining:`joining`,leaving:`leaving`},CHANNEL_EVENTS$1={close:`phx_close`,error:`phx_error`,join:`phx_join`,reply:`phx_reply`,leave:`phx_leave`,access_token:`access_token`},CONNECTION_STATE={connecting:`connecting`,open:`open`,closing:`closing`,closed:`closed`},Serializer=class{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT=`broadcast`,this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,t){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event==`string`)return t(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var t;return this._isArrayBuffer(e.payload?.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var t,n;let r=e.payload?.payload??new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,r)}_encodeJsonUserBroadcastPush(e){var t,n;let r=e.payload?.payload??{},a=new TextEncoder().encode(JSON.stringify(r)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(e,t,n){var r,a;let o=e.topic,s=e.ref??``,c=e.join_ref??``,l=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},d=Object.keys(u).length===0?``:JSON.stringify(u);if(c.length>255)throw Error(`joinRef length ${c.length} exceeds maximum of 255`);if(s.length>255)throw Error(`ref length ${s.length} exceeds maximum of 255`);if(o.length>255)throw Error(`topic length ${o.length} exceeds maximum of 255`);if(l.length>255)throw Error(`userEvent length ${l.length} exceeds maximum of 255`);if(d.length>255)throw Error(`metadata length ${d.length} exceeds maximum of 255`);let f=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+s.length+o.length+l.length+d.length,m=new ArrayBuffer(this.HEADER_LENGTH+f),g=new DataView(m),_=0;g.setUint8(_++,this.KINDS.userBroadcastPush),g.setUint8(_++,c.length),g.setUint8(_++,s.length),g.setUint8(_++,o.length),g.setUint8(_++,l.length),g.setUint8(_++,d.length),g.setUint8(_++,t),Array.from(c,e=>g.setUint8(_++,e.charCodeAt(0))),Array.from(s,e=>g.setUint8(_++,e.charCodeAt(0))),Array.from(o,e=>g.setUint8(_++,e.charCodeAt(0))),Array.from(l,e=>g.setUint8(_++,e.charCodeAt(0))),Array.from(d,e=>g.setUint8(_++,e.charCodeAt(0)));var v=new Uint8Array(m.byteLength+n.byteLength);return v.set(new Uint8Array(m),0),v.set(new Uint8Array(n),m.byteLength),v.buffer}decode(e,t){if(this._isArrayBuffer(e))return t(this._binaryDecode(e));if(typeof e==`string`){let[n,r,a,o,s]=JSON.parse(e);return t({join_ref:n,ref:r,topic:a,event:o,payload:s})}return t({})}_binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,t,r)}}_decodeUserBroadcast(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),o=t.getUint8(3),s=t.getUint8(4),c=this.HEADER_LENGTH+4,l=n.decode(e.slice(c,c+r));c+=r;let u=n.decode(e.slice(c,c+a));c+=a;let d=n.decode(e.slice(c,c+o));c+=o;let f=e.slice(c,e.byteLength),m=s===this.JSON_ENCODING?JSON.parse(n.decode(f)):f,g={type:this.BROADCAST_EVENT,event:u,payload:m};return o>0&&(g.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:l,event:this.BROADCAST_EVENT,payload:g}}_isArrayBuffer(e){var t;return e instanceof ArrayBuffer||e?.constructor?.name===`ArrayBuffer`}_pick(e,t){return!e||typeof e!=`object`?{}:Object.fromEntries(Object.entries(e).filter(([e])=>t.includes(e)))}},PostgresTypes;(function(e){e.abstime=`abstime`,e.bool=`bool`,e.date=`date`,e.daterange=`daterange`,e.float4=`float4`,e.float8=`float8`,e.int2=`int2`,e.int4=`int4`,e.int4range=`int4range`,e.int8=`int8`,e.int8range=`int8range`,e.json=`json`,e.jsonb=`jsonb`,e.money=`money`,e.numeric=`numeric`,e.oid=`oid`,e.reltime=`reltime`,e.text=`text`,e.time=`time`,e.timestamp=`timestamp`,e.timestamptz=`timestamptz`,e.timetz=`timetz`,e.tsrange=`tsrange`,e.tstzrange=`tstzrange`})(PostgresTypes||={});var convertChangeData=(e,t,n={})=>{var r;let a=n.skipTypes??[];return t?Object.keys(t).reduce((n,r)=>(n[r]=convertColumn(r,e,t,a),n),{}):{}},convertColumn=(e,t,n,r)=>{let a=t.find(t=>t.name===e)?.type,o=n[e];return a&&!r.includes(a)?convertCell(a,o):noop(o)},convertCell=(e,t)=>{if(e.charAt(0)===`_`)return toArray(t,e.slice(1,e.length));switch(e){case PostgresTypes.bool:return toBoolean(t);case PostgresTypes.float4:case PostgresTypes.float8:case PostgresTypes.int2:case PostgresTypes.int4:case PostgresTypes.int8:case PostgresTypes.numeric:case PostgresTypes.oid:return toNumber(t);case PostgresTypes.json:case PostgresTypes.jsonb:return toJson(t);case PostgresTypes.timestamp:return toTimestampString(t);case PostgresTypes.abstime:case PostgresTypes.date:case PostgresTypes.daterange:case PostgresTypes.int4range:case PostgresTypes.int8range:case PostgresTypes.money:case PostgresTypes.reltime:case PostgresTypes.text:case PostgresTypes.time:case PostgresTypes.timestamptz:case PostgresTypes.timetz:case PostgresTypes.tsrange:case PostgresTypes.tstzrange:default:return noop(t)}},noop=e=>e,toBoolean=e=>{switch(e){case`t`:return!0;case`f`:return!1;default:return e}},toNumber=e=>{if(typeof e==`string`){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},toJson=e=>{if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e},toArray=(e,t)=>{if(typeof e!=`string`)return e;let n=e.length-1,r=e[n];if(e[0]===`{`&&r===`}`){let r,a=e.slice(1,n);try{r=JSON.parse(`[`+a+`]`)}catch{r=a?a.split(`,`):[]}return r.map(e=>convertCell(t,e))}return e},toTimestampString=e=>typeof e==`string`?e.replace(` `,`T`):e,httpEndpointURL=e=>{let t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,`http`),t.pathname=t.pathname.replace(/\/+$/,``).replace(/\/socket\/websocket$/i,``).replace(/\/socket$/i,``).replace(/\/websocket$/i,``),t.pathname===``||t.pathname===`/`?t.pathname=`/api/broadcast`:t.pathname+=`/api/broadcast`,t.href},closure=e=>typeof e==`function`?e:function(){return e},globalSelf=typeof self<`u`?self:null,phxWindow=typeof window<`u`?window:null,global=globalSelf||phxWindow||globalThis,DEFAULT_VSN=`2.0.0`,DEFAULT_TIMEOUT=1e4,WS_CLOSE_NORMAL=1e3,SOCKET_STATES={connecting:0,open:1,closing:2,closed:3},CHANNEL_STATES={closed:`closed`,errored:`errored`,joined:`joined`,joining:`joining`,leaving:`leaving`},CHANNEL_EVENTS={close:`phx_close`,error:`phx_error`,join:`phx_join`,reply:`phx_reply`,leave:`phx_leave`},TRANSPORTS={longpoll:`longpoll`,websocket:`websocket`},XHR_STATES={complete:4},AUTH_TOKEN_PREFIX=`base64url.bearer.phx.`,Push=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived(`timeout`)||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger(`timeout`,{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Timer=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries+=1,this.callback()},this.timerCalc(this.tries+1))}},Channel=class{constructor(e,t,n){this.state=CHANNEL_STATES.closed,this.topic=e,this.params=closure(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Push(this,CHANNEL_EVENTS.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Timer(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive(`ok`,()=>{this.state=CHANNEL_STATES.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive(`error`,e=>{this.state=CHANNEL_STATES.errored,this.socket.hasLogger()&&this.socket.log(`channel`,`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log(`channel`,`close ${this.topic}`),this.state=CHANNEL_STATES.closed,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log(`channel`,`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=CHANNEL_STATES.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive(`timeout`,()=>{this.socket.hasLogger()&&this.socket.log(`channel`,`timeout ${this.topic}`,this.joinPush.timeout),new Push(this,CHANNEL_EVENTS.leave,closure({}),this.timeout).send(),this.state=CHANNEL_STATES.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(CHANNEL_EVENTS.reply,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw Error(`tried to join multiple times. 'join' can only be called a single time per channel instance`);return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=CHANNEL_STATES.closed,this.bindings=[]}onClose(e){this.on(CHANNEL_EVENTS.close,e)}onError(e){return this.on(CHANNEL_EVENTS.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>n.event!==e||t!==void 0&&t!==n.ref)}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t||={},!this.joinedOnce)throw Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new Push(this,e,function(){return t},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=CHANNEL_STATES.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log(`channel`,`leave ${this.topic}`),this.trigger(CHANNEL_EVENTS.close,`leave`)},n=new Push(this,CHANNEL_EVENTS.leave,closure({}),e);return n.receive(`ok`,()=>t()).receive(`timeout`,()=>t()),n.send(),this.canPush()||n.trigger(`ok`,{}),n}onMessage(e,t,n){return t}filterBindings(e,t,n){return!0}isMember(e,t,n,r){return this.topic===e?r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log(`channel`,`dropping outdated message`,{topic:e,event:t,payload:n,joinRef:r}),!1):!0:!1}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=CHANNEL_STATES.joining,this.joinPush.resend(e))}trigger(e,t,n,r){let a=this.onMessage(e,t,n,r);if(t&&!a)throw Error(`channel onMessage callbacks must return the payload, modified or unmodified`);let o=this.bindings.filter(r=>r.event===e&&this.filterBindings(r,t,n));for(let e=0;e<o.length;e++)o[e].callback(a,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===CHANNEL_STATES.closed}isErrored(){return this.state===CHANNEL_STATES.errored}isJoined(){return this.state===CHANNEL_STATES.joined}isJoining(){return this.state===CHANNEL_STATES.joining}isLeaving(){return this.state===CHANNEL_STATES.leaving}},Ajax=class{static request(e,t,n,r,a,o,s){if(global.XDomainRequest){let n=new global.XDomainRequest;return this.xdomainRequest(n,e,t,r,a,o,s)}if(global.XMLHttpRequest){let c=new global.XMLHttpRequest;return this.xhrRequest(c,e,t,n,r,a,o,s)}if(global.fetch&&global.AbortController)return this.fetchRequest(e,t,n,r,a,o,s);throw Error(`No suitable XMLHttpRequest implementation found`)}static fetchRequest(e,t,n,r,a,o,s){let c={method:e,headers:n,body:r},l=null;return a&&(l=new AbortController,setTimeout(()=>l.abort(),a),c.signal=l.signal),global.fetch(t,c).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>s&&s(e)).catch(e=>{e.name===`AbortError`&&o?o():s&&s(null)}),l}static xdomainRequest(e,t,n,r,a,o,s){return e.timeout=a,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);s&&s(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,a,o,s,c){e.open(t,n,!0),e.timeout=o;for(let[t,n]of Object.entries(r))e.setRequestHeader(t,n);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{e.readyState===XHR_STATES.complete&&c&&c(this.parseJSON(e.responseText))},s&&(e.ontimeout=s),e.send(a),e}static parseJSON(e){if(!e||e===``)return null;try{return JSON.parse(e)}catch{return console&&console.log(`failed to parse JSON response`,e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let a=t?`${t}[${r}]`:r,o=e[r];typeof o==`object`?n.push(this.serialize(o,a)):n.push(encodeURIComponent(a)+`=`+encodeURIComponent(o))}return n.join(`&`)}static appendParams(e,t){return Object.keys(t).length===0?e:`${e}${e.match(/\?/)?`&`:`?`}${this.serialize(t)}`}},arrayBufferToBase64=e=>{let t=``,n=new Uint8Array(e),r=n.byteLength;for(let e=0;e<r;e++)t+=String.fromCharCode(n[e]);return btoa(t)},LongPoll=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(AUTH_TOKEN_PREFIX)&&(this.authToken=atob(t[1].slice(AUTH_TOKEN_PREFIX.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=SOCKET_STATES.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace(`ws://`,`http://`).replace(`wss://`,`https://`).replace(RegExp(`(.*)/`+TRANSPORTS.websocket),`$1/`+TRANSPORTS.longpoll)}endpointURL(){return Ajax.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=SOCKET_STATES.connecting}ontimeout(){this.onerror(`timeout`),this.closeAndRetry(1005,`timeout`,!1)}isActive(){return this.readyState===SOCKET_STATES.open||this.readyState===SOCKET_STATES.connecting}poll(){let e={Accept:`application/json`};this.authToken&&(e[`X-Phoenix-AuthToken`]=this.authToken),this.ajax(`GET`,e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:n,messages:r}=e;if(t===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,`session_gone`,!1);return}this.token=n}else t=0;switch(t){case 200:r.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=SOCKET_STATES.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,`forbidden`,!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,`internal server error`,500);break;default:throw Error(`unhandled poll status ${t}`)}})}send(e){typeof e!=`string`&&(e=arrayBufferToBase64(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax(`POST`,{"Content-Type":`application/x-ndjson`},e.join(`
|
|
12
12
|
`),()=>this.onerror(`timeout`),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,`internal server error`,!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let e of this.reqs)e.abort();this.readyState=SOCKET_STATES.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<`u`?this.onclose(new CloseEvent(`close`,r)):this.onclose(r)}ajax(e,t,n,r,a){let o;o=Ajax.request(e,this.endpointURL(),t,n,this.timeout,()=>{this.reqs.delete(o),r()},e=>{this.reqs.delete(o),this.isActive()&&a(e)}),this.reqs.add(o)}},Presence=class e{constructor(t,n={}){let r=n.events||{state:`presence_state`,diff:`presence_diff`};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,t=>{let{onJoin:n,onLeave:r,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,n,r),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,n,r)}),this.pendingDiffs=[],a()}),this.channel.on(r.diff,t=>{let{onJoin:n,onLeave:r,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,n,r),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,n,r){let a=this.clone(e),o={},s={};return this.map(a,(e,n)=>{t[e]||(s[e]=n)}),this.map(t,(e,t)=>{let n=a[e];if(n){let r=t.metas.map(e=>e.phx_ref),a=n.metas.map(e=>e.phx_ref),c=t.metas.filter(e=>a.indexOf(e.phx_ref)<0),l=n.metas.filter(e=>r.indexOf(e.phx_ref)<0);c.length>0&&(o[e]=t,o[e].metas=c),l.length>0&&(s[e]=this.clone(n),s[e].metas=l)}else o[e]=t}),this.syncDiff(a,{joins:o,leaves:s},n,r)}static syncDiff(e,t,n,r){let{joins:a,leaves:o}=this.clone(t);return n||=function(){},r||=function(){},this.map(a,(t,r)=>{let a=e[t];if(e[t]=this.clone(r),a){let n=e[t].metas.map(e=>e.phx_ref),r=a.metas.filter(e=>n.indexOf(e.phx_ref)<0);e[t].metas.unshift(...r)}n(t,a,r)}),this.map(o,(t,n)=>{let a=e[t];if(!a)return;let o=n.metas.map(e=>e.phx_ref);a.metas=a.metas.filter(e=>o.indexOf(e.phx_ref)<0),r(t,a,n),a.metas.length===0&&delete e[t]}),e}static list(e,t){return t||=function(e,t){return t},this.map(e,(e,n)=>t(e,n))}static map(e,t){return Object.getOwnPropertyNames(e).map(n=>t(n,e[n]))}static clone(e){return JSON.parse(JSON.stringify(e))}},serializer_default={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,a,o,s]=JSON.parse(e);return t({join_ref:n,ref:r,topic:a,event:o,payload:s})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:a,payload:o}=e,s=this.META_LENGTH+t.length+n.length+a.length+r.length,c=new ArrayBuffer(this.HEADER_LENGTH+s),l=new DataView(c),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,n.length),l.setUint8(u++,a.length),l.setUint8(u++,r.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(a,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(r,e=>l.setUint8(u++,e.charCodeAt(0)));var d=new Uint8Array(c.byteLength+o.byteLength);return d.set(new Uint8Array(c),0),d.set(new Uint8Array(o),c.byteLength),d.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),o=t.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,c=n.decode(e.slice(s,s+r));s+=r;let l=n.decode(e.slice(s,s+a));s+=a;let u=n.decode(e.slice(s,s+o));return s+=o,{join_ref:c,ref:null,topic:l,event:u,payload:e.slice(s,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),o=t.getUint8(3),s=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(e.slice(c,c+r));c+=r;let u=n.decode(e.slice(c,c+a));c+=a;let d=n.decode(e.slice(c,c+o));c+=o;let f=n.decode(e.slice(c,c+s));c+=s;let m={status:f,response:e.slice(c,e.byteLength)};return{join_ref:l,ref:u,topic:d,event:CHANNEL_EVENTS.reply,payload:m}},decodeBroadcast(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),o=this.HEADER_LENGTH+2,s=n.decode(e.slice(o,o+r));o+=r;let c=n.decode(e.slice(o,o+a));return o+=a,{join_ref:null,ref:null,topic:s,event:c,payload:e.slice(o,e.byteLength)}}},Socket=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||DEFAULT_TIMEOUT,this.transport=t.transport||global.WebSocket||LongPoll,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let n=null;try{n=global&&global.sessionStorage}catch{}this.sessionStore=t.sessionStorage||n,this.establishedConnections=0,this.defaultEncoder=serializer_default.encode.bind(serializer_default),this.defaultDecoder=serializer_default.decode.bind(serializer_default),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||`arraybuffer`,this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport===LongPoll?(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder):(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder);let r=null;phxWindow&&phxWindow.addEventListener&&(phxWindow.addEventListener(`pagehide`,e=>{this.conn&&(this.disconnect(),r=this.connectClock)}),phxWindow.addEventListener(`pageshow`,e=>{r===this.connectClock&&(r=null,this.connect())}),phxWindow.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,n)=>{console.log(`${e}: ${t}`,n)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=closure(t.params||{}),this.endPoint=`${e}/${TRANSPORTS.websocket}`,this.vsn=t.vsn||DEFAULT_VSN,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Timer(()=>{this.pageHidden?(this.log(`Not reconnecting as page is hidden!`),this.teardown()):this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return LongPoll}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&=(this.conn.close(),null),this.transport=e}protocol(){return location.protocol.match(/^https/)?`wss`:`ws`}endPointURL(){let e=Ajax.appendParams(Ajax.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)===`/`?e.charAt(1)===`/`?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`:e}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log(`passing params to connect is deprecated. Instead pass :params to the Socket constructor`),this.params=closure(e)),(!this.conn||this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==LongPoll?this.connectWithFallback(LongPoll,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:`phoenix`,event:`heartbeat`,payload:{},ref:t});let r=this.onMessage(a=>{a.ref===t&&(this.off([r]),e(Date.now()-n))});return!0}transportName(e){return e===LongPoll?`LongPoll`:e.name}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=[`phoenix`,`${AUTH_TOKEN_PREFIX}${btoa(this.authToken).replace(/=/g,``)}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,a,o,s=this.transportName(e),c=t=>{this.log(`transport`,`falling back to ${s}...`,t),this.off([a,o]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${s}`))return c(`memorized`);this.fallbackTimer=setTimeout(c,t),o=this.onError(e=>{this.log(`transport`,`error`,e),r&&!n&&(clearTimeout(this.fallbackTimer),c(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,`true`),this.log(`transport`,`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(c,t),this.ping(e=>{this.log(`transport`,`connected to primary after`,e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log(`transport`,`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks(`open`)}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log(`transport`,`heartbeat timeout. Attempting to re-establish connection`);try{this.heartbeatCallback(`timeout`)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}this.triggerChanError(Error(`heartbeat timeout`)),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),WS_CLOSE_NORMAL,`heartbeat timeout`)}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();let r=this.conn;this.waitForBufferDone(r,()=>{t?r.close(t,n||``):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){n===5||!e.bufferedAmount?t():setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){n===5||e.readyState===SOCKET_STATES.closed?t():setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log(`transport`,`close`,e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks(`close`,e)}onConnError(e){this.hasLogger()&&this.log(`transport`,`error`,e);let t=this.transport,n=this.establishedConnections;this.triggerStateCallbacks(`error`,e,t,n),(t===this.transport||n>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(CHANNEL_EVENTS.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case SOCKET_STATES.connecting:return`connecting`;case SOCKET_STATES.open:return`open`;case SOCKET_STATES.closing:return`closing`;default:return`closed`}}isConnected(){return this.connectionState()===`open`}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>e.indexOf(t)===-1)}channel(e,t={}){let n=new Channel(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:a,join_ref:o}=e;this.log(`push`,`${t} ${n} (${o}, ${a})`,r)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return this.ref=e===this.ref?0:e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected())try{this.heartbeatCallback(`disconnected`)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}else if(this.pendingHeartbeatRef)this.heartbeatTimeout();else{this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:`phoenix`,event:`heartbeat`,payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback(`sent`)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:n,payload:r,ref:a,join_ref:o}=e;if(a&&a===this.pendingHeartbeatRef){let e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(r.status===`ok`?`ok`:`error`,e)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log(`receive`,`${r.status||``} ${t} ${n} ${a&&`(`+a+`)`||``}`.trim(),r);for(let e=0;e<this.channels.length;e++){let s=this.channels[e];s.isMember(t,n,r,o)&&s.trigger(n,r,a,o)}this.triggerStateCallbacks(`message`,e)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([n,r])=>{try{r(...t)}catch(t){this.log(`error`,`error in ${e} callback`,t)}})}catch(t){this.log(`error`,`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log(`transport`,`leaving duplicate topic "${e}"`),t.leave())}},PresenceAdapter=class e{constructor(t,n){let r=phoenixPresenceOptions(n);this.presence=new Presence(t.getChannel(),r),this.presence.onJoin((n,r,a)=>{let o=e.onJoinPayload(n,r,a);t.getChannel().trigger(`presence`,o)}),this.presence.onLeave((n,r,a)=>{let o=e.onLeavePayload(n,r,a);t.getChannel().trigger(`presence`,o)}),this.presence.onSync(()=>{t.getChannel().trigger(`presence`,{event:`sync`})})}get state(){return e.transformState(this.presence.state)}static transformState(e){return e=cloneState(e),Object.getOwnPropertyNames(e).reduce((t,n)=>(t[n]=transformState(e[n]),t),{})}static onJoinPayload(e,t,n){return{event:`join`,key:e,currentPresences:parseCurrentPresences(t),newPresences:transformState(n)}}static onLeavePayload(e,t,n){return{event:`leave`,key:e,currentPresences:parseCurrentPresences(t),leftPresences:transformState(n)}}};function transformState(e){return e.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function cloneState(e){return JSON.parse(JSON.stringify(e))}function phoenixPresenceOptions(e){return e?.events&&{events:e.events}}function parseCurrentPresences(e){return e?.metas?transformState(e):[]}var REALTIME_PRESENCE_LISTEN_EVENTS;(function(e){e.SYNC=`sync`,e.JOIN=`join`,e.LEAVE=`leave`})(REALTIME_PRESENCE_LISTEN_EVENTS||={});var RealtimePresence=class{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new PresenceAdapter(this.channel.channelAdapter,t)}};function normalizeChannelError(e){if(e instanceof Error)return e;if(typeof e==`string`)return Error(e);if(e&&typeof e==`object`){let t=e;if(typeof t.code==`number`){let n=typeof t.reason==`string`&&t.reason?` (${t.reason})`:``;return Error(`socket closed: ${t.code}${n}`,{cause:e})}return Error(`channel error: transport failure`,{cause:e})}return Error(`channel error: connection lost`)}var ChannelAdapter=class{constructor(e,t,n){let r=phoenixChannelParams(n);this.channel=e.getSocket().channel(t,r),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,t){return this.channel.on(e,t)}off(e,t){this.channel.off(e,t)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,t,n){let r;try{r=this.channel.push(e,t,n)}catch{throw Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>100){let e=this.channel.pushBuffer.shift();e.cancelTimeout(),this.socket.log(`channel`,`discarded push due to buffer overflow: ${e.event}`,e.payload())}return r}updateJoinPayload(e){let t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),e)}canPush(){return this.socket.isConnected()&&this.state===CHANNEL_STATES$1.joined}isJoined(){return this.state===CHANNEL_STATES$1.joined}isJoining(){return this.state===CHANNEL_STATES$1.joining}isClosed(){return this.state===CHANNEL_STATES$1.closed}isLeaving(){return this.state===CHANNEL_STATES$1.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}};function phoenixChannelParams(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:``,enabled:!1},private:!1},e.config)}}var REALTIME_POSTGRES_CHANGES_LISTEN_EVENT;(function(e){e.ALL=`*`,e.INSERT=`INSERT`,e.UPDATE=`UPDATE`,e.DELETE=`DELETE`})(REALTIME_POSTGRES_CHANGES_LISTEN_EVENT||={});var REALTIME_LISTEN_TYPES;(function(e){e.BROADCAST=`broadcast`,e.PRESENCE=`presence`,e.POSTGRES_CHANGES=`postgres_changes`,e.SYSTEM=`system`})(REALTIME_LISTEN_TYPES||={});var REALTIME_SUBSCRIBE_STATES;(function(e){e.SUBSCRIBED=`SUBSCRIBED`,e.TIMED_OUT=`TIMED_OUT`,e.CLOSED=`CLOSED`,e.CHANNEL_ERROR=`CHANNEL_ERROR`})(REALTIME_SUBSCRIBE_STATES||={});var RealtimeChannel=class e{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){var r,a;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,``),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:``,enabled:!1},private:!1},t.config),this.channelAdapter=new ChannelAdapter(this.socket.socketAdapter,e,this.params),this.presence=new RealtimePresence(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=httpEndpointURL(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&this.params.config?.broadcast?.replay)throw Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var n,r,a;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){let{config:{broadcast:n,presence:r,private:a}}=this.params,o=this.bindings.postgres_changes?.map(e=>e.filter)??[],s=!!this.bindings[REALTIME_LISTEN_TYPES.PRESENCE]&&this.bindings[REALTIME_LISTEN_TYPES.PRESENCE].length>0||this.params.config.presence?.enabled===!0,c={},l={broadcast:n,presence:Object.assign(Object.assign({},r),{enabled:s}),postgres_changes:o,private:a};this.socket.accessTokenValue&&(c.access_token=this.socket.accessTokenValue),this._onError(t=>{e?.(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR,normalizeChannelError(t))}),this._onClose(()=>e?.(REALTIME_SUBSCRIBE_STATES.CLOSED)),this.updateJoinPayload(Object.assign({config:l},c)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive(`ok`,async({postgres_changes:t})=>{this.socket._isManualToken()||this.socket.setAuth(),t===void 0?e?.(REALTIME_SUBSCRIBE_STATES.SUBSCRIBED):this._updatePostgresBindings(t,e)}).receive(`error`,t=>{this.state=CHANNEL_STATES$1.errored;let n=Object.values(t).join(`, `)||`error`;e?.(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR,Error(n,{cause:t}))}).receive(`timeout`,()=>{e?.(REALTIME_SUBSCRIBE_STATES.TIMED_OUT)})}return this}_updatePostgresBindings(t,n){var r;let a=this.bindings.postgres_changes,o=a?.length??0,s=[];for(let r=0;r<o;r++){let o=a[r],{filter:{event:c,schema:l,table:u,filter:d}}=o,f=t&&t[r];if(f&&f.event===c&&e.isFilterValueEqual(f.schema,l)&&e.isFilterValueEqual(f.table,u)&&e.isFilterValueEqual(f.filter,d))s.push(Object.assign(Object.assign({},o),{id:f.id}));else{this.unsubscribe(),this.state=CHANNEL_STATES$1.errored,n?.(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR,Error(`mismatch between server and client bindings for postgres changes`));return}}this.bindings.postgres_changes=s,this.state!=CHANNEL_STATES$1.errored&&n&&n(REALTIME_SUBSCRIBE_STATES.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:`presence`,event:`track`,payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:`presence`,event:`untrack`},e)}on(e,t,n){let r=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),a=e===REALTIME_LISTEN_TYPES.PRESENCE||e===REALTIME_LISTEN_TYPES.POSTGRES_CHANGES;if(r&&a)throw this.socket.log(`channel`,`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,t,n)}async httpSend(e,t,n={}){var r;if(t==null)return Promise.reject(Error(`Payload is required for httpSend()`));let a={apikey:this.socket.apiKey?this.socket.apiKey:``,"Content-Type":`application/json`};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);let o={method:`POST`,headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:t,private:this.private}]})},s=await this._fetchWithTimeout(this.broadcastEndpointURL,o,n.timeout??this.timeout);if(s.status===202)return{success:!0};let c=s.statusText;try{let e=await s.json();c=e.error||e.message||c}catch{}return Promise.reject(Error(c))}async send(e,t={}){var n,r;if(!this.channelAdapter.canPush()&&e.type===`broadcast`){console.warn(`Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.`);let{event:n,payload:r}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:``,"Content-Type":`application/json`};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);let o={method:`POST`,headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:n,payload:r,private:this.private}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,o,t.timeout??this.timeout);return await e.body?.cancel(),e.ok?`ok`:`error`}catch(e){return e instanceof Error&&e.name===`AbortError`?`timed out`:`error`}}return new Promise(n=>{var r,a,o;let s=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);e.type===`broadcast`&&!this.params?.config?.broadcast?.ack&&n(`ok`),s.receive(`ok`,()=>n(`ok`)),s.receive(`error`,()=>n(`error`)),s.receive(`timeout`,()=>n(`timed out`))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive(`ok`,()=>t(`ok`)).receive(`timeout`,()=>t(`timed out`)).receive(`error`,()=>t(`error`))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){let r=new AbortController,a=setTimeout(()=>r.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:r.signal}));return clearTimeout(a),o}_on(e,t,n){let r=e.toLocaleLowerCase(),a={type:r,filter:t,callback:n,ref:this.channelAdapter.on(e,n)};return this.bindings[r]?this.bindings[r].push(a):this.bindings[r]=[a],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{var r,a,o,s,c,l,u;let d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;let f=this.bindings[d]?.find(t=>t.ref===e.ref);if(!f)return!0;if([`broadcast`,`presence`,`postgres_changes`].includes(d)){if(`id`in f){let e=f.id,n=f.filter?.event;return e&&t.ids?.includes(e)&&(n===`*`||n?.toLocaleLowerCase()===t.data?.type.toLocaleLowerCase())}{let e=(f?.filter?.event)?.toLocaleLowerCase();return e===`*`||e===(t?.event)?.toLocaleLowerCase()}}return f.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){let{close:n,error:r,leave:a,join:o}=CHANNEL_EVENTS$1;return t&&[n,r,a,o].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if(typeof t==`object`&&`ids`in t){let e=t.data,{schema:n,table:r,commit_timestamp:a,type:o,errors:s}=e;return Object.assign(Object.assign({},{schema:n,table:r,commit_timestamp:a,eventType:o,new:{},old:{},errors:s}),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw Error(`cannot copy bindings into joined channel`);for(let t in e.bindings)for(let n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(e??void 0)===(t??void 0)}_getPayloadRecords(e){let t={new:{},old:{}};return(e.type===`INSERT`||e.type===`UPDATE`)&&(t.new=convertChangeData(e.columns,e.record)),(e.type===`UPDATE`||e.type===`DELETE`)&&(t.old=convertChangeData(e.columns,e.old_record)),t}},SocketAdapter=class{constructor(e,t){this.socket=new Socket(e,t)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,t,n,r=1e4){return new Promise(a=>{setTimeout(()=>a(`timeout`),r),this.socket.disconnect(()=>{e(),a(`ok`)},t,n)})}push(e){this.socket.push(e)}log(e,t,n){this.socket.log(e,t,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==CONNECTION_STATE.connecting}isDisconnecting(){return this.socket.connectionState()==CONNECTION_STATE.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}},CONNECTION_TIMEOUTS={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},RECONNECT_INTERVALS=[1e3,2e3,5e3,1e4],DEFAULT_RECONNECT_FALLBACK=1e4;function createMemorySessionStorage(){let e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var n;return Array.from(e.keys())[t]??null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function resolveSessionStorage(){try{if(typeof globalThis<`u`&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return createMemorySessionStorage()}var WORKER_SCRIPT=`
|
|
@@ -29,7 +29,7 @@ Option 2: Install and provide the "ws" package:
|
|
|
29
29
|
\r=`.split(``),FROM_BASE64URL=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<IGNORE_BASE64URL.length;t+=1)e[IGNORE_BASE64URL[t].charCodeAt(0)]=-2;for(let t=0;t<TO_BASE64URL.length;t+=1)e[TO_BASE64URL[t].charCodeAt(0)]=t;return e})();function byteToBase64URL(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;)n(TO_BASE64URL[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6;else if(t.queuedBits>0)for(t.queue<<=6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;)n(TO_BASE64URL[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6}function byteFromBase64URL(e,t,n){let r=FROM_BASE64URL[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else if(r===-2)return;else throw Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}function stringFromBase64URL(e){let t=[],n=e=>{t.push(String.fromCodePoint(e))},r={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},o=e=>{stringFromUTF8(e,r,n)};for(let t=0;t<e.length;t+=1)byteFromBase64URL(e.charCodeAt(t),a,o);return t.join(``)}function codepointToUTF8(e,t){if(e<=127)t(e);else if(e<=2047)t(192|e>>6),t(128|e&63);else if(e<=65535)t(224|e>>12),t(128|e>>6&63),t(128|e&63);else if(e<=1114111)t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);else throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function stringToUTF8(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){let t=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|t)+65536,n+=1}codepointToUTF8(r,t)}}function stringFromUTF8(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw Error(`Invalid UTF-8 sequence`);--t.utf8seq}else if(t.utf8seq>0){if(e<=127)throw Error(`Invalid UTF-8 sequence`);t.codepoint=t.codepoint<<6|e&63,--t.utf8seq,t.utf8seq===0&&n(t.codepoint)}}function base64UrlToUint8Array(e){let t=[],n={queue:0,queuedBits:0},r=e=>{t.push(e)};for(let t=0;t<e.length;t+=1)byteFromBase64URL(e.charCodeAt(t),n,r);return new Uint8Array(t)}function stringToUint8Array(e){let t=[];return stringToUTF8(e,e=>t.push(e)),new Uint8Array(t)}function bytesToBase64URL(e){let t=[],n={queue:0,queuedBits:0},r=e=>{t.push(e)};return e.forEach(e=>byteToBase64URL(e,n,r)),byteToBase64URL(null,n,r),t.join(``)}function expiresAt(e){return Math.round(Date.now()/1e3)+e}function generateCallbackId(){return Symbol(`auth-callback`)}var isBrowser=()=>typeof window<`u`&&typeof document<`u`,localStorageWriteTests={tested:!1,writable:!1},supportsLocalStorage=()=>{if(!isBrowser())return!1;try{if(typeof globalThis.localStorage!=`object`)return!1}catch{return!1}if(localStorageWriteTests.tested)return localStorageWriteTests.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),localStorageWriteTests.tested=!0,localStorageWriteTests.writable=!0}catch{localStorageWriteTests.tested=!0,localStorageWriteTests.writable=!1}return localStorageWriteTests.writable};function parseParametersFromURL(e){let t={},n=new URL(e);if(n.hash&&n.hash[0]===`#`)try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch{}return n.searchParams.forEach((e,n)=>{t[n]=e}),t}var resolveFetch$1=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),looksLikeFetchResponse=e=>typeof e==`object`&&!!e&&`status`in e&&`ok`in e&&`json`in e&&typeof e.json==`function`,setItemAsync=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},getItemAsync=async(e,t)=>{let n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return null}},removeItemAsync=async(e,t)=>{await e.removeItem(t)},Deferred=class e{constructor(){this.promise=new e.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}};Deferred.promiseConstructor=Promise;function decodeJWT(e){let t=e.split(`.`);if(t.length!==3)throw new AuthInvalidJwtError(`Invalid JWT structure`);for(let e=0;e<t.length;e++)if(!BASE64URL_REGEX.test(t[e]))throw new AuthInvalidJwtError(`JWT not in base64url format`);return{header:JSON.parse(stringFromBase64URL(t[0])),payload:JSON.parse(stringFromBase64URL(t[1])),signature:base64UrlToUint8Array(t[2]),raw:{header:t[0],payload:t[1]}}}async function sleep(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function retryable(e,t){return new Promise((n,r)=>{(async()=>{for(let a=0;a<1/0;a++)try{let r=await e(a);if(!t(a,null,r)){n(r);return}}catch(e){if(!t(a,e)){r(e);return}}})()})}function dec2hex(e){return(`0`+e.toString(16)).substr(-2)}function generatePKCEVerifier(){let e=56,t=new Uint32Array(56);if(typeof crypto>`u`){let e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~`,t=66,n=``;for(let e=0;e<56;e++)n+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~`.charAt(Math.floor(Math.random()*66));return n}return crypto.getRandomValues(t),Array.from(t,dec2hex).join(``)}async function sha256(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t),r=new Uint8Array(n);return Array.from(r).map(e=>String.fromCharCode(e)).join(``)}async function generatePKCEChallenge(e){if(typeof crypto>`u`||crypto.subtle===void 0||typeof TextEncoder>`u`)return console.warn(`WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256.`),e;let t=await sha256(e);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function getCodeChallengeAndMethod(e,t,n=!1){let r=generatePKCEVerifier(),a=r;n&&(a+=`/recovery`),await setItemAsync(e,`${t}-code-verifier`,a);let o=await generatePKCEChallenge(r);return[o,r===o?`plain`:`s256`]}var API_VERSION_REGEX=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function parseResponseAPIVersion(e){let t=e.headers.get(API_VERSION_HEADER_NAME);if(!t||!t.match(API_VERSION_REGEX))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function validateExp(e){if(!e)throw Error(`Missing exp claim`);if(e<=Math.floor(Date.now()/1e3))throw Error(`JWT has expired`)}function getAlgorithm(e){switch(e){case`RS256`:return{name:`RSASSA-PKCS1-v1_5`,hash:{name:`SHA-256`}};case`ES256`:return{name:`ECDSA`,namedCurve:`P-256`,hash:{name:`SHA-256`}};default:throw Error(`Invalid alg claim`)}}var UUID_REGEX=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function validateUUID(e){if(!UUID_REGEX.test(e))throw Error(`@supabase/auth-js: Expected parameter to be UUID but is not`)}function assertPasskeyExperimentalEnabled(e){if(!e.passkey)throw Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function userNotAvailableProxy(){return new Proxy({},{get:(e,t)=>{if(t===`__isUserNotAvailableProxy`)return!0;if(typeof t==`symbol`){let e=t.toString();if(e===`Symbol(Symbol.toPrimitive)`||e===`Symbol(Symbol.toStringTag)`||e===`Symbol(util.inspect.custom)`)return}throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function insecureUserWarningProxy(e,t){return new Proxy(e,{get:(e,n,r)=>{if(n===`__isInsecureUserWarningProxy`)return!0;if(typeof n==`symbol`){let t=n.toString();if(t===`Symbol(Symbol.toPrimitive)`||t===`Symbol(Symbol.toStringTag)`||t===`Symbol(util.inspect.custom)`||t===`Symbol(nodejs.util.inspect.custom)`)return Reflect.get(e,n,r)}return!t.value&&typeof n==`string`&&(console.warn(`Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server.`),t.value=!0),Reflect.get(e,n,r)}})}function deepClone(e){return JSON.parse(JSON.stringify(e))}var _getErrorMessage=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.msg==`string`)return t.msg;if(typeof t.message==`string`)return t.message;if(typeof t.error_description==`string`)return t.error_description;if(typeof t.error==`string`)return t.error}return JSON.stringify(e)},NETWORK_ERROR_CODES=[502,503,504,520,521,522,523,524,530];async function handleError(e){var t;if(!looksLikeFetchResponse(e))throw new AuthRetryableFetchError(_getErrorMessage(e),0);if(NETWORK_ERROR_CODES.includes(e.status))throw new AuthRetryableFetchError(_getErrorMessage(e),e.status);let n;try{n=await e.json()}catch(e){throw new AuthUnknownError(_getErrorMessage(e),e)}let r,a=parseResponseAPIVersion(e);if(a&&a.getTime()>=API_VERSIONS[`2024-01-01`].timestamp&&typeof n==`object`&&n&&typeof n.code==`string`?r=n.code:typeof n==`object`&&n&&typeof n.error_code==`string`&&(r=n.error_code),!r){if(typeof n==`object`&&n&&typeof n.weak_password==`object`&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((e,t)=>e&&typeof t==`string`,!0))throw new AuthWeakPasswordError(_getErrorMessage(n),e.status,n.weak_password.reasons)}else if(r===`weak_password`)throw new AuthWeakPasswordError(_getErrorMessage(n),e.status,n.weak_password?.reasons||[]);else if(r===`session_not_found`)throw new AuthSessionMissingError;throw new AuthApiError(_getErrorMessage(n),e.status||500,r)}var _getRequestParams=(e,t,n,r)=>{let a={method:e,headers:t?.headers||{}};return e===`GET`?a:(a.headers=Object.assign({"Content-Type":`application/json;charset=UTF-8`},t?.headers),a.body=JSON.stringify(r),Object.assign(Object.assign({},a),n))};async function _request(e,t,n,r){var a;let o=Object.assign({},r?.headers);o[`X-Supabase-Api-Version`]||(o[API_VERSION_HEADER_NAME]=API_VERSIONS[`2024-01-01`].name),r?.jwt&&(o.Authorization=`Bearer ${r.jwt}`);let s=r?.query??{};r?.redirectTo&&(s.redirect_to=r.redirectTo);let c=await _handleRequest(e,t,n+(Object.keys(s).length?`?`+new URLSearchParams(s).toString():``),{headers:o,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(c):{data:Object.assign({},c),error:null}}async function _handleRequest(e,t,n,r,a,o){let s=_getRequestParams(t,r,a,o),c;try{c=await e(n,Object.assign({},s))}catch(e){throw console.error(e),new AuthRetryableFetchError(_getErrorMessage(e),0)}if(c.ok||await handleError(c),r?.noResolveJson)return c;try{return await c.json()}catch(e){await handleError(e)}}function _sessionResponse(e){var t;let n=null;hasSession(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=expiresAt(e.expires_in)));let r=e.user??null;return{data:{session:n,user:r},error:null}}function _sessionResponsePassword(e){let t=_sessionResponse(e);return!t.error&&e.weak_password&&typeof e.weak_password==`object`&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message==`string`&&e.weak_password.reasons.reduce((e,t)=>e&&typeof t==`string`,!0)&&(t.data.weak_password=e.weak_password),t}function _userResponse(e){var t;return{data:{user:e.user??e},error:null}}function _ssoResponse(e){return{data:e,error:null}}function _generateLinkResponse(e){let{action_link:t,email_otp:n,hashed_token:r,redirect_to:a,verification_type:o}=e,s=__rest(e,[`action_link`,`email_otp`,`hashed_token`,`redirect_to`,`verification_type`]);return{data:{properties:{action_link:t,email_otp:n,hashed_token:r,redirect_to:a,verification_type:o},user:Object.assign({},s)},error:null}}function _noResolveJsonResponse(e){return e}function hasSession(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}var SIGN_OUT_SCOPES=[`global`,`local`,`others`],GoTrueAdminApi=class{_encodePathSegment(e){if(e===`.`||e===`..`)throw new AuthError(`Invalid path segment`);return encodeURIComponent(e)}constructor({url:e=``,headers:t={},fetch:n,experimental:r}){this.url=e,this.headers=t,this.fetch=resolveFetch$1(n),this.experimental=r??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,t=SIGN_OUT_SCOPES[0]){if(SIGN_OUT_SCOPES.indexOf(t)<0)throw Error(`@supabase/auth-js: Parameter scope must be one of ${SIGN_OUT_SCOPES.join(`, `)}`);try{return await _request(this.fetch,`POST`,`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await _request(this.fetch,`POST`,`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:_userResponse})}catch(e){if(isAuthError(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,n=__rest(e,[`options`]),r=Object.assign(Object.assign({},n),t);return`newEmail`in n&&(r.new_email=n?.newEmail,delete r.newEmail),await _request(this.fetch,`POST`,`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:_generateLinkResponse,redirectTo:t?.redirectTo})}catch(e){if(isAuthError(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await _request(this.fetch,`POST`,`${this.url}/admin/users`,{body:e,headers:this.headers,xform:_userResponse})}catch(e){if(isAuthError(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,n,r,a,o,s,c;try{let t={nextPage:null,lastPage:0,total:0},n=await _request(this.fetch,`GET`,`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(e?.page)?.toString()??``,per_page:(e?.perPage)?.toString()??``},xform:_noResolveJsonResponse});if(n.error)throw n.error;let r=await n.json(),a=n.headers.get(`x-total-count`)??0,o=n.headers.get(`link`)?.split(`,`)??[];return o.length>0&&(o.forEach(e=>{let n=parseInt(e.split(`;`)[0].split(`=`)[1].substring(0,1)),r=JSON.parse(e.split(`;`)[1].split(`=`)[1]);t[`${r}Page`]=n}),t.total=parseInt(a)),{data:Object.assign(Object.assign({},r),t),error:null}}catch(e){if(isAuthError(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){validateUUID(e);try{return await _request(this.fetch,`GET`,`${this.url}/admin/users/${e}`,{headers:this.headers,xform:_userResponse})}catch(e){if(isAuthError(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){validateUUID(e);try{return await _request(this.fetch,`PUT`,`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:_userResponse})}catch(e){if(isAuthError(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){validateUUID(e);try{return await _request(this.fetch,`DELETE`,`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:_userResponse})}catch(e){if(isAuthError(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){validateUUID(e.userId);try{let{data:t,error:n}=await _request(this.fetch,`GET`,`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:n}}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _deleteFactor(e){validateUUID(e.userId),validateUUID(e.id);try{return{data:await _request(this.fetch,`DELETE`,`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _listOAuthClients(e){var t,n,r,a,o,s,c;try{let t={nextPage:null,lastPage:0,total:0},n=await _request(this.fetch,`GET`,`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(e?.page)?.toString()??``,per_page:(e?.perPage)?.toString()??``},xform:_noResolveJsonResponse});if(n.error)throw n.error;let r=await n.json(),a=n.headers.get(`x-total-count`)??0,o=n.headers.get(`link`)?.split(`,`)??[];return o.length>0&&(o.forEach(e=>{let n=parseInt(e.split(`;`)[0].split(`=`)[1].substring(0,1)),r=JSON.parse(e.split(`;`)[1].split(`=`)[1]);t[`${r}Page`]=n}),t.total=parseInt(a)),{data:Object.assign(Object.assign({},r),t),error:null}}catch(e){if(isAuthError(e))return{data:{clients:[]},error:e};throw e}}async _createOAuthClient(e){try{return await _request(this.fetch,`POST`,`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _getOAuthClient(e){try{let t=this._encodePathSegment(e);return await _request(this.fetch,`GET`,`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _updateOAuthClient(e,t){try{let n=this._encodePathSegment(e);return await _request(this.fetch,`PUT`,`${this.url}/admin/oauth/clients/${n}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _deleteOAuthClient(e){try{let t=this._encodePathSegment(e);return await _request(this.fetch,`DELETE`,`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _regenerateOAuthClientSecret(e){try{let t=this._encodePathSegment(e);return await _request(this.fetch,`POST`,`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _listCustomProviders(e){try{let t={};return e?.type&&(t.type=e.type),await _request(this.fetch,`GET`,`${this.url}/admin/custom-providers`,{headers:this.headers,query:t,xform:e=>{var t;return{data:{providers:e?.providers??[]},error:null}}})}catch(e){if(isAuthError(e))return{data:{providers:[]},error:e};throw e}}async _createCustomProvider(e){try{return await _request(this.fetch,`POST`,`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _getCustomProvider(e){try{let t=this._encodePathSegment(e);return await _request(this.fetch,`GET`,`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _updateCustomProvider(e,t){try{let n=this._encodePathSegment(e);return await _request(this.fetch,`PUT`,`${this.url}/admin/custom-providers/${n}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _deleteCustomProvider(e){try{let t=this._encodePathSegment(e);return await _request(this.fetch,`DELETE`,`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _adminListPasskeys(e){assertPasskeyExperimentalEnabled(this.experimental),validateUUID(e.userId);try{return await _request(this.fetch,`GET`,`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}async _adminDeletePasskey(e){assertPasskeyExperimentalEnabled(this.experimental),validateUUID(e.userId),validateUUID(e.passkeyId);try{return await _request(this.fetch,`DELETE`,`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(isAuthError(e))return{data:null,error:e};throw e}}};function memoryLocalStorageAdapter(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}var internals={debug:!!(globalThis&&supportsLocalStorage()&&globalThis.localStorage&&globalThis.localStorage.getItem(`supabase.gotrue-js.locks.debug`)===`true`)},LockAcquireTimeoutError=class extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}},NavigatorLockAcquireTimeoutError=class extends LockAcquireTimeoutError{};async function navigatorLock(e,t,n){internals.debug&&console.log(`@supabase/gotrue-js: navigatorLock: acquire lock`,e,t);let r=new globalThis.AbortController,a;t>0&&(a=setTimeout(()=>{r.abort(),internals.debug&&console.log(`@supabase/gotrue-js: navigatorLock acquire timed out`,e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:`exclusive`,ifAvailable:!0}:{mode:`exclusive`,signal:r.signal},async r=>{if(r){clearTimeout(a),internals.debug&&console.log(`@supabase/gotrue-js: navigatorLock: acquired`,e,r.name);try{return await n()}finally{internals.debug&&console.log(`@supabase/gotrue-js: navigatorLock: released`,e,r.name)}}else if(t===0)throw internals.debug&&console.log(`@supabase/gotrue-js: navigatorLock: not immediately available`,e),new NavigatorLockAcquireTimeoutError(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);else{if(internals.debug)try{let e=await globalThis.navigator.locks.query();console.log(`@supabase/gotrue-js: Navigator LockManager state`,JSON.stringify(e,null,` `))}catch(e){console.warn(`@supabase/gotrue-js: Error when querying Navigator LockManager state`,e)}return console.warn(`@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request`),clearTimeout(a),await n()}})}catch(o){if(t>0&&clearTimeout(a),typeof o==`object`&&o&&`name`in o&&o.name===`AbortError`&&t>0){if(r.signal.aborted)return internals.debug&&console.log(`@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock`,e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:`exclusive`,steal:!0},async t=>{if(t){internals.debug&&console.log(`@supabase/gotrue-js: navigatorLock: recovered (stolen)`,e,t.name);try{return await n()}finally{internals.debug&&console.log(`@supabase/gotrue-js: navigatorLock: released (stolen)`,e,t.name)}}else return console.warn(`@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true`),await n()}));throw internals.debug&&console.log(`@supabase/gotrue-js: navigatorLock: lock was stolen by another request`,e),new NavigatorLockAcquireTimeoutError(`Lock "${e}" was released because another request stole it`)}throw o}}function polyfillGlobalThis(){if(typeof globalThis!=`object`)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<`u`&&(self.globalThis=self)}}function getAddress(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function fromHex(e){return parseInt(e,16)}function toHex(e){let t=new TextEncoder().encode(e);return`0x`+Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}function createSiweMessage(e){var t;let{chainId:n,domain:r,expirationTime:a,issuedAt:o=new Date,nonce:s,notBefore:c,requestId:l,resources:u,scheme:d,uri:f,version:m}=e;if(!Number.isInteger(n))throw Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw Error(`@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.`);if(s&&s.length<8)throw Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${s}`);if(!f)throw Error(`@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.`);if(m!==`1`)throw Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${m}`);if(e.statement?.includes(`
|
|
30
30
|
`))throw Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`);let g=getAddress(e.address),_=`${d?`${d}://${r}`:r} wants you to sign in with your Ethereum account:\n${g}\n\n${e.statement?`${e.statement}\n`:``}`,v=`URI: ${f}\nVersion: ${m}\nChain ID: ${n}${s?`\nNonce: ${s}`:``}\nIssued At: ${o.toISOString()}`;if(a&&(v+=`\nExpiration Time: ${a.toISOString()}`),c&&(v+=`\nNot Before: ${c.toISOString()}`),l&&(v+=`\nRequest ID: ${l}`),u){let e=`
|
|
31
31
|
Resources:`;for(let t of u){if(!t||typeof t!=`string`)throw Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${t}`);e+=`\n- ${t}`}v+=e}return`${_}\n${v}`}var WebAuthnError=class extends Error{constructor({message:e,code:t,cause:n,name:r}){var a;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=r??(n instanceof Error?n.name:void 0)??`Unknown Error`,this.code=t}toJSON(){return{name:this.name,message:this.message,code:this.code}}},WebAuthnUnknownError=class extends WebAuthnError{constructor(e,t){super({code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:t,message:e}),this.name=`WebAuthnUnknownError`,this.originalError=t}};function identifyRegistrationError({error:e,options:t}){var n,r,a;let{publicKey:o}=t;if(!o)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new WebAuthnError({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(o.authenticatorSelection?.requireResidentKey===!0)return new WebAuthnError({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&o.authenticatorSelection?.userVerification===`required`)return new WebAuthnError({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(o.authenticatorSelection?.userVerification===`required`)return new WebAuthnError({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new WebAuthnError({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new WebAuthnError({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return o.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new WebAuthnError({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new WebAuthnError({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=window.location.hostname;if(!isValidDomain(t))return new WebAuthnError({message:`${window.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(o.rp.id!==t)return new WebAuthnError({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`TypeError`){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new WebAuthnError({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new WebAuthnError({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return new WebAuthnError({message:`a Non-Webauthn related error has occurred`,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e})}function identifyAuthenticationError({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new WebAuthnError({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new WebAuthnError({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=window.location.hostname;if(!isValidDomain(t))return new WebAuthnError({message:`${window.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new WebAuthnError({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new WebAuthnError({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return new WebAuthnError({message:`a Non-Webauthn related error has occurred`,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e})}var WebAuthnAbortService=class{createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},webAuthnAbortService=new WebAuthnAbortService;function deserializeCredentialCreationOptions(e){if(!e)throw Error(`Credential creation options are required`);if(typeof PublicKeyCredential<`u`&&`parseCreationOptionsFromJSON`in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON==`function`)return PublicKeyCredential.parseCreationOptionsFromJSON(e);let{challenge:t,user:n,excludeCredentials:r}=e,a=__rest(e,[`challenge`,`user`,`excludeCredentials`]),o=base64UrlToUint8Array(t).buffer,s=Object.assign(Object.assign({},n),{id:base64UrlToUint8Array(n.id).buffer}),c=Object.assign(Object.assign({},a),{challenge:o,user:s});if(r&&r.length>0){c.excludeCredentials=Array(r.length);for(let e=0;e<r.length;e++){let t=r[e];c.excludeCredentials[e]=Object.assign(Object.assign({},t),{id:base64UrlToUint8Array(t.id).buffer,type:t.type||`public-key`,transports:t.transports})}}return c}function deserializeCredentialRequestOptions(e){if(!e)throw Error(`Credential request options are required`);if(typeof PublicKeyCredential<`u`&&`parseRequestOptionsFromJSON`in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON==`function`)return PublicKeyCredential.parseRequestOptionsFromJSON(e);let{challenge:t,allowCredentials:n}=e,r=__rest(e,[`challenge`,`allowCredentials`]),a=base64UrlToUint8Array(t).buffer,o=Object.assign(Object.assign({},r),{challenge:a});if(n&&n.length>0){o.allowCredentials=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e];o.allowCredentials[e]=Object.assign(Object.assign({},t),{id:base64UrlToUint8Array(t.id).buffer,type:t.type||`public-key`,transports:t.transports})}}return o}function serializeCredentialCreationResponse(e){var t;if(`toJSON`in e&&typeof e.toJSON==`function`)return e.toJSON();let n=e;return{id:e.id,rawId:e.id,response:{attestationObject:bytesToBase64URL(new Uint8Array(e.response.attestationObject)),clientDataJSON:bytesToBase64URL(new Uint8Array(e.response.clientDataJSON))},type:`public-key`,clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:n.authenticatorAttachment??void 0}}function serializeCredentialRequestResponse(e){var t;if(`toJSON`in e&&typeof e.toJSON==`function`)return e.toJSON();let n=e,r=e.getClientExtensionResults(),a=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:bytesToBase64URL(new Uint8Array(a.authenticatorData)),clientDataJSON:bytesToBase64URL(new Uint8Array(a.clientDataJSON)),signature:bytesToBase64URL(new Uint8Array(a.signature)),userHandle:a.userHandle?bytesToBase64URL(new Uint8Array(a.userHandle)):void 0},type:`public-key`,clientExtensionResults:r,authenticatorAttachment:n.authenticatorAttachment??void 0}}function isValidDomain(e){return e===`localhost`||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function browserSupportsWebAuthn(){var e,t;return!!(isBrowser()&&`PublicKeyCredential`in window&&window.PublicKeyCredential&&`credentials`in navigator&&typeof(navigator==null?void 0:navigator.credentials)?.create==`function`&&typeof(navigator==null?void 0:navigator.credentials)?.get==`function`)}async function createCredential(e){try{let t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new WebAuthnUnknownError(`Browser returned unexpected credential type`,t)}:{data:null,error:new WebAuthnUnknownError(`Empty credential response`,t)}}catch(t){return{data:null,error:identifyRegistrationError({error:t,options:e})}}}async function getCredential(e){try{let t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new WebAuthnUnknownError(`Browser returned unexpected credential type`,t)}:{data:null,error:new WebAuthnUnknownError(`Empty credential response`,t)}}catch(t){return{data:null,error:identifyAuthenticationError({error:t,options:e})}}}var DEFAULT_CREATION_OPTIONS={hints:[`security-key`],authenticatorSelection:{authenticatorAttachment:`cross-platform`,requireResidentKey:!1,userVerification:`preferred`,residentKey:`discouraged`},attestation:`direct`},DEFAULT_REQUEST_OPTIONS={userVerification:`preferred`,hints:[`security-key`],attestation:`direct`};function deepMerge(...e){let t=e=>typeof e==`object`&&!!e&&!Array.isArray(e),n=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),r={};for(let a of e)if(a)for(let e in a){let o=a[e];if(o!==void 0){if(Array.isArray(o))r[e]=o;else if(n(o))r[e]=o;else if(t(o)){let n=r[e];r[e]=t(n)?deepMerge(n,o):deepMerge(o)}else r[e]=o}}return r}function mergeCredentialCreationOptions(e,t){return deepMerge(DEFAULT_CREATION_OPTIONS,e,t||{})}function mergeCredentialRequestOptions(e,t){return deepMerge(DEFAULT_REQUEST_OPTIONS,e,t||{})}var WebAuthnApi=class{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:`webauthn`}))}async _challenge({factorId:e,webauthn:t,friendlyName:n,signal:r},a){var o;try{let{data:o,error:s}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!o)return{data:null,error:s};let c=r??webAuthnAbortService.createNewAbortSignal();if(o.webauthn.type===`create`){let{user:e}=o.webauthn.credential_options.publicKey;if(!e.name){let t=n;if(t)e.name=`${e.id}:${t}`;else{let t=(await this.client.getUser()).data.user,n=t?.user_metadata?.name||t?.email||t?.id||`User`;e.name=`${e.id}:${n}`}}e.displayName||=e.name}switch(o.webauthn.type){case`create`:{let{data:t,error:n}=await createCredential({publicKey:mergeCredentialCreationOptions(o.webauthn.credential_options.publicKey,a?.create),signal:c});return t?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:t}},error:null}:{data:null,error:n}}case`request`:{let t=mergeCredentialRequestOptions(o.webauthn.credential_options.publicKey,a?.request),{data:n,error:r}=await getCredential(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:t,signal:c}));return n?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:n}},error:null}:{data:null,error:r}}}}catch(e){return isAuthError(e)?{data:null,error:e}:{data:null,error:new AuthUnknownError(`Unexpected error in challenge`,e)}}}async _verify({challengeId:e,factorId:t,webauthn:n}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:t=typeof window<`u`?window.location.hostname:void 0,rpOrigins:n=typeof window<`u`?[window.location.origin]:void 0,signal:r}={}},a){if(!t)return{data:null,error:new AuthError(`rpId is required for WebAuthn authentication`)};try{if(!browserSupportsWebAuthn())return{data:null,error:new AuthUnknownError(`Browser does not support WebAuthn`,null)};let{data:o,error:s}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:n},signal:r},{request:a});if(!o)return{data:null,error:s};let{webauthn:c}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:c.type,rpId:t,rpOrigins:n,credential_response:c.credential_response}})}catch(e){return isAuthError(e)?{data:null,error:e}:{data:null,error:new AuthUnknownError(`Unexpected error in authenticate`,e)}}}async _register({friendlyName:e,webauthn:{rpId:t=typeof window<`u`?window.location.hostname:void 0,rpOrigins:n=typeof window<`u`?[window.location.origin]:void 0,signal:r}={}},a){if(!t)return{data:null,error:new AuthError(`rpId is required for WebAuthn registration`)};try{if(!browserSupportsWebAuthn())return{data:null,error:new AuthUnknownError(`Browser does not support WebAuthn`,null)};let{data:o,error:s}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(t=>{var n;return t.data?.all.find(t=>t.factor_type===`webauthn`&&t.friendly_name===e&&t.status!==`unverified`)}).then(e=>e?this.client.mfa.unenroll({factorId:e?.id}):void 0),{data:null,error:s};let{data:c,error:l}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:t,rpOrigins:n},signal:r},{create:a});return c?this._verify({factorId:o.id,challengeId:c.challengeId,webauthn:{rpId:t,rpOrigins:n,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:l}}catch(e){return isAuthError(e)?{data:null,error:e}:{data:null,error:new AuthUnknownError(`Unexpected error in register`,e)}}}};polyfillGlobalThis();var DEFAULT_OPTIONS={url:GOTRUE_URL,storageKey:STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:DEFAULT_HEADERS,flowType:`implicit`,debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function lockNoOp(e,t,n){return await n()}var GLOBAL_JWKS={},GoTrueClient=class e{get jwks(){var e,t;return GLOBAL_JWKS[this.storageKey]?.jwks??{keys:[]}}set jwks(e){GLOBAL_JWKS[this.storageKey]=Object.assign(Object.assign({},GLOBAL_JWKS[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return GLOBAL_JWKS[this.storageKey]?.cachedAt??-(2**53-1)}set jwks_cached_at(e){GLOBAL_JWKS[this.storageKey]=Object.assign(Object.assign({},GLOBAL_JWKS[this.storageKey]),{cachedAt:e})}constructor(t){var n,r,a,o;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;let s=Object.assign(Object.assign({},DEFAULT_OPTIONS),t);if(this.storageKey=s.storageKey,this.instanceID=e.nextInstanceID[this.storageKey]??0,e.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug==`function`&&(this.logger=s.debug),this.instanceID>0&&isBrowser()){let e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.experimental=s.experimental??{},this.admin=new GoTrueAdminApi({url:s.url,headers:s.headers,fetch:s.fetch,experimental:this.experimental}),this.url=s.url,this.headers=s.headers,this.fetch=resolveFetch$1(s.fetch),this.lock=s.lock||lockNoOp,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,this.lockAcquireTimeout=s.lockAcquireTimeout,this.lock=s.lock?s.lock:this.persistSession&&isBrowser()&&(globalThis==null?void 0:globalThis.navigator)?.locks?navigatorLock:lockNoOp,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=-(2**53-1)),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:supportsLocalStorage()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=memoryLocalStorageAdapter(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=memoryLocalStorageAdapter(this.memoryStorage)),isBrowser()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error(`Failed to create a new BroadcastChannel, multi-tab state changes will not be available`,e)}(o=this.broadcastChannel)==null||o.addEventListener(`message`,async e=>{this._debug(`received broadcast notification from other tab or client`,e);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug(`#broadcastChannel`,`error`,e)}})}s.skipAutoInitialize||this.initialize().catch(e=>{this._debug(`#initialize()`,`error`,e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${version$1}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise}async _initialize(){var e;try{let e={},t=`none`;if(isBrowser()&&(e=parseParametersFromURL(window.location.href),this._isImplicitGrantCallback(e)?t=`implicit`:await this._isPKCECallback(e)&&(t=`pkce`)),isBrowser()&&this.detectSessionInUrl&&t!==`none`){let{data:n,error:r}=await this._getSessionFromURL(e,t);if(r){if(this._debug(`#_initialize()`,`error detecting session from URL`,r),isAuthImplicitGrantRedirectError(r)){let e=r.details?.code;if(e===`identity_already_exists`||e===`identity_not_found`||e===`single_identity_not_deletable`)return{error:r}}return{error:r}}let{session:a,redirectType:o}=n;return this._debug(`#_initialize()`,`detected session in URL`,a,`redirect type`,o),await this._saveSession(a),setTimeout(async()=>{o===`recovery`?await this._notifyAllSubscribers(`PASSWORD_RECOVERY`,a):await this._notifyAllSubscribers(`SIGNED_IN`,a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return isAuthError(e)?this._returnResult({error:e}):this._returnResult({error:new AuthUnknownError(`Unexpected error during initialization`,e)})}finally{await this._handleVisibilityChange(),this._debug(`#_initialize()`,`end`)}}async signInAnonymously(e){var t,n,r;try{let{data:t,error:n}=await _request(this.fetch,`POST`,`${this.url}/signup`,{headers:this.headers,body:{data:e?.options?.data??{},gotrue_meta_security:{captcha_token:e?.options?.captchaToken}},xform:_sessionResponse});if(n||!t)return this._returnResult({data:{user:null,session:null},error:n});let r=t.session,a=t.user;return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers(`SIGNED_IN`,r)),this._returnResult({data:{user:a,session:r},error:null})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,n,r;try{let t;if(`email`in e){let{email:n,password:r,options:a}=e,o=null,s=null;this.flowType===`pkce`&&([o,s]=await getCodeChallengeAndMethod(this.storage,this.storageKey)),t=await _request(this.fetch,`POST`,`${this.url}/signup`,{headers:this.headers,redirectTo:a?.emailRedirectTo,body:{email:n,password:r,data:a?.data??{},gotrue_meta_security:{captcha_token:a?.captchaToken},code_challenge:o,code_challenge_method:s},xform:_sessionResponse})}else if(`phone`in e){let{phone:n,password:r,options:a}=e;t=await _request(this.fetch,`POST`,`${this.url}/signup`,{headers:this.headers,body:{phone:n,password:r,data:a?.data??{},channel:a?.channel??`sms`,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:_sessionResponse})}else throw new AuthInvalidCredentialsError(`You must provide either an email or phone number and a password`);let{data:n,error:r}=t;if(r||!n)return await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:r});let a=n.session,o=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers(`SIGNED_IN`,a)),this._returnResult({data:{user:o,session:a},error:null})}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if(`email`in e){let{email:n,password:r,options:a}=e;t=await _request(this.fetch,`POST`,`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:n,password:r,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:_sessionResponsePassword})}else if(`phone`in e){let{phone:n,password:r,options:a}=e;t=await _request(this.fetch,`POST`,`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:n,password:r,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:_sessionResponsePassword})}else throw new AuthInvalidCredentialsError(`You must provide either an email or phone number and a password`);let{data:n,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!n||!n.session||!n.user){let e=new AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers(`SIGNED_IN`,n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:r})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,n,r,a;return await this._handleProviderSignIn(e.provider,{redirectTo:e.options?.redirectTo,scopes:e.options?.scopes,queryParams:e.options?.queryParams,skipBrowserRedirect:e.options?.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:t}=e;switch(t){case`ethereum`:return await this.signInWithEthereum(e);case`solana`:return await this.signInWithSolana(e);default:throw Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,n,r,a,o,s,c,l,u,d,f;let m,g;if(`message`in e)m=e.message,g=e.signature;else{let{chain:t,wallet:n,statement:r,options:a}=e,o;if(!isBrowser()){if(typeof n!=`object`||!a?.url)throw Error(`@supabase/auth-js: Both wallet and url must be specified in non-browser environments.`);o=n}else if(typeof n==`object`)o=n;else{let e=window;if(`ethereum`in e&&typeof e.ethereum==`object`&&`request`in e.ethereum&&typeof e.ethereum.request==`function`)o=e.ethereum;else throw Error(`@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.`)}let s=new URL(a?.url??window.location.href),c=await o.request({method:`eth_requestAccounts`}).then(e=>e).catch(()=>{throw Error(`@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid`)});if(!c||c.length===0)throw Error(`@supabase/auth-js: No accounts available. Please ensure the wallet is connected.`);let l=getAddress(c[0]),u=a?.signInWithEthereum?.chainId;u||=fromHex(await o.request({method:`eth_chainId`})),m=createSiweMessage({domain:s.host,address:l,statement:r,uri:s.href,version:`1`,chainId:u,nonce:a?.signInWithEthereum?.nonce,issuedAt:a?.signInWithEthereum?.issuedAt??new Date,expirationTime:a?.signInWithEthereum?.expirationTime,notBefore:a?.signInWithEthereum?.notBefore,requestId:a?.signInWithEthereum?.requestId,resources:a?.signInWithEthereum?.resources}),g=await o.request({method:`personal_sign`,params:[toHex(m),l]})}try{let{data:t,error:n}=await _request(this.fetch,`POST`,`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:`ethereum`,message:m,signature:g},e.options?.captchaToken?{gotrue_meta_security:{captcha_token:e.options?.captchaToken}}:null),xform:_sessionResponse});if(n)throw n;if(!t||!t.session||!t.user){let e=new AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers(`SIGNED_IN`,t.session)),this._returnResult({data:Object.assign({},t),error:n})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,n,r,a,o,s,c,l,u,d,f,m;let g,_;if(`message`in e)g=e.message,_=e.signature;else{let{chain:t,wallet:n,statement:r,options:a}=e,o;if(!isBrowser()){if(typeof n!=`object`||!a?.url)throw Error(`@supabase/auth-js: Both wallet and url must be specified in non-browser environments.`);o=n}else if(typeof n==`object`)o=n;else{let e=window;if(`solana`in e&&typeof e.solana==`object`&&(`signIn`in e.solana&&typeof e.solana.signIn==`function`||`signMessage`in e.solana&&typeof e.solana.signMessage==`function`))o=e.solana;else throw Error(`@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.`)}let s=new URL(a?.url??window.location.href);if(`signIn`in o&&o.signIn){let e=await o.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},a?.signInWithSolana),{version:`1`,domain:s.host,uri:s.href}),r?{statement:r}:null)),t;if(Array.isArray(e)&&e[0]&&typeof e[0]==`object`)t=e[0];else if(e&&typeof e==`object`&&`signedMessage`in e&&`signature`in e)t=e;else throw Error(`@supabase/auth-js: Wallet method signIn() returned unrecognized value`);if(`signedMessage`in t&&`signature`in t&&(typeof t.signedMessage==`string`||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array)g=typeof t.signedMessage==`string`?t.signedMessage:new TextDecoder().decode(t.signedMessage),_=t.signature;else throw Error(`@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields`)}else{if(!(`signMessage`in o)||typeof o.signMessage!=`function`||!(`publicKey`in o)||typeof o!=`object`||!o.publicKey||!(`toBase58`in o.publicKey)||typeof o.publicKey.toBase58!=`function`)throw Error(`@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API`);g=[`${s.host} wants you to sign in with your Solana account:`,o.publicKey.toBase58(),...r?[``,r,``]:[``],`Version: 1`,`URI: ${s.href}`,`Issued At: ${a?.signInWithSolana?.issuedAt??new Date().toISOString()}`,...a?.signInWithSolana?.notBefore?[`Not Before: ${a.signInWithSolana.notBefore}`]:[],...a?.signInWithSolana?.expirationTime?[`Expiration Time: ${a.signInWithSolana.expirationTime}`]:[],...a?.signInWithSolana?.chainId?[`Chain ID: ${a.signInWithSolana.chainId}`]:[],...a?.signInWithSolana?.nonce?[`Nonce: ${a.signInWithSolana.nonce}`]:[],...a?.signInWithSolana?.requestId?[`Request ID: ${a.signInWithSolana.requestId}`]:[],...a?.signInWithSolana?.resources?.length?[`Resources`,...a.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join(`
|
|
32
|
-
`);let e=await o.signMessage(new TextEncoder().encode(g),`utf8`);if(!e||!(e instanceof Uint8Array))throw Error(`@supabase/auth-js: Wallet signMessage() API returned an recognized value`);_=e}}try{let{data:t,error:n}=await _request(this.fetch,`POST`,`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:`solana`,message:g,signature:bytesToBase64URL(_)},e.options?.captchaToken?{gotrue_meta_security:{captcha_token:e.options?.captchaToken}}:null),xform:_sessionResponse});if(n)throw n;if(!t||!t.session||!t.user){let e=new AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers(`SIGNED_IN`,t.session)),this._returnResult({data:Object.assign({},t),error:n})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){let[t,n]=(await getItemAsync(this.storage,`${this.storageKey}-code-verifier`)??``).split(`/`);try{if(!t&&this.flowType===`pkce`)throw new AuthPKCECodeVerifierMissingError;let{data:r,error:a}=await _request(this.fetch,`POST`,`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:t},xform:_sessionResponse});if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!r||!r.session||!r.user){let e=new AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers(n===`recovery`?`PASSWORD_RECOVERY`:`SIGNED_IN`,r.session)),this._returnResult({data:Object.assign(Object.assign({},r),{redirectType:n??null}),error:a})}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{let{options:t,provider:n,token:r,access_token:a,nonce:o}=e,{data:s,error:c}=await _request(this.fetch,`POST`,`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:r,access_token:a,nonce:o,gotrue_meta_security:{captcha_token:t?.captchaToken}},xform:_sessionResponse});if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!s||!s.session||!s.user){let e=new AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers(`SIGNED_IN`,s.session)),this._returnResult({data:s,error:c})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,n,r,a,o;try{if(`email`in e){let{email:t,options:n}=e,r=null,a=null;this.flowType===`pkce`&&([r,a]=await getCodeChallengeAndMethod(this.storage,this.storageKey));let{error:o}=await _request(this.fetch,`POST`,`${this.url}/otp`,{headers:this.headers,body:{email:t,data:n?.data??{},create_user:n?.shouldCreateUser??!0,gotrue_meta_security:{captcha_token:n?.captchaToken},code_challenge:r,code_challenge_method:a},redirectTo:n?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if(`phone`in e){let{phone:t,options:n}=e,{data:r,error:a}=await _request(this.fetch,`POST`,`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:n?.data??{},create_user:n?.shouldCreateUser??!0,gotrue_meta_security:{captcha_token:n?.captchaToken},channel:n?.channel??`sms`}});return this._returnResult({data:{user:null,session:null,messageId:r?.message_id},error:a})}throw new AuthInvalidCredentialsError(`You must provide either an email or phone number.`)}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,n;try{let t,n;`options`in e&&(t=e.options?.redirectTo,n=e.options?.captchaToken);let{data:r,error:a}=await _request(this.fetch,`POST`,`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:n}}),redirectTo:t,xform:_sessionResponse});if(a)throw a;if(!r)throw Error(`An error occurred on token verification.`);let o=r.session,s=r.user;return o?.access_token&&(await this._saveSession(o),await this._notifyAllSubscribers(e.type==`recovery`?`PASSWORD_RECOVERY`:`SIGNED_IN`,o)),this._returnResult({data:{user:s,session:o},error:null})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,n,r,a,o;try{let t=null,n=null;this.flowType===`pkce`&&([t,n]=await getCodeChallengeAndMethod(this.storage,this.storageKey));let r=await _request(this.fetch,`POST`,`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},`providerId`in e?{provider_id:e.providerId}:null),`domain`in e?{domain:e.domain}:null),{redirect_to:e.options?.redirectTo??void 0}),e?.options?.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:t,code_challenge_method:n}),headers:this.headers,xform:_ssoResponse});return r.data?.url&&isBrowser()&&!e.options?.skipBrowserRedirect&&window.location.assign(r.data.url),this._returnResult(r)}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;if(n)throw n;if(!t)throw new AuthSessionMissingError;let{error:r}=await _request(this.fetch,`GET`,`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let t=`${this.url}/resend`;if(`email`in e){let{email:n,type:r,options:a}=e,{error:o}=await _request(this.fetch,`POST`,t,{headers:this.headers,body:{email:n,type:r,gotrue_meta_security:{captcha_token:a?.captchaToken}},redirectTo:a?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if(`phone`in e){let{phone:n,type:r,options:a}=e,{data:o,error:s}=await _request(this.fetch,`POST`,t,{headers:this.headers,body:{phone:n,type:r,gotrue_meta_security:{captcha_token:a?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o?.message_id},error:s})}throw new AuthInvalidCredentialsError(`You must provide either an email or phone number and a type`)}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug(`#_acquireLock`,`begin`,e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug(`#_acquireLock`,`lock acquired for storage key`,this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch{}})()),await e;this.pendingInLock.length;){let e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug(`#_acquireLock`,`lock released for storage key`,this.storageKey),this.lockAcquired=!1}})}finally{this._debug(`#_acquireLock`,`end`)}}async _useSession(e){this._debug(`#_useSession`,`begin`);try{return await e(await this.__loadSession())}finally{this._debug(`#_useSession`,`end`)}}async __loadSession(){this._debug(`#__loadSession()`,`begin`),this.lockAcquired||this._debug(`#__loadSession()`,`used outside of an acquired lock!`,Error().stack);try{let e=null,t=await getItemAsync(this.storage,this.storageKey);if(this._debug(`#getSession()`,`session from storage`,t),t!==null&&(this._isValidSession(t)?e=t:(this._debug(`#getSession()`,`session from storage is not valid`),await this._removeSession())),!e)return{data:{session:null},error:null};let n=e.expires_at?e.expires_at*1e3-Date.now()<EXPIRY_MARGIN_MS:!1;if(this._debug(`#__loadSession()`,`session has${n?``:` not`} expired`,`expires_at`,e.expires_at),!n){if(this.userStorage){let t=await getItemAsync(this.userStorage,this.storageKey+`-user`);t?.user?e.user=t.user:e.user=userNotAvailableProxy()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){let t={value:this.suppressGetSessionWarning};e.user=insecureUserWarningProxy(e.user,t),t.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}let{data:r,error:a}=await this._callRefreshToken(e.refresh_token);return a?this._returnResult({data:{session:null},error:a}):this._returnResult({data:{session:r},error:null})}finally{this._debug(`#__loadSession()`,`end`)}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let t=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await _request(this.fetch,`GET`,`${this.url}/user`,{headers:this.headers,jwt:e,xform:_userResponse}):await this._useSession(async e=>{var t,n,r;let{data:a,error:o}=e;if(o)throw o;return!a.session?.access_token&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new AuthSessionMissingError}:await _request(this.fetch,`GET`,`${this.url}/user`,{headers:this.headers,jwt:a.session?.access_token??void 0,xform:_userResponse})})}catch(e){if(isAuthError(e))return isAuthSessionMissingError(e)&&(await this._removeSession(),await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async n=>{let{data:r,error:a}=n;if(a)throw a;if(!r.session)throw new AuthSessionMissingError;let o=r.session,s=null,c=null;this.flowType===`pkce`&&e.email!=null&&([s,c]=await getCodeChallengeAndMethod(this.storage,this.storageKey));let{data:l,error:u}=await _request(this.fetch,`PUT`,`${this.url}/user`,{headers:this.headers,redirectTo:t?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:s,code_challenge_method:c}),jwt:o.access_token,xform:_userResponse});if(u)throw u;return o.user=l.user,await this._saveSession(o),await this._notifyAllSubscribers(`USER_UPDATED`,o),this._returnResult({data:{user:o.user},error:null})})}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new AuthSessionMissingError;let t=Date.now()/1e3,n=t,r=!0,a=null,{payload:o}=decodeJWT(e.access_token);if(o.exp&&(n=o.exp,r=n<=t),r){let{data:t,error:n}=await this._callRefreshToken(e.refresh_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!t)return{data:{user:null,session:null},error:null};a=t}else{let{data:r,error:o}=await this._getUser(e.access_token);if(o)return this._returnResult({data:{user:null,session:null},error:o});a={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:`bearer`,expires_in:n-t,expires_at:n},await this._saveSession(a),await this._notifyAllSubscribers(`SIGNED_IN`,a)}return this._returnResult({data:{user:a.user,session:a},error:null})}catch(e){if(isAuthError(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var n;if(!e){let{data:n,error:r}=t;if(r)throw r;e=n.session??void 0}if(!e?.refresh_token)throw new AuthSessionMissingError;let{data:r,error:a}=await this._callRefreshToken(e.refresh_token);return a?this._returnResult({data:{user:null,session:null},error:a}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var n;try{if(!isBrowser())throw new AuthImplicitGrantRedirectError(`No browser detected.`);if(e.error||e.error_description||e.error_code)throw new AuthImplicitGrantRedirectError(e.error_description||`Error in URL with unspecified error_description`,{error:e.error||`unspecified_error`,code:e.error_code||`unspecified_code`});switch(t){case`implicit`:if(this.flowType===`pkce`)throw new AuthPKCEGrantCodeExchangeError(`Not a valid PKCE flow url.`);break;case`pkce`:if(this.flowType===`implicit`)throw new AuthImplicitGrantRedirectError(`Not a valid implicit grant flow url.`)}if(t===`pkce`){if(this._debug(`#_initialize()`,`begin`,`is PKCE flow`,!0),!e.code)throw new AuthPKCEGrantCodeExchangeError(`No code detected.`);let{data:t,error:n}=await this._exchangeCodeForSession(e.code);if(n)throw n;let r=new URL(window.location.href);return r.searchParams.delete(`code`),window.history.replaceState(window.history.state,``,r.toString()),{data:{session:t.session,redirectType:t.redirectType??null},error:null}}let{provider_token:n,provider_refresh_token:r,access_token:a,refresh_token:o,expires_in:s,expires_at:c,token_type:l}=e;if(!a||!s||!o||!l)throw new AuthImplicitGrantRedirectError(`No session defined in URL`);let u=Math.round(Date.now()/1e3),d=parseInt(s),f=u+d;c&&(f=parseInt(c));let m=f-u;m*1e3<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${d}s`);let g=f-d;u-g>=120?console.warn(`@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale`,g,f,u):u-g<0&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew`,g,f,u);let{data:_,error:v}=await this._getUser(a);if(v)throw v;let y={provider_token:n,provider_refresh_token:r,access_token:a,expires_in:d,expires_at:f,refresh_token:o,token_type:l,user:_.user};return window.location.hash=``,this._debug(`#_getSessionFromURL()`,`clearing window.location.hash`),this._returnResult({data:{session:y,redirectType:e.type},error:null})}catch(e){if(isAuthError(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl==`function`?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await getItemAsync(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:`global`}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:`global`}){return await this._useSession(async t=>{var n;let{data:r,error:a}=t;if(a&&!isAuthSessionMissingError(a))return this._returnResult({error:a});let o=r.session?.access_token;if(o){let{error:t}=await this.admin.signOut(o,e);if(t&&!(isAuthApiError(t)&&(t.status===404||t.status===401||t.status===403)||isAuthSessionMissingError(t)))return this._returnResult({error:t})}return e!==`others`&&(await this._removeSession(),await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let t=generateCallbackId(),n={id:t,callback:e,unsubscribe:()=>{this._debug(`#unsubscribe()`,`state change callback with id removed`,t),this.stateChangeEmitters.delete(t)}};return this._debug(`#onAuthStateChange()`,`registered callback with id`,t),this.stateChangeEmitters.set(t,n),(async()=>{await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async t=>{var n,r;try{let{data:{session:n},error:r}=t;if(r)throw r;await this.stateChangeEmitters.get(e)?.callback(`INITIAL_SESSION`,n),this._debug(`INITIAL_SESSION`,`callback id`,e,`session`,n)}catch(t){await this.stateChangeEmitters.get(e)?.callback(`INITIAL_SESSION`,null),this._debug(`INITIAL_SESSION`,`callback id`,e,`error`,t),isAuthSessionMissingError(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let n=null,r=null;this.flowType===`pkce`&&([n,r]=await getCodeChallengeAndMethod(this.storage,this.storageKey,!0));try{return await _request(this.fetch,`POST`,`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{let{data:e,error:t}=await this.getUser();if(t)throw t;return this._returnResult({data:{identities:e.user.identities??[]},error:null})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return`token`in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{let{data:t,error:n}=await this._useSession(async t=>{var n,r,a,o,s;let{data:c,error:l}=t;if(l)throw l;let u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:e.options?.redirectTo,scopes:e.options?.scopes,queryParams:e.options?.queryParams,skipBrowserRedirect:!0});return await _request(this.fetch,`GET`,u,{headers:this.headers,jwt:c.session?.access_token??void 0})});if(n)throw n;return isBrowser()&&!e.options?.skipBrowserRedirect&&window.location.assign(t?.url),this._returnResult({data:{provider:e.provider,url:t?.url},error:null})}catch(t){if(isAuthError(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var n;try{let{error:n,data:{session:r}}=t;if(n)throw n;let{options:a,provider:o,token:s,access_token:c,nonce:l}=e,{data:u,error:d}=await _request(this.fetch,`POST`,`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:r?.access_token??void 0,body:{provider:o,id_token:s,access_token:c,nonce:l,link_identity:!0,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:_sessionResponse});return d?this._returnResult({data:{user:null,session:null},error:d}):!u||!u.session||!u.user?this._returnResult({data:{user:null,session:null},error:new AuthInvalidTokenResponseError}):(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers(`USER_UPDATED`,u.session)),this._returnResult({data:u,error:d}))}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var n,r;let{data:a,error:o}=t;if(o)throw o;return await _request(this.fetch,`DELETE`,`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:a.session?.access_token??void 0})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){let t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,`begin`);try{let n=Date.now();return await retryable(async n=>(n>0&&await sleep(200*2**(n-1)),this._debug(t,`refreshing attempt`,n),await _request(this.fetch,`POST`,`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:_sessionResponse})),(e,t)=>{let r=200*2**e;return t&&isAuthRetryableFetchError(t)&&Date.now()+r-n<3e4})}catch(e){if(this._debug(t,`error`,e),isAuthError(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}finally{this._debug(t,`end`)}}_isValidSession(e){return typeof e==`object`&&!!e&&`access_token`in e&&`refresh_token`in e&&`expires_at`in e}async _handleProviderSignIn(e,t){let n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug(`#_handleProviderSignIn()`,`provider`,e,`options`,t,`url`,n),isBrowser()&&!t.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,t;let n=`#_recoverAndRefresh()`;this._debug(n,`begin`);try{let e=await getItemAsync(this.storage,this.storageKey);if(e&&this.userStorage){let t=await getItemAsync(this.userStorage,this.storageKey+`-user`);!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!t&&(t={user:e.user},await setItemAsync(this.userStorage,this.storageKey+`-user`,t)),e.user=t?.user??userNotAvailableProxy()}else if(e&&!e.user&&!e.user){let t=await getItemAsync(this.storage,this.storageKey+`-user`);t&&t?.user?(e.user=t.user,await removeItemAsync(this.storage,this.storageKey+`-user`),await setItemAsync(this.storage,this.storageKey,e)):e.user=userNotAvailableProxy()}if(this._debug(n,`session from storage`,e),!this._isValidSession(e)){this._debug(n,`session is not valid`),e!==null&&await this._removeSession();return}let t=(e.expires_at??1/0)*1e3-Date.now()<EXPIRY_MARGIN_MS;if(this._debug(n,`session has${t?``:` not`} expired with margin of ${EXPIRY_MARGIN_MS}s`),t){if(this.autoRefreshToken&&e.refresh_token){let{error:t}=await this._callRefreshToken(e.refresh_token);t&&(console.error(t),isAuthRetryableFetchError(t)||(this._debug(n,`refresh failed with a non-retryable error, removing the session`,t),await this._removeSession()))}}else if(e.user&&e.user.__isUserNotAvailableProxy===!0)try{let{data:t,error:r}=await this._getUser(e.access_token);!r&&t?.user?(e.user=t.user,await this._saveSession(e),await this._notifyAllSubscribers(`SIGNED_IN`,e)):this._debug(n,`could not get user data, skipping SIGNED_IN notification`)}catch(e){console.error(`Error getting user data:`,e),this._debug(n,`error getting user data, skipping SIGNED_IN notification`,e)}else await this._notifyAllSubscribers(`SIGNED_IN`,e)}catch(e){this._debug(n,`error`,e),console.error(e);return}finally{this._debug(n,`end`)}}async _callRefreshToken(e){var t,n;if(!e)throw new AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let r=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(r,`begin`);try{this.refreshingDeferred=new Deferred;let{data:t,error:n}=await this._refreshAccessToken(e);if(n)throw n;if(!t.session)throw new AuthSessionMissingError;await this._saveSession(t.session),await this._notifyAllSubscribers(`TOKEN_REFRESHED`,t.session);let r={data:t.session,error:null};return this.refreshingDeferred.resolve(r),r}catch(e){if(this._debug(r,`error`,e),isAuthError(e)){let n={data:null,error:e};return isAuthRetryableFetchError(e)||await this._removeSession(),(t=this.refreshingDeferred)==null||t.resolve(n),n}throw(n=this.refreshingDeferred)==null||n.reject(e),e}finally{this.refreshingDeferred=null,this._debug(r,`end`)}}async _notifyAllSubscribers(e,t,n=!0){let r=`#_notifyAllSubscribers(${e})`;this._debug(r,`begin`,t,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:t});let r=[],a=Array.from(this.stateChangeEmitters.values()).map(async n=>{try{await n.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(a),r.length>0){for(let e=0;e<r.length;e+=1)console.error(r[e]);throw r[0]}}finally{this._debug(r,`end`)}}async _saveSession(e){this._debug(`#_saveSession()`,e),this.suppressGetSessionWarning=!0,await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`);let t=Object.assign({},e),n=t.user&&t.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&t.user&&await setItemAsync(this.userStorage,this.storageKey+`-user`,{user:t.user});let e=Object.assign({},t);delete e.user;let r=deepClone(e);await setItemAsync(this.storage,this.storageKey,r)}else{let e=deepClone(t);await setItemAsync(this.storage,this.storageKey,e)}}async _removeSession(){this._debug(`#_removeSession()`),this.suppressGetSessionWarning=!1,await removeItemAsync(this.storage,this.storageKey),await removeItemAsync(this.storage,this.storageKey+`-code-verifier`),await removeItemAsync(this.storage,this.storageKey+`-user`),this.userStorage&&await removeItemAsync(this.userStorage,this.storageKey+`-user`),await this._notifyAllSubscribers(`SIGNED_OUT`,null)}_removeVisibilityChangedCallback(){this._debug(`#_removeVisibilityChangedCallback()`);let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&isBrowser()&&window!=null&&window.removeEventListener&&window.removeEventListener(`visibilitychange`,e)}catch(e){console.error(`removing visibilitychange callback failed`,e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug(`#_startAutoRefresh()`);let e=setInterval(()=>this._autoRefreshTokenTick(),AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&typeof e==`object`&&typeof e.unref==`function`?e.unref():typeof Deno<`u`&&typeof Deno.unrefTimer==`function`&&Deno.unrefTimer(e);let t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&typeof t==`object`&&typeof t.unref==`function`?t.unref():typeof Deno<`u`&&typeof Deno.unrefTimer==`function`&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug(`#_stopAutoRefresh()`);let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);let t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug(`#_autoRefreshTokenTick()`,`begin`);try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async t=>{let{data:{session:n}}=t;if(!n||!n.refresh_token||!n.expires_at){this._debug(`#_autoRefreshTokenTick()`,`no session`);return}let r=Math.floor((n.expires_at*1e3-e)/AUTO_REFRESH_TICK_DURATION_MS);this._debug(`#_autoRefreshTokenTick()`,`access token expires in ${r} ticks, a tick lasts ${AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is 3 ticks`),r<=3&&await this._callRefreshToken(n.refresh_token)})}catch(e){console.error(`Auto refresh tick failed with error. This is likely a transient error.`,e)}}finally{this._debug(`#_autoRefreshTokenTick()`,`end`)}})}catch(e){if(e instanceof LockAcquireTimeoutError)this._debug(`auto refresh token tick lock not available`);else throw e}}async _handleVisibilityChange(){if(this._debug(`#_handleVisibilityChange()`),!isBrowser()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug(`#visibilityChangedCallback`,`error`,e)}},window==null||window.addEventListener(`visibilitychange`,this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error(`_handleVisibilityChange`,e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;this._debug(t,`visibilityState`,document.visibilityState),document.visibilityState===`visible`?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{document.visibilityState===`visible`?await this._recoverAndRefresh():this._debug(t,`acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting`)}))):document.visibilityState===`hidden`&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,n){let r=[`provider=${encodeURIComponent(t)}`];if(n?.redirectTo&&r.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n?.scopes&&r.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType===`pkce`){let[e,t]=await getCodeChallengeAndMethod(this.storage,this.storageKey),n=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(n.toString())}if(n?.queryParams){let e=new URLSearchParams(n.queryParams);r.push(e.toString())}return n?.skipBrowserRedirect&&r.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${r.join(`&`)}`}async _unenroll(e){try{return await this._useSession(async t=>{var n;let{data:r,error:a}=t;return a?this._returnResult({data:null,error:a}):await _request(this.fetch,`DELETE`,`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:r?.session?.access_token})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var n,r;let{data:a,error:o}=t;if(o)return this._returnResult({data:null,error:o});let s=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType===`phone`?{phone:e.phone}:e.factorType===`totp`?{issuer:e.issuer}:{}),{data:c,error:l}=await _request(this.fetch,`POST`,`${this.url}/factors`,{body:s,headers:this.headers,jwt:a?.session?.access_token});return l?this._returnResult({data:null,error:l}):(e.factorType===`totp`&&c.type===`totp`&&c?.totp?.qr_code&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var n;let{data:r,error:a}=t;if(a)return this._returnResult({data:null,error:a});let o=Object.assign({challenge_id:e.challengeId},`webauthn`in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type===`create`?serializeCredentialCreationResponse(e.webauthn.credential_response):serializeCredentialRequestResponse(e.webauthn.credential_response)})}:{code:e.code}),{data:s,error:c}=await _request(this.fetch,`POST`,`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:r?.session?.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+s.expires_in},s)),await this._notifyAllSubscribers(`MFA_CHALLENGE_VERIFIED`,s),this._returnResult({data:s,error:c}))})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var n;let{data:r,error:a}=t;if(a)return this._returnResult({data:null,error:a});let o=await _request(this.fetch,`POST`,`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:r?.session?.access_token});if(o.error)return o;let{data:s}=o;if(s.type!==`webauthn`)return{data:s,error:null};switch(s.webauthn.type){case`create`:return{data:Object.assign(Object.assign({},s),{webauthn:Object.assign(Object.assign({},s.webauthn),{credential_options:Object.assign(Object.assign({},s.webauthn.credential_options),{publicKey:deserializeCredentialCreationOptions(s.webauthn.credential_options.publicKey)})})}),error:null};case`request`:return{data:Object.assign(Object.assign({},s),{webauthn:Object.assign(Object.assign({},s.webauthn),{credential_options:Object.assign(Object.assign({},s.webauthn.credential_options),{publicKey:deserializeCredentialRequestOptions(s.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}})}async _challengeAndVerify(e){let{data:t,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;let{data:{user:t},error:n}=await this.getUser();if(n)return{data:null,error:n};let r={all:[],phone:[],totp:[],webauthn:[]};for(let e of t?.factors??[])r.all.push(e),e.status===`verified`&&r[e.factor_type].push(e);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,n,r,a;if(e)try{let{payload:t}=decodeJWT(e),n=null;t.aal&&(n=t.aal);let r=n,{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});((a?.factors)?.filter(e=>e.status===`verified`)??[]).length>0&&(r=`aal2`);let s=t.amr||[];return{data:{currentLevel:n,nextLevel:r,currentAuthenticationMethods:s},error:null}}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}let{data:{session:o},error:s}=await this.getSession();if(s)return this._returnResult({data:null,error:s});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:c}=decodeJWT(o.access_token),l=null;c.aal&&(l=c.aal);let u=l;(o.user.factors?.filter(e=>e.status===`verified`)??[]).length>0&&(u=`aal2`);let d=c.amr||[];return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await _request(this.fetch,`GET`,`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new AuthSessionMissingError})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async n=>{let{data:{session:r},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!r)return this._returnResult({data:null,error:new AuthSessionMissingError});let o=await _request(this.fetch,`POST`,`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:`approve`},xform:e=>({data:e,error:null})});return o.data&&o.data.redirect_url&&isBrowser()&&!t?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async n=>{let{data:{session:r},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!r)return this._returnResult({data:null,error:new AuthSessionMissingError});let o=await _request(this.fetch,`POST`,`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:`deny`},xform:e=>({data:e,error:null})});return o.data&&o.data.redirect_url&&isBrowser()&&!t?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;return n?this._returnResult({data:null,error:n}):t?await _request(this.fetch,`GET`,`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new AuthSessionMissingError})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?(await _request(this.fetch,`DELETE`,`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new AuthSessionMissingError})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let n=t.keys.find(t=>t.kid===e);if(n)return n;let r=Date.now();if(n=this.jwks.keys.find(t=>t.kid===e),n&&this.jwks_cached_at+6e5>r)return n;let{data:a,error:o}=await _request(this.fetch,`GET`,`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!a.keys||a.keys.length===0||(this.jwks=a,this.jwks_cached_at=r,n=a.keys.find(t=>t.kid===e),!n)?null:n}async getClaims(e,t={}){try{let n=e;if(!n){let{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});n=e.session.access_token}let{header:r,payload:a,signature:o,raw:{header:s,payload:c}}=decodeJWT(n);t?.allowExpired||validateExp(a.exp);let l=!r.alg||r.alg.startsWith(`HS`)||!r.kid||!(`crypto`in globalThis&&`subtle`in globalThis.crypto)?null:await this.fetchJwk(r.kid,t?.keys?{keys:t.keys}:t?.jwks);if(!l){let{error:e}=await this.getUser(n);if(e)throw e;return{data:{claims:a,header:r,signature:o},error:null}}let u=getAlgorithm(r.alg),d=await crypto.subtle.importKey(`jwk`,l,u,!0,[`verify`]);if(!await crypto.subtle.verify(u,d,o,stringToUint8Array(`${s}.${c}`)))throw new AuthInvalidJwtError(`Invalid JWT signature`);return{data:{claims:a,header:r,signature:o},error:null}}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,n,r;assertPasskeyExperimentalEnabled(this.experimental);try{if(!browserSupportsWebAuthn())return this._returnResult({data:null,error:new AuthUnknownError(`Browser does not support WebAuthn`,null)});let{data:t,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:e?.options?.captchaToken}});if(n||!t)return this._returnResult({data:null,error:n});let{data:r,error:a}=await getCredential({publicKey:deserializeCredentialRequestOptions(t.options),signal:e?.options?.signal??webAuthnAbortService.createNewAbortSignal()});if(a||!r)return this._returnResult({data:null,error:a??new AuthUnknownError(`WebAuthn ceremony failed`,null)});let o=serializeCredentialRequestResponse(r);return this._verifyPasskeyAuthentication({challengeId:t.challenge_id,credential:o})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,n;assertPasskeyExperimentalEnabled(this.experimental);try{if(!browserSupportsWebAuthn())return this._returnResult({data:null,error:new AuthUnknownError(`Browser does not support WebAuthn`,null)});let{data:t,error:n}=await this._startPasskeyRegistration();if(n||!t)return this._returnResult({data:null,error:n});let{data:r,error:a}=await createCredential({publicKey:deserializeCredentialCreationOptions(t.options),signal:e?.options?.signal??webAuthnAbortService.createNewAbortSignal()});if(a||!r)return this._returnResult({data:null,error:a??new AuthUnknownError(`WebAuthn ceremony failed`,null)});let o=serializeCredentialCreationResponse(r);return this._verifyPasskeyRegistration({challengeId:t.challenge_id,credential:o})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){assertPasskeyExperimentalEnabled(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!t)return this._returnResult({data:null,error:new AuthSessionMissingError});let{data:r,error:a}=await _request(this.fetch,`POST`,`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:r,error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){assertPasskeyExperimentalEnabled(this.experimental);try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new AuthSessionMissingError});let{data:a,error:o}=await _request(this.fetch,`POST`,`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;assertPasskeyExperimentalEnabled(this.experimental);try{let{data:t,error:n}=await _request(this.fetch,`POST`,`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:e?.options?.captchaToken}}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:t,error:null})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){assertPasskeyExperimentalEnabled(this.experimental);try{let{data:t,error:n}=await _request(this.fetch,`POST`,`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:_sessionResponse});return n?this._returnResult({data:null,error:n}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers(`SIGNED_IN`,t.session)),this._returnResult({data:t,error:null}))}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){assertPasskeyExperimentalEnabled(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!t)return this._returnResult({data:null,error:new AuthSessionMissingError});let{data:r,error:a}=await _request(this.fetch,`GET`,`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return a?this._returnResult({data:null,error:a}):this._returnResult({data:r,error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){assertPasskeyExperimentalEnabled(this.experimental);try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new AuthSessionMissingError});let{data:a,error:o}=await _request(this.fetch,`PATCH`,`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){assertPasskeyExperimentalEnabled(this.experimental);try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new AuthSessionMissingError});let{error:a}=await _request(this.fetch,`DELETE`,`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return a?this._returnResult({data:null,error:a}):this._returnResult({data:null,error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}};GoTrueClient.nextInstanceID={};var AuthClient=GoTrueClient,version=`2.106.1`,JS_ENV=``;JS_ENV=typeof Deno<`u`?`deno`:typeof document<`u`?`web`:typeof navigator<`u`&&navigator.product===`ReactNative`?`react-native`:`node`;var DEFAULT_GLOBAL_OPTIONS={headers:{"X-Client-Info":`supabase-js-${JS_ENV}/${version}`}},DEFAULT_DB_OPTIONS={schema:`public`},DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:`implicit`},DEFAULT_REALTIME_OPTIONS={},DEFAULT_TRACE_PROPAGATION_OPTIONS={enabled:!1,respectSamplingDecision:!0};function __awaiter(e,t,n,r){function a(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?n(e.value):a(e.value).then(s,c)}l((r=r.apply(e,t||[])).next())})}var otelModulePromise=null,OTEL_PKG=`@opentelemetry/api`;function loadOtel(){return otelModulePromise===null&&(otelModulePromise=import(OTEL_PKG).catch(()=>null)),otelModulePromise}function extractTraceContext(){return __awaiter(this,void 0,void 0,function*(){try{let e=yield loadOtel();if(!e||!e.propagation||!e.context)return null;let t={};e.propagation.inject(e.context.active(),t);let n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch{return null}})}function parseTraceParent(e){if(!e||typeof e!=`string`)return null;let t=e.split(`-`);if(t.length!==4)return null;let[n,r,a,o]=t;if(n.length!==2||r.length!==32||a.length!==16||o.length!==2)return null;let s=/^[0-9a-f]+$/i;return!s.test(n)||!s.test(r)||!s.test(a)||!s.test(o)||r===`00000000000000000000000000000000`||a===`0000000000000000`?null:{version:n,traceId:r,parentId:a,traceFlags:o,isSampled:(parseInt(o,16)&1)==1}}function shouldPropagateToTarget(e,t){if(!e||!t||t.length===0)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch{return!1}for(let e of t)try{if(typeof e==`string`){if(matchStringTarget(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if(typeof e==`function`&&e(n))return!0}catch{continue}return!1}function matchStringTarget(e,t){if(t===e)return!0;if(t.startsWith(`*.`)){let n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith(`.`+n)))return!0}return!1}function getDefaultPropagationTargets(e){let t=[];try{let n=new URL(e);t.push(n.hostname)}catch{}return t.push(`*.supabase.co`,`*.supabase.in`),t.push(`localhost`,`127.0.0.1`,`[::1]`),t}function _typeof(e){"@babel/helpers - typeof";return _typeof=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},_typeof(e)}function toPrimitive(e,t){if(_typeof(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_typeof(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function toPropertyKey(e){var t=toPrimitive(e,`string`);return _typeof(t)==`symbol`?t:t+``}function _defineProperty(e,t,n){return(t=toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys(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 _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),resolveHeadersConstructor=()=>Headers,fetchWithAuth=(e,t,n,r,a)=>{let o=resolveFetch(r),s=resolveHeadersConstructor(),c=a?.enabled===!0,l=a?.respectSamplingDecision!==!1,u=c?getDefaultPropagationTargets(t):null;return async(t,r)=>{var a;let c=await n()??e,d=new s(r?.headers);if(d.has(`apikey`)||d.set(`apikey`,e),d.has(`Authorization`)||d.set(`Authorization`,`Bearer ${c}`),u){let e=await getTraceHeaders(t,u,l);e&&(e.traceparent&&!d.has(`traceparent`)&&d.set(`traceparent`,e.traceparent),e.tracestate&&!d.has(`tracestate`)&&d.set(`tracestate`,e.tracestate),e.baggage&&!d.has(`baggage`)&&d.set(`baggage`,e.baggage))}return o(t,_objectSpread2(_objectSpread2({},r),{},{headers:d}))}};async function getTraceHeaders(e,t,n){if(!shouldPropagateToTarget(typeof e==`string`||e instanceof URL?e:e.url,t))return null;let r=await extractTraceContext();if(!r||!r.traceparent)return null;if(n){let e=parseTraceParent(r.traceparent);if(e&&!e.isSampled)return null}return r}function normalizeTracePropagation(e){return typeof e==`boolean`?{enabled:e}:e}function ensureTrailingSlash(e){return e.endsWith(`/`)?e:e+`/`}function applySettingDefaults(e,t){var n,r,a,o,s,c;let{db:l,auth:u,realtime:d,global:f}=e,{db:m,auth:g,realtime:_,global:v}=t,y=normalizeTracePropagation(e.tracePropagation),b=normalizeTracePropagation(t.tracePropagation),x={db:_objectSpread2(_objectSpread2({},m),l),auth:_objectSpread2(_objectSpread2({},g),u),realtime:_objectSpread2(_objectSpread2({},_),d),storage:{},global:_objectSpread2(_objectSpread2(_objectSpread2({},v),f),{},{headers:_objectSpread2(_objectSpread2({},v?.headers??{}),f?.headers??{})}),tracePropagation:{enabled:y?.enabled??b?.enabled??!1,respectSamplingDecision:y?.respectSamplingDecision??b?.respectSamplingDecision??!0},accessToken:async()=>``};return e.accessToken?x.accessToken=e.accessToken:delete x.accessToken,x}function validateSupabaseUrl(e){let t=e?.trim();if(!t)throw Error(`supabaseUrl is required.`);if(!t.match(/^https?:\/\//i))throw Error(`Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.`);try{return new URL(ensureTrailingSlash(t))}catch{throw Error(`Invalid supabaseUrl: Provided URL is malformed.`)}}var SupabaseAuthClient=class extends AuthClient{constructor(e){super(e)}},SupabaseClient=class{constructor(e,t,n){var r,a;this.supabaseUrl=e,this.supabaseKey=t;let o=validateSupabaseUrl(e);if(!t)throw Error(`supabaseKey is required.`);this.realtimeUrl=new URL(`realtime/v1`,o),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace(`http`,`ws`),this.authUrl=new URL(`auth/v1`,o),this.storageUrl=new URL(`storage/v1`,o),this.functionsUrl=new URL(`functions/v1`,o);let s=`sb-${o.hostname.split(`.`)[0]}-auth-token`,c={db:DEFAULT_DB_OPTIONS,realtime:DEFAULT_REALTIME_OPTIONS,auth:_objectSpread2(_objectSpread2({},DEFAULT_AUTH_OPTIONS),{},{storageKey:s}),global:DEFAULT_GLOBAL_OPTIONS,tracePropagation:DEFAULT_TRACE_PROPAGATION_OPTIONS},l=applySettingDefaults(n??{},c);if(this.settings=l,this.storageKey=l.auth.storageKey??``,this.headers=l.global.headers??{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient(l.auth??{},this.headers,l.global.fetch)}this.fetch=fetchWithAuth(t,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(_objectSpread2({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn(`Failed to set initial Realtime auth token:`,e)),this.rest=new PostgrestClient(new URL(`rest/v1`,o).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();let{data:r}=await e.auth.getSession();return r.session?.access_token??e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:a,storageKey:o,flowType:s,lock:c,debug:l,throwOnError:u,experimental:d,lockAcquireTimeout:f,skipAutoInitialize:m},g,_){let v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new SupabaseAuthClient({url:this.authUrl.href,headers:_objectSpread2(_objectSpread2({},v),g),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:a,flowType:s,lock:c,debug:l,throwOnError:u,experimental:d,fetch:_,lockAcquireTimeout:f,skipAutoInitialize:m,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>e.toLowerCase()===`authorization`)})}_initRealtimeClient(e){return new RealtimeClient(this.realtimeUrl.href,_objectSpread2(_objectSpread2({},e),{},{params:_objectSpread2(_objectSpread2({},{apikey:this.supabaseKey}),e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,`CLIENT`,t?.access_token)})}_handleTokenChanged(e,t,n){(e===`TOKEN_REFRESHED`||e===`SIGNED_IN`)&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e===`SIGNED_OUT`&&(this.realtime.setAuth(),t==`STORAGE`&&this.auth.signOut(),this.changedAccessToken=void 0)}},createClient=(e,t,n)=>new SupabaseClient(e,t,n);function shouldShowDeprecationWarning(){if(typeof window<`u`)return!1;let e=globalThis.process;if(!e)return!1;let t=e.version;if(t==null)return!1;let n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}shouldShowDeprecationWarning()&&console.warn(`⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217`);var SupabaseTransport=class{client;channels=new Map;eventSubs=new Map;presenceSubs=new Map;constructor(e){if(e.client)this.client=e.client;else{if(!e.url||!e.anonKey)throw Error(`SupabaseTransport requires url + anonKey when no client is provided`);this.client=createClient(e.url,e.anonKey)}}getChannel(e){let t=this.channels.get(e);return t||(t=this.client.channel(e,{config:{broadcast:{self:!1}}}),t.on(`broadcast`,{event:`gameEvent`},({payload:t})=>{let n=this.eventSubs.get(e);if(n)for(let e of n)e(t)}),t.on(`presence`,{event:`sync`},()=>{let t=this.presenceSubs.get(e);if(t){let n=this.flattenPresence(e);for(let e of t)e(n)}}),t.subscribe(),this.channels.set(e,t)),t}async broadcast(e,t){let n=this.eventSubs.get(e);if(n)for(let e of[...n])e(t);await this.getChannel(e).send({type:`broadcast`,event:`gameEvent`,payload:t})}subscribe(e,t){return this.getChannel(e),this.eventSubs.has(e)||this.eventSubs.set(e,new Set),this.eventSubs.get(e).add(t),()=>{this.eventSubs.get(e)?.delete(t)}}flattenPresence(e){let t=this.channels.get(e);if(!t)return[];let n=t.presenceState();return Object.values(n).flat()}presence={track:async(e,t)=>{await this.getChannel(e).track(t)},untrack:async e=>{let t=this.channels.get(e);t&&await t.untrack()},list:e=>(this.getChannel(e),this.flattenPresence(e)),onChange:(e,t)=>(this.getChannel(e),this.presenceSubs.has(e)||this.presenceSubs.set(e,new Set),this.presenceSubs.get(e).add(t),()=>{this.presenceSubs.get(e)?.delete(t)})}},HOST_PRESENCE_ID=`__host__`,SESSION_KEY=`hashquiz:player-session`;function loadSession(e){try{let t=sessionStorage.getItem(SESSION_KEY);if(!t)return null;let n=JSON.parse(t);return n.code===e?n:null}catch{return null}}function saveSession(e){try{sessionStorage.setItem(SESSION_KEY,JSON.stringify(e))}catch{}}function loadDraft(){try{let e=sessionStorage.getItem(SESSION_KEY+`:draft`);return e?JSON.parse(e):null}catch{return null}}function saveDraft(e){try{sessionStorage.setItem(SESSION_KEY+`:draft`,JSON.stringify(e))}catch{}}function clearDraft(){try{sessionStorage.removeItem(SESSION_KEY+`:draft`)}catch{}}function newPlayerId(){return Math.random().toString(36).slice(2)+Date.now().toString(36)}var useGameStore=defineStore(`game`,()=>{let e=ref(`join`),t=ref(newPlayerId()),n=ref(0),r=ref(null),a=ref(0),o=ref(!1),s=ref(0),c=ref(0),l=ref(0),u=ref(null),d=ref(0),f=ref([]),m=ref(void 0),g=ref([]),_=ref(``),v=ref(null),y=ref(null),b=ref(`connecting`),x=computed(()=>!o.value&&y.value!==null&&Date.now()<y.value),S=null,C=null,w=``,T=``,E=``,D=``,O=`local`,k=0,A=null,j=!1;function M(){j||typeof document>`u`||(j=!0,document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&P()}),window.addEventListener(`pageshow`,P),window.addEventListener(`online`,P),window.addEventListener(`pagehide`,ee))}function ee(){O===`supabase`&&C&&w&&C.presence.untrack(w)}function P(){if(e.value!==`join`&&T){if(O===`local`)!S||S.readyState===WebSocket.CLOSED||S.readyState===WebSocket.CLOSING?F(0):S.readyState===WebSocket.OPEN&&S.send(JSON.stringify({type:`state_request`}));else if(O===`supabase`&&C&&w){let e={id:t.value,pseudo:E,email:D,score:c.value,joinedAt:Date.now()};C.presence.track(w,e),C.broadcast(w,GameEvents.stateRequest(t.value)),b.value=`connected`}}}function F(e){if(A)return;let t=e===void 0?Math.min(1e4,1e3*2**k):e;b.value=`reconnecting`,A=setTimeout(()=>{A=null,k++,L(!0)},t)}async function I(n,r,a){let o=config.supabaseUrl,s=config.supabaseAnonKey;if(!o||!s){_.value=`Identifiants Supabase manquants`;return}O=`supabase`,C=new SupabaseTransport({url:o,anonKey:s}),w=`game:${n}`,T=n,E=r,D=a,C.subscribe(w,B),M(),await new Promise(e=>setTimeout(e,300));let l=C.presence.list(w).filter(e=>e.id!==HOST_PRESENCE_ID&&e.id!==t.value).map(e=>e.pseudo),u=r,d=2;for(;l.includes(u);)u=`${r}-${d++}`;E=u;let f={id:t.value,pseudo:u,email:a,score:c.value,joinedAt:Date.now()};await C.presence.track(w,f),setTimeout(()=>{C.presence.list(w).some(e=>e.id===HOST_PRESENCE_ID)?(e.value===`join`&&(e.value=`lobby`),b.value=`connected`,saveSession({playerId:t.value,code:T,pseudo:E,email:D}),C.broadcast(w,GameEvents.stateRequest(t.value))):(_.value=`Aucune partie trouvée pour ce code`,b.value=`offline`)},3e3)}function te(e,n){C&&C.broadcast(w,GameEvents.answerSubmit(t.value,e,n))}function L(n){b.value=n?`reconnecting`:`connecting`;let r=`ws://${location.hostname}:3030/ws?role=player&id=${t.value}&code=${encodeURIComponent(T)}`,c=new WebSocket(r);S=c,c.onerror=()=>{n||(_.value=`Connexion impossible : vérifiez le code et réessayez`)},c.onopen=()=>{k=0;let e=n?`player_rejoin`:`player_join`;c.send(JSON.stringify({type:e,pseudo:E,email:D})),b.value=`connected`;let t=loadDraft();t&&t.questionIdx===a.value&&x.value&&(c.send(JSON.stringify({type:`submit_answer`,choiceIds:t.choiceIds,answerTimeMs:t.elapsed})),o.value=!0,s.value=t.elapsed,clearDraft())},c.onmessage=e=>{B(JSON.parse(e.data))},c.onclose=()=>{S===c&&(b.value=`reconnecting`,e.value!==`join`&&F())}}function R(e,n,r){_.value=``,T=e,E=n,D=r;let a=loadSession(e);a&&(t.value=a.playerId,n||(E=a.pseudo),r||(D=a.email)),config.transport===`supabase`?I(e,E,D):(O=`local`,M(),L(a!==null))}function z(_){if(v.value=_.quizMeta,c.value=_.totalScore,n.value=_.playerCount,_.phase===`finished`)g.value=_.podium??[],e.value=`podium`,y.value=null;else if(_.phase===`lobby`)e.value=`lobby`,r.value=null,y.value=null;else if(_.question&&(r.value=_.question,a.value=_.questionIdx??_.question.idx),_.phase===`revealed`&&_.reveal){f.value=_.reveal.correct,m.value=_.reveal.explanation;let n=_.reveal.scores.find(e=>e.playerId===t.value);n&&(l.value=n.delta,c.value=n.score);let r=rankOf(_.reveal.scores,t.value);u.value=r?.rank??null,d.value=r?.total??0,o.value=!0,y.value=null,e.value=`question`}else{f.value=[],m.value=void 0,y.value=_.deadlineMs??null;let t=loadDraft();t&&t.questionIdx===a.value||o.value&&y.value&&Date.now()>=y.value||(o.value=!1,s.value=0),e.value=`question`}}function B(_){if(_.type===`joined`)e.value=`lobby`,v.value=_.quizMeta,n.value=_.playerCount,b.value=`connected`,saveSession({playerId:t.value,code:T,pseudo:E,email:D});else if(_.type===`state_snapshot`){if(_.playerId&&_.playerId!==t.value)return;z(_.snapshot),b.value=`connected`,saveSession({playerId:t.value,code:T,pseudo:E,email:D})}else switch(_.type){case`player_joined`:_.player.id!==t.value&&n.value++;break;case`player_rejoined`:break;case`player_left`:_.playerId!==t.value&&(n.value=Math.max(0,n.value-1));break;case`question_started`:r.value=_.question,a.value=_.idx,o.value=!1,s.value=0,u.value=null,d.value=0,f.value=[],m.value=void 0,y.value=_.deadlineMs,e.value=`question`,clearDraft();break;case`answer_revealed`:{let e=_.scores.find(e=>e.playerId===t.value);e&&(l.value=e.delta,c.value=e.score);let n=rankOf(_.scores,t.value);u.value=n?.rank??null,d.value=n?.total??0,f.value=_.correct,m.value=_.explanation,o.value=!0,y.value=null,clearDraft();break}case`game_ended`:g.value=_.podium,e.value=`podium`,clearDraft();break;case`game_reset`:r.value=null,a.value=0,o.value=!1,s.value=0,c.value=0,l.value=0,u.value=null,d.value=0,f.value=[],m.value=void 0,g.value=[],y.value=null,e.value=`lobby`,clearDraft()}}function V(e,t){o.value||y.value!==null&&Date.now()>=y.value||(o.value=!0,s.value=t,saveDraft({questionIdx:a.value,choiceIds:e,elapsed:t}),O===`supabase`?te(e,t):S&&S.readyState===WebSocket.OPEN&&(S.send(JSON.stringify({type:`submit_answer`,choiceIds:e,answerTimeMs:t})),clearDraft()))}return{phase:e,playerId:t,playerCount:n,question:r,questionIdx:a,answered:o,answerTimeMs:s,totalScore:c,lastDelta:l,rank:u,playerTotal:d,correctIds:f,explanation:m,podium:g,connectError:_,quizMeta:v,deadlineMs:y,status:b,canStillAnswer:x,connect:R,submitAnswer:V,submitAnswerSupabase:te}}),STALE_DECK_REASONS=new Set([`deck version mismatch`,`unknown deck`]),PSEUDO_MAX=24,TOP_SIZE=20,deps=null;function setSoloDeps(e){deps=e}var ignore=()=>{},useSoloStore=defineStore(`solo`,()=>{let e=ref(`unavailable`),t=shallowRef(null),n=shallowRef(null),r=ref(``),a=ref(null),o=ref(0),s=ref(0),c=ref(0),l=ref(0),u=ref(0),d=ref(null),f=ref(null),m=ref([]),g=ref([]),_=ref(null),v=ref(null),y=ref(null),b=ref(null),x=ref(`idle`),S=ref(null),C=null,w=null,T=null,E=0,D=Promise.resolve(),O=computed(()=>m.value.filter(e=>e.key!==C?.key)),k=computed(()=>({rank:1+O.value.filter(e=>e.score>c.value).length,of:1+O.value.length})),A=computed(()=>{let e=g.value.map((e,t)=>({...e,rank:t+1,mine:e.id===v.value})),t=b.value;return t&&y.value!==null&&!e.some(e=>e.mine)&&e.push({...t,rank:y.value,mine:!0}),e});function j(){let t=n.value;a.value=t?.question??null,o.value=t?.index??0,s.value=t?.total??0,c.value=t?.score??0,l.value=t?.correctCount??0,u.value=t?.totalTimeMs??0,d.value=t?.deadlineMs??null,f.value=t?.lastResult??null,t&&(t.status===`question`?e.value=`question`:t.status===`revealed`?e.value=`revealed`:t.status===`finished`&&(e.value=`end`))}let M=()=>({pseudo:r.value,index:o.value,total:s.value,score:c.value});function ee(){n.value=null,v.value=null,y.value=null,b.value=null,x.value=`idle`,S.value=null,j()}function P(){E++,w?.();let e=[D];T&&e.push(Promise.resolve().then(T)),C&&e.push(C.leave()),D=Promise.all(e.map(e=>e.catch(ignore))),C=w=T=null,m.value=[],ee()}async function F(){let e=deps?.backend?.api,n=t.value?.id;if(!e||!n)return;let r=E,[a,o]=await Promise.all([e.fetchTop(n,TOP_SIZE),e.fetchCount(n)]);if(r!==E)return;a.ok&&(g.value=a.value),o.ok&&(_.value=o.value);let s=v.value;if(!a.ok||!s)return;let c=a.value.findIndex(e=>e.id===s);if(c>=0){y.value=c+1;return}let[l,u]=await Promise.all([e.fetchRank(s),b.value?.id===s?null:e.fetchRun(s)]);r===E&&v.value===s&&(l.ok&&(y.value=l.value),u?.ok&&(b.value=u.value))}async function I(n){P(),g.value=[],_.value=null,t.value=null;let r=deps?.backend;if(!deps||!r){e.value=`unavailable`;return}e.value=`loading`;let a=E,o;try{o=await deps.findDeck(n)}catch{o=void 0}a===E&&(!o||!o.quiz.meta.solo?e.value=`unavailable`:(t.value=o,e.value=`intro`,await Promise.all([te(o.id,a),F()])))}async function te(r,a){await D;let o=deps?.backend;if(a===E&&o){try{C=o.live(r)}catch{e.value===`intro`&&(t.value=null,e.value=`unavailable`);return}w=C.onChange(e=>{m.value=e}),C.watch().catch(ignore),T=o.api.onNewRun(r,()=>{F()}),n.value&&n.value.status!==`finished`&&C.join(M()).catch(ignore)}}function L(a){let o=a.trim(),s=t.value;if(!s||o.length<1||o.length>24||e.value!==`intro`&&e.value!==`end`)return;ee(),r.value=o;let c=new SoloSession({quiz:s.quiz,deckId:s.id,deckVersion:s.version,pseudo:o,now:R});c.start(),c.total===0?(t.value=null,e.value=`unavailable`):(n.value=c,j(),C?.join(M()).catch(ignore))}let R=()=>(deps?.now??Date.now)(),z=()=>d.value!==null&&R()>=d.value;function B(t){e.value===`question`&&(z()?V():(n.value?.answer(t),j(),C?.update(M()).catch(ignore)))}function V(t=[]){e.value===`question`&&(t.length>0?n.value?.answer(t):n.value?.timeout(),j(),C?.update(M()).catch(ignore))}function H(){e.value===`revealed`&&(n.value?.next(),j(),n.value?.status===`finished`?U():C?.update(M()).catch(ignore))}async function U(){C?.untrack().catch(ignore),await W()}async function W(){let e=deps?.backend?.api,r=n.value,a=t.value;if(!e||!r||!a||r.status!==`finished`||x.value===`saving`||x.value===`saved`)return;let o=E;x.value=`saving`;let s=await e.submitRun(r.toSubmission(),a.quiz);o===E&&n.value===r&&(s.ok?(v.value=s.value.runId,y.value=s.value.rank,x.value=`saved`,await F()):(S.value=s.error,STALE_DECK_REASONS.has(s.error)?(x.value=`stale`,deps?.reloadDecks?.()):x.value=`error`))}function G(){x.value===`error`&&W()}async function K(){if(e.value!==`end`)return;let n=t.value;if(x.value===`stale`&&n){let t=r.value;await I(n.id),e.value===`intro`&&L(t)}else L(r.value)}function q(){P(),t.value=null,e.value=`unavailable`}async function J(e,n={}){let r=deps?.backend?.api;return r?r.submitLead(e,t.value?.id??null,n):{ok:!1,error:`unavailable`}}return{phase:e,deck:t,session:n,pseudo:r,question:a,index:o,total:s,score:c,correctCount:l,totalTimeMs:u,deadlineMs:d,lastResult:f,live:m,liveOthers:O,liveRank:k,top:g,runCount:_,myRunId:v,myRank:y,myRun:b,board:A,submitState:x,submitError:S,open:I,start:L,answer:B,timeout:V,next:H,retrySubmit:G,playAgain:K,abandon:q,submitLead:J}}),scriptRel=`modulepreload`,assetsURL=function(e){return`/`+e},seen={},failedCssLinks={},isCssPreloadUrl=function(e){return e.pathname.endsWith(`.css`)},preloadOnce=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let a=r.then(()=>{e[t]=void 0},n=>{throw delete e[t],n});return e[t]=a,a},__vitePreload=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,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}))))}function c(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=s(t.map(t=>{t=assetsURL(t,n);let r=c(t),a=isCssPreloadUrl(r);return preloadOnce(seen,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}let t=a?e.styles:e.all,n=a?failedCssLinks[r.href]:void 0;if(!n&&t.has(r.href))return;let s=document.createElement(`link`);if(s.rel=a?`stylesheet`:scriptRel,a||(s.as=`script`),s.crossOrigin=``,s.href=r.href,o&&s.setAttribute(`nonce`,o),n&&delete failedCssLinks[r.href],n?.isConnected?n.replaceWith(s):document.head.appendChild(s),a)return new Promise((e,t)=>{let n=a=>{s.removeEventListener(`load`,n),s.removeEventListener(`error`,n),a.type===`error`?(failedCssLinks[r.href]=s,t(Error(`Unable to preload CSS for ${r}`))):e(a)};s.addEventListener(`load`,n),s.addEventListener(`error`,n)})})}).filter(e=>e!==void 0))}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)})},loading=null;function loadSoloDeps(){return loading??=__vitePreload(async()=>{let{defaultSoloDeps:e}=await import(`./deps-BMfrnC0X.js`);return{defaultSoloDeps:e}},__vite__mapDeps([0,1])).then(({defaultSoloDeps:e})=>setSoloDeps(e())),loading}function splitBlocks(e){let t=e.split(/(^|\n)---(\n|$)/g).filter((e,t)=>t%3==0).map(e=>e.trim()).filter(e=>e.length>0);if(t.length===0)return[];let n=t[0],r=t.slice(1);if(r.length%2!=0)throw Error(`Malformed .hashquiz.md file: expected an even number of blocks after the meta section, got ${r.length}`);let a=[];for(let e=0;e<r.length;e+=2){let t=r[e],n=r[e+1];a.push(`---\n${t}\n---\n\n${n}`)}return[n,...a]}var require___vite_browser_external=__commonJSMin(((e,t)=>{t.exports={}})),require_kind_of=__commonJSMin(((e,t)=>{var n=Object.prototype.toString;t.exports=function(e){if(e===void 0)return`undefined`;if(e===null)return`null`;var t=typeof e;if(t===`boolean`)return`boolean`;if(t===`string`)return`string`;if(t===`number`)return`number`;if(t===`symbol`)return`symbol`;if(t===`function`)return l(e)?`generatorfunction`:`function`;if(a(e))return`array`;if(f(e))return`buffer`;if(d(e))return`arguments`;if(s(e))return`date`;if(o(e))return`error`;if(c(e))return`regexp`;switch(r(e)){case`Symbol`:return`symbol`;case`Promise`:return`promise`;case`WeakMap`:return`weakmap`;case`WeakSet`:return`weakset`;case`Map`:return`map`;case`Set`:return`set`;case`Int8Array`:return`int8array`;case`Uint8Array`:return`uint8array`;case`Uint8ClampedArray`:return`uint8clampedarray`;case`Int16Array`:return`int16array`;case`Uint16Array`:return`uint16array`;case`Int32Array`:return`int32array`;case`Uint32Array`:return`uint32array`;case`Float32Array`:return`float32array`;case`Float64Array`:return`float64array`}if(u(e))return`generator`;switch(t=n.call(e),t){case`[object Object]`:return`object`;case`[object Map Iterator]`:return`mapiterator`;case`[object Set Iterator]`:return`setiterator`;case`[object String Iterator]`:return`stringiterator`;case`[object Array Iterator]`:return`arrayiterator`}return t.slice(8,-1).toLowerCase().replace(/\s/g,``)};function r(e){return typeof e.constructor==`function`?e.constructor.name:null}function a(e){return Array.isArray?Array.isArray(e):e instanceof Array}function o(e){return e instanceof Error||typeof e.message==`string`&&e.constructor&&typeof e.constructor.stackTraceLimit==`number`}function s(e){return e instanceof Date||typeof e.toDateString==`function`&&typeof e.getDate==`function`&&typeof e.setDate==`function`}function c(e){return e instanceof RegExp||typeof e.flags==`string`&&typeof e.ignoreCase==`boolean`&&typeof e.multiline==`boolean`&&typeof e.global==`boolean`}function l(e,t){return r(e)===`GeneratorFunction`}function u(e){return typeof e.throw==`function`&&typeof e.return==`function`&&typeof e.next==`function`}function d(e){try{if(typeof e.length==`number`&&typeof e.callee==`function`)return!0}catch(e){if(e.message.indexOf(`callee`)!==-1)return!0}return!1}function f(e){return e.constructor&&typeof e.constructor.isBuffer==`function`?e.constructor.isBuffer(e):!1}})),require_is_extendable=__commonJSMin(((e,t)=>{t.exports=function(e){return e!=null&&(typeof e==`object`||typeof e==`function`)}})),require_extend_shallow=__commonJSMin(((e,t)=>{var n=require_is_extendable();t.exports=function(e){n(e)||(e={});for(var t=arguments.length,a=1;a<t;a++){var o=arguments[a];n(o)&&r(e,o)}return e};function r(e,t){for(var n in t)a(t,n)&&(e[n]=t[n])}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})),require_section_matter=__commonJSMin(((e,t)=>{var n=require_kind_of(),r=require_extend_shallow();t.exports=function(e,t){typeof t==`function`&&(t={parse:t});var n=o(e),u=r({},{section_delimiter:`---`,parse:l},t),d=u.section_delimiter,f=n.content.split(/\r?\n/),m=null,g=c(),_=[],v=[];function y(e){n.content=e,m=[],_=[]}function b(e){v.length&&(g.key=s(v[0],d),g.content=e,u.parse(g,m),m.push(g),g=c(),_=[],v=[])}for(var x=0;x<f.length;x++){var S=f[x],C=v.length,w=S.trim();if(a(w,d)){if(w.length===3&&x!==0){if(C===0||C===2){_.push(S);continue}v.push(w),g.data=_.join(`
|
|
32
|
+
`);let e=await o.signMessage(new TextEncoder().encode(g),`utf8`);if(!e||!(e instanceof Uint8Array))throw Error(`@supabase/auth-js: Wallet signMessage() API returned an recognized value`);_=e}}try{let{data:t,error:n}=await _request(this.fetch,`POST`,`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:`solana`,message:g,signature:bytesToBase64URL(_)},e.options?.captchaToken?{gotrue_meta_security:{captcha_token:e.options?.captchaToken}}:null),xform:_sessionResponse});if(n)throw n;if(!t||!t.session||!t.user){let e=new AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers(`SIGNED_IN`,t.session)),this._returnResult({data:Object.assign({},t),error:n})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){let[t,n]=(await getItemAsync(this.storage,`${this.storageKey}-code-verifier`)??``).split(`/`);try{if(!t&&this.flowType===`pkce`)throw new AuthPKCECodeVerifierMissingError;let{data:r,error:a}=await _request(this.fetch,`POST`,`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:t},xform:_sessionResponse});if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!r||!r.session||!r.user){let e=new AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers(n===`recovery`?`PASSWORD_RECOVERY`:`SIGNED_IN`,r.session)),this._returnResult({data:Object.assign(Object.assign({},r),{redirectType:n??null}),error:a})}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{let{options:t,provider:n,token:r,access_token:a,nonce:o}=e,{data:s,error:c}=await _request(this.fetch,`POST`,`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:r,access_token:a,nonce:o,gotrue_meta_security:{captcha_token:t?.captchaToken}},xform:_sessionResponse});if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!s||!s.session||!s.user){let e=new AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers(`SIGNED_IN`,s.session)),this._returnResult({data:s,error:c})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,n,r,a,o;try{if(`email`in e){let{email:t,options:n}=e,r=null,a=null;this.flowType===`pkce`&&([r,a]=await getCodeChallengeAndMethod(this.storage,this.storageKey));let{error:o}=await _request(this.fetch,`POST`,`${this.url}/otp`,{headers:this.headers,body:{email:t,data:n?.data??{},create_user:n?.shouldCreateUser??!0,gotrue_meta_security:{captcha_token:n?.captchaToken},code_challenge:r,code_challenge_method:a},redirectTo:n?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if(`phone`in e){let{phone:t,options:n}=e,{data:r,error:a}=await _request(this.fetch,`POST`,`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:n?.data??{},create_user:n?.shouldCreateUser??!0,gotrue_meta_security:{captcha_token:n?.captchaToken},channel:n?.channel??`sms`}});return this._returnResult({data:{user:null,session:null,messageId:r?.message_id},error:a})}throw new AuthInvalidCredentialsError(`You must provide either an email or phone number.`)}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,n;try{let t,n;`options`in e&&(t=e.options?.redirectTo,n=e.options?.captchaToken);let{data:r,error:a}=await _request(this.fetch,`POST`,`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:n}}),redirectTo:t,xform:_sessionResponse});if(a)throw a;if(!r)throw Error(`An error occurred on token verification.`);let o=r.session,s=r.user;return o?.access_token&&(await this._saveSession(o),await this._notifyAllSubscribers(e.type==`recovery`?`PASSWORD_RECOVERY`:`SIGNED_IN`,o)),this._returnResult({data:{user:s,session:o},error:null})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,n,r,a,o;try{let t=null,n=null;this.flowType===`pkce`&&([t,n]=await getCodeChallengeAndMethod(this.storage,this.storageKey));let r=await _request(this.fetch,`POST`,`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},`providerId`in e?{provider_id:e.providerId}:null),`domain`in e?{domain:e.domain}:null),{redirect_to:e.options?.redirectTo??void 0}),e?.options?.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:t,code_challenge_method:n}),headers:this.headers,xform:_ssoResponse});return r.data?.url&&isBrowser()&&!e.options?.skipBrowserRedirect&&window.location.assign(r.data.url),this._returnResult(r)}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;if(n)throw n;if(!t)throw new AuthSessionMissingError;let{error:r}=await _request(this.fetch,`GET`,`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let t=`${this.url}/resend`;if(`email`in e){let{email:n,type:r,options:a}=e,{error:o}=await _request(this.fetch,`POST`,t,{headers:this.headers,body:{email:n,type:r,gotrue_meta_security:{captcha_token:a?.captchaToken}},redirectTo:a?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if(`phone`in e){let{phone:n,type:r,options:a}=e,{data:o,error:s}=await _request(this.fetch,`POST`,t,{headers:this.headers,body:{phone:n,type:r,gotrue_meta_security:{captcha_token:a?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o?.message_id},error:s})}throw new AuthInvalidCredentialsError(`You must provide either an email or phone number and a type`)}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug(`#_acquireLock`,`begin`,e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug(`#_acquireLock`,`lock acquired for storage key`,this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch{}})()),await e;this.pendingInLock.length;){let e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug(`#_acquireLock`,`lock released for storage key`,this.storageKey),this.lockAcquired=!1}})}finally{this._debug(`#_acquireLock`,`end`)}}async _useSession(e){this._debug(`#_useSession`,`begin`);try{return await e(await this.__loadSession())}finally{this._debug(`#_useSession`,`end`)}}async __loadSession(){this._debug(`#__loadSession()`,`begin`),this.lockAcquired||this._debug(`#__loadSession()`,`used outside of an acquired lock!`,Error().stack);try{let e=null,t=await getItemAsync(this.storage,this.storageKey);if(this._debug(`#getSession()`,`session from storage`,t),t!==null&&(this._isValidSession(t)?e=t:(this._debug(`#getSession()`,`session from storage is not valid`),await this._removeSession())),!e)return{data:{session:null},error:null};let n=e.expires_at?e.expires_at*1e3-Date.now()<EXPIRY_MARGIN_MS:!1;if(this._debug(`#__loadSession()`,`session has${n?``:` not`} expired`,`expires_at`,e.expires_at),!n){if(this.userStorage){let t=await getItemAsync(this.userStorage,this.storageKey+`-user`);t?.user?e.user=t.user:e.user=userNotAvailableProxy()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){let t={value:this.suppressGetSessionWarning};e.user=insecureUserWarningProxy(e.user,t),t.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}let{data:r,error:a}=await this._callRefreshToken(e.refresh_token);return a?this._returnResult({data:{session:null},error:a}):this._returnResult({data:{session:r},error:null})}finally{this._debug(`#__loadSession()`,`end`)}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let t=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await _request(this.fetch,`GET`,`${this.url}/user`,{headers:this.headers,jwt:e,xform:_userResponse}):await this._useSession(async e=>{var t,n,r;let{data:a,error:o}=e;if(o)throw o;return!a.session?.access_token&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new AuthSessionMissingError}:await _request(this.fetch,`GET`,`${this.url}/user`,{headers:this.headers,jwt:a.session?.access_token??void 0,xform:_userResponse})})}catch(e){if(isAuthError(e))return isAuthSessionMissingError(e)&&(await this._removeSession(),await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async n=>{let{data:r,error:a}=n;if(a)throw a;if(!r.session)throw new AuthSessionMissingError;let o=r.session,s=null,c=null;this.flowType===`pkce`&&e.email!=null&&([s,c]=await getCodeChallengeAndMethod(this.storage,this.storageKey));let{data:l,error:u}=await _request(this.fetch,`PUT`,`${this.url}/user`,{headers:this.headers,redirectTo:t?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:s,code_challenge_method:c}),jwt:o.access_token,xform:_userResponse});if(u)throw u;return o.user=l.user,await this._saveSession(o),await this._notifyAllSubscribers(`USER_UPDATED`,o),this._returnResult({data:{user:o.user},error:null})})}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new AuthSessionMissingError;let t=Date.now()/1e3,n=t,r=!0,a=null,{payload:o}=decodeJWT(e.access_token);if(o.exp&&(n=o.exp,r=n<=t),r){let{data:t,error:n}=await this._callRefreshToken(e.refresh_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!t)return{data:{user:null,session:null},error:null};a=t}else{let{data:r,error:o}=await this._getUser(e.access_token);if(o)return this._returnResult({data:{user:null,session:null},error:o});a={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:`bearer`,expires_in:n-t,expires_at:n},await this._saveSession(a),await this._notifyAllSubscribers(`SIGNED_IN`,a)}return this._returnResult({data:{user:a.user,session:a},error:null})}catch(e){if(isAuthError(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var n;if(!e){let{data:n,error:r}=t;if(r)throw r;e=n.session??void 0}if(!e?.refresh_token)throw new AuthSessionMissingError;let{data:r,error:a}=await this._callRefreshToken(e.refresh_token);return a?this._returnResult({data:{user:null,session:null},error:a}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var n;try{if(!isBrowser())throw new AuthImplicitGrantRedirectError(`No browser detected.`);if(e.error||e.error_description||e.error_code)throw new AuthImplicitGrantRedirectError(e.error_description||`Error in URL with unspecified error_description`,{error:e.error||`unspecified_error`,code:e.error_code||`unspecified_code`});switch(t){case`implicit`:if(this.flowType===`pkce`)throw new AuthPKCEGrantCodeExchangeError(`Not a valid PKCE flow url.`);break;case`pkce`:if(this.flowType===`implicit`)throw new AuthImplicitGrantRedirectError(`Not a valid implicit grant flow url.`)}if(t===`pkce`){if(this._debug(`#_initialize()`,`begin`,`is PKCE flow`,!0),!e.code)throw new AuthPKCEGrantCodeExchangeError(`No code detected.`);let{data:t,error:n}=await this._exchangeCodeForSession(e.code);if(n)throw n;let r=new URL(window.location.href);return r.searchParams.delete(`code`),window.history.replaceState(window.history.state,``,r.toString()),{data:{session:t.session,redirectType:t.redirectType??null},error:null}}let{provider_token:n,provider_refresh_token:r,access_token:a,refresh_token:o,expires_in:s,expires_at:c,token_type:l}=e;if(!a||!s||!o||!l)throw new AuthImplicitGrantRedirectError(`No session defined in URL`);let u=Math.round(Date.now()/1e3),d=parseInt(s),f=u+d;c&&(f=parseInt(c));let m=f-u;m*1e3<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${d}s`);let g=f-d;u-g>=120?console.warn(`@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale`,g,f,u):u-g<0&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew`,g,f,u);let{data:_,error:v}=await this._getUser(a);if(v)throw v;let y={provider_token:n,provider_refresh_token:r,access_token:a,expires_in:d,expires_at:f,refresh_token:o,token_type:l,user:_.user};return window.location.hash=``,this._debug(`#_getSessionFromURL()`,`clearing window.location.hash`),this._returnResult({data:{session:y,redirectType:e.type},error:null})}catch(e){if(isAuthError(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl==`function`?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await getItemAsync(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:`global`}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:`global`}){return await this._useSession(async t=>{var n;let{data:r,error:a}=t;if(a&&!isAuthSessionMissingError(a))return this._returnResult({error:a});let o=r.session?.access_token;if(o){let{error:t}=await this.admin.signOut(o,e);if(t&&!(isAuthApiError(t)&&(t.status===404||t.status===401||t.status===403)||isAuthSessionMissingError(t)))return this._returnResult({error:t})}return e!==`others`&&(await this._removeSession(),await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let t=generateCallbackId(),n={id:t,callback:e,unsubscribe:()=>{this._debug(`#unsubscribe()`,`state change callback with id removed`,t),this.stateChangeEmitters.delete(t)}};return this._debug(`#onAuthStateChange()`,`registered callback with id`,t),this.stateChangeEmitters.set(t,n),(async()=>{await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async t=>{var n,r;try{let{data:{session:n},error:r}=t;if(r)throw r;await this.stateChangeEmitters.get(e)?.callback(`INITIAL_SESSION`,n),this._debug(`INITIAL_SESSION`,`callback id`,e,`session`,n)}catch(t){await this.stateChangeEmitters.get(e)?.callback(`INITIAL_SESSION`,null),this._debug(`INITIAL_SESSION`,`callback id`,e,`error`,t),isAuthSessionMissingError(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let n=null,r=null;this.flowType===`pkce`&&([n,r]=await getCodeChallengeAndMethod(this.storage,this.storageKey,!0));try{return await _request(this.fetch,`POST`,`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{let{data:e,error:t}=await this.getUser();if(t)throw t;return this._returnResult({data:{identities:e.user.identities??[]},error:null})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return`token`in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{let{data:t,error:n}=await this._useSession(async t=>{var n,r,a,o,s;let{data:c,error:l}=t;if(l)throw l;let u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:e.options?.redirectTo,scopes:e.options?.scopes,queryParams:e.options?.queryParams,skipBrowserRedirect:!0});return await _request(this.fetch,`GET`,u,{headers:this.headers,jwt:c.session?.access_token??void 0})});if(n)throw n;return isBrowser()&&!e.options?.skipBrowserRedirect&&window.location.assign(t?.url),this._returnResult({data:{provider:e.provider,url:t?.url},error:null})}catch(t){if(isAuthError(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var n;try{let{error:n,data:{session:r}}=t;if(n)throw n;let{options:a,provider:o,token:s,access_token:c,nonce:l}=e,{data:u,error:d}=await _request(this.fetch,`POST`,`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:r?.access_token??void 0,body:{provider:o,id_token:s,access_token:c,nonce:l,link_identity:!0,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:_sessionResponse});return d?this._returnResult({data:{user:null,session:null},error:d}):!u||!u.session||!u.user?this._returnResult({data:{user:null,session:null},error:new AuthInvalidTokenResponseError}):(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers(`USER_UPDATED`,u.session)),this._returnResult({data:u,error:d}))}catch(e){if(await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`),isAuthError(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var n,r;let{data:a,error:o}=t;if(o)throw o;return await _request(this.fetch,`DELETE`,`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:a.session?.access_token??void 0})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){let t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,`begin`);try{let n=Date.now();return await retryable(async n=>(n>0&&await sleep(200*2**(n-1)),this._debug(t,`refreshing attempt`,n),await _request(this.fetch,`POST`,`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:_sessionResponse})),(e,t)=>{let r=200*2**e;return t&&isAuthRetryableFetchError(t)&&Date.now()+r-n<3e4})}catch(e){if(this._debug(t,`error`,e),isAuthError(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}finally{this._debug(t,`end`)}}_isValidSession(e){return typeof e==`object`&&!!e&&`access_token`in e&&`refresh_token`in e&&`expires_at`in e}async _handleProviderSignIn(e,t){let n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug(`#_handleProviderSignIn()`,`provider`,e,`options`,t,`url`,n),isBrowser()&&!t.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,t;let n=`#_recoverAndRefresh()`;this._debug(n,`begin`);try{let e=await getItemAsync(this.storage,this.storageKey);if(e&&this.userStorage){let t=await getItemAsync(this.userStorage,this.storageKey+`-user`);!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!t&&(t={user:e.user},await setItemAsync(this.userStorage,this.storageKey+`-user`,t)),e.user=t?.user??userNotAvailableProxy()}else if(e&&!e.user&&!e.user){let t=await getItemAsync(this.storage,this.storageKey+`-user`);t&&t?.user?(e.user=t.user,await removeItemAsync(this.storage,this.storageKey+`-user`),await setItemAsync(this.storage,this.storageKey,e)):e.user=userNotAvailableProxy()}if(this._debug(n,`session from storage`,e),!this._isValidSession(e)){this._debug(n,`session is not valid`),e!==null&&await this._removeSession();return}let t=(e.expires_at??1/0)*1e3-Date.now()<EXPIRY_MARGIN_MS;if(this._debug(n,`session has${t?``:` not`} expired with margin of ${EXPIRY_MARGIN_MS}s`),t){if(this.autoRefreshToken&&e.refresh_token){let{error:t}=await this._callRefreshToken(e.refresh_token);t&&(console.error(t),isAuthRetryableFetchError(t)||(this._debug(n,`refresh failed with a non-retryable error, removing the session`,t),await this._removeSession()))}}else if(e.user&&e.user.__isUserNotAvailableProxy===!0)try{let{data:t,error:r}=await this._getUser(e.access_token);!r&&t?.user?(e.user=t.user,await this._saveSession(e),await this._notifyAllSubscribers(`SIGNED_IN`,e)):this._debug(n,`could not get user data, skipping SIGNED_IN notification`)}catch(e){console.error(`Error getting user data:`,e),this._debug(n,`error getting user data, skipping SIGNED_IN notification`,e)}else await this._notifyAllSubscribers(`SIGNED_IN`,e)}catch(e){this._debug(n,`error`,e),console.error(e);return}finally{this._debug(n,`end`)}}async _callRefreshToken(e){var t,n;if(!e)throw new AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let r=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(r,`begin`);try{this.refreshingDeferred=new Deferred;let{data:t,error:n}=await this._refreshAccessToken(e);if(n)throw n;if(!t.session)throw new AuthSessionMissingError;await this._saveSession(t.session),await this._notifyAllSubscribers(`TOKEN_REFRESHED`,t.session);let r={data:t.session,error:null};return this.refreshingDeferred.resolve(r),r}catch(e){if(this._debug(r,`error`,e),isAuthError(e)){let n={data:null,error:e};return isAuthRetryableFetchError(e)||await this._removeSession(),(t=this.refreshingDeferred)==null||t.resolve(n),n}throw(n=this.refreshingDeferred)==null||n.reject(e),e}finally{this.refreshingDeferred=null,this._debug(r,`end`)}}async _notifyAllSubscribers(e,t,n=!0){let r=`#_notifyAllSubscribers(${e})`;this._debug(r,`begin`,t,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:t});let r=[],a=Array.from(this.stateChangeEmitters.values()).map(async n=>{try{await n.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(a),r.length>0){for(let e=0;e<r.length;e+=1)console.error(r[e]);throw r[0]}}finally{this._debug(r,`end`)}}async _saveSession(e){this._debug(`#_saveSession()`,e),this.suppressGetSessionWarning=!0,await removeItemAsync(this.storage,`${this.storageKey}-code-verifier`);let t=Object.assign({},e),n=t.user&&t.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&t.user&&await setItemAsync(this.userStorage,this.storageKey+`-user`,{user:t.user});let e=Object.assign({},t);delete e.user;let r=deepClone(e);await setItemAsync(this.storage,this.storageKey,r)}else{let e=deepClone(t);await setItemAsync(this.storage,this.storageKey,e)}}async _removeSession(){this._debug(`#_removeSession()`),this.suppressGetSessionWarning=!1,await removeItemAsync(this.storage,this.storageKey),await removeItemAsync(this.storage,this.storageKey+`-code-verifier`),await removeItemAsync(this.storage,this.storageKey+`-user`),this.userStorage&&await removeItemAsync(this.userStorage,this.storageKey+`-user`),await this._notifyAllSubscribers(`SIGNED_OUT`,null)}_removeVisibilityChangedCallback(){this._debug(`#_removeVisibilityChangedCallback()`);let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&isBrowser()&&window!=null&&window.removeEventListener&&window.removeEventListener(`visibilitychange`,e)}catch(e){console.error(`removing visibilitychange callback failed`,e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug(`#_startAutoRefresh()`);let e=setInterval(()=>this._autoRefreshTokenTick(),AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&typeof e==`object`&&typeof e.unref==`function`?e.unref():typeof Deno<`u`&&typeof Deno.unrefTimer==`function`&&Deno.unrefTimer(e);let t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&typeof t==`object`&&typeof t.unref==`function`?t.unref():typeof Deno<`u`&&typeof Deno.unrefTimer==`function`&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug(`#_stopAutoRefresh()`);let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);let t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug(`#_autoRefreshTokenTick()`,`begin`);try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async t=>{let{data:{session:n}}=t;if(!n||!n.refresh_token||!n.expires_at){this._debug(`#_autoRefreshTokenTick()`,`no session`);return}let r=Math.floor((n.expires_at*1e3-e)/AUTO_REFRESH_TICK_DURATION_MS);this._debug(`#_autoRefreshTokenTick()`,`access token expires in ${r} ticks, a tick lasts ${AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is 3 ticks`),r<=3&&await this._callRefreshToken(n.refresh_token)})}catch(e){console.error(`Auto refresh tick failed with error. This is likely a transient error.`,e)}}finally{this._debug(`#_autoRefreshTokenTick()`,`end`)}})}catch(e){if(e instanceof LockAcquireTimeoutError)this._debug(`auto refresh token tick lock not available`);else throw e}}async _handleVisibilityChange(){if(this._debug(`#_handleVisibilityChange()`),!isBrowser()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug(`#visibilityChangedCallback`,`error`,e)}},window==null||window.addEventListener(`visibilitychange`,this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error(`_handleVisibilityChange`,e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;this._debug(t,`visibilityState`,document.visibilityState),document.visibilityState===`visible`?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{document.visibilityState===`visible`?await this._recoverAndRefresh():this._debug(t,`acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting`)}))):document.visibilityState===`hidden`&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,n){let r=[`provider=${encodeURIComponent(t)}`];if(n?.redirectTo&&r.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n?.scopes&&r.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType===`pkce`){let[e,t]=await getCodeChallengeAndMethod(this.storage,this.storageKey),n=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(n.toString())}if(n?.queryParams){let e=new URLSearchParams(n.queryParams);r.push(e.toString())}return n?.skipBrowserRedirect&&r.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${r.join(`&`)}`}async _unenroll(e){try{return await this._useSession(async t=>{var n;let{data:r,error:a}=t;return a?this._returnResult({data:null,error:a}):await _request(this.fetch,`DELETE`,`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:r?.session?.access_token})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var n,r;let{data:a,error:o}=t;if(o)return this._returnResult({data:null,error:o});let s=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType===`phone`?{phone:e.phone}:e.factorType===`totp`?{issuer:e.issuer}:{}),{data:c,error:l}=await _request(this.fetch,`POST`,`${this.url}/factors`,{body:s,headers:this.headers,jwt:a?.session?.access_token});return l?this._returnResult({data:null,error:l}):(e.factorType===`totp`&&c.type===`totp`&&c?.totp?.qr_code&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var n;let{data:r,error:a}=t;if(a)return this._returnResult({data:null,error:a});let o=Object.assign({challenge_id:e.challengeId},`webauthn`in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type===`create`?serializeCredentialCreationResponse(e.webauthn.credential_response):serializeCredentialRequestResponse(e.webauthn.credential_response)})}:{code:e.code}),{data:s,error:c}=await _request(this.fetch,`POST`,`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:r?.session?.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+s.expires_in},s)),await this._notifyAllSubscribers(`MFA_CHALLENGE_VERIFIED`,s),this._returnResult({data:s,error:c}))})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var n;let{data:r,error:a}=t;if(a)return this._returnResult({data:null,error:a});let o=await _request(this.fetch,`POST`,`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:r?.session?.access_token});if(o.error)return o;let{data:s}=o;if(s.type!==`webauthn`)return{data:s,error:null};switch(s.webauthn.type){case`create`:return{data:Object.assign(Object.assign({},s),{webauthn:Object.assign(Object.assign({},s.webauthn),{credential_options:Object.assign(Object.assign({},s.webauthn.credential_options),{publicKey:deserializeCredentialCreationOptions(s.webauthn.credential_options.publicKey)})})}),error:null};case`request`:return{data:Object.assign(Object.assign({},s),{webauthn:Object.assign(Object.assign({},s.webauthn),{credential_options:Object.assign(Object.assign({},s.webauthn.credential_options),{publicKey:deserializeCredentialRequestOptions(s.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}})}async _challengeAndVerify(e){let{data:t,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;let{data:{user:t},error:n}=await this.getUser();if(n)return{data:null,error:n};let r={all:[],phone:[],totp:[],webauthn:[]};for(let e of t?.factors??[])r.all.push(e),e.status===`verified`&&r[e.factor_type].push(e);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,n,r,a;if(e)try{let{payload:t}=decodeJWT(e),n=null;t.aal&&(n=t.aal);let r=n,{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});((a?.factors)?.filter(e=>e.status===`verified`)??[]).length>0&&(r=`aal2`);let s=t.amr||[];return{data:{currentLevel:n,nextLevel:r,currentAuthenticationMethods:s},error:null}}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}let{data:{session:o},error:s}=await this.getSession();if(s)return this._returnResult({data:null,error:s});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:c}=decodeJWT(o.access_token),l=null;c.aal&&(l=c.aal);let u=l;(o.user.factors?.filter(e=>e.status===`verified`)??[]).length>0&&(u=`aal2`);let d=c.amr||[];return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await _request(this.fetch,`GET`,`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new AuthSessionMissingError})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async n=>{let{data:{session:r},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!r)return this._returnResult({data:null,error:new AuthSessionMissingError});let o=await _request(this.fetch,`POST`,`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:`approve`},xform:e=>({data:e,error:null})});return o.data&&o.data.redirect_url&&isBrowser()&&!t?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async n=>{let{data:{session:r},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!r)return this._returnResult({data:null,error:new AuthSessionMissingError});let o=await _request(this.fetch,`POST`,`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:`deny`},xform:e=>({data:e,error:null})});return o.data&&o.data.redirect_url&&isBrowser()&&!t?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;return n?this._returnResult({data:null,error:n}):t?await _request(this.fetch,`GET`,`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new AuthSessionMissingError})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?(await _request(this.fetch,`DELETE`,`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new AuthSessionMissingError})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let n=t.keys.find(t=>t.kid===e);if(n)return n;let r=Date.now();if(n=this.jwks.keys.find(t=>t.kid===e),n&&this.jwks_cached_at+6e5>r)return n;let{data:a,error:o}=await _request(this.fetch,`GET`,`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!a.keys||a.keys.length===0||(this.jwks=a,this.jwks_cached_at=r,n=a.keys.find(t=>t.kid===e),!n)?null:n}async getClaims(e,t={}){try{let n=e;if(!n){let{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});n=e.session.access_token}let{header:r,payload:a,signature:o,raw:{header:s,payload:c}}=decodeJWT(n);t?.allowExpired||validateExp(a.exp);let l=!r.alg||r.alg.startsWith(`HS`)||!r.kid||!(`crypto`in globalThis&&`subtle`in globalThis.crypto)?null:await this.fetchJwk(r.kid,t?.keys?{keys:t.keys}:t?.jwks);if(!l){let{error:e}=await this.getUser(n);if(e)throw e;return{data:{claims:a,header:r,signature:o},error:null}}let u=getAlgorithm(r.alg),d=await crypto.subtle.importKey(`jwk`,l,u,!0,[`verify`]);if(!await crypto.subtle.verify(u,d,o,stringToUint8Array(`${s}.${c}`)))throw new AuthInvalidJwtError(`Invalid JWT signature`);return{data:{claims:a,header:r,signature:o},error:null}}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,n,r;assertPasskeyExperimentalEnabled(this.experimental);try{if(!browserSupportsWebAuthn())return this._returnResult({data:null,error:new AuthUnknownError(`Browser does not support WebAuthn`,null)});let{data:t,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:e?.options?.captchaToken}});if(n||!t)return this._returnResult({data:null,error:n});let{data:r,error:a}=await getCredential({publicKey:deserializeCredentialRequestOptions(t.options),signal:e?.options?.signal??webAuthnAbortService.createNewAbortSignal()});if(a||!r)return this._returnResult({data:null,error:a??new AuthUnknownError(`WebAuthn ceremony failed`,null)});let o=serializeCredentialRequestResponse(r);return this._verifyPasskeyAuthentication({challengeId:t.challenge_id,credential:o})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,n;assertPasskeyExperimentalEnabled(this.experimental);try{if(!browserSupportsWebAuthn())return this._returnResult({data:null,error:new AuthUnknownError(`Browser does not support WebAuthn`,null)});let{data:t,error:n}=await this._startPasskeyRegistration();if(n||!t)return this._returnResult({data:null,error:n});let{data:r,error:a}=await createCredential({publicKey:deserializeCredentialCreationOptions(t.options),signal:e?.options?.signal??webAuthnAbortService.createNewAbortSignal()});if(a||!r)return this._returnResult({data:null,error:a??new AuthUnknownError(`WebAuthn ceremony failed`,null)});let o=serializeCredentialCreationResponse(r);return this._verifyPasskeyRegistration({challengeId:t.challenge_id,credential:o})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){assertPasskeyExperimentalEnabled(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!t)return this._returnResult({data:null,error:new AuthSessionMissingError});let{data:r,error:a}=await _request(this.fetch,`POST`,`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:r,error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){assertPasskeyExperimentalEnabled(this.experimental);try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new AuthSessionMissingError});let{data:a,error:o}=await _request(this.fetch,`POST`,`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;assertPasskeyExperimentalEnabled(this.experimental);try{let{data:t,error:n}=await _request(this.fetch,`POST`,`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:e?.options?.captchaToken}}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:t,error:null})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){assertPasskeyExperimentalEnabled(this.experimental);try{let{data:t,error:n}=await _request(this.fetch,`POST`,`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:_sessionResponse});return n?this._returnResult({data:null,error:n}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers(`SIGNED_IN`,t.session)),this._returnResult({data:t,error:null}))}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){assertPasskeyExperimentalEnabled(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!t)return this._returnResult({data:null,error:new AuthSessionMissingError});let{data:r,error:a}=await _request(this.fetch,`GET`,`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return a?this._returnResult({data:null,error:a}):this._returnResult({data:r,error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){assertPasskeyExperimentalEnabled(this.experimental);try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new AuthSessionMissingError});let{data:a,error:o}=await _request(this.fetch,`PATCH`,`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){assertPasskeyExperimentalEnabled(this.experimental);try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new AuthSessionMissingError});let{error:a}=await _request(this.fetch,`DELETE`,`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return a?this._returnResult({data:null,error:a}):this._returnResult({data:null,error:null})})}catch(e){if(isAuthError(e))return this._returnResult({data:null,error:e});throw e}}};GoTrueClient.nextInstanceID={};var AuthClient=GoTrueClient,version=`2.106.1`,JS_ENV=``;JS_ENV=typeof Deno<`u`?`deno`:typeof document<`u`?`web`:typeof navigator<`u`&&navigator.product===`ReactNative`?`react-native`:`node`;var DEFAULT_GLOBAL_OPTIONS={headers:{"X-Client-Info":`supabase-js-${JS_ENV}/${version}`}},DEFAULT_DB_OPTIONS={schema:`public`},DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:`implicit`},DEFAULT_REALTIME_OPTIONS={},DEFAULT_TRACE_PROPAGATION_OPTIONS={enabled:!1,respectSamplingDecision:!0};function __awaiter(e,t,n,r){function a(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?n(e.value):a(e.value).then(s,c)}l((r=r.apply(e,t||[])).next())})}var otelModulePromise=null,OTEL_PKG=`@opentelemetry/api`;function loadOtel(){return otelModulePromise===null&&(otelModulePromise=import(OTEL_PKG).catch(()=>null)),otelModulePromise}function extractTraceContext(){return __awaiter(this,void 0,void 0,function*(){try{let e=yield loadOtel();if(!e||!e.propagation||!e.context)return null;let t={};e.propagation.inject(e.context.active(),t);let n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch{return null}})}function parseTraceParent(e){if(!e||typeof e!=`string`)return null;let t=e.split(`-`);if(t.length!==4)return null;let[n,r,a,o]=t;if(n.length!==2||r.length!==32||a.length!==16||o.length!==2)return null;let s=/^[0-9a-f]+$/i;return!s.test(n)||!s.test(r)||!s.test(a)||!s.test(o)||r===`00000000000000000000000000000000`||a===`0000000000000000`?null:{version:n,traceId:r,parentId:a,traceFlags:o,isSampled:(parseInt(o,16)&1)==1}}function shouldPropagateToTarget(e,t){if(!e||!t||t.length===0)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch{return!1}for(let e of t)try{if(typeof e==`string`){if(matchStringTarget(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if(typeof e==`function`&&e(n))return!0}catch{continue}return!1}function matchStringTarget(e,t){if(t===e)return!0;if(t.startsWith(`*.`)){let n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith(`.`+n)))return!0}return!1}function getDefaultPropagationTargets(e){let t=[];try{let n=new URL(e);t.push(n.hostname)}catch{}return t.push(`*.supabase.co`,`*.supabase.in`),t.push(`localhost`,`127.0.0.1`,`[::1]`),t}function _typeof(e){"@babel/helpers - typeof";return _typeof=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},_typeof(e)}function toPrimitive(e,t){if(_typeof(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_typeof(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function toPropertyKey(e){var t=toPrimitive(e,`string`);return _typeof(t)==`symbol`?t:t+``}function _defineProperty(e,t,n){return(t=toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys(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 _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),resolveHeadersConstructor=()=>Headers,fetchWithAuth=(e,t,n,r,a)=>{let o=resolveFetch(r),s=resolveHeadersConstructor(),c=a?.enabled===!0,l=a?.respectSamplingDecision!==!1,u=c?getDefaultPropagationTargets(t):null;return async(t,r)=>{var a;let c=await n()??e,d=new s(r?.headers);if(d.has(`apikey`)||d.set(`apikey`,e),d.has(`Authorization`)||d.set(`Authorization`,`Bearer ${c}`),u){let e=await getTraceHeaders(t,u,l);e&&(e.traceparent&&!d.has(`traceparent`)&&d.set(`traceparent`,e.traceparent),e.tracestate&&!d.has(`tracestate`)&&d.set(`tracestate`,e.tracestate),e.baggage&&!d.has(`baggage`)&&d.set(`baggage`,e.baggage))}return o(t,_objectSpread2(_objectSpread2({},r),{},{headers:d}))}};async function getTraceHeaders(e,t,n){if(!shouldPropagateToTarget(typeof e==`string`||e instanceof URL?e:e.url,t))return null;let r=await extractTraceContext();if(!r||!r.traceparent)return null;if(n){let e=parseTraceParent(r.traceparent);if(e&&!e.isSampled)return null}return r}function normalizeTracePropagation(e){return typeof e==`boolean`?{enabled:e}:e}function ensureTrailingSlash(e){return e.endsWith(`/`)?e:e+`/`}function applySettingDefaults(e,t){var n,r,a,o,s,c;let{db:l,auth:u,realtime:d,global:f}=e,{db:m,auth:g,realtime:_,global:v}=t,y=normalizeTracePropagation(e.tracePropagation),b=normalizeTracePropagation(t.tracePropagation),x={db:_objectSpread2(_objectSpread2({},m),l),auth:_objectSpread2(_objectSpread2({},g),u),realtime:_objectSpread2(_objectSpread2({},_),d),storage:{},global:_objectSpread2(_objectSpread2(_objectSpread2({},v),f),{},{headers:_objectSpread2(_objectSpread2({},v?.headers??{}),f?.headers??{})}),tracePropagation:{enabled:y?.enabled??b?.enabled??!1,respectSamplingDecision:y?.respectSamplingDecision??b?.respectSamplingDecision??!0},accessToken:async()=>``};return e.accessToken?x.accessToken=e.accessToken:delete x.accessToken,x}function validateSupabaseUrl(e){let t=e?.trim();if(!t)throw Error(`supabaseUrl is required.`);if(!t.match(/^https?:\/\//i))throw Error(`Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.`);try{return new URL(ensureTrailingSlash(t))}catch{throw Error(`Invalid supabaseUrl: Provided URL is malformed.`)}}var SupabaseAuthClient=class extends AuthClient{constructor(e){super(e)}},SupabaseClient=class{constructor(e,t,n){var r,a;this.supabaseUrl=e,this.supabaseKey=t;let o=validateSupabaseUrl(e);if(!t)throw Error(`supabaseKey is required.`);this.realtimeUrl=new URL(`realtime/v1`,o),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace(`http`,`ws`),this.authUrl=new URL(`auth/v1`,o),this.storageUrl=new URL(`storage/v1`,o),this.functionsUrl=new URL(`functions/v1`,o);let s=`sb-${o.hostname.split(`.`)[0]}-auth-token`,c={db:DEFAULT_DB_OPTIONS,realtime:DEFAULT_REALTIME_OPTIONS,auth:_objectSpread2(_objectSpread2({},DEFAULT_AUTH_OPTIONS),{},{storageKey:s}),global:DEFAULT_GLOBAL_OPTIONS,tracePropagation:DEFAULT_TRACE_PROPAGATION_OPTIONS},l=applySettingDefaults(n??{},c);if(this.settings=l,this.storageKey=l.auth.storageKey??``,this.headers=l.global.headers??{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient(l.auth??{},this.headers,l.global.fetch)}this.fetch=fetchWithAuth(t,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(_objectSpread2({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn(`Failed to set initial Realtime auth token:`,e)),this.rest=new PostgrestClient(new URL(`rest/v1`,o).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();let{data:r}=await e.auth.getSession();return r.session?.access_token??e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:a,storageKey:o,flowType:s,lock:c,debug:l,throwOnError:u,experimental:d,lockAcquireTimeout:f,skipAutoInitialize:m},g,_){let v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new SupabaseAuthClient({url:this.authUrl.href,headers:_objectSpread2(_objectSpread2({},v),g),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:a,flowType:s,lock:c,debug:l,throwOnError:u,experimental:d,fetch:_,lockAcquireTimeout:f,skipAutoInitialize:m,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>e.toLowerCase()===`authorization`)})}_initRealtimeClient(e){return new RealtimeClient(this.realtimeUrl.href,_objectSpread2(_objectSpread2({},e),{},{params:_objectSpread2(_objectSpread2({},{apikey:this.supabaseKey}),e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,`CLIENT`,t?.access_token)})}_handleTokenChanged(e,t,n){(e===`TOKEN_REFRESHED`||e===`SIGNED_IN`)&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e===`SIGNED_OUT`&&(this.realtime.setAuth(),t==`STORAGE`&&this.auth.signOut(),this.changedAccessToken=void 0)}},createClient=(e,t,n)=>new SupabaseClient(e,t,n);function shouldShowDeprecationWarning(){if(typeof window<`u`)return!1;let e=globalThis.process;if(!e)return!1;let t=e.version;if(t==null)return!1;let n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}shouldShowDeprecationWarning()&&console.warn(`⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217`);var SupabaseTransport=class{client;channels=new Map;eventSubs=new Map;presenceSubs=new Map;constructor(e){if(e.client)this.client=e.client;else{if(!e.url||!e.anonKey)throw Error(`SupabaseTransport requires url + anonKey when no client is provided`);this.client=createClient(e.url,e.anonKey)}}getChannel(e){let t=this.channels.get(e);return t||(t=this.client.channel(e,{config:{broadcast:{self:!1}}}),t.on(`broadcast`,{event:`gameEvent`},({payload:t})=>{let n=this.eventSubs.get(e);if(n)for(let e of n)e(t)}),t.on(`presence`,{event:`sync`},()=>{let t=this.presenceSubs.get(e);if(t){let n=this.flattenPresence(e);for(let e of t)e(n)}}),t.subscribe(),this.channels.set(e,t)),t}async broadcast(e,t){let n=this.eventSubs.get(e);if(n)for(let e of[...n])e(t);await this.getChannel(e).send({type:`broadcast`,event:`gameEvent`,payload:t})}subscribe(e,t){return this.getChannel(e),this.eventSubs.has(e)||this.eventSubs.set(e,new Set),this.eventSubs.get(e).add(t),()=>{this.eventSubs.get(e)?.delete(t)}}flattenPresence(e){let t=this.channels.get(e);if(!t)return[];let n=t.presenceState();return Object.values(n).flat()}presence={track:async(e,t)=>{await this.getChannel(e).track(t)},untrack:async e=>{let t=this.channels.get(e);t&&await t.untrack()},list:e=>(this.getChannel(e),this.flattenPresence(e)),onChange:(e,t)=>(this.getChannel(e),this.presenceSubs.has(e)||this.presenceSubs.set(e,new Set),this.presenceSubs.get(e).add(t),()=>{this.presenceSubs.get(e)?.delete(t)})}},HOST_PRESENCE_ID=`__host__`,SESSION_KEY=`hashquiz:player-session`;function loadSession(e){try{let t=sessionStorage.getItem(SESSION_KEY);if(!t)return null;let n=JSON.parse(t);return n.code===e?n:null}catch{return null}}function saveSession(e){try{sessionStorage.setItem(SESSION_KEY,JSON.stringify(e))}catch{}}function loadDraft(){try{let e=sessionStorage.getItem(SESSION_KEY+`:draft`);return e?JSON.parse(e):null}catch{return null}}function saveDraft(e){try{sessionStorage.setItem(SESSION_KEY+`:draft`,JSON.stringify(e))}catch{}}function clearDraft(){try{sessionStorage.removeItem(SESSION_KEY+`:draft`)}catch{}}function newPlayerId(){return Math.random().toString(36).slice(2)+Date.now().toString(36)}var useGameStore=defineStore(`game`,()=>{let e=ref(`join`),t=ref(newPlayerId()),n=ref(0),r=ref(null),a=ref(0),o=ref(!1),s=ref(0),c=ref(0),l=ref(0),u=ref(null),d=ref(0),f=ref([]),m=ref(void 0),g=ref([]),_=ref(``),v=ref(null),y=ref(null),b=ref(`connecting`),x=computed(()=>!o.value&&y.value!==null&&Date.now()<y.value),S=null,C=null,w=``,T=``,E=``,D=``,O=`local`,k=0,A=null,j=!1;function M(){j||typeof document>`u`||(j=!0,document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&P()}),window.addEventListener(`pageshow`,P),window.addEventListener(`online`,P),window.addEventListener(`pagehide`,ee))}function ee(){O===`supabase`&&C&&w&&C.presence.untrack(w)}function P(){if(e.value!==`join`&&T){if(O===`local`)!S||S.readyState===WebSocket.CLOSED||S.readyState===WebSocket.CLOSING?F(0):S.readyState===WebSocket.OPEN&&S.send(JSON.stringify({type:`state_request`}));else if(O===`supabase`&&C&&w){let e={id:t.value,pseudo:E,email:D,score:c.value,joinedAt:Date.now()};C.presence.track(w,e),C.broadcast(w,GameEvents.stateRequest(t.value)),b.value=`connected`}}}function F(e){if(A)return;let t=e===void 0?Math.min(1e4,1e3*2**k):e;b.value=`reconnecting`,A=setTimeout(()=>{A=null,k++,L(!0)},t)}async function I(n,r,a){let o=config.supabaseUrl,s=config.supabaseAnonKey;if(!o||!s){_.value=`Identifiants Supabase manquants`;return}O=`supabase`,C=new SupabaseTransport({url:o,anonKey:s}),w=`game:${n}`,T=n,E=r,D=a,C.subscribe(w,B),M(),await new Promise(e=>setTimeout(e,300));let l=C.presence.list(w).filter(e=>e.id!==HOST_PRESENCE_ID&&e.id!==t.value).map(e=>e.pseudo),u=r,d=2;for(;l.includes(u);)u=`${r}-${d++}`;E=u;let f={id:t.value,pseudo:u,email:a,score:c.value,joinedAt:Date.now()};await C.presence.track(w,f),setTimeout(()=>{C.presence.list(w).some(e=>e.id===HOST_PRESENCE_ID)?(e.value===`join`&&(e.value=`lobby`),b.value=`connected`,saveSession({playerId:t.value,code:T,pseudo:E,email:D}),C.broadcast(w,GameEvents.stateRequest(t.value))):(_.value=`Aucune partie trouvée pour ce code`,b.value=`offline`)},3e3)}function te(e,n){C&&C.broadcast(w,GameEvents.answerSubmit(t.value,e,n))}function L(n){b.value=n?`reconnecting`:`connecting`;let r=`ws://${location.hostname}:3030/ws?role=player&id=${t.value}&code=${encodeURIComponent(T)}`,c=new WebSocket(r);S=c,c.onerror=()=>{n||(_.value=`Connexion impossible : vérifiez le code et réessayez`)},c.onopen=()=>{k=0;let e=n?`player_rejoin`:`player_join`;c.send(JSON.stringify({type:e,pseudo:E,email:D})),b.value=`connected`;let t=loadDraft();t&&t.questionIdx===a.value&&x.value&&(c.send(JSON.stringify({type:`submit_answer`,choiceIds:t.choiceIds,answerTimeMs:t.elapsed})),o.value=!0,s.value=t.elapsed,clearDraft())},c.onmessage=e=>{B(JSON.parse(e.data))},c.onclose=()=>{S===c&&(b.value=`reconnecting`,e.value!==`join`&&F())}}function R(e,n,r){_.value=``,T=e,E=n,D=r;let a=loadSession(e);a&&(t.value=a.playerId,n||(E=a.pseudo),r||(D=a.email)),config.transport===`supabase`?I(e,E,D):(O=`local`,M(),L(a!==null))}function z(_){if(v.value=_.quizMeta,c.value=_.totalScore,n.value=_.playerCount,_.phase===`finished`)g.value=_.podium??[],e.value=`podium`,y.value=null;else if(_.phase===`lobby`)e.value=`lobby`,r.value=null,y.value=null;else if(_.question&&(r.value=_.question,a.value=_.questionIdx??_.question.idx),_.phase===`revealed`&&_.reveal){f.value=_.reveal.correct,m.value=_.reveal.explanation;let n=_.reveal.scores.find(e=>e.playerId===t.value);n&&(l.value=n.delta,c.value=n.score);let r=rankOf(_.reveal.scores,t.value);u.value=r?.rank??null,d.value=r?.total??0,o.value=!0,y.value=null,e.value=`question`}else{f.value=[],m.value=void 0,y.value=_.deadlineMs??null;let t=loadDraft();t&&t.questionIdx===a.value||o.value&&y.value&&Date.now()>=y.value||(o.value=!1,s.value=0),e.value=`question`}}function B(_){if(_.type===`joined`)e.value=`lobby`,v.value=_.quizMeta,n.value=_.playerCount,b.value=`connected`,saveSession({playerId:t.value,code:T,pseudo:E,email:D});else if(_.type===`state_snapshot`){if(_.playerId&&_.playerId!==t.value)return;z(_.snapshot),b.value=`connected`,saveSession({playerId:t.value,code:T,pseudo:E,email:D})}else switch(_.type){case`player_joined`:_.player.id!==t.value&&n.value++;break;case`player_rejoined`:break;case`player_left`:_.playerId!==t.value&&(n.value=Math.max(0,n.value-1));break;case`question_started`:r.value=_.question,a.value=_.idx,o.value=!1,s.value=0,u.value=null,d.value=0,f.value=[],m.value=void 0,y.value=_.deadlineMs,e.value=`question`,clearDraft();break;case`answer_revealed`:{let e=_.scores.find(e=>e.playerId===t.value);e&&(l.value=e.delta,c.value=e.score);let n=rankOf(_.scores,t.value);u.value=n?.rank??null,d.value=n?.total??0,f.value=_.correct,m.value=_.explanation,o.value=!0,y.value=null,clearDraft();break}case`game_ended`:g.value=_.podium,e.value=`podium`,clearDraft();break;case`game_reset`:r.value=null,a.value=0,o.value=!1,s.value=0,c.value=0,l.value=0,u.value=null,d.value=0,f.value=[],m.value=void 0,g.value=[],y.value=null,e.value=`lobby`,clearDraft()}}function V(e,t){o.value||y.value!==null&&Date.now()>=y.value||(o.value=!0,s.value=t,saveDraft({questionIdx:a.value,choiceIds:e,elapsed:t}),O===`supabase`?te(e,t):S&&S.readyState===WebSocket.OPEN&&(S.send(JSON.stringify({type:`submit_answer`,choiceIds:e,answerTimeMs:t})),clearDraft()))}return{phase:e,playerId:t,playerCount:n,question:r,questionIdx:a,answered:o,answerTimeMs:s,totalScore:c,lastDelta:l,rank:u,playerTotal:d,correctIds:f,explanation:m,podium:g,connectError:_,quizMeta:v,deadlineMs:y,status:b,canStillAnswer:x,connect:R,submitAnswer:V,submitAnswerSupabase:te}}),STALE_DECK_REASONS=new Set([`deck version mismatch`,`unknown deck`]),PSEUDO_MAX=24,TOP_SIZE=20,deps=null;function setSoloDeps(e){deps=e}var ignore=()=>{},useSoloStore=defineStore(`solo`,()=>{let e=ref(`unavailable`),t=shallowRef(null),n=shallowRef(null),r=ref(``),a=ref(null),o=ref(0),s=ref(0),c=ref(0),l=ref(0),u=ref(0),d=ref(null),f=ref(null),m=ref([]),g=ref([]),_=ref(null),v=ref(null),y=ref(null),b=ref(null),x=ref(`idle`),S=ref(null),C=null,w=null,T=null,E=0,D=Promise.resolve(),O=computed(()=>m.value.filter(e=>e.key!==C?.key)),k=computed(()=>({rank:1+O.value.filter(e=>e.score>c.value).length,of:1+O.value.length})),A=computed(()=>{let e=g.value.map((e,t)=>({...e,rank:t+1,mine:e.id===v.value})),t=b.value;return t&&y.value!==null&&!e.some(e=>e.mine)&&e.push({...t,rank:y.value,mine:!0}),e});function j(){let t=n.value;a.value=t?.question??null,o.value=t?.index??0,s.value=t?.total??0,c.value=t?.score??0,l.value=t?.correctCount??0,u.value=t?.totalTimeMs??0,d.value=t?.deadlineMs??null,f.value=t?.lastResult??null,t&&(t.status===`question`?e.value=`question`:t.status===`revealed`?e.value=`revealed`:t.status===`finished`&&(e.value=`end`))}let M=()=>({pseudo:r.value,index:o.value,total:s.value,score:c.value});function ee(){n.value=null,v.value=null,y.value=null,b.value=null,x.value=`idle`,S.value=null,j()}function P(){E++,w?.();let e=[D];T&&e.push(Promise.resolve().then(T)),C&&e.push(C.leave()),D=Promise.all(e.map(e=>e.catch(ignore))),C=w=T=null,m.value=[],ee()}async function F(){let e=deps?.backend?.api,n=t.value?.id;if(!e||!n)return;let r=E,[a,o]=await Promise.all([e.fetchTop(n,TOP_SIZE),e.fetchCount(n)]);if(r!==E)return;a.ok&&(g.value=a.value),o.ok&&(_.value=o.value);let s=v.value;if(!a.ok||!s)return;let c=a.value.findIndex(e=>e.id===s);if(c>=0){y.value=c+1;return}let[l,u]=await Promise.all([e.fetchRank(s),b.value?.id===s?null:e.fetchRun(s)]);r===E&&v.value===s&&(l.ok&&(y.value=l.value),u?.ok&&(b.value=u.value))}async function I(n){P(),g.value=[],_.value=null,t.value=null;let r=deps?.backend;if(!deps||!r){e.value=`unavailable`;return}e.value=`loading`;let a=E,o;try{o=await deps.findDeck(n)}catch{o=void 0}a===E&&(!o||!o.quiz.meta.solo?e.value=`unavailable`:(t.value=o,e.value=`intro`,await Promise.all([te(o.id,a),F()])))}async function te(r,a){await D;let o=deps?.backend;if(a===E&&o){try{C=o.live(r)}catch{e.value===`intro`&&(t.value=null,e.value=`unavailable`);return}w=C.onChange(e=>{m.value=e}),C.watch().catch(ignore),T=o.api.onNewRun(r,()=>{F()}),n.value&&n.value.status!==`finished`&&C.join(M()).catch(ignore)}}function L(a){let o=a.trim(),s=t.value;if(!s||o.length<1||o.length>24||e.value!==`intro`&&e.value!==`end`)return;ee(),r.value=o;let c=new SoloSession({quiz:s.quiz,deckId:s.id,deckVersion:s.version,pseudo:o,now:R});c.start(),c.total===0?(t.value=null,e.value=`unavailable`):(n.value=c,j(),C?.join(M()).catch(ignore))}let R=()=>(deps?.now??Date.now)(),z=()=>d.value!==null&&R()>=d.value;function B(t){e.value===`question`&&(z()?V():(n.value?.answer(t),j(),C?.update(M()).catch(ignore)))}function V(t=[]){e.value===`question`&&(t.length>0?n.value?.answer(t):n.value?.timeout(),j(),C?.update(M()).catch(ignore))}function H(){e.value===`revealed`&&(n.value?.next(),j(),n.value?.status===`finished`?U():C?.update(M()).catch(ignore))}async function U(){C?.untrack().catch(ignore),await W()}async function W(){let e=deps?.backend?.api,r=n.value,a=t.value;if(!e||!r||!a||r.status!==`finished`||x.value===`saving`||x.value===`saved`)return;let o=E;x.value=`saving`;let s=await e.submitRun(r.toSubmission(),a.quiz);o===E&&n.value===r&&(s.ok?(v.value=s.value.runId,y.value=s.value.rank,x.value=`saved`,await F()):(S.value=s.error,STALE_DECK_REASONS.has(s.error)?(x.value=`stale`,deps?.reloadDecks?.()):x.value=`error`))}function G(){x.value===`error`&&W()}async function K(){if(e.value!==`end`)return;let n=t.value;if(x.value===`stale`&&n){let t=r.value;await I(n.id),e.value===`intro`&&L(t)}else L(r.value)}function q(){P(),t.value=null,e.value=`unavailable`}async function J(e,n={}){let r=deps?.backend?.api;return r?r.submitLead(e,t.value?.id??null,n):{ok:!1,error:`unavailable`}}return{phase:e,deck:t,session:n,pseudo:r,question:a,index:o,total:s,score:c,correctCount:l,totalTimeMs:u,deadlineMs:d,lastResult:f,live:m,liveOthers:O,liveRank:k,top:g,runCount:_,myRunId:v,myRank:y,myRun:b,board:A,submitState:x,submitError:S,open:I,start:L,answer:B,timeout:V,next:H,retrySubmit:G,playAgain:K,abandon:q,submitLead:J}}),scriptRel=`modulepreload`,assetsURL=function(e){return`/`+e},seen={},failedCssLinks={},isCssPreloadUrl=function(e){return e.pathname.endsWith(`.css`)},preloadOnce=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let a=r.then(()=>{e[t]=void 0},n=>{throw delete e[t],n});return e[t]=a,a},__vitePreload=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,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}))))}function c(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=s(t.map(t=>{t=assetsURL(t,n);let r=c(t),a=isCssPreloadUrl(r);return preloadOnce(seen,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}let t=a?e.styles:e.all,n=a?failedCssLinks[r.href]:void 0;if(!n&&t.has(r.href))return;let s=document.createElement(`link`);if(s.rel=a?`stylesheet`:scriptRel,a||(s.as=`script`),s.crossOrigin=``,s.href=r.href,o&&s.setAttribute(`nonce`,o),n&&delete failedCssLinks[r.href],n?.isConnected?n.replaceWith(s):document.head.appendChild(s),a)return new Promise((e,t)=>{let n=a=>{s.removeEventListener(`load`,n),s.removeEventListener(`error`,n),a.type===`error`?(failedCssLinks[r.href]=s,t(Error(`Unable to preload CSS for ${r}`))):e(a)};s.addEventListener(`load`,n),s.addEventListener(`error`,n)})})}).filter(e=>e!==void 0))}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)})},loading=null;function loadSoloDeps(){return loading??=__vitePreload(async()=>{let{defaultSoloDeps:e}=await import(`./deps-CxwVlDwg.js`);return{defaultSoloDeps:e}},__vite__mapDeps([0,1])).then(({defaultSoloDeps:e})=>setSoloDeps(e())),loading}function splitBlocks(e){let t=e.split(/(^|\n)---(\n|$)/g).filter((e,t)=>t%3==0).map(e=>e.trim()).filter(e=>e.length>0);if(t.length===0)return[];let n=t[0],r=t.slice(1);if(r.length%2!=0)throw Error(`Malformed .hashquiz.md file: expected an even number of blocks after the meta section, got ${r.length}`);let a=[];for(let e=0;e<r.length;e+=2){let t=r[e],n=r[e+1];a.push(`---\n${t}\n---\n\n${n}`)}return[n,...a]}var require___vite_browser_external=__commonJSMin(((e,t)=>{t.exports={}})),require_kind_of=__commonJSMin(((e,t)=>{var n=Object.prototype.toString;t.exports=function(e){if(e===void 0)return`undefined`;if(e===null)return`null`;var t=typeof e;if(t===`boolean`)return`boolean`;if(t===`string`)return`string`;if(t===`number`)return`number`;if(t===`symbol`)return`symbol`;if(t===`function`)return l(e)?`generatorfunction`:`function`;if(a(e))return`array`;if(f(e))return`buffer`;if(d(e))return`arguments`;if(s(e))return`date`;if(o(e))return`error`;if(c(e))return`regexp`;switch(r(e)){case`Symbol`:return`symbol`;case`Promise`:return`promise`;case`WeakMap`:return`weakmap`;case`WeakSet`:return`weakset`;case`Map`:return`map`;case`Set`:return`set`;case`Int8Array`:return`int8array`;case`Uint8Array`:return`uint8array`;case`Uint8ClampedArray`:return`uint8clampedarray`;case`Int16Array`:return`int16array`;case`Uint16Array`:return`uint16array`;case`Int32Array`:return`int32array`;case`Uint32Array`:return`uint32array`;case`Float32Array`:return`float32array`;case`Float64Array`:return`float64array`}if(u(e))return`generator`;switch(t=n.call(e),t){case`[object Object]`:return`object`;case`[object Map Iterator]`:return`mapiterator`;case`[object Set Iterator]`:return`setiterator`;case`[object String Iterator]`:return`stringiterator`;case`[object Array Iterator]`:return`arrayiterator`}return t.slice(8,-1).toLowerCase().replace(/\s/g,``)};function r(e){return typeof e.constructor==`function`?e.constructor.name:null}function a(e){return Array.isArray?Array.isArray(e):e instanceof Array}function o(e){return e instanceof Error||typeof e.message==`string`&&e.constructor&&typeof e.constructor.stackTraceLimit==`number`}function s(e){return e instanceof Date||typeof e.toDateString==`function`&&typeof e.getDate==`function`&&typeof e.setDate==`function`}function c(e){return e instanceof RegExp||typeof e.flags==`string`&&typeof e.ignoreCase==`boolean`&&typeof e.multiline==`boolean`&&typeof e.global==`boolean`}function l(e,t){return r(e)===`GeneratorFunction`}function u(e){return typeof e.throw==`function`&&typeof e.return==`function`&&typeof e.next==`function`}function d(e){try{if(typeof e.length==`number`&&typeof e.callee==`function`)return!0}catch(e){if(e.message.indexOf(`callee`)!==-1)return!0}return!1}function f(e){return e.constructor&&typeof e.constructor.isBuffer==`function`?e.constructor.isBuffer(e):!1}})),require_is_extendable=__commonJSMin(((e,t)=>{t.exports=function(e){return e!=null&&(typeof e==`object`||typeof e==`function`)}})),require_extend_shallow=__commonJSMin(((e,t)=>{var n=require_is_extendable();t.exports=function(e){n(e)||(e={});for(var t=arguments.length,a=1;a<t;a++){var o=arguments[a];n(o)&&r(e,o)}return e};function r(e,t){for(var n in t)a(t,n)&&(e[n]=t[n])}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})),require_section_matter=__commonJSMin(((e,t)=>{var n=require_kind_of(),r=require_extend_shallow();t.exports=function(e,t){typeof t==`function`&&(t={parse:t});var n=o(e),u=r({},{section_delimiter:`---`,parse:l},t),d=u.section_delimiter,f=n.content.split(/\r?\n/),m=null,g=c(),_=[],v=[];function y(e){n.content=e,m=[],_=[]}function b(e){v.length&&(g.key=s(v[0],d),g.content=e,u.parse(g,m),m.push(g),g=c(),_=[],v=[])}for(var x=0;x<f.length;x++){var S=f[x],C=v.length,w=S.trim();if(a(w,d)){if(w.length===3&&x!==0){if(C===0||C===2){_.push(S);continue}v.push(w),g.data=_.join(`
|
|
33
33
|
`),_=[];continue}m===null&&y(_.join(`
|
|
34
34
|
`)),C===2&&b(_.join(`
|
|
35
35
|
`)),v.push(w)}else _.push(S)}return m===null?y(_.join(`
|
|
@@ -77,4 +77,4 @@ return `+str.trim()+`;
|
|
|
77
77
|
`}})),require_excerpt=__commonJSMin(((e,t)=>{var n=require_defaults();t.exports=function(e,t){let r=n(t);if(e.data??={},typeof r.excerpt==`function`)return r.excerpt(e,r);let a=e.data.excerpt_separator||r.excerpt_separator;if(a==null&&(r.excerpt===!1||r.excerpt==null))return e;let o=typeof r.excerpt==`string`?r.excerpt:a||r.delimiters[0],s=e.content.indexOf(o);return s!==-1&&(e.excerpt=e.content.slice(0,s)),e}})),require_to_file=__commonJSMin(((e,t)=>{var n=require_kind_of(),r=require_stringify(),a=require_utils();t.exports=function(e){return n(e)!==`object`&&(e={content:e}),n(e.data)!==`object`&&(e.data={}),e.contents&&e.content==null&&(e.content=e.contents),a.define(e,`orig`,a.toBuffer(e.content)),a.define(e,`language`,e.language||``),a.define(e,`matter`,e.matter||``),a.define(e,`stringify`,function(t,n){return n&&n.language&&(e.language=n.language),r(e,t,n)}),e.content=a.toString(e.content),e.isEmpty=!1,e.excerpt=``,e}})),require_parse=__commonJSMin(((e,t)=>{var n=require_engine(),r=require_defaults();t.exports=function(e,t,a){let o=r(a),s=n(e,o);if(typeof s.parse!=`function`)throw TypeError(`expected "`+e+`.parse" to be a function`);return s.parse(t,o)}})),require_gray_matter=__commonJSMin(((e,t)=>{var n=require___vite_browser_external(),r=require_section_matter(),a=require_defaults(),o=require_stringify(),s=require_excerpt(),c=require_engines(),l=require_to_file(),u=require_parse(),d=require_utils();function f(e,t){if(e===``)return{data:{},content:e,excerpt:``,orig:e};let n=l(e),r=f.cache[n.content];if(!t){if(r)return n=Object.assign({},r),n.orig=r.orig,n;f.cache[n.content]=n}return m(n,t)}function m(e,t){let n=a(t),o=n.delimiters[0],c=`
|
|
78
78
|
`+n.delimiters[1],l=e.content;n.language&&(e.language=n.language);let m=o.length;if(!d.startsWith(l,o,m))return s(e,n),e;if(l.charAt(m)===o.slice(-1))return e;l=l.slice(m);let g=l.length,_=f.language(l,n);_.name&&(e.language=_.name,l=l.slice(_.raw.length));let v=l.indexOf(c);return v===-1&&(v=g),e.matter=l.slice(0,v),e.matter.replace(/^\s*#[^\n]+/gm,``).trim()===``?(e.isEmpty=!0,e.empty=e.content,e.data={}):e.data=u(e.language,e.matter,n),v===g?e.content=``:(e.content=l.slice(v+c.length),e.content[0]===`\r`&&(e.content=e.content.slice(1)),e.content[0]===`
|
|
79
79
|
`&&(e.content=e.content.slice(1))),s(e,n),(n.sections===!0||typeof n.section==`function`)&&r(e,n.section),e}f.engines=c,f.stringify=function(e,t,n){return typeof e==`string`&&(e=f(e,n)),o(e,t,n)},f.read=function(e,t){let r=f(n.readFileSync(e,`utf8`),t);return r.path=e,r},f.test=function(e,t){return d.startsWith(e,a(t).delimiters[0])},f.language=function(e,t){let n=a(t).delimiters[0];f.test(e)&&(e=e.slice(n.length));let r=e.slice(0,e.search(/\r?\n/));return{raw:r,name:r?r.trim():``}},f.cache={},f.clearCache=function(){f.cache={}},t.exports=f})),import_gray_matter=__toESM(require_gray_matter(),1);function parseMaxTime(e){if(e!=null){if(typeof e==`number`)return e*60;if(typeof e==`string`){let t=e.trim();if(t.endsWith(`s`)){let e=parseInt(t,10);return isNaN(e)?void 0:e}if(t.endsWith(`m`)){let e=parseInt(t,10);return isNaN(e)?void 0:e*60}let n=parseInt(t,10);return isNaN(n)?void 0:n*60}}}function parseMeta(e){let t;t=e.startsWith(`---`)?e.split(`
|
|
80
|
-
`).slice(1).findIndex(e=>e===`---`)===-1?`${e}\n---`:e:`---\n${e}\n---`;let{data:n}=(0,import_gray_matter.default)(t);return{title:typeof n.title==`string`?n.title:``,description:typeof n.description==`string`?n.description:void 0,theme:typeof n.theme==`string`?n.theme:`default`,author:typeof n.author==`string`?n.author:void 0,tags:Array.isArray(n.tags)?n.tags:[],oneShoot:n[`one-shoot`]!==!1,solo:n.solo===!0,maxQuestions:typeof n[`max-questions`]==`number`&&n[`max-questions`]>0?n[`max-questions`]:void 0,maxTimeSec:parseMaxTime(n[`max-time`]),targetDifficulty:[`easy`,`medium`,`hard`].includes(n[`target-difficulty`])?n[`target-difficulty`]:void 0}}var CHOICE_IDS=[`a`,`b`,`c`,`d`];function parseQuestion(e){let t={},n=e;if(e.startsWith(`---`)){let r=(0,import_gray_matter.default)(e);t=r.data,n=r.content.trim()}let r=n.match(/^## (.+)$/m),a=r?r[1].trim():``,o=/^-\s+\[(x| )\]\s+(.+)$/gm,s=[],c,l=0;for(;(c=o.exec(n))!==null;)s.push({id:CHOICE_IDS[l]??String(l),text:c[2].trim(),isCorrect:c[1]===`x`}),l++;let u=/^>\s+(.+)$/gm,d=[];for(;(c=u.exec(n))!==null;)d.push(c[1].trim());let f=d.length>0?d.join(` `):void 0,m=s.filter(e=>e.isCorrect).length>1?`multiple`:`single`;return{type:t.type===`multiple`||t.type===`single`?t.type:m,timer:typeof t.timer==`number`?t.timer:20,difficulty:t.difficulty===`easy`||t.difficulty===`medium`||t.difficulty===`hard`?t.difficulty:`medium`,tags:Array.isArray(t.tags)?t.tags:[],text:a,choices:s,explanation:f}}function parseQuizFile(e){let t=splitBlocks(e);if(t.length===0)return{meta:{title:``,theme:`default`,tags:[],solo:!1},questions:[]};let[n,...r]=t;return{meta:parseMeta(n),questions:r.map(parseQuestion)}}function deckVersion(e){let t=0x811c9dc5;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return(t>>>0).toString(16).padStart(8,`0`)}var slugify=e=>e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);function deckSlug(e){return e.replace(/(^|\/)index\.hashquiz\.md$/,``).replace(/\.hashquiz\.md$/,``).split(`/`).map(slugify).filter(Boolean).join(`/`)||`quiz`}function deckSlugs(e){let t=new Set,n=new Map;for(let r of[...new Set(e)].sort()){let e=deckSlug(r),a=e;for(let n=2;t.has(a)||a===`tag`;n++)a=`${e}-${n}`;t.add(a),n.set(r,a)}return n}function toDecks(e){let t=deckSlugs(e.map(e=>e.id));return e.flatMap(({id:e,content:n})=>{try{let r=parseQuizFile(n);return[{id:e,slug:t.get(e),name:r.meta.title||e,version:deckVersion(n),quiz:r}]}catch(t){return console.error(`Skipping deck ${e}:`,t),[]}}).sort((e,t)=>e.name.localeCompare(t.name))}async function fetchDecks(e,t=fetch){let n=await t(e);if(!n.ok)throw Error(`Failed to load ${e}: ${n.status}`);return toDecks(await n.json())}function deckInfo(e){let{meta:t,questions:n}=e.quiz,r=n.length,a=e=>Math.round(n.filter(t=>t.difficulty===e).length/(r||1)*100);return{title:t.title||e.name,...t.description!==void 0&&{description:t.description},tags:t.tags,totalQuestions:t.maxQuestions===void 0?r:Math.min(t.maxQuestions,r),...t.targetDifficulty!==void 0&&{targetDifficulty:t.targetDifficulty},difficultyDistribution:{easy:a(`easy`),medium:a(`medium`),hard:a(`hard`)},...quizFormat(t,r)}}function soloDecks(e){return e.filter(e=>e.quiz.meta.solo)}var cache=null;function loadDecks(e=`/decks.json`){return cache??=fetchDecks(e).catch(e=>{throw cache=null,e}),cache}function resetDecks(){cache=null}async function loadSoloDecks(){return soloDecks(await loadDecks())}async function findDeck(e){let t=await loadDecks();return t.find(t=>t.id===e)??t.find(t=>t.slug===e)}var _hoisted_1$4={class:`join`},_hoisted_2$4={class:`join__form`},_hoisted_3$2={key:0,class:`join__error`},_hoisted_4$2=[`disabled`],JoinView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`JoinView`,setup(e){let t=defineAsyncComponent(()=>__vitePreload(()=>import(`./SoloCatalog-BHS5PBPk.js`),__vite__mapDeps([2,3,1,4,5,6]))),n=soloAvailable(config),r=useGameStore(),a=ref(``),o=ref(``),s=ref(``);onMounted(()=>{let e=new URLSearchParams(location.search).get(`code`);e&&(a.value=e.toUpperCase());try{let e=sessionStorage.getItem(`hashquiz:player-session`);if(e&&a.value){let t=JSON.parse(e);t.code===a.value&&(o.value=t.pseudo,s.value=t.email,r.connect(a.value,t.pseudo,t.email))}}catch{}});function c(){r.connect(a.value.trim().toUpperCase(),o.value.trim(),s.value.trim())}return(e,l)=>(openBlock(),createElementBlock(`div`,_hoisted_1$4,[l[3]||=createBaseVNode(`p`,{class:`join__sub`},`Entrez le code de la partie pour la rejoindre`,-1),createBaseVNode(`div`,_hoisted_2$4,[withDirectives(createBaseVNode(`input`,{"onUpdate:modelValue":l[0]||=e=>a.value=e,class:`hq-input`,placeholder:`Code de la partie (ex. ABC123)`,style:{"text-transform":`uppercase`,"letter-spacing":`0.12em`},maxlength:`8`},null,512),[[vModelText,a.value]]),withDirectives(createBaseVNode(`input`,{"onUpdate:modelValue":l[1]||=e=>o.value=e,class:`hq-input`,placeholder:`Votre pseudo`,maxlength:`20`},null,512),[[vModelText,o.value]]),withDirectives(createBaseVNode(`input`,{"onUpdate:modelValue":l[2]||=e=>s.value=e,class:`hq-input`,type:`email`,placeholder:`Email (facultatif)`},null,512),[[vModelText,s.value]]),unref(r).connectError?(openBlock(),createElementBlock(`p`,_hoisted_3$2,toDisplayString(unref(r).connectError),1)):createCommentVNode(``,!0),createBaseVNode(`button`,{class:`hq-btn-primary hq-press`,disabled:!a.value.trim()||!o.value.trim(),onClick:c},` Rejoindre la partie `,8,_hoisted_4$2)]),unref(n)?(openBlock(),createBlock(unref(t),{key:0})):createCommentVNode(``,!0)]))}}),JoinView_default=_plugin_vue_export_helper_default(JoinView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-4da42b23`]]),_hoisted_1$3={class:`lobby`},_hoisted_2$3={class:`lobby__wait`},LobbyView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`LobbyView`,setup(e){let t=useGameStore(),n=computed(()=>Array.from({length:Math.max(t.playerCount,1)},(e,t)=>({id:`p`+t})));return(e,r)=>(openBlock(),createElementBlock(`div`,_hoisted_1$3,[unref(t).quizMeta?(openBlock(),createBlock(unref(QuizInfoPanel_default),{key:0,quizInfo:unref(t).quizMeta,playerCount:unref(t).playerCount,compact:``},null,8,[`quizInfo`,`playerCount`])):createCommentVNode(``,!0),createBaseVNode(`div`,_hoisted_2$3,[createVNode(unref(FxHourglass_default),{class:`lobby__icon`}),r[0]||=createBaseVNode(`h2`,null,`En attente de l’animateur…`,-1)]),createVNode(unref(FxLobby_default),{class:`lobby__fx`,players:n.value,highlightId:`p0`},null,8,[`players`])]))}}),LobbyView_default=_plugin_vue_export_helper_default(LobbyView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-dcc95501`]]),_hoisted_1$2={key:0,class:`question-view`},_hoisted_2$2={class:`hq-progress`},_hoisted_3$1={class:`hq-progress__label hq-label`},_hoisted_4$1={class:`hq-progress__track hq-steps`},_hoisted_5$1={class:`hq-progress__label`},_hoisted_6$1={key:0,class:`hq-timer-wrap`},_hoisted_7={class:`hq-sr-only`},_hoisted_8={class:`hq-result__line`},_hoisted_9={class:`hq-result__score`},_hoisted_10={key:0,class:`hq-result__rank hq-label`},_hoisted_11={class:`hq-result__delta`},_hoisted_12={key:0,class:`hq-result__info`},_hoisted_13={key:1,class:`hq-result__info`},_hoisted_14={class:`hq-q-meta`},_hoisted_15={class:`hq-q-meta__tags`},_hoisted_16={class:`hq-q-text`},_hoisted_17={class:`hq-grid`},_hoisted_18=[`disabled`],QuestionView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`QuestionView`,setup(e){let t=useGameStore(),n=ref(t.question?.timer??0),r=ref(new Set),a=ref(!1),o=ref(0),s=null,c=0,l=0,u=computed(()=>t.question?.oneShoot??!0),d=computed(()=>t.question?.type===`multiple`),f=computed(()=>t.correctIds.length>0),m=computed(()=>t.lastDelta>0),g=ref(0),_=0;watch(f,e=>{if(cancelAnimationFrame(_),!e){g.value=0;return}let n=t.lastDelta;if(typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches||n<=0){g.value=n;return}let r=performance.now(),a=e=>{let t=Math.min((e-r)/600,1);g.value=Math.round(n*(1-(1-t)**3)),t<1&&(_=requestAnimationFrame(a))};_=requestAnimationFrame(a)},{immediate:!0});function v(){s&&clearInterval(s),s=setInterval(()=>{let e=Math.min(c,Math.max(0,Math.round((l-Date.now())/100)/10));n.value=e,e<=0&&(clearInterval(s),s=null,a.value=!0,r.value.size>0&&!t.answered&&t.submitAnswer([...r.value],o.value))},100)}watch(()=>t.question?.idx,()=>{r.value=new Set,a.value=!1,o.value=0},{immediate:!0}),watch(()=>[t.question?.idx,t.deadlineMs],([,e])=>{let r=t.question;r&&(c=r.timer,e==null?s&&=(clearInterval(s),null):(l=e,n.value=Math.min(c,Math.max(0,Math.round((l-Date.now())/100)/10)),n.value<=0?(a.value=!0,s&&=(clearInterval(s),null)):v()))},{immediate:!0}),onMounted(()=>{t.question&&l>Date.now()&&!s&&v()}),onUnmounted(()=>{s&&clearInterval(s),cancelAnimationFrame(_)});function y(e){if(f.value){let n=t.correctIds.includes(e),a=r.value.has(e);return n?`correct`:a?`wrong`:`disabled`}return a.value||t.answered?r.value.has(e)?`selected`:`disabled`:r.value.has(e)?`selected`:`idle`}function b(e){if(a.value||t.answered||f.value)return;if(!u.value){o.value=(t.question.timer-n.value)*1e3;let a=new Set(r.value);a.has(e)?a.delete(e):a.add(e),r.value=a;return}if(!d.value){if(r.value.size>0)return;let a=(t.question.timer-n.value)*1e3;r.value=new Set([e]),t.submitAnswer([e],a);return}o.value=(t.question.timer-n.value)*1e3;let s=new Set(r.value);s.has(e)?s.delete(e):s.add(e),r.value=s}function x(){a.value||t.answered||r.value.size===0||t.submitAnswer([...r.value],o.value)}return(e,o)=>unref(t).question?(openBlock(),createElementBlock(`div`,_hoisted_1$2,[createBaseVNode(`div`,_hoisted_2$2,[createBaseVNode(`span`,_hoisted_3$1,`Q`+toDisplayString(unref(t).questionIdx+1),1),createBaseVNode(`div`,_hoisted_4$1,[createBaseVNode(`div`,{class:`hq-progress__fill`,style:normalizeStyle({width:(unref(t).questionIdx+1)/(unref(t).quizMeta?.totalQuestions??1)*100+`%`})},null,4)]),createBaseVNode(`span`,_hoisted_5$1,toDisplayString(unref(t).quizMeta?.totalQuestions??`?`),1)]),f.value?(openBlock(),createElementBlock(`div`,{key:1,role:`status`,class:normalizeClass([`hq-result`,m.value?`hq-result--correct`:`hq-result--wrong`])},[createVNode(unref(FxVerdict_default),{class:`hq-result__fx`,correct:m.value,delta:unref(t).lastDelta,answered:unref(t).answered},null,8,[`correct`,`delta`,`answered`]),createBaseVNode(`span`,_hoisted_7,toDisplayString(m.value?`Bonne réponse`:unref(t).answered?`Mauvaise réponse`:`Temps écoulé`),1),createBaseVNode(`div`,_hoisted_8,[createBaseVNode(`span`,_hoisted_9,[createTextVNode(toDisplayString(unref(t).totalScore)+` `,1),o[0]||=createBaseVNode(`small`,null,`pts`,-1)]),unref(t).rank===null?createCommentVNode(``,!0):(openBlock(),createElementBlock(`span`,_hoisted_10,toDisplayString(unref(ordinalFr)(unref(t).rank))+` / `+toDisplayString(unref(t).playerTotal),1))]),createBaseVNode(`span`,_hoisted_11,toDisplayString(g.value>0?`+`+g.value:`+0`)+` pts`,1),unref(t).answered?(openBlock(),createElementBlock(`span`,_hoisted_12,`Répondu en `+toDisplayString(Math.round(unref(t).answerTimeMs/1e3))+` s / `+toDisplayString(unref(t).question.timer)+` s`,1)):(openBlock(),createElementBlock(`span`,_hoisted_13,`Pas de réponse`))],2)):(openBlock(),createElementBlock(`div`,_hoisted_6$1,[createVNode(unref(FxCountdown_default),{total:unref(t).question.timer,remaining:n.value,size:`compact`},null,8,[`total`,`remaining`])])),createBaseVNode(`div`,_hoisted_14,[createBaseVNode(`div`,_hoisted_15,[(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(t).question.tags,e=>(openBlock(),createElementBlock(`span`,{key:e,class:`hq-q-meta__tag`},toDisplayString(e),1))),128))]),createBaseVNode(`span`,{class:normalizeClass([`hq-difficulty`,`hq-difficulty--${unref(t).question.difficulty}`])},[...o[1]||=[createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--1`},null,-1),createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--2`},null,-1),createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--3`},null,-1)]],2)]),createBaseVNode(`h2`,_hoisted_16,toDisplayString(unref(t).question.text.replace(/^#+\s/,``)),1),createBaseVNode(`div`,_hoisted_17,[(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(t).question.choices,(e,t)=>(openBlock(),createBlock(unref(AnswerButton_default),{key:e.id,id:e.id,text:e.text,"color-id":[`a`,`b`,`c`,`d`][t],state:y(e.id),onSelect:t=>b(e.id)},null,8,[`id`,`text`,`color-id`,`state`,`onSelect`]))),128))]),u.value&&d.value&&!unref(t).answered&&!a.value?(openBlock(),createElementBlock(`button`,{key:2,class:`hq-validate-btn hq-press`,disabled:r.value.size===0,onClick:x},` Valider → `,8,_hoisted_18)):createCommentVNode(``,!0)])):createCommentVNode(``,!0)}}),QuestionView_default=_plugin_vue_export_helper_default(QuestionView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-830ed527`]]),_hoisted_1$1={class:`podium-view`},_hoisted_2$1={class:`podium-view__rank`},_hoisted_3={class:`podium-view__medal`},_hoisted_4={class:`podium-view__name`},_hoisted_5={class:`podium-view__score`},_hoisted_6={class:`podium-view__fx`},PodiumView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`PodiumView`,setup(e){let t=useGameStore(),n=computed(()=>t.podium.find(e=>e.playerId===t.playerId)),r=computed(()=>{let e=n.value?.rank??99;return e===1?`🥇`:e===2?`🥈`:e===3?`🥉`:`#${e}`});return(e,a)=>(openBlock(),createElementBlock(`div`,_hoisted_1$1,[createBaseVNode(`div`,_hoisted_2$1,[createBaseVNode(`p`,_hoisted_3,toDisplayString(r.value),1),createBaseVNode(`p`,_hoisted_4,toDisplayString(n.value?.pseudo??``),1),createBaseVNode(`p`,_hoisted_5,toDisplayString(unref(t).totalScore.toLocaleString())+` pts`,1)]),createBaseVNode(`div`,_hoisted_6,[createVNode(unref(FxPodium_default),{podium:unref(t).podium,"highlight-id":unref(t).playerId},null,8,[`podium`,`highlight-id`])]),createVNode(unref(Podium_default),{podium:unref(t).podium},null,8,[`podium`])]))}}),PodiumView_default=_plugin_vue_export_helper_default(PodiumView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-608e2d6a`]]),_hoisted_1={class:`app`},_hoisted_2={class:`app__main`},App_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`App`,setup(e){let t=defineAsyncComponent(()=>__vitePreload(()=>import(`./SoloIntroView-Db4kFtLD.js`),__vite__mapDeps([7,8,9,10,11,5]))),n=defineAsyncComponent(()=>__vitePreload(()=>import(`./SoloQuestionView-Bo5XB8rw.js`),__vite__mapDeps([12,9,13,5]))),r=defineAsyncComponent(()=>__vitePreload(()=>import(`./SoloEndView-qSQsU1-X.js`),__vite__mapDeps([14,9,8,10,3,1,4,5,15]))),a=useGameStore(),o=useSoloStore(),s=ref(null),c=ref(!1);async function l(){let e=parseLegacySoloHash(location.hash);if(e===null)return;let t=await findDeck(e).catch(()=>void 0);history.replaceState(null,``,soloPath(t?.slug??deckSlug(e)))}async function u(e=!1){await l();let t=parseSoloPath(location.pathname)?.slug??null;if(t===s.value&&!e||(s.value!==null&&o.abandon(),s.value=t,c.value=!1,t===null)||(await loadSoloDeps(),s.value!==t))return;let n=o.open(t);c.value=!0,await n}function d(){s.value!==null&&(o.abandon(),c.value=!1)}function f(e){e.persisted&&u(!0)}let m=()=>{u()};onMounted(()=>{u(),window.addEventListener(`popstate`,m),window.addEventListener(`hashchange`,m),window.addEventListener(`pagehide`,d),window.addEventListener(`pageshow`,f)}),onUnmounted(()=>{window.removeEventListener(`popstate`,m),window.removeEventListener(`hashchange`,m),window.removeEventListener(`pagehide`,d),window.removeEventListener(`pageshow`,f)});let g=computed(()=>{switch(a.status){case`connecting`:return`Connexion…`;case`reconnecting`:return`Reconnexion…`;case`offline`:return`Hors ligne`;default:return``}});return(e,l)=>(openBlock(),createElementBlock(Fragment,null,[createVNode(unref(FxBackdrop_default)),createVNode(AppHeader_default),createBaseVNode(`div`,_hoisted_1,[createBaseVNode(`main`,_hoisted_2,[s.value===null?(openBlock(),createElementBlock(Fragment,{key:1},[createVNode(Transition,{name:`status`},{default:withCtx(()=>[unref(a).phase!==`join`&&unref(a).status!==`connected`?(openBlock(),createElementBlock(`p`,{key:0,class:normalizeClass([`status-banner`,`status-banner--${unref(a).status}`])},toDisplayString(g.value),3)):createCommentVNode(``,!0)]),_:1}),unref(a).phase===`join`?(openBlock(),createBlock(JoinView_default,{key:0})):unref(a).phase===`lobby`?(openBlock(),createBlock(LobbyView_default,{key:1})):unref(a).phase===`question`?(openBlock(),createBlock(QuestionView_default,{key:2})):unref(a).phase===`podium`?(openBlock(),createBlock(PodiumView_default,{key:3})):createCommentVNode(``,!0)],64)):(openBlock(),createElementBlock(Fragment,{key:0},[unref(o).phase===`question`||unref(o).phase===`revealed`?(openBlock(),createBlock(unref(n),{key:0})):unref(o).phase===`end`?(openBlock(),createBlock(unref(r),{key:1})):c.value?(openBlock(),createBlock(unref(t),{key:s.value})):createCommentVNode(``,!0)],64))]),s.value!==null||unref(a).phase===`join`?(openBlock(),createBlock(AppFooter_default,{key:0})):createCommentVNode(``,!0)])],64))}}),App_default=App_vue_vue_type_script_setup_true_lang_default;createApp(App_default).use(createPinia()).mount(`#app`);export{createElementBlock as A,withDirectives as B,vModelText as C,createBaseVNode as D,computed as E,onMounted as F,normalizeStyle as G,shallowRef as H,onUnmounted as I,toDisplayString as K,openBlock as L,createVNode as M,defineComponent as N,createBlock as O,nextTick as P,renderList as R,vModelSelect as S,Fragment as T,unref as U,ref as V,normalizeClass as W,FxVerdict_default as _,loadSoloDeps as a,_plugin_vue_export_helper_default as b,config as c,REPO_URL as d,AppIcon_default as f,AnswerButton_default as g,QuizInfoPanel_default as h,deckInfo as i,createTextVNode as j,createCommentVNode as k,calcPoints as l,soloPath as m,loadSoloDecks as n,useSoloStore as o,followLink as p,resetDecks as r,createClient as s,findDeck as t,REPO_API_URL as u,FxFireworks_default as v,withModifiers as w,vModelCheckbox as x,FxCountdown_default as y,watch as z};
|
|
80
|
+
`).slice(1).findIndex(e=>e===`---`)===-1?`${e}\n---`:e:`---\n${e}\n---`;let{data:n}=(0,import_gray_matter.default)(t);return{title:typeof n.title==`string`?n.title:``,description:typeof n.description==`string`?n.description:void 0,theme:typeof n.theme==`string`?n.theme:`default`,author:typeof n.author==`string`?n.author:void 0,tags:Array.isArray(n.tags)?n.tags:[],oneShoot:n[`one-shoot`]!==!1,solo:n.solo===!0,maxQuestions:typeof n[`max-questions`]==`number`&&n[`max-questions`]>0?n[`max-questions`]:void 0,maxTimeSec:parseMaxTime(n[`max-time`]),targetDifficulty:[`easy`,`medium`,`hard`].includes(n[`target-difficulty`])?n[`target-difficulty`]:void 0}}var CHOICE_IDS=[`a`,`b`,`c`,`d`];function parseQuestion(e){let t={},n=e;if(e.startsWith(`---`)){let r=(0,import_gray_matter.default)(e);t=r.data,n=r.content.trim()}let r=n.match(/^## (.+)$/m),a=r?r[1].trim():``,o=/^-\s+\[(x| )\]\s+(.+)$/gm,s=[],c,l=0;for(;(c=o.exec(n))!==null;)s.push({id:CHOICE_IDS[l]??String(l),text:c[2].trim(),isCorrect:c[1]===`x`}),l++;let u=/^>\s+(.+)$/gm,d=[];for(;(c=u.exec(n))!==null;)d.push(c[1].trim());let f=d.length>0?d.join(` `):void 0,m=s.filter(e=>e.isCorrect).length>1?`multiple`:`single`;return{type:t.type===`multiple`||t.type===`single`?t.type:m,timer:typeof t.timer==`number`?t.timer:20,difficulty:t.difficulty===`easy`||t.difficulty===`medium`||t.difficulty===`hard`?t.difficulty:`medium`,tags:Array.isArray(t.tags)?t.tags:[],text:a,choices:s,explanation:f}}function parseQuizFile(e){let t=splitBlocks(e);if(t.length===0)return{meta:{title:``,theme:`default`,tags:[],solo:!1},questions:[]};let[n,...r]=t;return{meta:parseMeta(n),questions:r.map(parseQuestion)}}function deckVersion(e){let t=0x811c9dc5;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return(t>>>0).toString(16).padStart(8,`0`)}var slugify=e=>e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);function deckSlug(e){return e.replace(/(^|\/)index\.hashquiz\.md$/,``).replace(/\.hashquiz\.md$/,``).split(`/`).map(slugify).filter(Boolean).join(`/`)||`quiz`}function deckSlugs(e){let t=new Set,n=new Map;for(let r of[...new Set(e)].sort()){let e=deckSlug(r),a=e;for(let n=2;t.has(a)||a===`tag`;n++)a=`${e}-${n}`;t.add(a),n.set(r,a)}return n}function toDecks(e){let t=deckSlugs(e.map(e=>e.id));return e.flatMap(({id:e,content:n})=>{try{let r=parseQuizFile(n);return[{id:e,slug:t.get(e),name:r.meta.title||e,version:deckVersion(n),quiz:r}]}catch(t){return console.error(`Skipping deck ${e}:`,t),[]}}).sort((e,t)=>e.name.localeCompare(t.name))}async function fetchDecks(e,t=fetch){let n=await t(e);if(!n.ok)throw Error(`Failed to load ${e}: ${n.status}`);return toDecks(await n.json())}function deckInfo(e){let{meta:t,questions:n}=e.quiz,r=n.length,a=e=>Math.round(n.filter(t=>t.difficulty===e).length/(r||1)*100);return{title:t.title||e.name,...t.description!==void 0&&{description:t.description},tags:t.tags,totalQuestions:t.maxQuestions===void 0?r:Math.min(t.maxQuestions,r),...t.targetDifficulty!==void 0&&{targetDifficulty:t.targetDifficulty},difficultyDistribution:{easy:a(`easy`),medium:a(`medium`),hard:a(`hard`)},...quizFormat(t,r)}}function soloDecks(e){return e.filter(e=>e.quiz.meta.solo)}var cache=null;function loadDecks(e=`/decks.json`){return cache??=fetchDecks(e).catch(e=>{throw cache=null,e}),cache}function resetDecks(){cache=null}async function loadSoloDecks(){return soloDecks(await loadDecks())}async function findDeck(e){let t=await loadDecks();return t.find(t=>t.id===e)??t.find(t=>t.slug===e)}var PLAYER_DEV_PORT=`3032`,HOST_DEV_PORT=`3031`;function hostUrl(e){return e.port===`3032`?`${e.protocol}//${e.hostname}:${HOST_DEV_PORT}/host/`:`/host/`}var _hoisted_1$4={class:`join`},_hoisted_2$4={key:0,class:`join__modes`,role:`group`,"aria-label":`Mode de jeu`},_hoisted_3$2=[`aria-pressed`],_hoisted_4$2=[`aria-pressed`],_hoisted_5$2={class:`join__room`,"aria-labelledby":`join-room-title`},_hoisted_6$2={class:`join__form`},_hoisted_7$1={key:0,class:`join__error`},_hoisted_8$1=[`disabled`],_hoisted_9$1={class:`join__host`},_hoisted_10$1=[`href`],JoinView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`JoinView`,setup(e){let t=defineAsyncComponent(()=>__vitePreload(()=>import(`./SoloCatalog-Z6TlUytv.js`),__vite__mapDeps([2,3,1,4,5,6]))),n=soloAvailable(config),r=useGameStore(),a=ref(``),o=ref(``),s=ref(``),c=hostUrl(location),l=new URLSearchParams(location.search).get(`code`),u=ref(n&&!l?`solo`:`room`);onMounted(()=>{l&&(a.value=l.toUpperCase());try{let e=sessionStorage.getItem(`hashquiz:player-session`);if(e&&a.value){let t=JSON.parse(e);t.code===a.value&&(o.value=t.pseudo,s.value=t.email,r.connect(a.value,t.pseudo,t.email))}}catch{}});function d(){r.connect(a.value.trim().toUpperCase(),o.value.trim(),s.value.trim())}return(e,l)=>(openBlock(),createElementBlock(`div`,_hoisted_1$4,[unref(n)?(openBlock(),createElementBlock(`div`,_hoisted_2$4,[createBaseVNode(`button`,{type:`button`,class:normalizeClass([`join__mode`,{"join__mode--on":u.value===`solo`}]),"aria-pressed":u.value===`solo`,onClick:l[0]||=e=>u.value=`solo`},`Jouer en solo`,10,_hoisted_3$2),createBaseVNode(`button`,{type:`button`,class:normalizeClass([`join__mode`,{"join__mode--on":u.value===`room`}]),"aria-pressed":u.value===`room`,onClick:l[1]||=e=>u.value=`room`},`Rejoindre un salon`,10,_hoisted_4$2)])):createCommentVNode(``,!0),withDirectives(createBaseVNode(`section`,_hoisted_5$2,[l[6]||=createBaseVNode(`h2`,{id:`join-room-title`,class:`join__title`},`Rejoindre un salon`,-1),l[7]||=createBaseVNode(`p`,{class:`join__sub`},` L'hôte lance le quiz sur grand écran et affiche un code ; les joueurs le saisissent ici, depuis leur téléphone, et répondent en direct. `,-1),createBaseVNode(`div`,_hoisted_6$2,[withDirectives(createBaseVNode(`input`,{"onUpdate:modelValue":l[2]||=e=>a.value=e,class:`hq-input`,placeholder:`Code de la partie (ex. ABC123)`,"aria-label":`Code de la partie`,style:{"text-transform":`uppercase`,"letter-spacing":`0.12em`},maxlength:`8`},null,512),[[vModelText,a.value]]),withDirectives(createBaseVNode(`input`,{"onUpdate:modelValue":l[3]||=e=>o.value=e,class:`hq-input`,placeholder:`Votre pseudo`,"aria-label":`Votre pseudo`,maxlength:`20`},null,512),[[vModelText,o.value]]),withDirectives(createBaseVNode(`input`,{"onUpdate:modelValue":l[4]||=e=>s.value=e,class:`hq-input`,type:`email`,placeholder:`Email (facultatif)`,"aria-label":`Email (facultatif)`},null,512),[[vModelText,s.value]]),unref(r).connectError?(openBlock(),createElementBlock(`p`,_hoisted_7$1,toDisplayString(unref(r).connectError),1)):createCommentVNode(``,!0),createBaseVNode(`button`,{class:`hq-btn-primary hq-press`,disabled:!a.value.trim()||!o.value.trim(),onClick:d},` Rejoindre la partie `,8,_hoisted_8$1)]),createBaseVNode(`div`,_hoisted_9$1,[l[5]||=createBaseVNode(`p`,{class:`join__host-text`},`Vous animez ? Créez un salon depuis un ordinateur relié à l'écran.`,-1),createBaseVNode(`a`,{class:`join__host-btn hq-press`,href:unref(c)},`Créer un salon`,8,_hoisted_10$1)])],512),[[vShow,u.value===`room`]]),unref(n)?withDirectives((openBlock(),createBlock(unref(t),{key:1},null,512)),[[vShow,u.value===`solo`]]):createCommentVNode(``,!0)]))}}),JoinView_default=_plugin_vue_export_helper_default(JoinView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-4602e3d1`]]),_hoisted_1$3={class:`lobby`},_hoisted_2$3={class:`lobby__wait`},LobbyView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`LobbyView`,setup(e){let t=useGameStore(),n=computed(()=>Array.from({length:Math.max(t.playerCount,1)},(e,t)=>({id:`p`+t})));return(e,r)=>(openBlock(),createElementBlock(`div`,_hoisted_1$3,[unref(t).quizMeta?(openBlock(),createBlock(unref(QuizInfoPanel_default),{key:0,quizInfo:unref(t).quizMeta,playerCount:unref(t).playerCount,compact:``},null,8,[`quizInfo`,`playerCount`])):createCommentVNode(``,!0),createBaseVNode(`div`,_hoisted_2$3,[createVNode(unref(FxHourglass_default),{class:`lobby__icon`}),r[0]||=createBaseVNode(`h2`,null,`En attente de l’animateur…`,-1)]),createVNode(unref(FxLobby_default),{class:`lobby__fx`,players:n.value,highlightId:`p0`},null,8,[`players`])]))}}),LobbyView_default=_plugin_vue_export_helper_default(LobbyView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-dcc95501`]]),_hoisted_1$2={key:0,class:`question-view`},_hoisted_2$2={class:`hq-progress`},_hoisted_3$1={class:`hq-progress__label hq-label`},_hoisted_4$1={class:`hq-progress__track hq-steps`},_hoisted_5$1={class:`hq-progress__label`},_hoisted_6$1={key:0,class:`hq-timer-wrap`},_hoisted_7={class:`hq-sr-only`},_hoisted_8={class:`hq-result__line`},_hoisted_9={class:`hq-result__score`},_hoisted_10={key:0,class:`hq-result__rank hq-label`},_hoisted_11={class:`hq-result__delta`},_hoisted_12={key:0,class:`hq-result__info`},_hoisted_13={key:1,class:`hq-result__info`},_hoisted_14={class:`hq-q-meta`},_hoisted_15={class:`hq-q-meta__tags`},_hoisted_16={class:`hq-q-text`},_hoisted_17={class:`hq-grid`},_hoisted_18=[`disabled`],QuestionView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`QuestionView`,setup(e){let t=useGameStore(),n=ref(t.question?.timer??0),r=ref(new Set),a=ref(!1),o=ref(0),s=null,c=0,l=0,u=computed(()=>t.question?.oneShoot??!0),d=computed(()=>t.question?.type===`multiple`),f=computed(()=>t.correctIds.length>0),m=computed(()=>t.lastDelta>0),g=ref(0),_=0;watch(f,e=>{if(cancelAnimationFrame(_),!e){g.value=0;return}let n=t.lastDelta;if(typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches||n<=0){g.value=n;return}let r=performance.now(),a=e=>{let t=Math.min((e-r)/600,1);g.value=Math.round(n*(1-(1-t)**3)),t<1&&(_=requestAnimationFrame(a))};_=requestAnimationFrame(a)},{immediate:!0});function v(){s&&clearInterval(s),s=setInterval(()=>{let e=Math.min(c,Math.max(0,Math.round((l-Date.now())/100)/10));n.value=e,e<=0&&(clearInterval(s),s=null,a.value=!0,r.value.size>0&&!t.answered&&t.submitAnswer([...r.value],o.value))},100)}watch(()=>t.question?.idx,()=>{r.value=new Set,a.value=!1,o.value=0},{immediate:!0}),watch(()=>[t.question?.idx,t.deadlineMs],([,e])=>{let r=t.question;r&&(c=r.timer,e==null?s&&=(clearInterval(s),null):(l=e,n.value=Math.min(c,Math.max(0,Math.round((l-Date.now())/100)/10)),n.value<=0?(a.value=!0,s&&=(clearInterval(s),null)):v()))},{immediate:!0}),onMounted(()=>{t.question&&l>Date.now()&&!s&&v()}),onUnmounted(()=>{s&&clearInterval(s),cancelAnimationFrame(_)});function y(e){if(f.value){let n=t.correctIds.includes(e),a=r.value.has(e);return n?`correct`:a?`wrong`:`disabled`}return a.value||t.answered?r.value.has(e)?`selected`:`disabled`:r.value.has(e)?`selected`:`idle`}function b(e){if(a.value||t.answered||f.value)return;if(!u.value){o.value=(t.question.timer-n.value)*1e3;let a=new Set(r.value);a.has(e)?a.delete(e):a.add(e),r.value=a;return}if(!d.value){if(r.value.size>0)return;let a=(t.question.timer-n.value)*1e3;r.value=new Set([e]),t.submitAnswer([e],a);return}o.value=(t.question.timer-n.value)*1e3;let s=new Set(r.value);s.has(e)?s.delete(e):s.add(e),r.value=s}function x(){a.value||t.answered||r.value.size===0||t.submitAnswer([...r.value],o.value)}return(e,o)=>unref(t).question?(openBlock(),createElementBlock(`div`,_hoisted_1$2,[createBaseVNode(`div`,_hoisted_2$2,[createBaseVNode(`span`,_hoisted_3$1,`Q`+toDisplayString(unref(t).questionIdx+1),1),createBaseVNode(`div`,_hoisted_4$1,[createBaseVNode(`div`,{class:`hq-progress__fill`,style:normalizeStyle({width:(unref(t).questionIdx+1)/(unref(t).quizMeta?.totalQuestions??1)*100+`%`})},null,4)]),createBaseVNode(`span`,_hoisted_5$1,toDisplayString(unref(t).quizMeta?.totalQuestions??`?`),1)]),f.value?(openBlock(),createElementBlock(`div`,{key:1,role:`status`,class:normalizeClass([`hq-result`,m.value?`hq-result--correct`:`hq-result--wrong`])},[createVNode(unref(FxVerdict_default),{class:`hq-result__fx`,correct:m.value,delta:unref(t).lastDelta,answered:unref(t).answered},null,8,[`correct`,`delta`,`answered`]),createBaseVNode(`span`,_hoisted_7,toDisplayString(m.value?`Bonne réponse`:unref(t).answered?`Mauvaise réponse`:`Temps écoulé`),1),createBaseVNode(`div`,_hoisted_8,[createBaseVNode(`span`,_hoisted_9,[createTextVNode(toDisplayString(unref(t).totalScore)+` `,1),o[0]||=createBaseVNode(`small`,null,`pts`,-1)]),unref(t).rank===null?createCommentVNode(``,!0):(openBlock(),createElementBlock(`span`,_hoisted_10,toDisplayString(unref(ordinalFr)(unref(t).rank))+` / `+toDisplayString(unref(t).playerTotal),1))]),createBaseVNode(`span`,_hoisted_11,toDisplayString(g.value>0?`+`+g.value:`+0`)+` pts`,1),unref(t).answered?(openBlock(),createElementBlock(`span`,_hoisted_12,`Répondu en `+toDisplayString(Math.round(unref(t).answerTimeMs/1e3))+` s / `+toDisplayString(unref(t).question.timer)+` s`,1)):(openBlock(),createElementBlock(`span`,_hoisted_13,`Pas de réponse`))],2)):(openBlock(),createElementBlock(`div`,_hoisted_6$1,[createVNode(unref(FxCountdown_default),{total:unref(t).question.timer,remaining:n.value,size:`compact`},null,8,[`total`,`remaining`])])),createBaseVNode(`div`,_hoisted_14,[createBaseVNode(`div`,_hoisted_15,[(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(t).question.tags,e=>(openBlock(),createElementBlock(`span`,{key:e,class:`hq-q-meta__tag`},toDisplayString(e),1))),128))]),createBaseVNode(`span`,{class:normalizeClass([`hq-difficulty`,`hq-difficulty--${unref(t).question.difficulty}`])},[...o[1]||=[createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--1`},null,-1),createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--2`},null,-1),createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--3`},null,-1)]],2)]),createBaseVNode(`h2`,_hoisted_16,toDisplayString(unref(t).question.text.replace(/^#+\s/,``)),1),createBaseVNode(`div`,_hoisted_17,[(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(t).question.choices,(e,t)=>(openBlock(),createBlock(unref(AnswerButton_default),{key:e.id,id:e.id,text:e.text,"color-id":[`a`,`b`,`c`,`d`][t],state:y(e.id),onSelect:t=>b(e.id)},null,8,[`id`,`text`,`color-id`,`state`,`onSelect`]))),128))]),u.value&&d.value&&!unref(t).answered&&!a.value?(openBlock(),createElementBlock(`button`,{key:2,class:`hq-validate-btn hq-press`,disabled:r.value.size===0,onClick:x},` Valider → `,8,_hoisted_18)):createCommentVNode(``,!0)])):createCommentVNode(``,!0)}}),QuestionView_default=_plugin_vue_export_helper_default(QuestionView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-830ed527`]]),_hoisted_1$1={class:`podium-view`},_hoisted_2$1={class:`podium-view__rank`},_hoisted_3={class:`podium-view__medal`},_hoisted_4={class:`podium-view__name`},_hoisted_5={class:`podium-view__score`},_hoisted_6={class:`podium-view__fx`},PodiumView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`PodiumView`,setup(e){let t=useGameStore(),n=computed(()=>t.podium.find(e=>e.playerId===t.playerId)),r=computed(()=>{let e=n.value?.rank??99;return e===1?`🥇`:e===2?`🥈`:e===3?`🥉`:`#${e}`});return(e,a)=>(openBlock(),createElementBlock(`div`,_hoisted_1$1,[createBaseVNode(`div`,_hoisted_2$1,[createBaseVNode(`p`,_hoisted_3,toDisplayString(r.value),1),createBaseVNode(`p`,_hoisted_4,toDisplayString(n.value?.pseudo??``),1),createBaseVNode(`p`,_hoisted_5,toDisplayString(unref(t).totalScore.toLocaleString())+` pts`,1)]),createBaseVNode(`div`,_hoisted_6,[createVNode(unref(FxPodium_default),{podium:unref(t).podium,"highlight-id":unref(t).playerId},null,8,[`podium`,`highlight-id`])]),createVNode(unref(Podium_default),{podium:unref(t).podium},null,8,[`podium`])]))}}),PodiumView_default=_plugin_vue_export_helper_default(PodiumView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-608e2d6a`]]),_hoisted_1={class:`app`},_hoisted_2={class:`app__main`},App_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`App`,setup(e){let t=defineAsyncComponent(()=>__vitePreload(()=>import(`./SoloIntroView-C-yZ2RJO.js`),__vite__mapDeps([7,8,9,10,11,5]))),n=defineAsyncComponent(()=>__vitePreload(()=>import(`./SoloQuestionView-D-PR4AaF.js`),__vite__mapDeps([12,9,13,5]))),r=defineAsyncComponent(()=>__vitePreload(()=>import(`./SoloEndView-Cr_3rclv.js`),__vite__mapDeps([14,9,8,10,3,1,4,5,15]))),a=useGameStore(),o=useSoloStore(),s=ref(null),c=ref(!1);async function l(){let e=parseLegacySoloHash(location.hash);if(e===null)return;let t=await findDeck(e).catch(()=>void 0);history.replaceState(null,``,soloPath(t?.slug??deckSlug(e)))}async function u(e=!1){await l();let t=parseSoloPath(location.pathname)?.slug??null;if(t===s.value&&!e||(s.value!==null&&o.abandon(),s.value=t,c.value=!1,t===null)||(await loadSoloDeps(),s.value!==t))return;let n=o.open(t);c.value=!0,await n}function d(){s.value!==null&&(o.abandon(),c.value=!1)}function f(e){e.persisted&&u(!0)}let m=()=>{u()};onMounted(()=>{u(),window.addEventListener(`popstate`,m),window.addEventListener(`hashchange`,m),window.addEventListener(`pagehide`,d),window.addEventListener(`pageshow`,f)}),onUnmounted(()=>{window.removeEventListener(`popstate`,m),window.removeEventListener(`hashchange`,m),window.removeEventListener(`pagehide`,d),window.removeEventListener(`pageshow`,f)});let g=computed(()=>{switch(a.status){case`connecting`:return`Connexion…`;case`reconnecting`:return`Reconnexion…`;case`offline`:return`Hors ligne`;default:return``}});return(e,l)=>(openBlock(),createElementBlock(Fragment,null,[createVNode(unref(FxBackdrop_default)),createBaseVNode(`div`,_hoisted_1,[createVNode(AppHeader_default),createBaseVNode(`main`,_hoisted_2,[s.value===null?(openBlock(),createElementBlock(Fragment,{key:1},[createVNode(Transition,{name:`status`},{default:withCtx(()=>[unref(a).phase!==`join`&&unref(a).status!==`connected`?(openBlock(),createElementBlock(`p`,{key:0,class:normalizeClass([`status-banner`,`status-banner--${unref(a).status}`])},toDisplayString(g.value),3)):createCommentVNode(``,!0)]),_:1}),unref(a).phase===`join`?(openBlock(),createBlock(JoinView_default,{key:0})):unref(a).phase===`lobby`?(openBlock(),createBlock(LobbyView_default,{key:1})):unref(a).phase===`question`?(openBlock(),createBlock(QuestionView_default,{key:2})):unref(a).phase===`podium`?(openBlock(),createBlock(PodiumView_default,{key:3})):createCommentVNode(``,!0)],64)):(openBlock(),createElementBlock(Fragment,{key:0},[unref(o).phase===`question`||unref(o).phase===`revealed`?(openBlock(),createBlock(unref(n),{key:0})):unref(o).phase===`end`?(openBlock(),createBlock(unref(r),{key:1})):c.value?(openBlock(),createBlock(unref(t),{key:s.value})):createCommentVNode(``,!0)],64))]),s.value!==null||unref(a).phase===`join`?(openBlock(),createBlock(AppFooter_default,{key:0})):createCommentVNode(``,!0)])],64))}}),App_default=App_vue_vue_type_script_setup_true_lang_default;createApp(App_default).use(createPinia()).mount(`#app`);export{createElementBlock as A,withDirectives as B,vModelText as C,createBaseVNode as D,computed as E,onMounted as F,normalizeStyle as G,shallowRef as H,onUnmounted as I,toDisplayString as K,openBlock as L,createVNode as M,defineComponent as N,createBlock as O,nextTick as P,renderList as R,vModelSelect as S,Fragment as T,unref as U,ref as V,normalizeClass as W,FxVerdict_default as _,loadSoloDeps as a,_plugin_vue_export_helper_default as b,config as c,REPO_URL as d,AppIcon_default as f,AnswerButton_default as g,QuizInfoPanel_default as h,deckInfo as i,createTextVNode as j,createCommentVNode as k,calcPoints as l,soloPath as m,loadSoloDecks as n,useSoloStore as o,followLink as p,resetDecks as r,createClient as s,findDeck as t,REPO_API_URL as u,FxFireworks_default as v,withModifiers as w,vModelCheckbox as x,FxCountdown_default as y,watch as z};
|